@wow-two-beta/fe 0.0.49 → 0.0.50
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/dist/feedback/FeedbackBus.d.ts +154 -29
- package/dist/feedback/FeedbackBus.js +264 -27
- package/dist/feedback/FeedbackBus.js.map +1 -1
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.js +3 -1
- package/dist/foundation/dom/enums/ElementTag.d.ts +2 -0
- package/dist/foundation/dom/enums/ElementTag.js +3 -1
- package/dist/foundation/dom/enums/ElementTag.js.map +1 -1
- package/dist/index.js +325 -312
- package/dist/index.js.map +1 -1
- package/dist/presentation/display/index.js +105 -102
- package/dist/presentation/display/index.js.map +1 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.d.ts +18 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js +120 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js +5 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.d.ts +11 -6
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js +255 -61
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js.map +1 -1
- package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.d.ts → NotificationCenterGroupItem.vue.d.ts} +13 -12
- package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.js → NotificationCenterGroupItem.vue.js} +81 -58
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js +5 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/index.d.ts +6 -1
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.d.ts +1 -9
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js +165 -20
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js.map +1 -1
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.d.ts +7 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js +56 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js.map +1 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js +5 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js.map +1 -0
- package/dist/presentation/feedback/index.js +9 -1
- package/dist/presentation/feedback/index.js.map +1 -1
- package/dist/presentation/feedback/toast/Toast.vue.d.ts +34 -8
- package/dist/presentation/feedback/toast/Toast.vue.js +290 -85
- package/dist/presentation/feedback/toast/Toast.vue.js.map +1 -1
- package/dist/presentation/feedback/toast/ToastContent.vue.d.ts +25 -0
- package/dist/presentation/feedback/toast/ToastContent.vue.js +78 -0
- package/dist/presentation/feedback/toast/ToastContent.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastContent2.vue.js +5 -0
- package/dist/presentation/feedback/toast/ToastContent2.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.d.ts +15 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js +88 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js +5 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastSurface.d.ts +8 -0
- package/dist/presentation/feedback/toast/ToastSurface.js +10 -0
- package/dist/presentation/feedback/toast/ToastSurface.js.map +1 -0
- package/dist/presentation/feedback/toast/index.d.ts +1 -0
- package/dist/presentation/feedback/toastHost/ToastContent.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/ToastEntry.d.ts +12 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.d.ts +2 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js +11 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastGroup.d.ts +8 -0
- package/dist/presentation/feedback/toastHost/ToastGroupLatest.d.ts +10 -0
- package/dist/presentation/feedback/toastHost/ToastHost.vue.d.ts +55 -110
- package/dist/presentation/feedback/toastHost/ToastHost.vue.js +394 -399
- package/dist/presentation/feedback/toastHost/ToastHost.vue.js.map +1 -1
- package/dist/presentation/feedback/toastHost/ToastHost2.vue.js +4 -5
- package/dist/presentation/feedback/toastHost/ToastHostStore.d.ts +37 -0
- package/dist/presentation/feedback/toastHost/ToastHostStore.js +98 -0
- package/dist/presentation/feedback/toastHost/ToastHostStore.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.d.ts +34 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.js +44 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastNode.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/ToastOptions.d.ts +72 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.d.ts +11 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.js +44 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastPromiseOptions.d.ts +12 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.d.ts +14 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.js +65 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastRing2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastRing2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.d.ts +9 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js +56 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeverity.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.d.ts +27 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.js +34 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.d.ts +14 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js +106 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.d.ts +34 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.js +128 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.d.ts +44 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.js +134 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.d.ts +26 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.js +23 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.d.ts +4 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.js +17 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.d.ts +11 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.js +52 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.d.ts +43 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js +173 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.d.ts +10 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.js +14 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.d.ts +20 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.js +66 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.d.ts +26 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.js +35 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.d.ts +27 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.js +96 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.d.ts +19 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.js +173 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.js.map +1 -0
- package/dist/presentation/feedback/toastHost/index.d.ts +8 -1
- package/dist/presentation/feedback/toastHost/index.js +7 -1
- package/dist/presentation/feedback/toastHost/index.js.map +1 -1
- package/dist/presentation/feedback/toastHost/styles.css +14 -2
- package/dist/presentation/layout/grid/Grid.variants.d.ts +7 -0
- package/dist/presentation/layout/grid/Grid.variants.js +4 -0
- package/dist/presentation/layout/grid/Grid.variants.js.map +1 -1
- package/dist/presentation/layout/grid/Grid.vue.d.ts +5 -0
- package/dist/presentation/layout/grid/Grid.vue.js +16 -4
- package/dist/presentation/layout/grid/Grid.vue.js.map +1 -1
- package/dist/presentation/layout/grid/index.d.ts +1 -1
- package/dist/presentation/layout/index.js +3 -1
- package/dist/presentation/layout/navbar/Navbar.vue.js.map +1 -1
- package/dist/presentation/overlays/popover/PopoverContent.vue.js +4 -4
- package/dist/presentation/overlays/popover/PopoverContent.vue.js.map +1 -1
- package/dist/presentation/overlays/tooltip/Tooltip.vue.js +8 -9
- package/dist/presentation/overlays/tooltip/Tooltip.vue.js.map +1 -1
- package/package.json +1 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationItem.vue.js.map +0 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js +0 -5
- package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastHost.vue.js","sources":["../../../../src/presentation/feedback/toastHost/ToastHost.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { VNode } from 'vue';\nimport type { OverlayPosition } from '../../../foundation/styles';\nimport type { ReportSend } from '../../../reporting';\nimport type { ToastSimpleVariants } from '../toastSimple/ToastSimple.variants';\n\nexport type ToastSeverity = NonNullable<ToastSimpleVariants['severity']>;\n\n/** Defines how a toast shows the time left before it dismisses itself. */\nexport const ToastTimer = {\n /** Refers to no countdown — the toast still expires on time. */\n None: 'none',\n /** Refers to a bar draining along the toast's bottom edge. */\n Bar: 'bar',\n /** Refers to a ring draining beside the close button. */\n Ring: 'ring',\n /** Refers to the whole seconds left, counted beside the close button. */\n Seconds: 'seconds',\n} as const;\n\nexport type ToastTimer = (typeof ToastTimer)[keyof typeof ToastTimer];\n\n/** Provides the per-severity expiry a `ToastHost` starts from — an error stays long enough to read and report. */\nexport const DefaultToastDurations: Readonly<Partial<Record<ToastSeverity, number>>> = Object.freeze({\n danger: 8000,\n});\n\n/**\n * A renderable slice of a toast. These travel through the imperative\n * `toastHost.toast()` payload, not through a slot, so a caller who wants\n * markup builds it with `h()`.\n */\nexport type ToastNode = string | VNode;\n\nexport interface ToastOptions {\n title?: ToastNode;\n description?: ToastNode;\n icon?: ToastNode;\n severity?: ToastSeverity;\n /**\n * ms before auto-dismiss. Default: the ToastHost's `durations` entry for the severity, then its\n * `defaultDuration`. `Infinity` = sticky.\n */\n duration?: number;\n action?: ToastNode;\n /**\n * Sends a one-click report of the failure this toast shows; the toast renders a Report action that walks\n * sending → reported (with the reference) → retry on failure. Pairs with `/reporting`'s `capture(error).send`.\n */\n report?: ReportSend;\n /** Shows the severity's own glyph when no `icon` is given. Default: the ToastHost's `showSeverityIcon`. */\n showSeverityIcon?: boolean;\n /**\n * Fully custom body — replaces the default `Toast` chrome (icon/title/description/close).\n * Still animates + auto-dismisses; the content owns its close via the returned id.\n */\n content?: ToastNode;\n /**\n * Fired when the toast is removed — auto-dismiss, close button, `dismiss(id)`, or `dismissAll()`.\n * Not fired on a dedup-update. For undo cleanup / analytics.\n */\n onDismiss?: () => void;\n /** Deletes an explicitly retained notification; omitted for transient toasts. */\n onDelete?: () => void;\n /**\n * Dedup key — a `toast` whose `key` is already showing updates that toast in place,\n * refreshing its timer instead of stacking a duplicate.\n */\n key?: string;\n /** How this toast shows its time left. Default: the ToastHost's `timer`. */\n timer?: ToastTimer;\n /**\n * Shows or hides this toast's countdown bar.\n * @deprecated Use `timer` — `ToastTimer.Bar` or `ToastTimer.None`.\n */\n progress?: boolean;\n}\n\n/** Content for a `toastHost.promise` phase — a title string, or a full partial options object. */\nexport type ToastContent = string | Partial<ToastOptions>;\n\n/**\n * Options for `toastHost.promise` — loading / success / error content\n * (success + error may be a fn of the settled value).\n */\nexport interface ToastPromiseOptions<T> {\n loading: ToastContent;\n success: ToastContent | ((value: T) => ToastContent);\n error: ToastContent | ((err: unknown) => ToastContent);\n /** Auto-dismiss (ms) for the settled toast; defaults to the ToastHost's `defaultDuration`. */\n duration?: number;\n}\n\nfunction normalizeContent(content: ToastContent): Partial<ToastOptions> {\n return typeof content === 'string' ? { title: content } : content;\n}\n\ninterface ToastEntry extends ToastOptions {\n id: string;\n /** Bumped on every `update` / dedup so the viewport can reset that toast's auto-dismiss timer. */\n nonce: number;\n}\n\ntype Listener = (toasts: ReadonlyArray<ToastEntry>) => void;\n\nclass ToastHostStore {\n private items: ReadonlyArray<ToastEntry> = [];\n private listeners = new Set<Listener>();\n private idSeq = 0;\n\n toast(opts: ToastOptions): string {\n if (opts.key !== undefined) {\n const existing = this.items.find((t) => t.key === opts.key);\n if (existing) {\n this.update(existing.id, opts);\n return existing.id;\n }\n }\n const id = `t_${++this.idSeq}`;\n this.items = [...this.items, { id, ...opts, nonce: 0 }];\n this.emit();\n return id;\n }\n\n /** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */\n update(id: string, patch: Partial<ToastOptions>): void {\n this.items = this.items.map((t) => (t.id === id ? { ...t, ...patch, nonce: t.nonce + 1 } : t));\n this.emit();\n }\n\n /** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */\n promise<T>(promise: Promise<T>, opts: ToastPromiseOptions<T>): Promise<T> {\n const id = this.toast({ ...normalizeContent(opts.loading), severity: 'info', duration: Infinity });\n const settle = (content: ToastContent, severity: ToastSeverity) =>\n this.update(id, { ...normalizeContent(content), severity, duration: opts.duration });\n return promise.then(\n (value) => {\n settle(typeof opts.success === 'function' ? opts.success(value) : opts.success, 'success');\n return value;\n },\n (err: unknown) => {\n settle(typeof opts.error === 'function' ? opts.error(err) : opts.error, 'danger');\n throw err;\n },\n );\n }\n\n dismiss(id: string): void {\n const entry = this.items.find((t) => t.id === id);\n this.items = this.items.filter((t) => t.id !== id);\n try {\n entry?.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n dismissAll(): void {\n const gone = this.items;\n this.items = [];\n try {\n for (const t of gone) t.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n subscribe(fn: Listener): () => void {\n this.listeners.add(fn);\n fn(this.items);\n return () => {\n this.listeners.delete(fn);\n };\n }\n\n private emit() {\n for (const fn of this.listeners) fn(this.items);\n }\n}\n\nexport const toastHost = new ToastHostStore();\n\n/**\n * The imperative toast API, bound to the app-wide store. A plain object — the\n * store is a module singleton, so there is nothing per-instance to memoize.\n */\nexport function useToastHost() {\n return {\n toast: (opts: ToastOptions) => toastHost.toast(opts),\n update: (id: string, patch: Partial<ToastOptions>) => toastHost.update(id, patch),\n promise: <T,>(promise: Promise<T>, opts: ToastPromiseOptions<T>) => toastHost.promise(promise, opts),\n dismiss: (id: string) => toastHost.dismiss(id),\n dismissAll: () => toastHost.dismissAll(),\n };\n}\n\nconst PositionClasses = 'top-4 right-4 items-end';\n\n/** Toasts enter from the right; reduced-motion users get an instant swap. */\nconst MotionClasses =\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-right) motion-safe:data-[state=closed]:animate-(--animate-slide-out-right) motion-reduce:animate-none';\n\nexport interface ToastHostProps {\n /** @deprecated Toasts always anchor top-right. Accepted for one release, without changing placement. */\n readonly position?: OverlayPosition;\n readonly max?: number;\n /**\n * The auto-dismiss delay in ms for a severity missing from `durations`; per-toast `duration` overrides.\n * Default 5000. `Infinity` to disable.\n */\n readonly defaultDuration?: number;\n /**\n * The auto-dismiss delay in ms per severity; per-toast `duration` overrides, and a severity left out falls\n * back to `defaultDuration`. Default `DefaultToastDurations` — errors stay 8 seconds. Replaces, never merges.\n */\n readonly durations?: Readonly<Partial<Record<ToastSeverity, number>>>;\n readonly canPauseOnHover?: boolean;\n readonly gap?: number;\n /**\n * How each auto-dismissing toast shows its time left; a toast's `timer` overrides. Every display pauses with\n * the expiry timer and restarts when the toast updates; sticky toasts show none, and reduced motion drops the\n * bar and the ring. Custom `content` has no close button to sit beside, so it takes the bar for a ring or\n * seconds. Default `ToastTimer.None`.\n */\n readonly timer?: ToastTimer;\n /**\n * Shows a countdown bar along the bottom of each auto-dismissing toast.\n * @deprecated Use `timer` — `ToastTimer.Bar`.\n */\n readonly showProgress?: boolean;\n /** Shows each severity's glyph on toasts given no `icon`; a toast's `showSeverityIcon` overrides. Default `true`. */\n readonly showSeverityIcon?: boolean;\n}\n\ninterface VisibleToast extends ToastEntry {\n resolvedDuration: number;\n}\n\n/** Countdown fill per severity; the neutral countdown uses the brand primary. */\nconst ProgressClasses: Record<ToastSeverity, string> = {\n neutral: 'bg-primary',\n info: 'bg-info',\n success: 'bg-success',\n warning: 'bg-warning',\n danger: 'bg-destructive',\n};\n\n/** Countdown-ring stroke per severity — the bar's tones, drawn as an arc. */\nconst RingClasses: Record<ToastSeverity, string> = {\n neutral: 'stroke-primary',\n info: 'stroke-info',\n success: 'stroke-success',\n warning: 'stroke-warning',\n danger: 'stroke-destructive',\n};\n\n/** The ring's radius in the 16×16 view box; the circumference is the dash the countdown drains. */\nconst RingRadius = 6;\nconst RingCircumference = 2 * Math.PI * RingRadius;\n\n/** How often the seconds display re-reads its clock — a quarter second keeps a whole-second flip on time. */\nconst SecondsTickMs = 250;\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport {\n computed,\n defineComponent,\n h,\n onMounted,\n onUnmounted,\n ref,\n shallowRef,\n useAttrs,\n watch,\n type PropType,\n} from 'vue';\nimport { cn, OverlayPosition as OverlayPositionToken } from '../../../foundation/styles';\nimport { Announce, Portal, Presence } from '../../../foundation/primitives';\nimport Toast from '../toast/Toast.vue';\nimport ReportAction from '../reportAction/ReportAction.vue';\n\nconst locale = useLocale();\n\n/** Renders a `ToastNode` — either a plain string or a caller-built VNode. */\nconst ToastNodeView = defineComponent({\n name: 'ToastNodeView',\n props: { node: { type: [String, Object] as PropType<ToastNode>, required: true } },\n setup: (nodeProps) => () => nodeProps.node,\n});\n\n/** The props every countdown display shares — it mirrors the host's expiry timer, never drives it. */\nconst CountdownProps = {\n duration: { type: Number, required: true },\n paused: { type: Boolean, default: false },\n severity: { type: String as PropType<ToastSeverity>, default: 'neutral' },\n} as const;\n\n/**\n * Runs one Web Animations API countdown on a template ref, paused and resumed in step with the host's expiry\n * timer; environments without `animate` leave the element static at full.\n */\nfunction useCountdownAnimation(\n element: () => Element | null,\n keyframes: Keyframe[],\n countdown: { readonly duration: number; readonly paused: boolean },\n): void {\n let animation: Animation | undefined;\n onMounted(() => {\n const target = element();\n if (!target || typeof target.animate !== 'function') return;\n animation = target.animate(keyframes, { duration: countdown.duration, easing: 'linear', fill: 'forwards' });\n if (countdown.paused) animation.pause();\n });\n watch(\n () => countdown.paused,\n (isPaused) => {\n if (isPaused) animation?.pause();\n else animation?.play();\n },\n );\n onUnmounted(() => animation?.cancel());\n}\n\n/** The countdown bar — a scale transform draining along the toast's bottom edge. */\nconst ToastProgress = defineComponent({\n name: 'ToastProgress',\n props: CountdownProps,\n setup(countdown) {\n const fill = ref<HTMLElement | null>(null);\n useCountdownAnimation(() => fill.value, [{ transform: 'scaleX(1)' }, { transform: 'scaleX(0)' }], countdown);\n return () =>\n h(\n 'div',\n {\n 'aria-hidden': 'true',\n 'data-toast-progress': '',\n class: 'absolute inset-x-0 bottom-0 h-1 motion-reduce:hidden',\n },\n [\n h('div', {\n ref: fill,\n class: cn('h-full w-full origin-left opacity-80', ProgressClasses[countdown.severity]),\n }),\n ],\n );\n },\n});\n\n/** The countdown ring — an arc draining clockwise from twelve o'clock, drawn beside the close button. */\nconst ToastRing = defineComponent({\n name: 'ToastRing',\n props: CountdownProps,\n setup(countdown) {\n const arc = ref<SVGCircleElement | null>(null);\n useCountdownAnimation(\n () => arc.value,\n [{ strokeDashoffset: '0' }, { strokeDashoffset: `${RingCircumference}` }],\n countdown,\n );\n return () =>\n h(\n 'svg',\n {\n 'aria-hidden': 'true',\n 'data-toast-timer': ToastTimer.Ring,\n viewBox: '0 0 16 16',\n class: 'size-4 -rotate-90 motion-reduce:hidden',\n },\n [\n h('circle', { cx: 8, cy: 8, r: RingRadius, fill: 'none', 'stroke-width': 2, class: 'stroke-border' }),\n h('circle', {\n ref: arc,\n cx: 8,\n cy: 8,\n r: RingRadius,\n fill: 'none',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'stroke-dasharray': `${RingCircumference}`,\n class: RingClasses[countdown.severity],\n }),\n ],\n );\n },\n});\n\n/**\n * The seconds display — the whole seconds left, rounded up so it reads `1s` until the toast goes. It keeps its\n * own clock, advancing only while unpaused; the announcement region already carries the toast, so it is hidden.\n */\nconst ToastSeconds = defineComponent({\n name: 'ToastSeconds',\n props: CountdownProps,\n setup(countdown) {\n const left = ref(countdown.duration);\n let lastTick = 0;\n let handle: number | undefined;\n const tick = () => {\n const now = Date.now();\n left.value = Math.max(0, left.value - (now - lastTick));\n lastTick = now;\n };\n const start = () => {\n if (handle !== undefined) return;\n lastTick = Date.now();\n handle = window.setInterval(tick, SecondsTickMs);\n };\n const stop = () => {\n if (handle === undefined) return;\n tick();\n window.clearInterval(handle);\n handle = undefined;\n };\n onMounted(() => {\n if (!countdown.paused) start();\n });\n watch(\n () => countdown.paused,\n (isPaused) => (isPaused ? stop() : start()),\n );\n onUnmounted(() => {\n if (handle !== undefined) window.clearInterval(handle);\n });\n return () =>\n h(\n 'span',\n {\n 'aria-hidden': 'true',\n 'data-toast-timer': ToastTimer.Seconds,\n class: 'text-xs tabular-nums text-muted-foreground',\n },\n `${Math.ceil(left.value / 1000)}s`,\n );\n },\n});\n\n/**\n * Renders the toast viewport — subscribes to the global `toastHost` store and stacks `Toast` cards.\n * Mount once, per app.\n *\n * A caller's `class` attr lands on the stack container.\n */\ndefineOptions({ name: 'ToastHost', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastHostProps>(), {\n position: OverlayPositionToken.TopRight,\n max: 5,\n defaultDuration: 5000,\n durations: () => DefaultToastDurations,\n canPauseOnHover: true,\n gap: 8,\n timer: undefined,\n showProgress: false,\n showSeverityIcon: true,\n});\n\nconst attrs = useAttrs();\n\nconst items = shallowRef<ReadonlyArray<ToastEntry>>([]);\nconst hovered = ref(false);\nconst focused = ref(false);\nconst paused = computed(() => props.canPauseOnHover && (hovered.value || focused.value));\n\n/* Non-reactive state — mutated across ticks, never rendered. */\nconst timers = new Map<string, number>();\nconst remaining = new Map<string, number>();\nconst startedAt = new Map<string, number>();\nconst nonces = new Map<string, number>();\n\nlet unsubscribe: (() => void) | undefined;\nonMounted(() => {\n unsubscribe = toastHost.subscribe((next) => {\n items.value = next;\n });\n});\n\n// Visible window (FIFO).\nconst visible = computed<ReadonlyArray<VisibleToast>>(() =>\n items.value.slice(0, props.max).map((t) => ({\n ...t,\n resolvedDuration: t.duration ?? props.durations[t.severity ?? 'neutral'] ?? props.defaultDuration,\n })),\n);\nconst visibleIds = computed(() => new Set(visible.value.map((v) => v.id)));\n\n// Toasts that just left `visible` (dismissed, or pushed out of the FIFO\n// window) but must still play their exit animation. Kept mounted with\n// `data-state=\"closed\"` until `Presence` unmounts the child — the `@vue:unmounted`\n// hook below then prunes the entry here.\nconst exiting = shallowRef<ReadonlyArray<VisibleToast>>([]);\nlet prevVisible: ReadonlyArray<VisibleToast> = [];\n\nwatch(\n visibleIds,\n (ids) => {\n const gone = prevVisible.filter((p) => !ids.has(p.id));\n prevVisible = visible.value;\n const current = exiting.value;\n const known = new Set(current.map((e) => e.id));\n // Add newly-gone toasts; drop any that re-entered `visible`.\n const merged = [...current, ...gone.filter((g) => !known.has(g.id))].filter((e) => !ids.has(e.id));\n if (merged.length !== current.length || !merged.every((e, i) => e.id === current[i]?.id)) {\n exiting.value = merged;\n }\n },\n { immediate: true, flush: 'post' },\n);\n\nconst removeExiting = (id: string) => {\n exiting.value = exiting.value.filter((e) => e.id !== id);\n};\n\n// Visible (present) first, then the ones animating out.\nconst rendered = computed<Array<VisibleToast & { present: boolean }>>(() => [\n ...visible.value.map((v) => ({ ...v, present: true })),\n ...exiting.value.map((e) => ({ ...e, present: false })),\n]);\n\nconst latestTitle = computed(() => {\n const last = visible.value[visible.value.length - 1];\n if (typeof last?.title === 'string') return last.title;\n if (typeof last?.description === 'string') return last.description;\n return '';\n});\n\n// Schedule auto-dismiss timers.\nwatch(\n [items, () => props.max, () => props.defaultDuration, () => props.durations, paused],\n () => {\n const ids = visibleIds.value;\n // Clear timers for items that are no longer visible.\n for (const [id, handle] of timers) {\n if (!ids.has(id)) {\n window.clearTimeout(handle);\n timers.delete(id);\n remaining.delete(id);\n startedAt.delete(id);\n }\n }\n for (const id of nonces.keys()) {\n if (!ids.has(id)) nonces.delete(id);\n }\n if (paused.value) return;\n // A content update / dedup bumps `nonce` — clear that toast's timer so it reschedules fresh.\n for (const v of visible.value) {\n const seen = nonces.get(v.id);\n if (seen !== undefined && seen !== v.nonce) {\n const handle = timers.get(v.id);\n if (handle !== undefined) window.clearTimeout(handle);\n timers.delete(v.id);\n remaining.delete(v.id);\n startedAt.delete(v.id);\n }\n nonces.set(v.id, v.nonce);\n }\n for (const v of visible.value) {\n if (v.resolvedDuration === Infinity) continue;\n if (timers.has(v.id)) continue;\n const left = remaining.get(v.id) ?? v.resolvedDuration;\n const handle = window.setTimeout(() => {\n toastHost.dismiss(v.id);\n }, left);\n timers.set(v.id, handle);\n startedAt.set(v.id, Date.now());\n remaining.set(v.id, left);\n }\n },\n { immediate: true, flush: 'post' },\n);\n\n// Cleanup on unmount.\nonUnmounted(() => {\n unsubscribe?.();\n for (const handle of timers.values()) window.clearTimeout(handle);\n timers.clear();\n});\n\nwatch(\n paused,\n (isPaused) => {\n if (!isPaused) return;\n for (const [id, handle] of timers) {\n window.clearTimeout(handle);\n const start = startedAt.get(id) ?? Date.now();\n remaining.set(id, Math.max(0, (remaining.get(id) ?? 0) - (Date.now() - start)));\n }\n timers.clear();\n },\n { flush: 'sync' },\n);\n\nwatch(\n () => rendered.value.length,\n (count) => {\n if (count === 0) {\n hovered.value = false;\n focused.value = false;\n }\n },\n);\n\nfunction onFocusout(event: FocusEvent): void {\n const stack = event.currentTarget as HTMLElement;\n if (!(event.relatedTarget instanceof Node) || !stack.contains(event.relatedTarget)) focused.value = false;\n}\n\nconst stackClasses = computed(() =>\n cn('pointer-events-none fixed z-toast flex flex-col', PositionClasses, attrs.class as string | undefined),\n);\n\nconst itemClasses = computed(() => cn('pointer-events-auto relative w-80 overflow-hidden rounded-md', MotionClasses));\n\n/** The display a toast asked for — its own `timer`, its deprecated `progress`, then the host's two. */\nfunction requestedTimer(t: VisibleToast): ToastTimer {\n if (t.timer !== undefined) return t.timer;\n if (t.progress !== undefined) return t.progress ? ToastTimer.Bar : ToastTimer.None;\n if (props.timer !== undefined) return props.timer;\n return props.showProgress ? ToastTimer.Bar : ToastTimer.None;\n}\n\n/**\n * The display a toast gets — none while exiting or sticky, and the bar for custom `content`, which has no close\n * button for a ring or seconds to sit beside.\n */\nfunction timerFor(t: VisibleToast & { present: boolean }): ToastTimer {\n if (!t.present || !Number.isFinite(t.resolvedDuration)) return ToastTimer.None;\n const requested = requestedTimer(t);\n return t.content && requested !== ToastTimer.None ? ToastTimer.Bar : requested;\n}\n\n/** Whether a toast's display sits beside the close button rather than along the bottom edge. */\nconst isTrailingTimer = (timer: ToastTimer): boolean => timer === ToastTimer.Ring || timer === ToastTimer.Seconds;\n\n/** Vue does not auto-suffix numeric style values with `px`. */\nconst stackStyle = computed(() => ({ gap: `${props.gap}px` }));\n</script>\n\n<template>\n <Portal>\n <div\n v-if=\"rendered.length > 0\"\n role=\"region\"\n :aria-label=\"locale.t('ToastHost.notifications', undefined, 'Notifications')\"\n :style=\"stackStyle\"\n :class=\"stackClasses\"\n @mouseenter=\"hovered = true\"\n @mouseleave=\"hovered = false\"\n @focusin=\"focused = true\"\n @focusout=\"onFocusout\"\n >\n <Presence v-for=\"t in rendered\" :key=\"t.id\" :is-present=\"t.present\">\n <!--\n `Presence` clones `data-state` onto this node and keeps it mounted\n until the exit animation ends; the `@vue:unmounted` hook is that\n \"exit finished\" signal (the read-only `Presence` API exposes no\n callback).\n -->\n <div :class=\"itemClasses\" @vue:unmounted=\"t.present ? undefined : removeExiting(t.id)\">\n <ToastNodeView v-if=\"t.content\" :node=\"t.content\" />\n <Toast\n v-else\n :severity=\"t.severity\"\n :show-severity-icon=\"t.showSeverityIcon ?? props.showSeverityIcon\"\n v-on=\"t.onDelete ? { delete: t.onDelete } : {}\"\n @close=\"toastHost.dismiss(t.id)\"\n >\n <template v-if=\"t.icon\" #icon><ToastNodeView :node=\"t.icon\" /></template>\n <template v-if=\"t.title\" #title><ToastNodeView :node=\"t.title\" /></template>\n <template v-if=\"t.description\" #description>\n <ToastNodeView :node=\"t.description\" />\n </template>\n <template v-if=\"t.action || t.report\" #actions>\n <ToastNodeView v-if=\"t.action\" :node=\"t.action\" />\n <ReportAction v-if=\"t.report\" :send=\"t.report\" />\n </template>\n <template v-if=\"isTrailingTimer(timerFor(t))\" #trailing>\n <ToastRing\n v-if=\"timerFor(t) === ToastTimer.Ring\"\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n <ToastSeconds\n v-else\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n </template>\n </Toast>\n <ToastProgress\n v-if=\"timerFor(t) === ToastTimer.Bar\"\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n </div>\n </Presence>\n </div>\n <Announce politeness=\"polite\">{{ latestTitle }}</Announce>\n </Portal>\n</template>\n"],"names":["_createBlock","_unref","Portal","_createElementBlock","_Fragment","_renderList","_createElementVNode","_openBlock","Toast","_mergeProps","_toHandlers","_createVNode","ReportAction","Announce"],"mappings":";;;;;;;;;;;AASO,MAAM,aAAa;AAAA;AAAA,EAExB,MAAM;AAAA;AAAA,EAEN,KAAK;AAAA;AAAA,EAEL,MAAM;AAAA;AAAA,EAEN,SAAS;AACX;AAKO,MAAM,wBAA0E,OAAO,OAAO;AAAA,EACnG,QAAQ;AACV,CAAC;AAoED,SAAS,iBAAiB,SAA8C;AACtE,SAAO,OAAO,YAAY,WAAW,EAAE,OAAO,YAAY;AAC5D;AAUA,MAAM,eAAe;AAAA,EACX,QAAmC,CAAA;AAAA,EACnC,gCAAgB,IAA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AE,YAAQ;AAAA,0BAAA,iEAEvBD,YAMEC,MAAA,YAAA,GAAA;AAAA,4BAJC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK;AAAA,4BACvB,UAAU,EAAE;AAAA,4BACZ,QAAQ,OAAA;AAAA,4BACR,UAAU,EAAE,YAAQ;AAAA,0BAAA;;;;;oBAKnB,SAAS,CAAC,MAAM,WAAW,oBADnCD,YAMEC,MAAA,aAAA,GAAA;AAAA,sBAJC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK;AAAA,sBACvB,UAAU,EAAE;AAAA,sBACZ,QAAQ,OAAA;AAAA,sBACR,UAAU,EAAE,YAAQ;AAAA,oBAAA;;;;;;;UAK7BU,YAA0DV,MAAAY,WAAA,GAAA,EAAhD,YAAW,YAAQ;AAAA,6BAAC,MAAiB;AAAA,8CAAd,YAAA,KAAW,GAAA,CAAA;AAAA,YAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ToastHost.vue.js","sources":["../../../../src/presentation/feedback/toastHost/ToastHost.vue"],"sourcesContent":["<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n shallowRef,\n useAttrs,\n useTemplateRef,\n watch,\n type PropType,\n type StyleValue,\n} from 'vue';\n\nimport type { NoticePriority } from '../../../feedback';\nimport { cn, OverlayPosition, Severity, Side } from '../../../foundation/styles';\nimport { ToastSurface } from '../toast/ToastSurface';\nimport type { ToastNode } from './ToastNode';\nimport type { ToastSeverity } from './ToastSeverity';\n\n/** Defines how a toast shows the time left before it dismisses itself. */\nexport const ToastTimer = {\n /** Refers to no countdown — the toast still expires on time. */\n None: 'none',\n /** Refers to a bar draining along the toast's bottom edge. */\n Bar: 'bar',\n /** Refers to a ring draining beside the close button. */\n Ring: 'ring',\n /** Refers to a ring around the close button, with a dim arc for elapsed time. */\n CloseRing: 'closeRing',\n /** Refers to the whole seconds left, counted beside the close button. */\n Seconds: 'seconds',\n} as const;\n\nexport type ToastTimer = (typeof ToastTimer)[keyof typeof ToastTimer];\n\n/** Defines the entry and exit motion of a toast stack. */\nexport const ToastMotion = {\n /** Refers to a horizontal slide in from the side of the selected corner. */\n SideSlide: 'sideSlide',\n /** Refers to a short move toward the selected top or bottom edge. */\n ShortSlide: 'shortSlide',\n /** Refers to a move by the card's height toward the selected top or bottom edge. */\n EdgeSlide: 'edgeSlide',\n /** Refers to a move toward the edge while scaling to full size. */\n SlideAndSettle: 'slideAndSettle',\n} as const;\n\nexport type ToastMotion = (typeof ToastMotion)[keyof typeof ToastMotion];\n\n/** Defines how a group shows a new arrival. */\nexport const ToastGroupMotion = {\n /** Refers to a preview that passes over the stack and merges into its group. */\n Card: 'card',\n /** Refers to an in-place update whose count briefly glows. */\n Highlight: 'highlight',\n} as const;\n\nexport type ToastGroupMotion = (typeof ToastGroupMotion)[keyof typeof ToastGroupMotion];\n\n/** Defines props for the toast viewport. */\nexport interface ToastHostProps {\n /** The corner or centered edge the stack grows from. Defaults to top-right. */\n readonly position?: OverlayPosition;\n\n /** The entry and exit motion of the cards. Defaults to `ToastMotion.SideSlide`. */\n readonly motion?: ToastMotion;\n\n /** The motion a group shows for a new arrival. Defaults to `ToastGroupMotion.Highlight`. */\n readonly groupMotion?: ToastGroupMotion;\n\n /** The maximum number of cards shown at rest, subject to viewport height. Default 5. */\n readonly max?: number;\n\n /** The time cards take to slide together after an exit, in ms. Default 200. Set to 0 for an instant reflow. */\n readonly moveDuration?: number;\n\n /**\n * The auto-dismiss delay in ms for a severity missing from `durations`; per-toast `duration` overrides.\n * Default 5000. `Infinity` to disable.\n */\n readonly defaultDuration?: number;\n\n /**\n * The auto-dismiss delay in ms per severity; per-toast `duration` overrides, and a severity left out falls\n * back to `defaultDuration`. Default `DefaultToastDurations` — errors stay 8 seconds. Replaces, never merges.\n */\n readonly durations?: Readonly<Partial<Record<ToastSeverity, number>>>;\n\n /** The display lifetime in ms per priority; unclassified notices count as Normal. */\n readonly priorityDurations?: Readonly<Partial<Record<NoticePriority, number>>>;\n\n /** The switch for holding the expiry clocks while the stack is hovered or focused. Default `true`. */\n readonly canPauseOnHover?: boolean;\n\n /** The default for showing Pin on timed cards; a toast's `canPin` overrides. Default `true`. */\n readonly canPin?: boolean;\n\n /** The space between cards, in px. Default 8. */\n readonly gap?: number;\n\n /**\n * The display each auto-dismissing toast shows its time left in; a toast's `timer` overrides. Every display\n * pauses with the expiry timer and restarts on update. Pinned, sticky and running toasts show none. Reduced\n * motion drops bars and rings. Custom `content` uses a bar for any visible timer. Default `ToastTimer.None`.\n */\n readonly timer?: ToastTimer;\n\n /** The switch for each severity's glyph on toasts given no `icon`; a toast's `showSeverityIcon` overrides. */\n readonly showSeverityIcon?: boolean;\n\n /** The card material; a toast's `surface` overrides. Default `ToastSurface.Solid`. */\n readonly surface?: ToastSurface;\n\n /**\n * The key that moves focus to the card nearest the anchor, or `false` for none; Escape returns it. The stack's\n * name includes it. Default `'F8'`.\n */\n readonly hotkey?: string | false;\n}\n\n/** @internal The vertical presets: entry offset and scale, entry and exit durations, and easing. */\nconst VerticalMotions = {\n [ToastMotion.ShortSlide]: {\n offset: '12px',\n scale: 1,\n enter: '200ms',\n exit: '150ms',\n easing: 'cubic-bezier(0, 0, 0.2, 1)',\n },\n [ToastMotion.EdgeSlide]: {\n offset: 'calc(100% + 1rem)',\n scale: 1,\n enter: '260ms',\n exit: '180ms',\n easing: 'cubic-bezier(0.16, 1, 0.3, 1)',\n },\n [ToastMotion.SlideAndSettle]: {\n offset: '24px',\n scale: 0.97,\n enter: '240ms',\n exit: '140ms',\n easing: 'cubic-bezier(0.2, 0.8, 0.2, 1)',\n },\n} as const;\n\n/** @internal Renders a `ToastNode` — either a plain string or a caller-built VNode. */\nconst ToastNodeView = defineComponent({\n name: 'ToastNodeView',\n props: { node: { type: [String, Object] as PropType<ToastNode>, required: true } },\n setup: (nodeProps) => () => nodeProps.node,\n});\n</script>\n\n<script setup lang=\"ts\">\nimport { ChevronDown } from 'lucide-vue-next';\n\nimport { AnimationDefaults } from '../../../foundation/animation';\nimport { useReducedMotion } from '../../../foundation/device';\nimport { dataAttr, Key } from '../../../foundation/dom';\nimport { useLocale } from '../../../foundation/i18n';\nimport { Icon } from '../../../foundation/icons';\nimport { Announce, Portal, Presence } from '../../../foundation/primitives';\nimport { Button } from '../../actions/button';\nimport ReportAction from '../reportAction/ReportAction.vue';\nimport Toast from '../toast/Toast.vue';\nimport { compareOrder, toastHost } from './ToastHostStore';\nimport {\n GroupArrivalClass,\n GroupCountClass,\n ItemClass,\n OverflowButtonClass,\n PositionClasses,\n SideSlideClasses,\n StackClass,\n StackInsets,\n UpdateHighlightClass,\n VerticalSlideClass,\n} from './ToastHostStyles';\nimport type { ToastOptions } from './ToastOptions';\nimport ToastProgress from './ToastProgress.vue';\nimport ToastRing from './ToastRing.vue';\nimport ToastSeconds from './ToastSeconds.vue';\nimport { DefaultToastDurations, useResolvedToasts, type VisibleToast } from './UseResolvedToasts';\nimport { useToastAnnouncer } from './UseToastAnnouncer';\nimport { useToastCapacity } from './UseToastCapacity';\nimport { useToastClock } from './UseToastClock';\nimport { useToastEntries } from './UseToastEntries';\nimport { useToastExits } from './UseToastExits';\nimport { ToastChange, useToastGroupMotion } from './UseToastGroupMotion';\nimport { useToastHotkey } from './UseToastHotkey';\nimport { useToastPins } from './UseToastPins';\nimport { useToastStackMotion } from './UseToastStackMotion';\nimport { useToastSwipe } from './UseToastSwipe';\n\n/**\n * Renders the app's transient notification stack. Mount once per app.\n * A caller's `class` and `style` attrs land on the stack container.\n */\ndefineOptions({ name: 'ToastHost', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastHostProps>(), {\n position: OverlayPosition.TopRight,\n motion: ToastMotion.SideSlide,\n groupMotion: ToastGroupMotion.Highlight,\n max: 5,\n moveDuration: AnimationDefaults.duration,\n defaultDuration: 5000,\n durations: () => DefaultToastDurations,\n canPauseOnHover: true,\n canPin: true,\n gap: 8,\n timer: undefined,\n showSeverityIcon: true,\n surface: undefined,\n hotkey: 'F8',\n});\n\nconst attrs = useAttrs();\nconst locale = useLocale();\nconst reducedMotion = useReducedMotion();\nconst stack = useTemplateRef<HTMLDivElement>('stack');\nconst overflowButton = useTemplateRef<InstanceType<typeof Button>>('overflowButton');\n\nconst expandedDetails = shallowRef<ReadonlySet<string>>(new Set());\n\n/** The stack's position — the prop, else top-right when it names no known position. */\nconst position = computed(() =>\n Object.hasOwn(PositionClasses, props.position) ? props.position : OverlayPosition.TopRight,\n);\nconst verticalMotion = computed(() =>\n props.motion === ToastMotion.SideSlide ? undefined : VerticalMotions[props.motion],\n);\n\nconst resolved = useResolvedToasts(useToastEntries(), props);\nconst pins = useToastPins(resolved, props);\nconst { overflowOpen, needsScroll, overflowCount, visible, copyOf, measureCapacity, toggleOverflow, ...capacity } =\n useToastCapacity(\n { stack, overflowButton: () => overflowButton.value?.el, cards: resolved, ordered: pins.ordered },\n props,\n );\nconst activeIds = computed(() => new Set(resolved.value.map((card) => card.id)));\nconst visibleIds = computed(() => new Set(visible.value.map((card) => card.id)));\nconst { exiting, removeExiting } = useToastExits(stack, visible, visibleIds, activeIds);\n\nconst { swiping, onPointerDown: onSwipeStart } = useToastSwipe({\n stack,\n position: () => position.value,\n reducedMotion,\n dismiss: (id) => toastHost.dismiss(id),\n});\n\nconst { pausedIds, hasCountdown, countdownKey, timerElapsed, ...clock } = useToastClock(\n {\n stack,\n cards: resolved,\n visible,\n activeIds,\n visibleIds,\n exiting,\n expandedDetails,\n pins,\n browsing: () => overflowOpen.value,\n swiping: () => swiping.value,\n expire: (id) => toastHost.dismiss(id),\n },\n props,\n);\nconst { captureToastChange } = useToastGroupMotion(\n {\n stack,\n visible,\n position: () => position.value,\n groupMotion: () => props.groupMotion,\n reducedMotion,\n scrolls: () => overflowOpen.value || needsScroll.value,\n isExpanded: (id) => expandedDetails.value.has(id),\n copyOf,\n },\n props,\n);\nconst { captureGap } = useToastStackMotion(\n { stack, visible, position: () => position.value, reducedMotion, browsing: () => overflowOpen.value },\n props,\n);\nconst { polite: politeMessage, assertive: assertiveMessage } = useToastAnnouncer(resolved, locale);\nconst hotkey = useToastHotkey({\n stack,\n hotkey: () => props.hotkey,\n hasCards: () => visible.value.length > 0,\n});\n\nconst rendered = computed(() =>\n [\n ...visible.value.map((toast) => ({ ...toast, present: true, copy: copyOf(toast) })),\n ...exiting.value.map((toast) => ({ ...toast, present: false, copy: copyOf(toast) })),\n ].sort(compareOrder),\n);\n\nconst regionLabel = computed(() => {\n const label = locale.t('ToastHost.notifications', undefined, 'Notifications');\n const key = hotkey.label.value;\n return key ? locale.t('ToastHost.notificationsHotkey', { label, hotkey: key }, '{label} ({hotkey})') : label;\n});\n\nconst overflowLabel = computed(() =>\n overflowOpen.value\n ? locale.t('ToastHost.showFewer', undefined, 'Show fewer notifications')\n : locale.t('ToastHost.showMore', { count: overflowCount.value }, 'Show {count} more notifications'),\n);\n\nconst stackClasses = computed(() =>\n cn(\n StackClass,\n PositionClasses[position.value],\n (overflowOpen.value || needsScroll.value) && 'overflow-y-auto overscroll-contain',\n overflowOpen.value &&\n (position.value.startsWith('top')\n ? 'scroll-pb-(--toast-overflow-control-height)'\n : 'scroll-pt-(--toast-overflow-control-height)'),\n attrs.class as string | undefined,\n ),\n);\n\nconst itemClasses = computed(() => {\n const [vertical, horizontal] = position.value.split('-');\n const edge =\n horizontal === Side.Left || horizontal === Side.Right\n ? horizontal\n : vertical === Side.Bottom\n ? Side.Bottom\n : Side.Top;\n return cn(ItemClass, verticalMotion.value ? VerticalSlideClass : SideSlideClasses[edge]);\n});\n\n/** The stack's own inline style — insets, gap and group duration, plus the vertical motion's properties. */\nconst ownStyle = computed(() => {\n const base = { ...StackInsets, gap: `${props.gap}px`, '--toast-group-duration': `${props.moveDuration}ms` };\n const slide = verticalMotion.value;\n if (!slide) return base;\n const bottom = position.value.startsWith('bottom');\n const offset = bottom ? `calc(-1 * ${slide.offset})` : slide.offset;\n return {\n ...base,\n '--toast-motion-origin': bottom ? 'center bottom' : 'center top',\n '--toast-motion-transform': `translateY(${offset}) scale(${slide.scale})`,\n '--toast-motion-enter': slide.enter,\n '--toast-motion-exit': slide.exit,\n '--toast-motion-ease': slide.easing,\n };\n});\n\n/** The stack's inline style — its own, then a caller's `style` attr (`--toast-top-offset: 4rem`), which wins. */\nconst stackStyle = computed<StyleValue>(() => [ownStyle.value, attrs.style as StyleValue]);\n\n// Open details close with their card's exit, or once the card has no details left to show.\nwatch(\n [resolved, exiting],\n ([cards, leaving]) => {\n if (expandedDetails.value.size === 0) return;\n const open = new Set([...cards.filter((card) => card.details), ...leaving].map((card) => card.id));\n const kept = [...expandedDetails.value].filter((id) => open.has(id));\n if (kept.length !== expandedDetails.value.size) expandedDetails.value = new Set(kept);\n },\n { flush: 'post' },\n);\n\nwatch(\n () => rendered.value.length,\n (count) => {\n if (count > 0) return;\n clock.release();\n capacity.reset();\n },\n);\n\n// The last card leaving hands focus back to where the hotkey found it.\nwatch(\n () => visible.value.length === 0,\n (empty) => {\n if (empty) hotkey.release();\n },\n);\n\n/** Opens or closes a card's details, animating a group's resize. */\nfunction setDetails(id: string, expanded: boolean): void {\n const next = new Set(expandedDetails.value);\n if (expanded) next.add(id);\n else next.delete(id);\n expandedDetails.value = next;\n if (visible.value.some((card) => card.id === id && card.group && card.group.count > 1)) {\n captureToastChange(id, ToastChange.Resize);\n }\n}\n\n/** Collapses an open overflow list on Escape first, then returns focus to where the hotkey found it. */\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key !== Key.Escape) return;\n if (overflowOpen.value) capacity.onEscape(event);\n else hotkey.returnFocus(event);\n}\n\nfunction onFocusout(event: FocusEvent): void {\n clock.onFocusout(event);\n hotkey.onFocusout(event);\n}\n\n/** Resolves the card material — the toast's own, the host's, then solid. */\nfunction surfaceOf(t: ToastOptions) {\n return t.surface ?? props.surface ?? ToastSurface.Solid;\n}\n\n/** Resolves the timer display a toast gets — its own `timer`, then the host's. Custom `content` uses a bar. */\nfunction timerFor(t: VisibleToast): ToastTimer {\n if (!hasCountdown(t)) return ToastTimer.None;\n const requested = t.timer ?? props.timer ?? ToastTimer.None;\n return t.content && requested !== ToastTimer.None ? ToastTimer.Bar : requested;\n}\n\n/** Builds the props a countdown display mirrors from the toast's clock; an exiting card's display holds. */\nfunction countdownOf(t: VisibleToast & { present: boolean }) {\n return {\n duration: t.resolvedDuration,\n elapsed: timerElapsed(t),\n isPaused: !t.present || pausedIds.value.has(t.id),\n severity: t.severity ?? Severity.Neutral,\n };\n}\n</script>\n\n<template>\n <Portal>\n <div\n v-if=\"rendered.length > 0\"\n ref=\"stack\"\n role=\"region\"\n :data-toast-position=\"position\"\n :aria-label=\"regionLabel\"\n :style=\"stackStyle\"\n :class=\"stackClasses\"\n :data-toast-expanded=\"dataAttr(overflowOpen)\"\n @pointerenter=\"clock.onPointerEnter\"\n @pointerleave=\"clock.onPointerLeave\"\n @pointerdown=\"onSwipeStart\"\n @focusin=\"clock.onFocusin\"\n @focusout=\"onFocusout\"\n @keydown=\"onKeydown\"\n >\n <Presence v-for=\"t in rendered\" :key=\"t.id\" :is-present=\"t.present\">\n <!-- `Presence` keeps this node mounted until the exit ends; `@vue:unmounted` signals it. -->\n <div\n :class=\"[\n itemClasses,\n t.present ? 'pointer-events-auto motion-safe:data-[state=closed]:opacity-0' : 'pointer-events-none',\n t.group && props.groupMotion === ToastGroupMotion.Card ? 'overflow-visible' : 'overflow-hidden',\n ]\"\n :data-toast-exiting=\"dataAttr(!t.present)\"\n :data-toast-id=\"t.id\"\n :data-toast-swiping=\"dataAttr(t.present && swiping === t.id)\"\n tabindex=\"-1\"\n :inert=\"t.present ? undefined : true\"\n @vue:mounted=\"measureCapacity()\"\n @vue:before-unmount=\"t.present ? undefined : captureGap()\"\n @vue:unmounted=\"t.present ? undefined : removeExiting(t.id)\"\n >\n <!-- The host announcer is the only speaker: the card drops `ToastSimple`'s `status` live region. -->\n <ToastNodeView v-if=\"t.content\" :node=\"t.content\" />\n <Toast\n v-else\n :role=\"undefined\"\n aria-live=\"off\"\n :severity=\"t.severity\"\n :surface=\"surfaceOf(t)\"\n :progress=\"t.progress\"\n :show-severity-icon=\"t.showSeverityIcon ?? props.showSeverityIcon\"\n :is-pinned=\"pins.canPin(t) ? pins.isPinned(t) : undefined\"\n :details-open=\"expandedDetails.has(t.id)\"\n :is-compact=\"overflowOpen\"\n :is-grouped=\"!!t.group && t.group.count > 1\"\n :on-delete=\"t.onDelete\"\n @close=\"toastHost.dismiss(t.id)\"\n @toggle-pin=\"pins.toggle(t.id)\"\n @update:details-open=\"setDetails(t.id, $event)\"\n >\n <template v-if=\"t.icon\" #icon><ToastNodeView :node=\"t.icon\" /></template>\n <template v-if=\"t.copy.title\" #title><ToastNodeView :node=\"t.copy.title\" /></template>\n <template v-if=\"t.copy.description\" #description>\n <span v-if=\"t.group && t.group.count > 1\" data-toast-group-count-highlight :class=\"GroupCountClass\">\n <ToastNodeView :node=\"t.copy.description\" />\n </span>\n <ToastNodeView v-else :node=\"t.copy.description\" />\n </template>\n <template v-if=\"t.action || t.report\" #actions>\n <ToastNodeView v-if=\"t.action\" :node=\"t.action\" />\n <ReportAction v-if=\"t.report\" :send=\"t.report\" />\n </template>\n <template v-if=\"t.details\" #details><ToastNodeView :node=\"t.details\" /></template>\n <template v-if=\"timerFor(t) === ToastTimer.Ring\" #trailing>\n <ToastRing :key=\"countdownKey(t)\" v-bind=\"countdownOf(t)\" :data-toast-timer=\"ToastTimer.Ring\" />\n </template>\n <template v-else-if=\"timerFor(t) === ToastTimer.Seconds\" #trailing>\n <ToastSeconds :key=\"countdownKey(t)\" v-bind=\"countdownOf(t)\" :data-toast-timer=\"ToastTimer.Seconds\" />\n </template>\n <template v-if=\"timerFor(t) === ToastTimer.CloseRing\" #closeIndicator>\n <ToastRing\n :key=\"countdownKey(t)\"\n v-bind=\"countdownOf(t)\"\n :data-toast-timer=\"ToastTimer.CloseRing\"\n is-around-close\n />\n </template>\n </Toast>\n <ToastProgress v-if=\"timerFor(t) === ToastTimer.Bar\" :key=\"countdownKey(t)\" v-bind=\"countdownOf(t)\" />\n <span v-if=\"!t.content\" aria-hidden=\"true\" data-toast-update-highlight :class=\"UpdateHighlightClass\" />\n <Toast\n v-if=\"t.group && t.group.count > 1 && props.groupMotion === ToastGroupMotion.Card\"\n data-toast-group-arrival\n aria-hidden=\"true\"\n aria-live=\"off\"\n role=\"presentation\"\n inert\n :class=\"GroupArrivalClass\"\n :title=\"t.group.latest.title ?? locale.t('ToastHost.groupArrival', undefined, 'New notification')\"\n :description=\"t.group.latest.description\"\n :severity=\"t.group.latest.severity\"\n :surface=\"surfaceOf(t)\"\n :progress=\"t.progress\"\n :show-severity-icon=\"props.showSeverityIcon\"\n />\n </div>\n </Presence>\n <Button\n v-if=\"overflowCount > 0 || overflowOpen\"\n ref=\"overflowButton\"\n variant=\"outline\"\n size=\"sm\"\n data-toast-overflow\n :data-toast-surface=\"props.surface === ToastSurface.Glass ? ToastSurface.Glass : undefined\"\n :aria-expanded=\"overflowOpen\"\n :class=\"[OverflowButtonClass, position.startsWith('top') ? 'bottom-0' : 'top-0']\"\n @click=\"toggleOverflow\"\n >\n <span class=\"min-w-0 [overflow-wrap:anywhere]\">{{ overflowLabel }}</span>\n <template #trailing>\n <Icon\n :icon=\"ChevronDown\"\n :size=\"14\"\n class=\"shrink-0\"\n :class=\"{ 'rotate-180': position.startsWith('bottom') !== overflowOpen }\"\n />\n </template>\n </Button>\n </div>\n <Announce politeness=\"polite\" data-toast-announcer=\"polite\">{{ politeMessage }}</Announce>\n <Announce politeness=\"assertive\" data-toast-announcer=\"assertive\">{{ assertiveMessage }}</Announce>\n </Portal>\n</template>\n"],"names":["_createBlock","_unref","Portal","_createElementBlock","_Fragment","_renderList","_createElementVNode","_normalizeClass","Toast","_createVNode","ReportAction","_openBlock","ToastRing","_mergeProps","ToastSeconds","ToastProgress","Button","Icon","_toDisplayString","Announce"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,aAAa;AAAA;AAAA,EAExB,MAAM;AAAA;AAAA,EAEN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AAzF,YAAW;AAAA,YAAY,wBAAqB;AAAA,UAAA;6BAAY,MAAsB;AAAA,8CAAnBlB,MAAA,gBAAA,CAAgB,GAAA,CAAA;AAAA,YAAA;;;;;;;;;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _sfc_main from "./ToastHost.vue.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ToastGroupMotion, ToastMotion, ToastTimer } from "./ToastHost.vue.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
ToastGroupMotion,
|
|
5
|
+
ToastMotion,
|
|
5
6
|
ToastTimer,
|
|
6
|
-
_sfc_main as default
|
|
7
|
-
toastHost,
|
|
8
|
-
useToastHost
|
|
7
|
+
_sfc_main as default
|
|
9
8
|
};
|
|
10
9
|
//# sourceMappingURL=ToastHost2.vue.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ToastEntry } from './ToastEntry';
|
|
2
|
+
import { ToastOptions } from './ToastOptions';
|
|
3
|
+
import { ToastPromiseOptions } from './ToastPromiseOptions';
|
|
4
|
+
/** @internal Receives the live toast list on every change. */
|
|
5
|
+
type ToastListener = (toasts: ReadonlyArray<ToastEntry>) => void;
|
|
6
|
+
/** Reports whether a toast carries an absolute deadline, which no hover, focus or pin can hold. */
|
|
7
|
+
export declare function hasDeadline<T extends ToastOptions>(t: T): t is T & {
|
|
8
|
+
expiresAtMs: number;
|
|
9
|
+
};
|
|
10
|
+
/** Reports whether a toast shows a running operation, which holds it on screen with no clock. */
|
|
11
|
+
export declare function isRunning(t: ToastOptions): boolean;
|
|
12
|
+
/** Orders the higher priority first; an unclassified toast counts as Normal. Equal priorities return 0. */
|
|
13
|
+
export declare function comparePriority(a: ToastOptions, b: ToastOptions): number;
|
|
14
|
+
/** Orders by priority, then by delivery. */
|
|
15
|
+
export declare function compareOrder(a: ToastEntry, b: ToastEntry): number;
|
|
16
|
+
/** Holds the live toasts every mounted `ToastHost` renders. */
|
|
17
|
+
export declare class ToastHostStore {
|
|
18
|
+
private items;
|
|
19
|
+
private listeners;
|
|
20
|
+
private idSeq;
|
|
21
|
+
/** Shows a toast and returns its id; a `key` already showing updates that toast in place and returns its id. */
|
|
22
|
+
toast(opts: ToastOptions): string;
|
|
23
|
+
/** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */
|
|
24
|
+
update(id: string, patch: Partial<ToastOptions>): void;
|
|
25
|
+
/** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */
|
|
26
|
+
promise<T>(promise: Promise<T>, opts: ToastPromiseOptions<T>): Promise<T>;
|
|
27
|
+
/** Removes a toast and fires its `onDismiss`; an unknown id removes nothing. */
|
|
28
|
+
dismiss(id: string): void;
|
|
29
|
+
/** Removes every toast and fires each `onDismiss`. */
|
|
30
|
+
dismissAll(): void;
|
|
31
|
+
/** Subscribes to the live toast list, receiving the current list at once; returns an unsubscribe. */
|
|
32
|
+
subscribe(fn: ToastListener): () => void;
|
|
33
|
+
private emit;
|
|
34
|
+
}
|
|
35
|
+
/** The app-wide store every `ToastHost` renders; its imperative API is `useToastHost()`. */
|
|
36
|
+
export declare const toastHost: ToastHostStore;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { NoticePriorityRank, NoticePriority } from "../../../feedback/FeedbackBus.js";
|
|
2
|
+
import { Severity } from "../../../foundation/styles/enums/Severity.js";
|
|
3
|
+
function normalizeContent(content) {
|
|
4
|
+
return typeof content === "string" ? { title: content } : content;
|
|
5
|
+
}
|
|
6
|
+
function hasDeadline(t) {
|
|
7
|
+
return t.expiresAtMs !== void 0 && Number.isFinite(t.expiresAtMs);
|
|
8
|
+
}
|
|
9
|
+
function isRunning(t) {
|
|
10
|
+
return typeof t.progress === "object" && t.progress !== null;
|
|
11
|
+
}
|
|
12
|
+
function comparePriority(a, b) {
|
|
13
|
+
return NoticePriorityRank[b.priority ?? NoticePriority.Normal] - NoticePriorityRank[a.priority ?? NoticePriority.Normal];
|
|
14
|
+
}
|
|
15
|
+
function compareOrder(a, b) {
|
|
16
|
+
return comparePriority(a, b) || a.sequence - b.sequence;
|
|
17
|
+
}
|
|
18
|
+
class ToastHostStore {
|
|
19
|
+
items = [];
|
|
20
|
+
listeners = /* @__PURE__ */ new Set();
|
|
21
|
+
idSeq = 0;
|
|
22
|
+
/** Shows a toast and returns its id; a `key` already showing updates that toast in place and returns its id. */
|
|
23
|
+
toast(opts) {
|
|
24
|
+
if (opts.key !== void 0) {
|
|
25
|
+
const existing = this.items.find((t) => t.key === opts.key);
|
|
26
|
+
if (existing) {
|
|
27
|
+
this.update(existing.id, opts);
|
|
28
|
+
return existing.id;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const sequence = ++this.idSeq;
|
|
32
|
+
const id = `t_${sequence}`;
|
|
33
|
+
this.items = [...this.items, { ...opts, id, sequence, nonce: 0, createdAtMs: Date.now() }];
|
|
34
|
+
this.emit();
|
|
35
|
+
return id;
|
|
36
|
+
}
|
|
37
|
+
/** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */
|
|
38
|
+
update(id, patch) {
|
|
39
|
+
this.items = this.items.map((t) => t.id === id ? { ...t, ...patch, nonce: t.nonce + 1 } : t);
|
|
40
|
+
this.emit();
|
|
41
|
+
}
|
|
42
|
+
/** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */
|
|
43
|
+
promise(promise, opts) {
|
|
44
|
+
const id = this.toast({ ...normalizeContent(opts.loading), severity: Severity.Info, duration: Infinity });
|
|
45
|
+
const settle = (content, severity) => this.update(id, { ...normalizeContent(content), severity, duration: opts.duration });
|
|
46
|
+
return promise.then(
|
|
47
|
+
(value) => {
|
|
48
|
+
settle(typeof opts.success === "function" ? opts.success(value) : opts.success, Severity.Success);
|
|
49
|
+
return value;
|
|
50
|
+
},
|
|
51
|
+
(err) => {
|
|
52
|
+
settle(typeof opts.error === "function" ? opts.error(err) : opts.error, Severity.Danger);
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
/** Removes a toast and fires its `onDismiss`; an unknown id removes nothing. */
|
|
58
|
+
dismiss(id) {
|
|
59
|
+
const entry = this.items.find((t) => t.id === id);
|
|
60
|
+
this.items = this.items.filter((t) => t.id !== id);
|
|
61
|
+
try {
|
|
62
|
+
entry?.onDismiss?.();
|
|
63
|
+
} finally {
|
|
64
|
+
this.emit();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Removes every toast and fires each `onDismiss`. */
|
|
68
|
+
dismissAll() {
|
|
69
|
+
const gone = this.items;
|
|
70
|
+
this.items = [];
|
|
71
|
+
try {
|
|
72
|
+
for (const t of gone) t.onDismiss?.();
|
|
73
|
+
} finally {
|
|
74
|
+
this.emit();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Subscribes to the live toast list, receiving the current list at once; returns an unsubscribe. */
|
|
78
|
+
subscribe(fn) {
|
|
79
|
+
this.listeners.add(fn);
|
|
80
|
+
fn(this.items);
|
|
81
|
+
return () => {
|
|
82
|
+
this.listeners.delete(fn);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
emit() {
|
|
86
|
+
for (const fn of this.listeners) fn(this.items);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const toastHost = new ToastHostStore();
|
|
90
|
+
export {
|
|
91
|
+
ToastHostStore,
|
|
92
|
+
compareOrder,
|
|
93
|
+
comparePriority,
|
|
94
|
+
hasDeadline,
|
|
95
|
+
isRunning,
|
|
96
|
+
toastHost
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=ToastHostStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastHostStore.js","sources":["../../../../src/presentation/feedback/toastHost/ToastHostStore.ts"],"sourcesContent":["import { NoticePriority, NoticePriorityRank } from '../../../feedback';\nimport { Severity } from '../../../foundation/styles';\nimport type { ToastContent } from './ToastContent';\nimport type { ToastEntry } from './ToastEntry';\nimport type { ToastOptions } from './ToastOptions';\nimport type { ToastPromiseOptions } from './ToastPromiseOptions';\nimport type { ToastSeverity } from './ToastSeverity';\n\n/** @internal Receives the live toast list on every change. */\ntype ToastListener = (toasts: ReadonlyArray<ToastEntry>) => void;\n\n/** @internal Reads a phase's content as a partial options object — a string is a title. */\nfunction normalizeContent(content: ToastContent): Partial<ToastOptions> {\n return typeof content === 'string' ? { title: content } : content;\n}\n\n/** Reports whether a toast carries an absolute deadline, which no hover, focus or pin can hold. */\nexport function hasDeadline<T extends ToastOptions>(t: T): t is T & { expiresAtMs: number } {\n return t.expiresAtMs !== undefined && Number.isFinite(t.expiresAtMs);\n}\n\n/** Reports whether a toast shows a running operation, which holds it on screen with no clock. */\nexport function isRunning(t: ToastOptions): boolean {\n return typeof t.progress === 'object' && t.progress !== null;\n}\n\n/** Orders the higher priority first; an unclassified toast counts as Normal. Equal priorities return 0. */\nexport function comparePriority(a: ToastOptions, b: ToastOptions): number {\n return (\n NoticePriorityRank[b.priority ?? NoticePriority.Normal] - NoticePriorityRank[a.priority ?? NoticePriority.Normal]\n );\n}\n\n/** Orders by priority, then by delivery. */\nexport function compareOrder(a: ToastEntry, b: ToastEntry): number {\n return comparePriority(a, b) || a.sequence - b.sequence;\n}\n\n/** Holds the live toasts every mounted `ToastHost` renders. */\nexport class ToastHostStore {\n private items: ReadonlyArray<ToastEntry> = [];\n private listeners = new Set<ToastListener>();\n private idSeq = 0;\n\n /** Shows a toast and returns its id; a `key` already showing updates that toast in place and returns its id. */\n toast(opts: ToastOptions): string {\n if (opts.key !== undefined) {\n const existing = this.items.find((t) => t.key === opts.key);\n if (existing) {\n this.update(existing.id, opts);\n return existing.id;\n }\n }\n const sequence = ++this.idSeq;\n const id = `t_${sequence}`;\n this.items = [...this.items, { ...opts, id, sequence, nonce: 0, createdAtMs: Date.now() }];\n this.emit();\n return id;\n }\n\n /** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */\n update(id: string, patch: Partial<ToastOptions>): void {\n this.items = this.items.map((t) => (t.id === id ? { ...t, ...patch, nonce: t.nonce + 1 } : t));\n this.emit();\n }\n\n /** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */\n promise<T>(promise: Promise<T>, opts: ToastPromiseOptions<T>): Promise<T> {\n const id = this.toast({ ...normalizeContent(opts.loading), severity: Severity.Info, duration: Infinity });\n const settle = (content: ToastContent, severity: ToastSeverity) =>\n this.update(id, { ...normalizeContent(content), severity, duration: opts.duration });\n return promise.then(\n (value) => {\n settle(typeof opts.success === 'function' ? opts.success(value) : opts.success, Severity.Success);\n return value;\n },\n (err: unknown) => {\n settle(typeof opts.error === 'function' ? opts.error(err) : opts.error, Severity.Danger);\n throw err;\n },\n );\n }\n\n /** Removes a toast and fires its `onDismiss`; an unknown id removes nothing. */\n dismiss(id: string): void {\n const entry = this.items.find((t) => t.id === id);\n this.items = this.items.filter((t) => t.id !== id);\n try {\n entry?.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n /** Removes every toast and fires each `onDismiss`. */\n dismissAll(): void {\n const gone = this.items;\n this.items = [];\n try {\n for (const t of gone) t.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n /** Subscribes to the live toast list, receiving the current list at once; returns an unsubscribe. */\n subscribe(fn: ToastListener): () => void {\n this.listeners.add(fn);\n fn(this.items);\n return () => {\n this.listeners.delete(fn);\n };\n }\n\n private emit() {\n for (const fn of this.listeners) fn(this.items);\n }\n}\n\n/** The app-wide store every `ToastHost` renders; its imperative API is `useToastHost()`. */\nexport const toastHost = new ToastHostStore();\n"],"names":[],"mappings":";;AAYA,SAAS,iBAAiB,SAA8C;AACtE,SAAO,OAAO,YAAY,WAAW,EAAE,OAAO,YAAY;AAC5D;AAGO,SAAS,YAAoC,GAAwC;AAC1F,SAAO,EAAE,gBAAgB,UAAa,OAAO,SAAS,EAAE,WAAW;AACrE;AAGO,SAAS,UAAU,GAA0B;AAClD,SAAO,OAAO,EAAE,aAAa,YAAY,EAAE,aAAa;AAC1D;AAGO,SAAS,g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AACT,eAAO,OAAO,KAAK,YAAY,aAAa,KAAK,QAAQ,KAAK,IAAI,KAAK,SAAS,SAAS,OAAO;AAChG,eAAO;AAAA,MACT;AAAA,MACA,CAAC,QAAiB;AAChB,eAAO,OAAO,KAAK,UAAU,aAAa,KAAK,MAAM,GAAG,IAAI,KAAK,OAAO,SAAS,MAAM;AACvF,cAAM;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA,EAGA,QAAQ,IAAkB;AACxB,UAAM,QAAQ,KAAK,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AAChD,SAAK,QAAQ,KAAK,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE;AACjD,QAAI;AACF,aAAO,YAAA;AAAA,IACT,UAAA;AACE,WAAK,KAAA;AAAA,IACP;AAAA,EACF;AAAA;AAAA,EAGA,aAAmB;AACjB,UAAM,OAAO,KAAK;AAClB,SAAK,QAAQ,CAAA;AACb,QAAI;AACF,iBAAW,KAAK,KAAM,GAAE,YAAA;AAAA,IAC1B,UAAA;AACE,WAAK,KAAA;AAAA,IACP;AAAA,EACF;AAAA;AAAA,EAGA,UAAU,IAA+B;AACvC,SAAK,UAAU,IAAI,EAAE;AACrB,OAAG,KAAK,KAAK;AACb,WAAO,MAAM;AACX,WAAK,UAAU,OAAO,EAAE;AAAA,IAC1B;AAAA,EACF;AAAA,EAEQ,OAAO;AACb,eAAW,MAAM,KAAK,UAAW,IAAG,KAAK,KAAK;AAAA,EAChD;AACF;AAGO,MAAM,YAAY,IAAI,eAAA;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OverlayPosition, Side } from '../../../foundation/styles';
|
|
2
|
+
/** The stack container: fixed, bounded by the safe-area insets. */
|
|
3
|
+
export declare const StackClass = "pointer-events-none fixed z-toast flex max-h-(--toast-available-height) max-w-(--toast-available-width)";
|
|
4
|
+
/** The stack's anchor and growth direction per position. */
|
|
5
|
+
export declare const PositionClasses: Record<OverlayPosition, string>;
|
|
6
|
+
/** The safe-area insets and the room they leave, which shell styles adjust through the `--toast-*` offsets. */
|
|
7
|
+
export declare const StackInsets: {
|
|
8
|
+
readonly '--toast-top-inset': "calc(var(--toast-top-offset, 1rem) + env(safe-area-inset-top, 0px))";
|
|
9
|
+
readonly '--toast-bottom-inset': "calc(var(--toast-bottom-offset, 1rem) + env(safe-area-inset-bottom, 0px))";
|
|
10
|
+
readonly '--toast-left-inset': "max(var(--toast-gutter, 1rem), env(safe-area-inset-left, 0px))";
|
|
11
|
+
readonly '--toast-right-inset': "max(var(--toast-gutter, 1rem), env(safe-area-inset-right, 0px))";
|
|
12
|
+
readonly '--toast-available-width': "calc(100dvw - var(--toast-left-inset) - var(--toast-right-inset))";
|
|
13
|
+
readonly '--toast-available-height': "max(0px, calc(100dvh - var(--toast-top-inset) - var(--toast-bottom-inset)))";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A card's slot: `--toast-width` wide (20rem unset), within the available width, and spanning it below the
|
|
17
|
+
* tablet breakpoint. Vertical pans stay with the page, so a horizontal drag is the card's own.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ItemClass = "relative w-(--toast-width,20rem) max-w-full shrink-0 touch-pan-y rounded-md max-md:w-(--toast-available-width)";
|
|
20
|
+
/** The `SideSlide` entry and exit per edge, read from the overridable `--animate-slide-*` tokens. */
|
|
21
|
+
export declare const SideSlideClasses: Record<Side, string>;
|
|
22
|
+
/** The vertical presets' entry and exit, driven by the `--toast-motion-*` properties the host sets. */
|
|
23
|
+
export declare const VerticalSlideClass: string;
|
|
24
|
+
/**
|
|
25
|
+
* The full-width overflow control, pinned to the stack's far edge while the list scrolls. On a glass host it takes
|
|
26
|
+
* the menu glass and its hairline; the attribute variant out-ranks the solid fill wherever the classes are ordered.
|
|
27
|
+
*/
|
|
28
|
+
export declare const OverflowButtonClass: string;
|
|
29
|
+
/** A group's count, which keeps its glow readable in forced colours. */
|
|
30
|
+
export declare const GroupCountClass: string;
|
|
31
|
+
/** The surface a changed card lights while its update highlight plays. */
|
|
32
|
+
export declare const UpdateHighlightClass: string;
|
|
33
|
+
/** The merge preview, hidden until its flight shows it. */
|
|
34
|
+
export declare const GroupArrivalClass = "pointer-events-none invisible absolute inset-x-0 top-0 z-20 rounded-[inherit]";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Side } from "../../../foundation/styles/enums/Side.js";
|
|
2
|
+
import { OverlayPosition } from "../../../foundation/styles/enums/OverlayPosition.js";
|
|
3
|
+
const StackClass = "pointer-events-none fixed z-toast flex max-h-(--toast-available-height) max-w-(--toast-available-width)";
|
|
4
|
+
const PositionClasses = {
|
|
5
|
+
[OverlayPosition.TopRight]: "top-(--toast-top-inset) right-(--toast-right-inset) flex-col items-end",
|
|
6
|
+
[OverlayPosition.TopLeft]: "top-(--toast-top-inset) left-(--toast-left-inset) flex-col items-start",
|
|
7
|
+
[OverlayPosition.TopCenter]: "top-(--toast-top-inset) left-1/2 -translate-x-1/2 flex-col items-center",
|
|
8
|
+
[OverlayPosition.BottomRight]: "bottom-(--toast-bottom-inset) right-(--toast-right-inset) flex-col-reverse items-end",
|
|
9
|
+
[OverlayPosition.BottomLeft]: "bottom-(--toast-bottom-inset) left-(--toast-left-inset) flex-col-reverse items-start",
|
|
10
|
+
[OverlayPosition.BottomCenter]: "bottom-(--toast-bottom-inset) left-1/2 -translate-x-1/2 flex-col-reverse items-center"
|
|
11
|
+
};
|
|
12
|
+
const StackInsets = {
|
|
13
|
+
"--toast-top-inset": "calc(var(--toast-top-offset, 1rem) + env(safe-area-inset-top, 0px))",
|
|
14
|
+
"--toast-bottom-inset": "calc(var(--toast-bottom-offset, 1rem) + env(safe-area-inset-bottom, 0px))",
|
|
15
|
+
"--toast-left-inset": "max(var(--toast-gutter, 1rem), env(safe-area-inset-left, 0px))",
|
|
16
|
+
"--toast-right-inset": "max(var(--toast-gutter, 1rem), env(safe-area-inset-right, 0px))",
|
|
17
|
+
"--toast-available-width": "calc(100dvw - var(--toast-left-inset) - var(--toast-right-inset))",
|
|
18
|
+
"--toast-available-height": "max(0px, calc(100dvh - var(--toast-top-inset) - var(--toast-bottom-inset)))"
|
|
19
|
+
};
|
|
20
|
+
const ItemClass = "relative w-(--toast-width,20rem) max-w-full shrink-0 touch-pan-y rounded-md max-md:w-(--toast-available-width)";
|
|
21
|
+
const SideSlideClasses = {
|
|
22
|
+
[Side.Right]: "motion-safe:data-[state=open]:animate-(--animate-slide-in-right) motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-right)",
|
|
23
|
+
[Side.Left]: "motion-safe:data-[state=open]:animate-(--animate-slide-in-left) motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-left)",
|
|
24
|
+
[Side.Top]: "motion-safe:data-[state=open]:animate-(--animate-slide-in-top) motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-top)",
|
|
25
|
+
[Side.Bottom]: "motion-safe:data-[state=open]:animate-(--animate-slide-in-bottom) motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-bottom)"
|
|
26
|
+
};
|
|
27
|
+
const VerticalSlideClass = "motion-safe:transition-[opacity,transform] motion-safe:[transform-origin:var(--toast-motion-origin)] motion-safe:[transition-duration:calc(var(--toast-motion-enter)*var(--toast-motion-speed,1))] motion-safe:ease-(--toast-motion-ease) motion-safe:data-[state=closed]:opacity-0 motion-safe:data-[state=closed]:[transform:var(--toast-motion-transform)] motion-safe:data-[state=closed]:[transition-duration:calc(var(--toast-motion-exit)*var(--toast-motion-speed,1))] motion-safe:data-[state=closed]:ease-in";
|
|
28
|
+
const OverflowButtonClass = "pointer-events-auto sticky z-10 h-auto min-h-9 w-0 min-w-full shrink-0 justify-between border-border bg-popover py-1.5 text-start text-popover-foreground pointer-coarse:min-h-11 data-[toast-surface=glass]:surface-glass-menu data-[toast-surface=glass]:border-glass-edge";
|
|
29
|
+
const GroupCountClass = "forced-colors:forced-color-adjust-none forced-colors:text-[CanvasText] forced-colors:[--toast-count-rest:CanvasText] forced-colors:[--toast-count-peak:LinkText] forced-colors:[--toast-count-glow:none]";
|
|
30
|
+
const UpdateHighlightClass = "pointer-events-none absolute inset-0 rounded-[inherit] border-2 border-primary/65 bg-primary/10 opacity-0 forced-colors:border-[Highlight]";
|
|
31
|
+
const GroupArrivalClass = "pointer-events-none invisible absolute inset-x-0 top-0 z-20 rounded-[inherit]";
|
|
32
|
+
export {
|
|
33
|
+
GroupArrivalClass,
|
|
34
|
+
GroupCountClass,
|
|
35
|
+
ItemClass,
|
|
36
|
+
OverflowButtonClass,
|
|
37
|
+
PositionClasses,
|
|
38
|
+
SideSlideClasses,
|
|
39
|
+
StackClass,
|
|
40
|
+
StackInsets,
|
|
41
|
+
UpdateHighlightClass,
|
|
42
|
+
VerticalSlideClass
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=ToastHostStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastHostStyles.js","sources":["../../../../src/presentation/feedback/toastHost/ToastHostStyles.ts"],"sourcesContent":["/* Provides the toast stack's class tables. The component-only stylesheet scans this module. */\n\nimport { OverlayPosition, Side } from '../../../foundation/styles';\n\n/** The stack container: fixed, bounded by the safe-area insets. */\nexport const StackClass =\n 'pointer-events-none fixed z-toast flex max-h-(--toast-available-height) max-w-(--toast-available-width)';\n\n/** The stack's anchor and growth direction per position. */\nexport const PositionClasses: Record<OverlayPosition, string> = {\n [OverlayPosition.TopRight]: 'top-(--toast-top-inset) right-(--toast-right-inset) flex-col items-end',\n [OverlayPosition.TopLeft]: 'top-(--toast-top-inset) left-(--toast-left-inset) flex-col items-start',\n [OverlayPosition.TopCenter]: 'top-(--toast-top-inset) left-1/2 -translate-x-1/2 flex-col items-center',\n [OverlayPosition.BottomRight]: 'bottom-(--toast-bottom-inset) right-(--toast-right-inset) flex-col-reverse items-end',\n [OverlayPosition.BottomLeft]: 'bottom-(--toast-bottom-inset) left-(--toast-left-inset) flex-col-reverse items-start',\n [OverlayPosition.BottomCenter]:\n 'bottom-(--toast-bottom-inset) left-1/2 -translate-x-1/2 flex-col-reverse items-center',\n};\n\n/** The safe-area insets and the room they leave, which shell styles adjust through the `--toast-*` offsets. */\nexport const StackInsets = {\n '--toast-top-inset': 'calc(var(--toast-top-offset, 1rem) + env(safe-area-inset-top, 0px))',\n '--toast-bottom-inset': 'calc(var(--toast-bottom-offset, 1rem) + env(safe-area-inset-bottom, 0px))',\n '--toast-left-inset': 'max(var(--toast-gutter, 1rem), env(safe-area-inset-left, 0px))',\n '--toast-right-inset': 'max(var(--toast-gutter, 1rem), env(safe-area-inset-right, 0px))',\n '--toast-available-width': 'calc(100dvw - var(--toast-left-inset) - var(--toast-right-inset))',\n '--toast-available-height': 'max(0px, calc(100dvh - var(--toast-top-inset) - var(--toast-bottom-inset)))',\n} as const;\n\n/**\n * A card's slot: `--toast-width` wide (20rem unset), within the available width, and spanning it below the\n * tablet breakpoint. Vertical pans stay with the page, so a horizontal drag is the card's own.\n */\nexport const ItemClass =\n 'relative w-(--toast-width,20rem) max-w-full shrink-0 touch-pan-y rounded-md max-md:w-(--toast-available-width)';\n\n/** The `SideSlide` entry and exit per edge, read from the overridable `--animate-slide-*` tokens. */\nexport const SideSlideClasses: Record<Side, string> = {\n [Side.Right]:\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-right) ' +\n 'motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-right)',\n [Side.Left]:\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-left) ' +\n 'motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-left)',\n [Side.Top]:\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-top) ' +\n 'motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-top)',\n [Side.Bottom]:\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-bottom) ' +\n 'motion-safe:data-[toast-exiting]:animate-(--animate-slide-out-bottom)',\n};\n\n/** The vertical presets' entry and exit, driven by the `--toast-motion-*` properties the host sets. */\nexport const VerticalSlideClass =\n 'motion-safe:transition-[opacity,transform] motion-safe:[transform-origin:var(--toast-motion-origin)] ' +\n 'motion-safe:[transition-duration:calc(var(--toast-motion-enter)*var(--toast-motion-speed,1))] ' +\n 'motion-safe:ease-(--toast-motion-ease) ' +\n 'motion-safe:data-[state=closed]:opacity-0 ' +\n 'motion-safe:data-[state=closed]:[transform:var(--toast-motion-transform)] ' +\n 'motion-safe:data-[state=closed]:[transition-duration:calc(var(--toast-motion-exit)*var(--toast-motion-speed,1))] ' +\n 'motion-safe:data-[state=closed]:ease-in';\n\n/**\n * The full-width overflow control, pinned to the stack's far edge while the list scrolls. On a glass host it takes\n * the menu glass and its hairline; the attribute variant out-ranks the solid fill wherever the classes are ordered.\n */\nexport const OverflowButtonClass =\n 'pointer-events-auto sticky z-10 h-auto min-h-9 w-0 min-w-full shrink-0 justify-between border-border ' +\n 'bg-popover py-1.5 text-start text-popover-foreground pointer-coarse:min-h-11 ' +\n 'data-[toast-surface=glass]:surface-glass-menu data-[toast-surface=glass]:border-glass-edge';\n\n/** A group's count, which keeps its glow readable in forced colours. */\nexport const GroupCountClass =\n 'forced-colors:forced-color-adjust-none forced-colors:text-[CanvasText] ' +\n 'forced-colors:[--toast-count-rest:CanvasText] forced-colors:[--toast-count-peak:LinkText] ' +\n 'forced-colors:[--toast-count-glow:none]';\n\n/** The surface a changed card lights while its update highlight plays. */\nexport const UpdateHighlightClass =\n 'pointer-events-none absolute inset-0 rounded-[inherit] border-2 border-primary/65 bg-primary/10 opacity-0 ' +\n 'forced-colors:border-[Highlight]';\n\n/** The merge preview, hidden until its flight shows it. */\nexport const GroupArrivalClass = 'pointer-events-none invisible absolute inset-x-0 top-0 z-20 rounded-[inherit]';\n"],"names":[],"mappings":";;AAKO,MAAM,aACX;AAGK,MAAM,kBAAmD;AAAA,EAC9D,CAAC,gBAAgB,QAAQ,GAAG;AAAA,EAC5B,CAAC,gBAAgB,OAAO,GAAG;AAAA,EAC3B,CAAC,gBAAgB,SAAS,GAAG;AAAA,EAC7B,CAAC,gBAAgB,WAAW,GAAG;AAAA,EAC/B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,YAAY,GAC3B;AACJ;AAGO,MAAM,cAAc;AAAA,EACzB,qBAAqB;AAAA,EACrB,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,2BAA2B;AAAA,EAC3B,4BAA4B;AAC9B;AAMO,MAAM,YACX;AAGK,MAAM,mBAAyC;AAAA,EACpD,CAAC,KAAK,KAAK,GACT;AAAA,EAEF,CAAC,KAAK,IAAI,GACR;AAAA,EAEF,CAAC,KAAK,GAAG,GACP;AAAA,EAEF,CAAC,KAAK,MAAM,GACV;AAEJ;AAGO,MAAM,qBACX;AAYK,MAAM,sBACX;AAKK,MAAM,kBACX;AAKK,MAAM,uBACX;AAIK,MAAM,oBAAoB;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { NoticeCompactCopy, NoticePriority, NoticeProgress } from '../../../feedback';
|
|
2
|
+
import { ReportSend } from '../../../reporting';
|
|
3
|
+
import { ToastSurface } from '../toast/ToastSurface';
|
|
4
|
+
import { ToastGroup } from './ToastGroup';
|
|
5
|
+
import { ToastTimer } from './ToastHost.vue';
|
|
6
|
+
import { ToastNode } from './ToastNode';
|
|
7
|
+
import { ToastSeverity } from './ToastSeverity';
|
|
8
|
+
/** Defines the content and behaviour of one toast. */
|
|
9
|
+
export interface ToastOptions {
|
|
10
|
+
/** The heading line. */
|
|
11
|
+
title?: ToastNode;
|
|
12
|
+
/** The body text below the title. */
|
|
13
|
+
description?: ToastNode;
|
|
14
|
+
/** The short copy shown in the expanded overflow list. */
|
|
15
|
+
compact?: NoticeCompactCopy;
|
|
16
|
+
/** The leading icon. */
|
|
17
|
+
icon?: ToastNode;
|
|
18
|
+
/** The severity palette. */
|
|
19
|
+
severity?: ToastSeverity;
|
|
20
|
+
/** Orders the toast and selects its default lifetime. */
|
|
21
|
+
priority?: NoticePriority;
|
|
22
|
+
/**
|
|
23
|
+
* ms before auto-dismiss. Defaults to the host's priority duration, severity duration, or
|
|
24
|
+
* `defaultDuration`. `Infinity` = sticky.
|
|
25
|
+
*/
|
|
26
|
+
duration?: number;
|
|
27
|
+
/** An absolute, unpausable deadline in epoch milliseconds. Overrides the display duration. */
|
|
28
|
+
expiresAtMs?: number;
|
|
29
|
+
/** Overrides the host's pin default for this toast. Sticky and custom-content toasts have no SDK pin. */
|
|
30
|
+
canPin?: boolean;
|
|
31
|
+
/** The action shown under the copy. */
|
|
32
|
+
action?: ToastNode;
|
|
33
|
+
/** Optional content shown under the toast's summary and actions. */
|
|
34
|
+
details?: ToastNode;
|
|
35
|
+
/** @internal The presentation state the feedback adapter supplies for a group of live notices. */
|
|
36
|
+
group?: ToastGroup;
|
|
37
|
+
/** Keeps this toast visible while its async action is pending. The getter may read reactive state. */
|
|
38
|
+
pauseExpiry?: () => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Sends a one-click report of the failure this toast shows; the toast renders a Report action that walks
|
|
41
|
+
* sending → reported (with the reference) → retry on failure. Pairs with `/reporting`'s `capture(error).send`.
|
|
42
|
+
*/
|
|
43
|
+
report?: ReportSend;
|
|
44
|
+
/** Shows the severity's own glyph when no `icon` is given. Default: the ToastHost's `showSeverityIcon`. */
|
|
45
|
+
showSeverityIcon?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Fully custom body — replaces the default `Toast` chrome (icon/title/description/close).
|
|
48
|
+
* Still animates + auto-dismisses; the content owns its close via the returned id.
|
|
49
|
+
*/
|
|
50
|
+
content?: ToastNode;
|
|
51
|
+
/**
|
|
52
|
+
* Fires when the toast is removed — auto-dismiss, close button, `dismiss(id)`, or `dismissAll()`.
|
|
53
|
+
* Not fired on a dedup-update.
|
|
54
|
+
*/
|
|
55
|
+
onDismiss?: () => void;
|
|
56
|
+
/** Fires when the reader deletes an explicitly retained notification; omitted for transient toasts. */
|
|
57
|
+
onDelete?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Dedup key — a `toast` whose `key` is already showing updates that toast in place,
|
|
60
|
+
* refreshing its timer instead of stacking a duplicate.
|
|
61
|
+
*/
|
|
62
|
+
key?: string;
|
|
63
|
+
/** How this toast shows its time left. Default: the ToastHost's `timer`. */
|
|
64
|
+
timer?: ToastTimer;
|
|
65
|
+
/**
|
|
66
|
+
* A running operation's progress. While set, the toast stays up with no countdown or Pin. An update with
|
|
67
|
+
* `progress: undefined` completes it, and the toast starts its full countdown.
|
|
68
|
+
*/
|
|
69
|
+
progress?: NoticeProgress;
|
|
70
|
+
/** The card material for this toast. Default: the ToastHost's `surface`. */
|
|
71
|
+
surface?: ToastSurface;
|
|
72
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Severity } from '../../../foundation/styles';
|
|
2
|
+
import { ToastCountdownProps } from './UseToastCountdown';
|
|
3
|
+
/** Defines props for the countdown bar. */
|
|
4
|
+
export interface ToastProgressProps extends ToastCountdownProps {
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import('vue').DefineComponent<ToastProgressProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ToastProgressProps> & Readonly<{}>, {
|
|
7
|
+
readonly severity: Severity;
|
|
8
|
+
readonly isPaused: boolean;
|
|
9
|
+
readonly elapsed: number;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineComponent, useTemplateRef, openBlock, createElementBlock, createElementVNode, normalizeClass, unref } from "vue";
|
|
2
|
+
import { cn } from "../../../foundation/styles/Cn.js";
|
|
3
|
+
import { Severity } from "../../../foundation/styles/enums/Severity.js";
|
|
4
|
+
import { useToastCountdown } from "./UseToastCountdown.js";
|
|
5
|
+
const _hoisted_1 = {
|
|
6
|
+
"aria-hidden": "true",
|
|
7
|
+
"data-toast-progress": "",
|
|
8
|
+
class: "absolute inset-x-0 bottom-0 h-1 motion-reduce:hidden"
|
|
9
|
+
};
|
|
10
|
+
const ProgressClasses = {
|
|
11
|
+
[Severity.Neutral]: "bg-primary",
|
|
12
|
+
[Severity.Info]: "bg-info",
|
|
13
|
+
[Severity.Success]: "bg-success",
|
|
14
|
+
[Severity.Warning]: "bg-warning",
|
|
15
|
+
[Severity.Danger]: "bg-destructive"
|
|
16
|
+
};
|
|
17
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
+
...{ name: "ToastProgress" },
|
|
19
|
+
__name: "ToastProgress",
|
|
20
|
+
props: {
|
|
21
|
+
duration: {},
|
|
22
|
+
elapsed: { default: 0 },
|
|
23
|
+
isPaused: { type: Boolean, default: false },
|
|
24
|
+
severity: { default: Severity.Neutral }
|
|
25
|
+
},
|
|
26
|
+
setup(__props) {
|
|
27
|
+
const props = __props;
|
|
28
|
+
const fill = useTemplateRef("fill");
|
|
29
|
+
useToastCountdown(() => fill.value, [{ transform: "scaleX(1)" }, { transform: "scaleX(0)" }], props);
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
32
|
+
createElementVNode("div", {
|
|
33
|
+
ref_key: "fill",
|
|
34
|
+
ref: fill,
|
|
35
|
+
class: normalizeClass(unref(cn)("h-full w-full origin-left opacity-80", ProgressClasses[props.severity]))
|
|
36
|
+
}, null, 2)
|
|
37
|
+
]);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
_sfc_main as default
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=ToastProgress.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProgress.vue.js","sources":["../../../../src/presentation/feedback/toastHost/ToastProgress.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cn, Severity } from '../../../foundation/styles';\nimport { useToastCountdown, type ToastCountdownProps } from './UseToastCountdown';\n\n/** Defines props for the countdown bar. */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface ToastProgressProps extends ToastCountdownProps {}\n\n/** @internal The countdown fill per severity; the neutral countdown uses the brand primary. */\nconst ProgressClasses: Record<Severity, string> = {\n [Severity.Neutral]: 'bg-primary',\n [Severity.Info]: 'bg-info',\n [Severity.Success]: 'bg-success',\n [Severity.Warning]: 'bg-warning',\n [Severity.Danger]: 'bg-destructive',\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { useTemplateRef } from 'vue';\n\n/** Renders the countdown bar — a scale transform draining along the toast's bottom edge. */\ndefineOptions({ name: 'ToastProgress' });\n\nconst props = withDefaults(defineProps<ToastProgressProps>(), {\n elapsed: 0,\n isPaused: false,\n severity: Severity.Neutral,\n});\n\nconst fill = useTemplateRef<HTMLDivElement>('fill');\nuseToastCountdown(() => fill.value, [{ transform: 'scaleX(1)' }, { transform: 'scaleX(0)' }], props);\n</script>\n\n<template>\n <div aria-hidden=\"true\" data-toast-progress class=\"absolute inset-x-0 bottom-0 h-1 motion-reduce:hidden\">\n <div ref=\"fill\" :class=\"cn('h-full w-full origin-left opacity-80', ProgressClasses[props.severity])\" />\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_unref"],"mappings":";;;;;;;;;AASA,MAAM,kBAA4C;AAAA,EAChD,CAAC,SAAS,OAAO,GAAG;AAAA,EACpB,CAAC,SAAS,IAAI,GAAG;AAAA,EACjB,CAAC,SAAS,OAAO,GAAG;AAAA,EACpB,CAAC,SAAS,OAAO,GAAG;AAAA,EACpB,CAAC,SAAS,MAAM,GAAG;AACrB;;;;;;;;;;;AASA,UAAM,QAAQ;AAMd,UAAM,OAAO,eAA+B,MAAM;AAClD,sBAAkB,MAAM,KAAK,OAAO,CAAC,EAAE,WAAW,YAAA,GAAe,EAAE,WAAW,YAAA,CAAa,GAAG,KAAK;;AAIjG,aAAAA,UAAA,GAAAC,mBAEM,OAFN,YAEM;AAAA,QADJC,mBAAuG,OAAA;AAAA,mBAA9F;AAAA,UAAJ,KAAI;AAAA,UAAQ,sBAAOC,MAAA,EAAA,EAAE,wCAAyC,gBAAgB,MAAM,QAAQ,CAAA,CAAA;AAAA,QAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProgress2.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToastContent } from './ToastContent';
|
|
2
|
+
/** Defines the loading, success and error content of a `toastHost.promise` toast. */
|
|
3
|
+
export interface ToastPromiseOptions<T> {
|
|
4
|
+
/** The content of the sticky toast shown while the promise is pending. */
|
|
5
|
+
loading: ToastContent;
|
|
6
|
+
/** The content once the promise resolves; a function receives the resolved value. */
|
|
7
|
+
success: ToastContent | ((value: T) => ToastContent);
|
|
8
|
+
/** The content once the promise rejects; a function receives the rejection. */
|
|
9
|
+
error: ToastContent | ((err: unknown) => ToastContent);
|
|
10
|
+
/** Auto-dismiss (ms) for the settled toast; defaults to the ToastHost's `defaultDuration`. */
|
|
11
|
+
duration?: number;
|
|
12
|
+
}
|