@rivinia/toast 0.3.0 → 0.3.1
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.
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ dedupe, overflow policies — zero DOM, zero styles, zero router dependency.
|
|
|
8
8
|
A future `@rivinia/toast/ui` entry point will render this state; Core never
|
|
9
9
|
imports UI.
|
|
10
10
|
|
|
11
|
-
- Version: **0.3.
|
|
11
|
+
- Version: **0.3.1**
|
|
12
12
|
- Requires: **Angular `^22.0.0`**, `tslib`
|
|
13
13
|
|
|
14
14
|
## Install
|
|
@@ -136,6 +136,7 @@ var RiviniaToast = class RiviniaToast {
|
|
|
136
136
|
});
|
|
137
137
|
if (removed) {
|
|
138
138
|
this.forgetDedupe(id);
|
|
139
|
+
this._generations.delete(id);
|
|
139
140
|
this.promote();
|
|
140
141
|
}
|
|
141
142
|
return removed;
|
|
@@ -144,6 +145,7 @@ var RiviniaToast = class RiviniaToast {
|
|
|
144
145
|
this.clearTimers();
|
|
145
146
|
this._paused.clear();
|
|
146
147
|
this._explicitDuration.clear();
|
|
148
|
+
this._generations.clear();
|
|
147
149
|
this._active.set([]);
|
|
148
150
|
this._queue.set([]);
|
|
149
151
|
this._dedupeByKey.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rivinia-toast.mjs","names":[],"sources":["../../../projects/toast/src/lib/toast-utils.ts","../../../projects/toast/src/lib/toast-config.ts","../../../projects/toast/src/lib/rivinia-toast.ts","../../../projects/toast/src/lib/provide-toast.ts"],"sourcesContent":["import type { Signal } from '@angular/core';\nimport type { ToastMessage } from './toast-types';\n\n/**\n * Reads a toast message regardless of shape. Future UI entry points call this\n * in templates — one place to support `string | Signal<string>`.\n */\nexport function resolveToastText(message: ToastMessage): string {\n return typeof message === 'string' ? message : (message as Signal<string>)();\n}\n\n/**\n * Normalizes a duration into a safe non-negative integer.\n * `0`, negatives, `NaN` and non-finite values all mean persistent (no timer).\n * Rationale: a `setTimeout(Infinity)` silently overflows to ~1ms in browsers —\n * converting to persistent is the only non-surprising mapping.\n */\nexport function clampDuration(value: number | undefined, fallback: number): number {\n const candidate = value === undefined ? fallback : value;\n if (typeof candidate !== 'number' || !Number.isFinite(candidate) || candidate <= 0) {\n return 0;\n }\n return Math.floor(candidate);\n}\n","import { InjectionToken } from '@angular/core';\nimport type { ToastKind, ToastOverflowPolicy } from './toast-types';\n\n/**\n * Global configuration for `@rivinia/toast`.\n *\n * Every field is optional. Per-toast options always win over globals.\n * URLs, icons, positions, styles: intentionally absent — presentation is\n * app-owned (a future `@rivinia/toast/ui` entry point will consume this Core).\n */\nexport interface RiviniaToastConfig {\n /**\n * Default auto-dismiss delay in milliseconds.\n * @default 5000\n */\n duration?: number;\n /**\n * Per-kind default delays. A per-toast `duration` beats both levels.\n * @default {} (every kind falls back to `duration`)\n */\n durations?: Partial<Record<ToastKind, number>>;\n /**\n * Maximum simultaneously visible (active) toasts. Clamped to ≥ 1.\n * @default 5 (industry standard: shadcn `TOAST_LIMIT = 3`, BRT `MAX_VISIBLE = 5`)\n */\n maxVisible?: number;\n /**\n * Maximum queued toasts when `overflow: 'queue'`. Further shows are rejected.\n * @default Infinity (bounded only if you bound it — an unbounded queue is a\n * documented leak risk for hot paths; prefer `'dismiss-oldest'` there)\n */\n maxQueue?: number;\n /**\n * What happens when a new toast arrives while `maxVisible` are active.\n * - `'dismiss-oldest'`: dismiss the oldest active toast, show the new one.\n * - `'queue'`: hold the new toast (no timer runs) until room frees up.\n * - `'reject'`: `show()` returns `null`; nothing changes.\n * @default 'dismiss-oldest'\n */\n overflow?: ToastOverflowPolicy;\n}\n\n/**\n * Internal configuration token. Consumers must use `provideRiviniaToast()`.\n * @internal\n */\nexport const RIVINIA_TOAST_CONFIG = new InjectionToken<RiviniaToastConfig>(\n 'RIVINIA_TOAST_CONFIG',\n);\n\nexport const DEFAULT_DURATION = 5000;\nexport const DEFAULT_MAX_VISIBLE = 5;\n","import { DestroyRef, inject, Service, signal } from '@angular/core';\nimport {\n DEFAULT_DURATION,\n DEFAULT_MAX_VISIBLE,\n RIVINIA_TOAST_CONFIG,\n type RiviniaToastConfig,\n} from './toast-config';\nimport type {\n Toast,\n ToastChanges,\n ToastKind,\n ToastOptions,\n} from './toast-types';\nimport { clampDuration } from './toast-utils';\n\ninterface TimerRecord {\n handle: ReturnType<typeof setTimeout>;\n startedAt: number;\n generation: number;\n}\n\n/**\n * Headless toast queue owner.\n *\n * State: two readonly signals — `active` (visible, capped) and `queue`\n * (overflow waiting, timerless). Who changes it: only the methods below.\n * Timers: one `setTimeout` per active timed toast, guarded by a per-toast\n * generation so a stale fire can never dismiss an updated toast. No DOM,\n * no styles, no router — presentation and navigation policy are app-owned\n * (see README recipes).\n */\n@Service()\nexport class RiviniaToast {\n private readonly config = inject<RiviniaToastConfig>(RIVINIA_TOAST_CONFIG, {\n optional: true,\n });\n\n private readonly _active = signal<Toast[]>([]);\n private readonly _queue = signal<Toast[]>([]);\n\n /** Visible toasts, oldest first. Never exceeds effective `maxVisible`. */\n readonly active = this._active.asReadonly();\n /** Overflow waiting for room. No timers run while queued. */\n readonly queue = this._queue.asReadonly();\n\n private readonly _timers = new Map<number, TimerRecord>();\n private readonly _paused = new Set<number>();\n /** Ids whose duration was set explicitly (per-toast override wins forever). */\n private readonly _explicitDuration = new Set<number>();\n private readonly _generations = new Map<number, number>();\n private readonly _dedupeByKey = new Map<string, number>();\n private readonly _dedupeKeyById = new Map<number, string>();\n private _nextId = 0;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.clearTimers());\n }\n\n /**\n * Shows a toast. Returns its stable id, or `null` when rejected by the\n * `'reject'` overflow policy (or a full finite queue).\n */\n show(options: ToastOptions): number | null {\n if (options.dedupeKey !== undefined) {\n const existing = this.findByDedupeKey(options.dedupeKey);\n if (existing !== null) {\n this.update(existing, {\n message: options.message,\n kind: options.kind,\n duration: options.duration,\n action: options.action ?? null,\n });\n return existing;\n }\n }\n\n const id = ++this._nextId;\n const kind = options.kind ?? 'info';\n const duration = this.resolveDuration(kind, options.duration);\n if (options.duration !== undefined) this._explicitDuration.add(id);\n const toast: Toast = {\n id,\n kind,\n message: options.message,\n duration,\n remaining: duration,\n paused: false,\n action: options.action ?? null,\n };\n if (options.dedupeKey !== undefined) {\n this._dedupeByKey.set(options.dedupeKey, id);\n this._dedupeKeyById.set(id, options.dedupeKey);\n }\n\n if (this._active().length < this.maxVisible()) {\n this._active.update((list) => [...list, toast]);\n this.arm(id, duration);\n return id;\n }\n\n switch (this.config?.overflow ?? 'dismiss-oldest') {\n case 'queue': {\n if (this._queue().length >= this.maxQueue()) {\n this.forgetDedupe(id);\n return null;\n }\n this._queue.update((list) => [...list, toast]);\n return id;\n }\n case 'reject':\n this.forgetDedupe(id);\n return null;\n case 'dismiss-oldest':\n default: {\n // Prefer evicting the oldest dismissible toast: timed and actionless\n // first (a persistent error with a Retry action is never collateral).\n // Only when everything is persistent/with-action does the oldest go.\n const list = this._active();\n const victim = list.find((t) => t.duration > 0 && !t.action) ?? list[0];\n if (victim) this.dismiss(victim.id);\n this._active.update((next) => [...next, toast]);\n this.arm(id, duration);\n return id;\n }\n }\n }\n\n /**\n * Merges changes into an active or queued toast and restarts its timer\n * with the new duration (unchanged when `changes.duration` is absent).\n * Unknown ids (never shown or already dismissed): no-op, returns `false`.\n */\n update(id: number, changes: ToastChanges): boolean {\n const inActive = this._active().some((t) => t.id === id);\n // Duration resolution on update: an explicit new duration always wins and\n // becomes sticky; otherwise a kind change re-resolves the per-kind default\n // (unless the toast already carries an explicit duration).\n let nextDuration = 0;\n const apply = (t: Toast): Toast => {\n if (changes.duration !== undefined) {\n nextDuration = clampDuration(changes.duration, t.duration);\n this._explicitDuration.add(id);\n } else if (changes.kind !== undefined && !this._explicitDuration.has(id)) {\n nextDuration = this.fallbackDuration(changes.kind);\n } else {\n nextDuration = t.duration;\n }\n return {\n ...t,\n message: changes.message ?? t.message,\n kind: changes.kind ?? t.kind,\n duration: nextDuration,\n remaining: nextDuration,\n action: changes.action !== undefined ? changes.action : t.action,\n };\n };\n if (inActive) {\n this.disarm(id);\n let next: Toast | undefined;\n this._active.update((list) =>\n list.map((t) => {\n if (t.id !== id) return t;\n next = apply(t);\n return next;\n }),\n );\n if (next && !this._paused.has(id)) this.arm(id, next.duration);\n return true;\n }\n let found = false;\n this._queue.update((list) =>\n list.map((t) => {\n if (t.id !== id) return t;\n found = true;\n return apply(t);\n }),\n );\n return found;\n }\n\n /**\n * Removes a toast wherever it lives, clearing its timer. Unknown ids and\n * repeated calls: no-op, returns `false`. Removing an active toast promotes\n * the queue head (if any), whose timer starts at promotion.\n */\n dismiss(id: number): boolean {\n this.disarm(id);\n this._paused.delete(id);\n this._explicitDuration.delete(id);\n let removed = false;\n this._active.update((list) => {\n const next = list.filter((t) => t.id !== id);\n removed = next.length !== list.length;\n return next;\n });\n if (!removed) {\n this._queue.update((list) => {\n const next = list.filter((t) => t.id !== id);\n removed = next.length !== list.length;\n return next;\n });\n }\n if (removed) {\n this.forgetDedupe(id);\n this.promote();\n }\n return removed;\n }\n\n /** Clears timers, active and queue. Ids keep incrementing (never reused). */\n dismissAll(): void {\n this.clearTimers();\n this._paused.clear();\n this._explicitDuration.clear();\n this._active.set([]);\n this._queue.set([]);\n this._dedupeByKey.clear();\n this._dedupeKeyById.clear();\n }\n\n /**\n * Suspends the active timer, preserving `remaining` and marking `paused`.\n * UI binds this to hover/focus (WCAG 2.2.1 timing control). Returns `false`\n * for unknown ids, queued/persistent toasts, or already-paused timers —\n * a persistent toast can never be paused, so hover-leave cannot dismiss it.\n */\n pause(id: number): boolean {\n const record = this._timers.get(id);\n if (!record) return false;\n clearTimeout(record.handle);\n this._timers.delete(id);\n this._paused.add(id);\n const elapsed = Date.now() - record.startedAt;\n this._active.update((list) =>\n list.map((t) =>\n t.id === id\n ? { ...t, remaining: Math.max(0, t.remaining - elapsed), paused: true }\n : t,\n ),\n );\n return true;\n }\n\n /**\n * Restarts a paused timer with the preserved `remaining`. No-op (`false`) on\n * anything that was never paused — including persistent toasts. A paused\n * toast whose remaining reached zero is dismissed instead (it logically\n * already expired).\n */\n resume(id: number): boolean {\n if (!this._paused.has(id)) return false;\n this._paused.delete(id);\n const toast = this._active().find((t) => t.id === id);\n if (!toast) return false;\n if (toast.remaining <= 0) {\n this.dismiss(id);\n return true;\n }\n this._active.update((list) => list.map((t) => (t.id === id ? { ...t, paused: false } : t)));\n this.arm(id, toast.remaining);\n return true;\n }\n\n /**\n * Runs the toast action callback, then dismisses unless the action opts out\n * via `dismissAfterPress: false`. Callback exceptions propagate to the caller.\n * Returns `false` when the toast or its action is missing.\n */\n runAction(id: number): boolean {\n const toast =\n this._active().find((t) => t.id === id) ?? this._queue().find((t) => t.id === id);\n if (!toast?.action) return false;\n toast.action.onPress();\n if (toast.action.dismissAfterPress ?? true) this.dismiss(id);\n return true;\n }\n\n private maxVisible(): number {\n const value = this.config?.maxVisible ?? DEFAULT_MAX_VISIBLE;\n return Math.max(1, Math.floor(value));\n }\n\n private maxQueue(): number {\n const value = this.config?.maxQueue ?? Number.POSITIVE_INFINITY;\n return value < 0 ? 0 : value;\n }\n\n private resolveDuration(kind: ToastKind, override?: number): number {\n if (override !== undefined) return clampDuration(override, this.fallbackDuration(kind));\n return this.fallbackDuration(kind);\n }\n\n private fallbackDuration(kind: ToastKind): number {\n const perKind = this.config?.durations?.[kind];\n if (perKind !== undefined) return clampDuration(perKind, DEFAULT_DURATION);\n return clampDuration(this.config?.duration, DEFAULT_DURATION);\n }\n\n private arm(id: number, delay: number): void {\n if (delay <= 0) return;\n const generation = (this._generations.get(id) ?? 0) + 1;\n this._generations.set(id, generation);\n this._timers.set(id, {\n handle: setTimeout(() => {\n // Stale-guard: only the latest generation may dismiss.\n if (this._timers.get(id)?.generation === generation) this.dismiss(id);\n }, delay),\n startedAt: Date.now(),\n generation,\n });\n }\n\n private disarm(id: number): void {\n const record = this._timers.get(id);\n if (record) {\n clearTimeout(record.handle);\n this._timers.delete(id);\n }\n }\n\n private clearTimers(): void {\n for (const record of this._timers.values()) clearTimeout(record.handle);\n this._timers.clear();\n }\n\n private promote(): void {\n while (this._active().length < this.maxVisible() && this._queue().length > 0) {\n const head = this._queue()[0];\n this._queue.update((list) => list.slice(1));\n const fresh: Toast = { ...head, remaining: head.duration };\n this._active.update((list) => [...list, fresh]);\n this.arm(fresh.id, fresh.duration);\n }\n }\n\n private findByDedupeKey(key: string): number | null {\n const id = this._dedupeByKey.get(key);\n if (id === undefined) return null;\n const present =\n this._active().some((t) => t.id === id) || this._queue().some((t) => t.id === id);\n if (!present) {\n this.forgetDedupe(id);\n return null;\n }\n return id;\n }\n\n private forgetDedupe(id: number): void {\n const key = this._dedupeKeyById.get(id);\n if (key !== undefined) {\n this._dedupeKeyById.delete(id);\n if (this._dedupeByKey.get(key) === id) this._dedupeByKey.delete(key);\n }\n }\n}\n","import { EnvironmentProviders, inject, makeEnvironmentProviders } from '@angular/core';\nimport { RIVINIA_TOAST_CONFIG, type RiviniaToastConfig } from './toast-config';\nimport { RiviniaToast } from './rivinia-toast';\n\n/**\n * Configures `@rivinia/toast`. The queue is a root singleton; call once at\n * bootstrap. Presentation (outlet component, position, styles, icons,\n * translations) stays app-owned — a future `@rivinia/toast/ui` entry point\n * will consume the same `RiviniaToast` state.\n *\n * @example\n * ```ts\n * provideRiviniaToast({ duration: 5000, maxVisible: 5 })\n * ```\n */\nexport function provideRiviniaToast(config: RiviniaToastConfig = {}): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: RIVINIA_TOAST_CONFIG, useValue: config }]);\n}\n\n/** Shorthand for `inject(RiviniaToast)`. */\nexport function injectRiviniaToast(): RiviniaToast {\n return inject(RiviniaToast);\n}\n"],"mappings":";;AAOA,SAAgB,iBAAiB,SAAqB;CACpD,OAAO,OAAO,YAAY,WAAW,UAAW,QAA0B;AAC5E;AAQA,SAAgB,cAAc,OAA2B,UAAgB;CACvE,MAAM,YAAY,UAAU,SAAY,WAAW;CACnD,I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A,GAAE;CACjE,OAAO,yBAAyB,CAAC;EAAE,SAAS;EAAsB,UAAU;CAAM,CAAE,CAAC;AACvF;AAGA,SAAgB,qBAAkB;CAChC,OAAO,OAAO,YAAY;AAC5B"}
|
|
1
|
+
{"version":3,"file":"rivinia-toast.mjs","names":[],"sources":["../../../projects/toast/src/lib/toast-utils.ts","../../../projects/toast/src/lib/toast-config.ts","../../../projects/toast/src/lib/rivinia-toast.ts","../../../projects/toast/src/lib/provide-toast.ts"],"sourcesContent":["import type { Signal } from '@angular/core';\nimport type { ToastMessage } from './toast-types';\n\n/**\n * Reads a toast message regardless of shape. Future UI entry points call this\n * in templates — one place to support `string | Signal<string>`.\n */\nexport function resolveToastText(message: ToastMessage): string {\n return typeof message === 'string' ? message : (message as Signal<string>)();\n}\n\n/**\n * Normalizes a duration into a safe non-negative integer.\n * `0`, negatives, `NaN` and non-finite values all mean persistent (no timer).\n * Rationale: a `setTimeout(Infinity)` silently overflows to ~1ms in browsers —\n * converting to persistent is the only non-surprising mapping.\n */\nexport function clampDuration(value: number | undefined, fallback: number): number {\n const candidate = value === undefined ? fallback : value;\n if (typeof candidate !== 'number' || !Number.isFinite(candidate) || candidate <= 0) {\n return 0;\n }\n return Math.floor(candidate);\n}\n","import { InjectionToken } from '@angular/core';\nimport type { ToastKind, ToastOverflowPolicy } from './toast-types';\n\n/**\n * Global configuration for `@rivinia/toast`.\n *\n * Every field is optional. Per-toast options always win over globals.\n * URLs, icons, positions, styles: intentionally absent — presentation is\n * app-owned (a future `@rivinia/toast/ui` entry point will consume this Core).\n */\nexport interface RiviniaToastConfig {\n /**\n * Default auto-dismiss delay in milliseconds.\n * @default 5000\n */\n duration?: number;\n /**\n * Per-kind default delays. A per-toast `duration` beats both levels.\n * @default {} (every kind falls back to `duration`)\n */\n durations?: Partial<Record<ToastKind, number>>;\n /**\n * Maximum simultaneously visible (active) toasts. Clamped to ≥ 1.\n * @default 5 (industry standard: shadcn `TOAST_LIMIT = 3`, BRT `MAX_VISIBLE = 5`)\n */\n maxVisible?: number;\n /**\n * Maximum queued toasts when `overflow: 'queue'`. Further shows are rejected.\n * @default Infinity (bounded only if you bound it — an unbounded queue is a\n * documented leak risk for hot paths; prefer `'dismiss-oldest'` there)\n */\n maxQueue?: number;\n /**\n * What happens when a new toast arrives while `maxVisible` are active.\n * - `'dismiss-oldest'`: dismiss the oldest active toast, show the new one.\n * - `'queue'`: hold the new toast (no timer runs) until room frees up.\n * - `'reject'`: `show()` returns `null`; nothing changes.\n * @default 'dismiss-oldest'\n */\n overflow?: ToastOverflowPolicy;\n}\n\n/**\n * Internal configuration token. Consumers must use `provideRiviniaToast()`.\n * @internal\n */\nexport const RIVINIA_TOAST_CONFIG = new InjectionToken<RiviniaToastConfig>(\n 'RIVINIA_TOAST_CONFIG',\n);\n\nexport const DEFAULT_DURATION = 5000;\nexport const DEFAULT_MAX_VISIBLE = 5;\n","import { DestroyRef, inject, Service, signal } from '@angular/core';\nimport {\n DEFAULT_DURATION,\n DEFAULT_MAX_VISIBLE,\n RIVINIA_TOAST_CONFIG,\n type RiviniaToastConfig,\n} from './toast-config';\nimport type { Toast, ToastChanges, ToastKind, ToastOptions } from './toast-types';\nimport { clampDuration } from './toast-utils';\n\ninterface TimerRecord {\n handle: ReturnType<typeof setTimeout>;\n startedAt: number;\n generation: number;\n}\n\n/**\n * Headless toast queue owner.\n *\n * State: two readonly signals — `active` (visible, capped) and `queue`\n * (overflow waiting, timerless). Who changes it: only the methods below.\n * Timers: one `setTimeout` per active timed toast, guarded by a per-toast\n * generation so a stale fire can never dismiss an updated toast. No DOM,\n * no styles, no router — presentation and navigation policy are app-owned\n * (see README recipes).\n */\n@Service()\nexport class RiviniaToast {\n private readonly config = inject<RiviniaToastConfig>(RIVINIA_TOAST_CONFIG, {\n optional: true,\n });\n\n private readonly _active = signal<Toast[]>([]);\n private readonly _queue = signal<Toast[]>([]);\n\n /** Visible toasts, oldest first. Never exceeds effective `maxVisible`. */\n readonly active = this._active.asReadonly();\n /** Overflow waiting for room. No timers run while queued. */\n readonly queue = this._queue.asReadonly();\n\n private readonly _timers = new Map<number, TimerRecord>();\n private readonly _paused = new Set<number>();\n /** Ids whose duration was set explicitly (per-toast override wins forever). */\n private readonly _explicitDuration = new Set<number>();\n private readonly _generations = new Map<number, number>();\n private readonly _dedupeByKey = new Map<string, number>();\n private readonly _dedupeKeyById = new Map<number, string>();\n private _nextId = 0;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.clearTimers());\n }\n\n /**\n * Shows a toast. Returns its stable id, or `null` when rejected by the\n * `'reject'` overflow policy (or a full finite queue).\n */\n show(options: ToastOptions): number | null {\n if (options.dedupeKey !== undefined) {\n const existing = this.findByDedupeKey(options.dedupeKey);\n if (existing !== null) {\n this.update(existing, {\n message: options.message,\n kind: options.kind,\n duration: options.duration,\n action: options.action ?? null,\n });\n return existing;\n }\n }\n\n const id = ++this._nextId;\n const kind = options.kind ?? 'info';\n const duration = this.resolveDuration(kind, options.duration);\n if (options.duration !== undefined) this._explicitDuration.add(id);\n const toast: Toast = {\n id,\n kind,\n message: options.message,\n duration,\n remaining: duration,\n paused: false,\n action: options.action ?? null,\n };\n if (options.dedupeKey !== undefined) {\n this._dedupeByKey.set(options.dedupeKey, id);\n this._dedupeKeyById.set(id, options.dedupeKey);\n }\n\n if (this._active().length < this.maxVisible()) {\n this._active.update((list) => [...list, toast]);\n this.arm(id, duration);\n return id;\n }\n\n switch (this.config?.overflow ?? 'dismiss-oldest') {\n case 'queue': {\n if (this._queue().length >= this.maxQueue()) {\n this.forgetDedupe(id);\n return null;\n }\n this._queue.update((list) => [...list, toast]);\n return id;\n }\n case 'reject':\n this.forgetDedupe(id);\n return null;\n case 'dismiss-oldest':\n default: {\n // Prefer evicting the oldest dismissible toast: timed and actionless\n // first (a persistent error with a Retry action is never collateral).\n // Only when everything is persistent/with-action does the oldest go.\n const list = this._active();\n const victim = list.find((t) => t.duration > 0 && !t.action) ?? list[0];\n if (victim) this.dismiss(victim.id);\n this._active.update((next) => [...next, toast]);\n this.arm(id, duration);\n return id;\n }\n }\n }\n\n /**\n * Merges changes into an active or queued toast and restarts its timer\n * with the new duration (unchanged when `changes.duration` is absent).\n * Unknown ids (never shown or already dismissed): no-op, returns `false`.\n */\n update(id: number, changes: ToastChanges): boolean {\n const inActive = this._active().some((t) => t.id === id);\n // Duration resolution on update: an explicit new duration always wins and\n // becomes sticky; otherwise a kind change re-resolves the per-kind default\n // (unless the toast already carries an explicit duration).\n let nextDuration = 0;\n const apply = (t: Toast): Toast => {\n if (changes.duration !== undefined) {\n nextDuration = clampDuration(changes.duration, t.duration);\n this._explicitDuration.add(id);\n } else if (changes.kind !== undefined && !this._explicitDuration.has(id)) {\n nextDuration = this.fallbackDuration(changes.kind);\n } else {\n nextDuration = t.duration;\n }\n return {\n ...t,\n message: changes.message ?? t.message,\n kind: changes.kind ?? t.kind,\n duration: nextDuration,\n remaining: nextDuration,\n action: changes.action !== undefined ? changes.action : t.action,\n };\n };\n if (inActive) {\n this.disarm(id);\n let next: Toast | undefined;\n this._active.update((list) =>\n list.map((t) => {\n if (t.id !== id) return t;\n next = apply(t);\n return next;\n }),\n );\n if (next && !this._paused.has(id)) this.arm(id, next.duration);\n return true;\n }\n let found = false;\n this._queue.update((list) =>\n list.map((t) => {\n if (t.id !== id) return t;\n found = true;\n return apply(t);\n }),\n );\n return found;\n }\n\n /**\n * Removes a toast wherever it lives, clearing its timer. Unknown ids and\n * repeated calls: no-op, returns `false`. Removing an active toast promotes\n * the queue head (if any), whose timer starts at promotion.\n */\n dismiss(id: number): boolean {\n this.disarm(id);\n this._paused.delete(id);\n this._explicitDuration.delete(id);\n let removed = false;\n this._active.update((list) => {\n const next = list.filter((t) => t.id !== id);\n removed = next.length !== list.length;\n return next;\n });\n if (!removed) {\n this._queue.update((list) => {\n const next = list.filter((t) => t.id !== id);\n removed = next.length !== list.length;\n return next;\n });\n }\n if (removed) {\n this.forgetDedupe(id);\n this._generations.delete(id);\n this.promote();\n }\n return removed;\n }\n\n /** Clears timers, active and queue. Ids keep incrementing (never reused). */\n dismissAll(): void {\n this.clearTimers();\n this._paused.clear();\n this._explicitDuration.clear();\n this._generations.clear();\n this._active.set([]);\n this._queue.set([]);\n this._dedupeByKey.clear();\n this._dedupeKeyById.clear();\n }\n\n /**\n * Suspends the active timer, preserving `remaining` and marking `paused`.\n * UI binds this to hover/focus (WCAG 2.2.1 timing control). Returns `false`\n * for unknown ids, queued/persistent toasts, or already-paused timers —\n * a persistent toast can never be paused, so hover-leave cannot dismiss it.\n */\n pause(id: number): boolean {\n const record = this._timers.get(id);\n if (!record) return false;\n clearTimeout(record.handle);\n this._timers.delete(id);\n this._paused.add(id);\n const elapsed = Date.now() - record.startedAt;\n this._active.update((list) =>\n list.map((t) =>\n t.id === id ? { ...t, remaining: Math.max(0, t.remaining - elapsed), paused: true } : t,\n ),\n );\n return true;\n }\n\n /**\n * Restarts a paused timer with the preserved `remaining`. No-op (`false`) on\n * anything that was never paused — including persistent toasts. A paused\n * toast whose remaining reached zero is dismissed instead (it logically\n * already expired).\n */\n resume(id: number): boolean {\n if (!this._paused.has(id)) return false;\n this._paused.delete(id);\n const toast = this._active().find((t) => t.id === id);\n if (!toast) return false;\n if (toast.remaining <= 0) {\n this.dismiss(id);\n return true;\n }\n this._active.update((list) => list.map((t) => (t.id === id ? { ...t, paused: false } : t)));\n this.arm(id, toast.remaining);\n return true;\n }\n\n /**\n * Runs the toast action callback, then dismisses unless the action opts out\n * via `dismissAfterPress: false`. Callback exceptions propagate to the caller.\n * Returns `false` when the toast or its action is missing.\n */\n runAction(id: number): boolean {\n const toast = this._active().find((t) => t.id === id) ?? this._queue().find((t) => t.id === id);\n if (!toast?.action) return false;\n toast.action.onPress();\n if (toast.action.dismissAfterPress ?? true) this.dismiss(id);\n return true;\n }\n\n private maxVisible(): number {\n const value = this.config?.maxVisible ?? DEFAULT_MAX_VISIBLE;\n return Math.max(1, Math.floor(value));\n }\n\n private maxQueue(): number {\n const value = this.config?.maxQueue ?? Number.POSITIVE_INFINITY;\n return value < 0 ? 0 : value;\n }\n\n private resolveDuration(kind: ToastKind, override?: number): number {\n if (override !== undefined) return clampDuration(override, this.fallbackDuration(kind));\n return this.fallbackDuration(kind);\n }\n\n private fallbackDuration(kind: ToastKind): number {\n const perKind = this.config?.durations?.[kind];\n if (perKind !== undefined) return clampDuration(perKind, DEFAULT_DURATION);\n return clampDuration(this.config?.duration, DEFAULT_DURATION);\n }\n\n private arm(id: number, delay: number): void {\n if (delay <= 0) return;\n const generation = (this._generations.get(id) ?? 0) + 1;\n this._generations.set(id, generation);\n this._timers.set(id, {\n handle: setTimeout(() => {\n // Stale-guard: only the latest generation may dismiss.\n if (this._timers.get(id)?.generation === generation) this.dismiss(id);\n }, delay),\n startedAt: Date.now(),\n generation,\n });\n }\n\n private disarm(id: number): void {\n const record = this._timers.get(id);\n if (record) {\n clearTimeout(record.handle);\n this._timers.delete(id);\n }\n }\n\n private clearTimers(): void {\n for (const record of this._timers.values()) clearTimeout(record.handle);\n this._timers.clear();\n }\n\n private promote(): void {\n while (this._active().length < this.maxVisible() && this._queue().length > 0) {\n const head = this._queue()[0];\n this._queue.update((list) => list.slice(1));\n const fresh: Toast = { ...head, remaining: head.duration };\n this._active.update((list) => [...list, fresh]);\n this.arm(fresh.id, fresh.duration);\n }\n }\n\n private findByDedupeKey(key: string): number | null {\n const id = this._dedupeByKey.get(key);\n if (id === undefined) return null;\n const present =\n this._active().some((t) => t.id === id) || this._queue().some((t) => t.id === id);\n if (!present) {\n this.forgetDedupe(id);\n return null;\n }\n return id;\n }\n\n private forgetDedupe(id: number): void {\n const key = this._dedupeKeyById.get(id);\n if (key !== undefined) {\n this._dedupeKeyById.delete(id);\n if (this._dedupeByKey.get(key) === id) this._dedupeByKey.delete(key);\n }\n }\n}\n","import { EnvironmentProviders, inject, makeEnvironmentProviders } from '@angular/core';\nimport { RIVINIA_TOAST_CONFIG, type RiviniaToastConfig } from './toast-config';\nimport { RiviniaToast } from './rivinia-toast';\n\n/**\n * Configures `@rivinia/toast`. The queue is a root singleton; call once at\n * bootstrap. Presentation (outlet component, position, styles, icons,\n * translations) stays app-owned — a future `@rivinia/toast/ui` entry point\n * will consume the same `RiviniaToast` state.\n *\n * @example\n * ```ts\n * provideRiviniaToast({ duration: 5000, maxVisible: 5 })\n * ```\n */\nexport function provideRiviniaToast(config: RiviniaToastConfig = {}): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: RIVINIA_TOAST_CONFIG, useValue: config }]);\n}\n\n/** Shorthand for `inject(RiviniaToast)`. */\nexport function injectRiviniaToast(): RiviniaToast {\n return inject(RiviniaToast);\n}\n"],"mappings":";;AAOA,SAAgB,iBAAiB,SAAqB;CACpD,OAAO,OAAO,YAAY,WAAW,UAAW,QAA0B;AAC5E;AAQA,SAAgB,cAAc,OAA2B,UAAgB;CACvE,MAAM,YAAY,UAAU,SAAY,WAAW;CACnD,IAAI,OAAO,cAAc,YAAY,CAAC,OAAO,SAAS,SAAS,KAAK,aAAa,GAC/E,OAAO;CAET,OAAO,KAAK,MAAM,SAAS;AAC7B;ACuBA,MAAa,uBAAuB,IAAI,eACtC,sBAAsB;AAGxB,MAAa,mBAAmB;ACvBhC,IAAa,eAAb,MAAa,aAAY;CACN,SAAS,OAA2B,sBAAsB,EACzE,UAAU,KACX,CAAA;CAEgB,UAAU,OAAgB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAC7B,SAAS,OAAgB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAGpC,SAAS,KAAK,QAAQ,WAAU;CAEhC,QAAQ,KAAK,OAAO,WAAU;CAEtB,0BAAU,IAAI,IAAG;CACjB,0BAAU,IAAI,IAAG;CAEjB,oCAAoB,IAAI,IAAG;CAC3B,+BAAe,IAAI,IAAG;CACtB,+BAAe,IAAI,IAAG;CACtB,iCAAiB,IAAI,IAAG;CACjC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K,aAAa,EAAE;GACpB,OAAO;EACT;EACA,OAAO;CACT;CAEQ,aAAa,IAAU;EAC7B,MAAM,MAAM,KAAK,eAAe,IAAI,EAAE;EACtC,IAAI,QAAQ,QAAW;GACrB,KAAK,eAAe,OAAO,EAAE;GAC7B,IAAI,KAAK,aAAa,IAAI,GAAG,MAAM,IAAI,KAAK,aAAa,OAAO,GAAG;EACrE;CACF;CAhUW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAY,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAZ,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAY,CAAA;;AAAZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA,EADxB,MAAA,QAAA,CAAA;;;ACXD,SAAgB,oBAAoB,SAA6B,CAAA,GAAE;CACjE,OAAO,yBAAyB,CAAC;EAAE,SAAS;EAAsB,UAAU;CAAM,CAAE,CAAC;AACvF;AAGA,SAAgB,qBAAkB;CAChC,OAAO,OAAO,YAAY;AAC5B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivinia/toast",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Headless toast queue for Angular
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Headless toast queue for Angular: signals, pause-on-hover timers, actions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
7
7
|
"toast",
|