@mantine-vue/notifications 3.0.0 → 3.2.0
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/cjs/index.cjs +318 -365
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +319 -366
- package/esm/index.mjs.map +1 -1
- package/lib/components/NotificationContainer/NotificationContainer.types.d.ts +25 -0
- package/lib/components/NotificationContainer/NotificationContainer.vue.d.ts +12 -0
- package/lib/components/NotificationContainer/index.d.ts +3 -0
- package/lib/components/Notifications/Notifications.d.ts +23 -0
- package/lib/components/Notifications/Notifications.types.d.ts +43 -0
- package/lib/components/Notifications/Notifications.vue.d.ts +6 -0
- package/lib/components/Notifications/index.d.ts +1 -0
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/notifications.store.d.ts +9 -0
- package/package.json +4 -4
- package/lib/NotificationContainer.d.ts +0 -82
- package/lib/Notifications.d.ts +0 -314
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/notifications.store.ts","../src/get-grouped-notifications/get-grouped-notifications.ts","../src/get-notification-state-styles.ts","../src/get-auto-close/get-auto-close.ts","../src/NotificationContainer.ts","../src/Notifications.module.css","../src/Notifications.ts"],"sourcesContent":["import { type Ref } from 'vue'\nimport { createStore, type MantineStore } from '@mantine-vue/store'\n\nexport type NotificationPosition =\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center'\n\nexport interface NotificationData extends Record<`data-${string}`, any> {\n id?: string\n position?: NotificationPosition\n message: any\n autoClose?: boolean | number\n allowClose?: boolean\n onClose?: (props: NotificationData) => void\n onOpen?: (props: NotificationData) => void\n style?: any\n withCloseButton?: boolean\n [key: string]: any\n}\n\nexport interface NotificationsState {\n notifications: NotificationData[]\n queue: NotificationData[]\n defaultPosition: NotificationPosition\n limit: number\n}\n\nexport type NotificationsStore = MantineStore<NotificationsState>\n\nfunction randomId() {\n return `mantine-${Math.random().toString(36).slice(2, 11)}`\n}\n\nfunction getDistributedNotifications(\n data: NotificationData[],\n defaultPosition: NotificationPosition,\n limit: number,\n) {\n const queue: NotificationData[] = []\n const notifications: NotificationData[] = []\n const count: Record<string, number> = {}\n\n for (const item of data) {\n const position = item.position || defaultPosition\n count[position] = count[position] || 0\n count[position] += 1\n\n if (count[position] <= limit) {\n notifications.push(item)\n } else {\n queue.push(item)\n }\n }\n\n return { notifications, queue }\n}\n\nexport const createNotificationsStore = () =>\n createStore<NotificationsState>({\n notifications: [],\n queue: [],\n defaultPosition: 'bottom-right',\n limit: 5,\n })\n\nexport const notificationsStore = createNotificationsStore()\nexport const useNotifications = (\n store: NotificationsStore = notificationsStore,\n): Readonly<Ref<NotificationsState>> => store.value\n\nexport function updateNotificationsState(\n store: NotificationsStore,\n update: (notifications: NotificationData[]) => NotificationData[],\n) {\n const state = store.getState()\n const notifications = update([...state.notifications, ...state.queue])\n const updated = getDistributedNotifications(notifications, state.defaultPosition, state.limit)\n\n store.setState({\n notifications: updated.notifications,\n queue: updated.queue,\n limit: state.limit,\n defaultPosition: state.defaultPosition,\n })\n}\n\nexport function showNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore,\n) {\n const id = notification.id || randomId()\n\n updateNotificationsState(store, (notifications) => {\n if (notification.id && notifications.some((n) => n.id === notification.id)) {\n return notifications\n }\n\n return [...notifications, { ...notification, id }]\n })\n\n return id\n}\n\nexport function hideNotification(id: string, store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n notification.onClose?.(notification)\n return false\n }\n\n return true\n }),\n )\n\n return id\n}\n\nexport function updateNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore,\n) {\n updateNotificationsState(store, (notifications) =>\n notifications.map((item) =>\n item.id === notification.id ? { ...item, ...notification } : item,\n ),\n )\n\n return notification.id\n}\n\nexport function cleanNotifications(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, () => [])\n}\n\nexport function cleanNotificationsQueue(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) => notifications.slice(0, store.getState().limit))\n}\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n updateState: updateNotificationsState,\n} as const\n","import type { NotificationData, NotificationPosition } from '../notifications.store'\n\nexport type GroupedNotifications = Record<NotificationPosition, NotificationData[]>\n\nexport const positions: NotificationPosition[] = [\n 'bottom-center',\n 'bottom-left',\n 'bottom-right',\n 'top-center',\n 'top-left',\n 'top-right',\n]\n\nexport function getGroupedNotifications(\n notifications: NotificationData[],\n defaultPosition: NotificationPosition,\n) {\n return notifications.reduce<GroupedNotifications>(\n (acc, notification) => {\n acc[notification.position || defaultPosition].push(notification)\n return acc\n },\n positions.reduce<GroupedNotifications>((acc, item) => {\n acc[item] = []\n return acc\n }, {} as GroupedNotifications),\n )\n}\n","import type { CSSProperties } from 'vue'\nimport type { NotificationPosition } from './notifications.store'\n\nexport type NotificationTransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited'\n\ninterface NotificationStateStylesProps {\n state: NotificationTransitionStatus\n maxHeight: number | string\n position: NotificationPosition\n transitionDuration: number\n}\n\nconst transforms = {\n left: 'translateX(-100%)',\n right: 'translateX(100%)',\n 'top-center': 'translateY(-100%)',\n 'bottom-center': 'translateY(100%)',\n}\n\nconst noTransform = {\n left: 'translateX(0)',\n right: 'translateX(0)',\n 'top-center': 'translateY(0)',\n 'bottom-center': 'translateY(0)',\n}\n\nfunction toCssLength(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nexport function getNotificationStateStyles({\n state,\n maxHeight,\n position,\n transitionDuration,\n}: NotificationStateStylesProps): CSSProperties {\n const [vertical, horizontal] = position.split('-')\n const property = (\n horizontal === 'center' ? `${vertical}-center` : horizontal\n ) as keyof typeof transforms\n\n const commonStyles: CSSProperties = {\n opacity: 0,\n maxHeight: toCssLength(maxHeight),\n transform: transforms[property],\n transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,\n transitionTimingFunction: 'cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear',\n transitionProperty: 'opacity, transform, max-height',\n }\n\n const inState: CSSProperties = {\n opacity: 1,\n transform: noTransform[property],\n }\n\n const outState: CSSProperties = {\n opacity: 0,\n maxHeight: toCssLength(0),\n transform: transforms[property],\n }\n\n const transitionStyles = {\n entering: inState,\n entered: inState,\n exiting: outState,\n exited: outState,\n }\n\n return { ...commonStyles, ...transitionStyles[state] }\n}\n","export function getAutoClose(\n autoClose: boolean | number | undefined,\n notificationAutoClose: boolean | number | undefined,\n) {\n if (typeof notificationAutoClose === 'number') {\n return notificationAutoClose\n }\n\n if (notificationAutoClose === false || autoClose === false) {\n return false\n }\n\n return autoClose\n}\n","import {\n computed,\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type CSSProperties,\n type PropType,\n} from 'vue'\nimport { Notification } from '@mantine-vue/core'\nimport { getAutoClose } from './get-auto-close/get-auto-close'\nimport type { NotificationData } from './notifications.store'\n\nconst SCROLL_DISMISS_RESET_TIMEOUT = 120\n\nfunction normalizeStyle(style: any): Record<string, any> {\n if (!style) return {}\n if (Array.isArray(style)) {\n return style.reduce<Record<string, any>>(\n (acc, item) => Object.assign(acc, normalizeStyle(item)),\n {},\n )\n }\n return typeof style === 'object' ? style : {}\n}\n\nfunction renderContent(value: any) {\n return typeof value === 'function' ? value() : value\n}\n\nfunction getNotificationProps(data: NotificationData) {\n const omittedKeys = new Set([\n 'autoClose',\n 'message',\n 'allowClose',\n 'position',\n 'style',\n 'withCloseButton',\n 'onOpen',\n 'onClose',\n 'id',\n ])\n\n return Object.entries(data).reduce<Record<string, any>>((acc, [key, value]) => {\n if (!omittedKeys.has(key)) {\n acc[key] = value\n }\n\n return acc\n }, {})\n}\n\nexport const NotificationContainer = defineComponent({\n name: 'NotificationContainer',\n inheritAttrs: false,\n props: {\n data: { type: Object as PropType<NotificationData>, required: true },\n autoClose: { type: [Boolean, Number] as PropType<number | false>, required: true },\n transitionDuration: { type: Number, required: true },\n allowDragDismiss: { type: Boolean, required: true },\n allowScrollDismiss: { type: Boolean, required: true },\n paused: { type: Boolean, required: true },\n onHide: { type: Function as PropType<(id: string) => void>, required: true },\n onHoverStart: { type: Function as PropType<() => void>, default: undefined },\n onHoverEnd: { type: Function as PropType<() => void>, default: undefined },\n },\n setup(props, { attrs }) {\n const notificationRef = ref<HTMLElement | null>(null)\n const offset = ref(0)\n const dismissed = ref(false)\n const dismissDirection = ref<-1 | 1>(1)\n const active = ref(false)\n const scrollDismissActive = ref(false)\n const hovered = ref(false)\n const startX = ref(0)\n const startTime = ref(0)\n let autoCloseTimeout = -1\n let hideTimeout = -1\n let scrollDismissTimeout = -1\n\n const autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose))\n const isCloseDisabled = computed(() => props.data.allowClose === false)\n\n const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout)\n const cancelHide = () => window.clearTimeout(hideTimeout)\n const cancelScrollDismissReset = () => window.clearTimeout(scrollDismissTimeout)\n\n const setSwipeOffset = (value: number) => {\n offset.value = value\n }\n\n const handleHide = () => {\n props.onHide(props.data.id!)\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n }\n\n const handleAutoClose = () => {\n if (\n typeof window === 'undefined' ||\n dismissed.value ||\n active.value ||\n props.paused ||\n hovered.value ||\n typeof autoCloseDuration.value !== 'number'\n ) {\n return\n }\n\n cancelAutoClose()\n autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value)\n }\n\n const getExitOffset = (direction: -1 | 1) => {\n const width = notificationRef.value?.offsetWidth ?? 440\n return direction * (width + 40)\n }\n\n const shouldDismiss = (movement: number, velocity: number) => {\n const width = notificationRef.value?.offsetWidth ?? 440\n return Math.abs(movement) > width * 0.35 || velocity > 0.5\n }\n\n const resetSwipe = () => {\n cancelScrollDismissReset()\n scrollDismissActive.value = false\n setSwipeOffset(0)\n }\n\n const dismissNotification = (direction: -1 | 1) => {\n dismissDirection.value = direction\n dismissed.value = true\n scrollDismissActive.value = false\n setSwipeOffset(getExitOffset(direction))\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n hideTimeout = window.setTimeout(handleHide, props.transitionDuration)\n }\n\n const scheduleScrollDismissReset = () => {\n cancelScrollDismissReset()\n scrollDismissTimeout = window.setTimeout(() => {\n scrollDismissActive.value = false\n setSwipeOffset(0)\n handleAutoClose()\n }, SCROLL_DISMISS_RESET_TIMEOUT)\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n if (!active.value || dismissed.value) {\n return\n }\n\n setSwipeOffset(event.clientX - startX.value)\n }\n\n const finishPointerDrag = (event: PointerEvent) => {\n if (!active.value) {\n return\n }\n\n active.value = false\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', finishPointerDrag)\n window.removeEventListener('pointercancel', cancelPointerDragEvent)\n\n const movement = event.clientX - startX.value\n const elapsed = Math.max(Date.now() - startTime.value, 1)\n const velocity = Math.abs(movement) / elapsed\n const direction = movement === 0 ? 1 : movement > 0 ? 1 : -1\n\n if (shouldDismiss(movement, velocity)) {\n dismissNotification(direction)\n } else {\n setSwipeOffset(0)\n handleAutoClose()\n }\n }\n\n function cancelPointerDrag(shouldRestartAutoClose = true) {\n active.value = false\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', finishPointerDrag)\n window.removeEventListener('pointercancel', cancelPointerDragEvent)\n setSwipeOffset(0)\n if (shouldRestartAutoClose) {\n handleAutoClose()\n }\n }\n\n const cancelPointerDragEvent = () => cancelPointerDrag()\n\n const handlePointerDown = (event: PointerEvent) => {\n if (\n !props.allowDragDismiss ||\n isCloseDisabled.value ||\n dismissed.value ||\n event.button !== 0\n ) {\n return\n }\n\n cancelAutoClose()\n active.value = true\n startX.value = event.clientX\n startTime.value = Date.now()\n window.addEventListener('pointermove', handlePointerMove)\n window.addEventListener('pointerup', finishPointerDrag)\n window.addEventListener('pointercancel', cancelPointerDragEvent)\n }\n\n const handleWheel = (event: WheelEvent) => {\n if (dismissed.value || active.value) {\n return\n }\n\n const isDocumentEvent = event.currentTarget === document\n if (!isDocumentEvent && !hovered.value) {\n return\n }\n\n const { deltaX, deltaY } = event\n if (Math.abs(deltaX) <= Math.abs(deltaY) || deltaX === 0) {\n return\n }\n\n if (!props.allowScrollDismiss || isCloseDisabled.value) {\n return\n }\n\n if (!isDocumentEvent) {\n event.preventDefault()\n event.stopPropagation()\n }\n\n cancelAutoClose()\n scrollDismissActive.value = true\n\n const nextOffset = offset.value - deltaX\n const direction = nextOffset > 0 ? 1 : -1\n\n if (shouldDismiss(nextOffset, 0)) {\n dismissNotification(direction)\n return\n }\n\n setSwipeOffset(nextOffset)\n scheduleScrollDismissReset()\n }\n\n const handleMouseEnter = () => {\n hovered.value = true\n cancelAutoClose()\n props.onHoverStart?.()\n }\n\n const handleMouseLeave = () => {\n hovered.value = false\n\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n\n props.onHoverEnd?.()\n }\n\n const handleResize = () => {\n if (dismissed.value) {\n setSwipeOffset(getExitOffset(dismissDirection.value))\n }\n }\n\n watch(\n () => scrollDismissActive.value,\n (value, _, onCleanup) => {\n if (!value) {\n return\n }\n\n document.addEventListener('wheel', handleWheel, { passive: false })\n onCleanup(() => document.removeEventListener('wheel', handleWheel))\n },\n )\n\n watch(\n [autoCloseDuration, active, dismissed, () => props.paused],\n () => {\n if (props.paused) {\n cancelAutoClose()\n } else {\n handleAutoClose()\n }\n },\n { immediate: true },\n )\n\n onMounted(() => {\n props.data.onOpen?.(props.data)\n notificationRef.value?.addEventListener('wheel', handleWheel, { passive: false })\n window.addEventListener('resize', handleResize)\n })\n\n onBeforeUnmount(() => {\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n })\n\n return () => {\n const resolvedAttrsStyle = normalizeStyle(attrs.style)\n const resolvedDataStyle = normalizeStyle(props.data.style)\n const baseStyle = { ...resolvedAttrsStyle, ...resolvedDataStyle }\n const baseOpacity = typeof baseStyle.opacity === 'number' ? baseStyle.opacity : 1\n const swipeOpacity = dismissed.value ? 0 : 1 - Math.min(Math.abs(offset.value) / 200, 1) * 0.6\n const resolvedTransitionDuration =\n baseStyle.transitionDuration ??\n `${props.transitionDuration}ms, ${props.transitionDuration}ms, ${props.transitionDuration}ms`\n const notificationStyle: CSSProperties = {\n ...baseStyle,\n '--notifications-state-transform':\n typeof baseStyle.transform === 'string' ? baseStyle.transform : 'translateX(0)',\n '--notifications-state-opacity': String(baseOpacity),\n '--notifications-swipe-offset': `${offset.value}px`,\n '--notifications-swipe-opacity': String(swipeOpacity),\n transform:\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)',\n opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration:\n active.value || scrollDismissActive.value ? '0ms, 0ms, 0ms' : resolvedTransitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n } as CSSProperties\n\n return h(\n Notification,\n {\n ...attrs,\n ...getNotificationProps(props.data),\n ref: (node: any) => {\n notificationRef.value = node?.$el ?? node\n },\n style: notificationStyle,\n withCloseButton: isCloseDisabled.value ? false : props.data.withCloseButton,\n onClose: handleHide,\n onMouseenter: handleMouseEnter,\n onMouseleave: handleMouseLeave,\n onPointerdown: handlePointerDown,\n },\n () => renderContent(props.data.message),\n )\n }\n },\n})\n",".root {\n width: calc(100% - var(--mantine-spacing-md) * 2);\n position: fixed;\n z-index: var(--notifications-z-index);\n max-width: var(--notifications-container-width);\n\n &:where([data-position='top-center']) {\n top: var(--mantine-spacing-md);\n left: 50%;\n transform: translateX(-50%);\n }\n\n &:where([data-position='top-left']) {\n top: var(--mantine-spacing-md);\n left: var(--mantine-spacing-md);\n }\n\n &:where([data-position='top-right']) {\n top: var(--mantine-spacing-md);\n right: var(--mantine-spacing-md);\n }\n\n &:where([data-position='bottom-center']) {\n bottom: var(--mantine-spacing-md);\n left: 50%;\n transform: translateX(-50%);\n }\n\n &:where([data-position='bottom-left']) {\n bottom: var(--mantine-spacing-md);\n left: var(--mantine-spacing-md);\n }\n\n &:where([data-position='bottom-right']) {\n bottom: var(--mantine-spacing-md);\n right: var(--mantine-spacing-md);\n }\n}\n\n.notification {\n & + & {\n margin-top: var(--mantine-spacing-md);\n }\n}\n","import { TransitionGroup, computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport {\n Box,\n OptionalPortal,\n createVarsResolver,\n getDefaultZIndex,\n rem,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine-vue/core'\nimport { useReducedMotion } from '@mantine-vue/hooks'\nimport {\n getGroupedNotifications,\n positions,\n} from './get-grouped-notifications/get-grouped-notifications'\nimport { getNotificationStateStyles } from './get-notification-state-styles'\nimport { NotificationContainer } from './NotificationContainer'\nimport {\n hideNotification,\n notifications,\n notificationsStore,\n useNotifications,\n type NotificationPosition,\n type NotificationsStore,\n} from './notifications.store'\nimport classes from './Notifications.module.css'\n\nexport type NotificationsStylesNames = 'root' | 'notification'\nexport type NotificationsCssVariables = {\n root: '--notifications-z-index' | '--notifications-container-width'\n}\n\nexport interface NotificationsProps {\n position?: NotificationPosition\n autoClose?: number | false\n transitionDuration?: number\n allowDragDismiss?: boolean\n allowScrollDismiss?: boolean\n containerWidth?: number | string\n notificationMaxHeight?: number | string\n limit?: number\n zIndex?: string | number\n portalProps?: Record<string, any>\n store?: NotificationsStore\n withinPortal?: boolean\n pauseResetOnHover?: 'all' | 'notification'\n classNames?: Record<string, any>\n styles?: Record<string, any>\n vars?: Record<string, any>\n unstyled?: boolean\n}\n\nconst defaultProps = {\n position: 'bottom-right',\n autoClose: 4000,\n transitionDuration: 250,\n allowDragDismiss: true,\n allowScrollDismiss: true,\n containerWidth: 440,\n notificationMaxHeight: 200,\n limit: 5,\n zIndex: getDefaultZIndex('overlay'),\n store: notificationsStore,\n withinPortal: true,\n pauseResetOnHover: 'all',\n} satisfies Partial<NotificationsProps>\n\nconst varsResolver = createVarsResolver<any>((_, { zIndex, containerWidth }) => ({\n root: {\n '--notifications-z-index': zIndex?.toString(),\n '--notifications-container-width': rem(containerWidth),\n },\n}))\n\nfunction applyTransitionStyles(\n element: Element,\n state: 'entered' | 'exited' | 'exiting',\n position: NotificationPosition,\n transitionDuration: number,\n maxHeight: number | string,\n) {\n Object.assign(\n (element as HTMLElement).style,\n getNotificationStateStyles({\n state,\n position,\n transitionDuration,\n maxHeight,\n }),\n )\n}\n\nconst NotificationsBase = defineComponent({\n name: 'Notifications',\n inheritAttrs: false,\n props: {\n position: { type: String as PropType<NotificationPosition>, default: undefined },\n autoClose: { type: [Number, Boolean] as PropType<number | false>, default: undefined },\n transitionDuration: { type: Number, default: undefined },\n allowDragDismiss: { type: Boolean, default: undefined },\n allowScrollDismiss: { type: Boolean, default: undefined },\n containerWidth: { type: [Number, String] as PropType<number | string>, default: undefined },\n notificationMaxHeight: {\n type: [Number, String] as PropType<number | string>,\n default: undefined,\n },\n limit: { type: Number, default: undefined },\n zIndex: { type: [Number, String] as PropType<number | string>, default: undefined },\n portalProps: { type: Object as PropType<Record<string, any>>, default: undefined },\n store: { type: Object as PropType<NotificationsStore>, default: undefined },\n withinPortal: { type: Boolean, default: undefined },\n pauseResetOnHover: { type: String as PropType<'all' | 'notification'>, default: undefined },\n classNames: { type: [Object, Function], default: undefined },\n styles: { type: [Object, Function], default: undefined },\n vars: { type: [Object, Function], default: undefined },\n unstyled: { type: Boolean, default: false },\n },\n setup(rawProps, { attrs }) {\n const props = useProps<NotificationsProps>('Notifications', defaultProps, rawProps as any)\n const theme = useMantineTheme()\n const shouldReduceMotion = useReducedMotion()\n const hoveredCount = ref(0)\n const data = useNotifications(props.store)\n const reduceMotion = computed(() =>\n theme.value.respectReducedMotion ? shouldReduceMotion.value : false,\n )\n const duration = computed(() => (reduceMotion.value ? 1 : props.transitionDuration!))\n\n const getStyles = useStyles({\n name: 'Notifications',\n classes,\n props,\n className: attrs.class,\n style: attrs.style as any,\n classNames: props.classNames as any,\n styles: props.styles as any,\n unstyled: props.unstyled,\n vars: props.vars as any,\n varsResolver,\n })\n\n watch(\n () => [props.limit, props.position, props.store] as const,\n () => {\n props.store?.setState((current) => ({\n ...current,\n limit: props.limit || 5,\n defaultPosition: props.position!,\n }))\n },\n { immediate: true },\n )\n\n const handleHoverStart = () => {\n hoveredCount.value += 1\n }\n\n const handleHoverEnd = () => {\n hoveredCount.value = Math.max(0, hoveredCount.value - 1)\n }\n\n return () => {\n const grouped = getGroupedNotifications(data.value.notifications, props.position!)\n const rootProps = (position: NotificationPosition) => ({\n ...attrs,\n ...getStyles('root'),\n 'data-position': position,\n })\n\n const renderGroup = (position: NotificationPosition) =>\n h(Box, rootProps(position), () =>\n h(\n TransitionGroup,\n {\n css: false,\n onBeforeEnter: (el: Element) =>\n applyTransitionStyles(\n el,\n 'exited',\n position,\n duration.value,\n props.notificationMaxHeight!,\n ),\n onEnter: (el: Element, done: () => void) => {\n void (el as HTMLElement).offsetHeight\n applyTransitionStyles(\n el,\n 'entered',\n position,\n duration.value,\n props.notificationMaxHeight!,\n )\n window.setTimeout(done, duration.value)\n },\n onLeave: (el: Element, done: () => void) => {\n applyTransitionStyles(\n el,\n 'exiting',\n position,\n duration.value,\n props.notificationMaxHeight!,\n )\n window.setTimeout(done, duration.value)\n },\n },\n () =>\n grouped[position].map(({ style: notificationStyle, ...notification }) =>\n h(NotificationContainer, {\n key: notification.id,\n data: notification,\n onHide: (id) => hideNotification(id, props.store),\n autoClose: props.autoClose!,\n transitionDuration: duration.value,\n allowDragDismiss: props.allowDragDismiss!,\n allowScrollDismiss: props.allowScrollDismiss!,\n paused: props.pauseResetOnHover === 'all' ? hoveredCount.value > 0 : false,\n onHoverStart: handleHoverStart,\n onHoverEnd: handleHoverEnd,\n ...getStyles('notification', { style: notificationStyle }),\n }),\n ),\n ),\n )\n\n return h(OptionalPortal, { withinPortal: props.withinPortal, ...props.portalProps }, () =>\n positions.map((position) => renderGroup(position)),\n )\n }\n },\n})\n\nexport const Notifications = Object.assign(NotificationsBase, {\n classes,\n varsResolver,\n show: notifications.show,\n hide: notifications.hide,\n update: notifications.update,\n clean: notifications.clean,\n cleanQueue: notifications.cleanQueue,\n updateState: notifications.updateState,\n})\n"],"mappings":";;;;;AAiCA,SAAS,WAAW;CAClB,OAAO,WAAW,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE;AAC1D;AAEA,SAAS,4BACP,MACA,iBACA,OACA;CACA,MAAM,QAA4B,CAAC;CACnC,MAAM,gBAAoC,CAAC;CAC3C,MAAM,QAAgC,CAAC;CAEvC,KAAK,MAAM,QAAQ,MAAM;EACvB,MAAM,WAAW,KAAK,YAAY;EAClC,MAAM,YAAY,MAAM,aAAa;EACrC,MAAM,aAAa;EAEnB,IAAI,MAAM,aAAa,OACrB,cAAc,KAAK,IAAI;OAEvB,MAAM,KAAK,IAAI;CAEnB;CAEA,OAAO;EAAE;EAAe;CAAM;AAChC;AAEA,IAAa,iCACX,YAAgC;CAC9B,eAAe,CAAC;CAChB,OAAO,CAAC;CACR,iBAAiB;CACjB,OAAO;AACT,CAAC;AAEH,IAAa,qBAAqB,yBAAyB;AAC3D,IAAa,oBACX,QAA4B,uBACU,MAAM;AAE9C,SAAgB,yBACd,OACA,QACA;CACA,MAAM,QAAQ,MAAM,SAAS;CAE7B,MAAM,UAAU,4BADM,OAAO,CAAC,GAAG,MAAM,eAAe,GAAG,MAAM,KAAK,CACxB,GAAe,MAAM,iBAAiB,MAAM,KAAK;CAE7F,MAAM,SAAS;EACb,eAAe,QAAQ;EACvB,OAAO,QAAQ;EACf,OAAO,MAAM;EACb,iBAAiB,MAAM;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IACE,KAAK;IACL,gBAAgB,OACd,sBACE,IACA,UACA,UACA,SAAS,OACT,MAAM,qBACR;IACF,UAAU,IAAa,SAAqB;KAC1C,GAAyB;KACzB,sBACE,IACA,WACA,UACA,SAAS,OACT,MAAM,qBACR;KACA,OAAO,WAAW,MAAM,SAAS,KAAK;IACxC;IACA,UAAU,IAAa,SAAqB;KAC1C,sBACE,IACA,WACA,UACA,SAAS,OACT,MAAM,qBACR;KACA,OAAO,WAAW,MAAM,SAAS,KAAK;IACxC;GACF,SAEE,QAAQ,UAAU,KAAK,EAAE,OAAO,mBAAmB,GAAG,mBACpD,EAAE,uBAAuB;IACvB,KAAK,aAAa;IAClB,MAAM;IACN,SAAS,OAAO,iBAAiB,IAAI,MAAM,KAAK;IAChD,WAAW,MAAM;IACjB,oBAAoB,SAAS;IAC7B,kBAAkB,MAAM;IACxB,oBAAoB,MAAM;IAC1B,QAAQ,MAAM,sBAAsB,QAAQ,aAAa,QAAQ,IAAI;IACrE,cAAc;IACd,YAAY;IACZ,GAAG,UAAU,gBAAgB,EAAE,OAAO,kBAAkB,CAAC;GAC3D,CAAC,CACH,CACJ,CACF;GAEF,OAAO,EAAE,gBAAgB;IAAE,cAAc,MAAM;IAAc,GAAG,MAAM;GAAY,SAChF,UAAU,KAAK,aAAa,YAAY,QAAQ,CAAC,CACnD;EACF;CACF;AACF,CAAC;AAED,IAAa,gBAAgB,OAAO,OAAO,mBAAmB;CAC5D,SAAA;CACA;CACA,MAAM,cAAc;CACpB,MAAM,cAAc;CACpB,QAAQ,cAAc;CACtB,OAAO,cAAc;CACrB,YAAY,cAAc;CAC1B,aAAa,cAAc;AAC7B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/notifications.store.ts","../src/get-auto-close/get-auto-close.ts","../src/components/NotificationContainer/NotificationContainer.vue","../src/components/NotificationContainer/NotificationContainer.vue","../src/get-grouped-notifications/get-grouped-notifications.ts","../src/get-notification-state-styles.ts","../src/Notifications.module.css","../src/components/Notifications/Notifications.vue","../src/components/Notifications/Notifications.vue","../src/components/Notifications/Notifications.ts"],"sourcesContent":["import { type Ref } from 'vue'\nimport { createStore, type MantineStore } from '@mantine-vue/store'\n\nexport type NotificationPosition =\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center'\n\nexport interface NotificationData extends Record<`data-${string}`, any> {\n /** Notification id, can be used to close or update notification. */\n id?: string\n /** Position of the notification, if not set, the position is determined based on `position` prop on Notifications component. */\n position?: NotificationPosition\n /** Notification message, required for all notifications. */\n message: any\n /** Display priority. Higher numbers are shown before lower ones when the number of active notifications exceeds `limit`. Notifications with equal priority keep insertion order (FIFO). @default 0 */\n priority?: number\n /** Determines whether notification should be closed automatically, number is auto close timeout in ms, overrides `autoClose` from `Notifications`. */\n autoClose?: boolean | number\n /** Determines whether notification can be closed with close button, drag or horizontal scroll swipe. @default true */\n allowClose?: boolean\n /** Called when notification closes. */\n onClose?: (props: NotificationData) => void\n /** Called when notification opens. */\n onOpen?: (props: NotificationData) => void\n style?: any\n withCloseButton?: boolean\n [key: string]: any\n}\n\nexport interface NotificationsState {\n notifications: NotificationData[]\n queue: NotificationData[]\n defaultPosition: NotificationPosition\n limit: number\n}\n\nexport type NotificationsStore = MantineStore<NotificationsState>\n\nfunction randomId() {\n return `mantine-${Math.random().toString(36).slice(2, 11)}`\n}\n\ninterface SequencedNotificationData extends NotificationData {\n __sequence?: number\n}\n\nlet notificationSequence = 0\n\nfunction getDistributedNotifications(\n data: SequencedNotificationData[],\n defaultPosition: NotificationPosition,\n limit: number,\n) {\n const queue: NotificationData[] = []\n const notifications: NotificationData[] = []\n const groups = new Map<string, SequencedNotificationData[]>()\n\n for (const item of data) {\n const position = item.position || defaultPosition\n const group = groups.get(position)\n if (group) {\n group.push(item)\n } else {\n groups.set(position, [item])\n }\n }\n\n for (const group of groups.values()) {\n group.sort(\n (a, b) => (b.priority ?? 0) - (a.priority ?? 0) || (a.__sequence ?? 0) - (b.__sequence ?? 0),\n )\n group.forEach((item, index) => {\n if (index < limit) notifications.push(item)\n else queue.push(item)\n })\n }\n\n return { notifications, queue }\n}\n\nexport const createNotificationsStore = () =>\n createStore<NotificationsState>({\n notifications: [],\n queue: [],\n defaultPosition: 'bottom-right',\n limit: 5,\n })\n\nexport const notificationsStore = createNotificationsStore()\nexport const useNotifications = (\n store: NotificationsStore = notificationsStore,\n): Readonly<Ref<NotificationsState>> => store.value\n\nexport function updateNotificationsState(\n store: NotificationsStore,\n update: (notifications: NotificationData[]) => NotificationData[],\n) {\n const state = store.getState()\n const notifications = update([...state.notifications, ...state.queue])\n for (const item of notifications as SequencedNotificationData[]) {\n if (item.__sequence === undefined) {\n item.__sequence = notificationSequence\n notificationSequence += 1\n }\n }\n const updated = getDistributedNotifications(notifications, state.defaultPosition, state.limit)\n\n store.setState({\n notifications: updated.notifications,\n queue: updated.queue,\n limit: state.limit,\n defaultPosition: state.defaultPosition,\n })\n}\n\nexport function showNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore,\n) {\n const id = notification.id || randomId()\n\n updateNotificationsState(store, (notifications) => {\n if (notification.id && notifications.some((n) => n.id === notification.id)) {\n return notifications\n }\n\n return [...notifications, { ...notification, id }]\n })\n\n return id\n}\n\nexport function hideNotification(id: string, store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n notification.onClose?.(notification)\n return false\n }\n\n return true\n }),\n )\n\n return id\n}\n\nexport function updateNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore,\n) {\n updateNotificationsState(store, (notifications) =>\n notifications.map((item) =>\n item.id === notification.id ? { ...item, ...notification } : item,\n ),\n )\n\n return notification.id\n}\n\nexport function cleanNotifications(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, () => [])\n}\n\nexport function cleanNotificationsQueue(store: NotificationsStore = notificationsStore) {\n const { defaultPosition, limit } = store.getState()\n updateNotificationsState(\n store,\n (notifications) =>\n getDistributedNotifications(notifications, defaultPosition, limit).notifications,\n )\n}\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n updateState: updateNotificationsState,\n} as const\n","export function getAutoClose(\n autoClose: boolean | number | undefined,\n notificationAutoClose: boolean | number | undefined,\n) {\n if (typeof notificationAutoClose === 'number') {\n return notificationAutoClose\n }\n\n if (notificationAutoClose === false || autoClose === false) {\n return false\n }\n\n return autoClose\n}\n","<script setup lang=\"ts\">\nimport {\n cloneVNode,\n computed,\n isVNode,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from 'vue'\nimport { Notification } from '@mantine-vue/core'\nimport { getAutoClose } from '../../get-auto-close/get-auto-close'\nimport type {\n NotificationContainerEmits,\n NotificationContainerProps,\n} from './NotificationContainer.types'\n\ndefineOptions({ name: 'NotificationContainer', inheritAttrs: false })\n\nconst props = defineProps<NotificationContainerProps>()\nconst emit = defineEmits<NotificationContainerEmits>()\nconst attrs = useAttrs()\nconst SCROLL_DISMISS_RESET_TIMEOUT = 120\n\nconst notificationRef = ref<HTMLElement | null>(null)\nconst offset = ref(0)\nconst dismissed = ref(false)\nconst dismissDirection = ref<-1 | 1>(1)\nconst active = ref(false)\nconst scrollDismissActive = ref(false)\nconst hovered = ref(false)\nconst startX = ref(0)\nconst startTime = ref(0)\nlet autoCloseTimeout = -1\nlet hideTimeout = -1\nlet scrollDismissTimeout = -1\n\nconst autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose))\nconst isCloseDisabled = computed(() => props.data.allowClose === false)\n\nfunction normalizeStyle(style: any): Record<string, any> {\n if (!style) return {}\n if (Array.isArray(style)) {\n return style.reduce<Record<string, any>>(\n (accumulator, item) => Object.assign(accumulator, normalizeStyle(item)),\n {},\n )\n }\n return typeof style === 'object' ? style : {}\n}\n\nfunction getNotificationProps() {\n const omittedKeys = new Set([\n 'autoClose',\n 'message',\n 'allowClose',\n 'position',\n 'style',\n 'withCloseButton',\n 'onOpen',\n 'onClose',\n 'id',\n ])\n return Object.fromEntries(\n Object.entries(props.data)\n .filter(([key]) => !omittedKeys.has(key))\n .map(([key, value]) => [key, cloneRenderable(value)]),\n )\n}\n\nfunction cloneRenderable(value: any): any {\n if (isVNode(value)) return cloneVNode(value)\n if (Array.isArray(value)) return value.map(cloneRenderable)\n return value\n}\n\nconst renderMessage = () =>\n cloneRenderable(\n typeof props.data.message === 'function' ? props.data.message() : props.data.message,\n )\n\nconst notificationStyle = computed(() => {\n const baseStyle = { ...normalizeStyle(attrs.style), ...normalizeStyle(props.data.style) }\n const baseOpacity = typeof baseStyle.opacity === 'number' ? baseStyle.opacity : 1\n const swipeOpacity = dismissed.value ? 0 : 1 - Math.min(Math.abs(offset.value) / 200, 1) * 0.6\n const transitionDuration =\n baseStyle.transitionDuration ??\n `${props.transitionDuration}ms, ${props.transitionDuration}ms, ${props.transitionDuration}ms`\n\n return {\n ...baseStyle,\n '--notifications-state-transform':\n typeof baseStyle.transform === 'string' ? baseStyle.transform : 'translateX(0)',\n '--notifications-state-opacity': String(baseOpacity),\n '--notifications-swipe-offset': `${offset.value}px`,\n '--notifications-swipe-opacity': String(swipeOpacity),\n transform:\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)',\n opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration:\n active.value || scrollDismissActive.value ? '0ms, 0ms, 0ms' : transitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n }\n})\n\nconst cancelAutoClose = () => window.clearTimeout(autoCloseTimeout)\nconst cancelHide = () => window.clearTimeout(hideTimeout)\nconst cancelScrollDismissReset = () => window.clearTimeout(scrollDismissTimeout)\n\nfunction handleHide() {\n emit('hide', props.data.id!)\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n}\n\nfunction handleAutoClose() {\n if (\n typeof window === 'undefined' ||\n dismissed.value ||\n active.value ||\n props.paused ||\n hovered.value ||\n typeof autoCloseDuration.value !== 'number'\n )\n return\n\n cancelAutoClose()\n autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value)\n}\n\nfunction getExitOffset(direction: -1 | 1) {\n return direction * ((notificationRef.value?.offsetWidth ?? 440) + 40)\n}\n\nfunction shouldDismiss(movement: number, velocity: number) {\n return Math.abs(movement) > (notificationRef.value?.offsetWidth ?? 440) * 0.35 || velocity > 0.5\n}\n\nfunction resetSwipe() {\n cancelScrollDismissReset()\n scrollDismissActive.value = false\n offset.value = 0\n}\n\nfunction dismissNotification(direction: -1 | 1) {\n dismissDirection.value = direction\n dismissed.value = true\n scrollDismissActive.value = false\n offset.value = getExitOffset(direction)\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n hideTimeout = window.setTimeout(handleHide, props.transitionDuration)\n}\n\nfunction scheduleScrollDismissReset() {\n cancelScrollDismissReset()\n scrollDismissTimeout = window.setTimeout(() => {\n scrollDismissActive.value = false\n offset.value = 0\n handleAutoClose()\n }, SCROLL_DISMISS_RESET_TIMEOUT)\n}\n\nfunction handlePointerMove(event: PointerEvent) {\n if (active.value && !dismissed.value) offset.value = event.clientX - startX.value\n}\n\nfunction finishPointerDrag(event: PointerEvent) {\n if (!active.value) return\n active.value = false\n removePointerListeners()\n const movement = event.clientX - startX.value\n const velocity = Math.abs(movement) / Math.max(Date.now() - startTime.value, 1)\n if (shouldDismiss(movement, velocity)) dismissNotification(movement >= 0 ? 1 : -1)\n else {\n offset.value = 0\n handleAutoClose()\n }\n}\n\nfunction removePointerListeners() {\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', finishPointerDrag)\n window.removeEventListener('pointercancel', cancelPointerDragEvent)\n}\n\nfunction cancelPointerDrag(restartAutoClose = true) {\n active.value = false\n removePointerListeners()\n offset.value = 0\n if (restartAutoClose) handleAutoClose()\n}\n\nconst cancelPointerDragEvent = () => cancelPointerDrag()\n\nfunction handlePointerDown(event: PointerEvent) {\n if (!props.allowDragDismiss || isCloseDisabled.value || dismissed.value || event.button !== 0)\n return\n cancelAutoClose()\n active.value = true\n startX.value = event.clientX\n startTime.value = Date.now()\n window.addEventListener('pointermove', handlePointerMove)\n window.addEventListener('pointerup', finishPointerDrag)\n window.addEventListener('pointercancel', cancelPointerDragEvent)\n}\n\nfunction handleWheel(event: WheelEvent) {\n if (dismissed.value || active.value) return\n const documentEvent = event.currentTarget === document\n if ((!documentEvent && !hovered.value) || Math.abs(event.deltaX) <= Math.abs(event.deltaY)) return\n if (!props.allowScrollDismiss || isCloseDisabled.value) return\n if (!documentEvent) {\n event.preventDefault()\n event.stopPropagation()\n }\n cancelAutoClose()\n scrollDismissActive.value = true\n const nextOffset = offset.value - event.deltaX\n if (shouldDismiss(nextOffset, 0)) dismissNotification(nextOffset > 0 ? 1 : -1)\n else {\n offset.value = nextOffset\n scheduleScrollDismissReset()\n }\n}\n\nfunction handleMouseEnter() {\n hovered.value = true\n cancelAutoClose()\n emit('hoverStart')\n}\n\nfunction handleMouseLeave() {\n hovered.value = false\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n emit('hoverEnd')\n}\n\nwatch(scrollDismissActive, (enabled, _, onCleanup) => {\n if (!enabled) return\n document.addEventListener('wheel', handleWheel, { passive: false })\n onCleanup(() => document.removeEventListener('wheel', handleWheel))\n})\n\nwatch(\n [autoCloseDuration, active, dismissed, () => props.paused],\n () => {\n if (props.paused) cancelAutoClose()\n else handleAutoClose()\n },\n { immediate: true },\n)\n\nonMounted(() => {\n props.data.onOpen?.(props.data)\n notificationRef.value?.addEventListener('wheel', handleWheel, { passive: false })\n window.addEventListener('resize', handleResize)\n})\n\nfunction handleResize() {\n if (dismissed.value) offset.value = getExitOffset(dismissDirection.value)\n}\n\nonBeforeUnmount(() => {\n if (hovered.value) emit('hoverEnd')\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n})\n</script>\n\n<template>\n <Notification\n v-bind=\"{ ...attrs, ...getNotificationProps() }\"\n :ref=\"(node: any) => (notificationRef = node?.$el ?? node)\"\n :style=\"notificationStyle\"\n :with-close-button=\"isCloseDisabled ? false : props.data.withCloseButton\"\n @close=\"handleHide\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderMessage\" />\n </Notification>\n</template>\n","<script setup lang=\"ts\">\nimport {\n cloneVNode,\n computed,\n isVNode,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from 'vue'\nimport { Notification } from '@mantine-vue/core'\nimport { getAutoClose } from '../../get-auto-close/get-auto-close'\nimport type {\n NotificationContainerEmits,\n NotificationContainerProps,\n} from './NotificationContainer.types'\n\ndefineOptions({ name: 'NotificationContainer', inheritAttrs: false })\n\nconst props = defineProps<NotificationContainerProps>()\nconst emit = defineEmits<NotificationContainerEmits>()\nconst attrs = useAttrs()\nconst SCROLL_DISMISS_RESET_TIMEOUT = 120\n\nconst notificationRef = ref<HTMLElement | null>(null)\nconst offset = ref(0)\nconst dismissed = ref(false)\nconst dismissDirection = ref<-1 | 1>(1)\nconst active = ref(false)\nconst scrollDismissActive = ref(false)\nconst hovered = ref(false)\nconst startX = ref(0)\nconst startTime = ref(0)\nlet autoCloseTimeout = -1\nlet hideTimeout = -1\nlet scrollDismissTimeout = -1\n\nconst autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose))\nconst isCloseDisabled = computed(() => props.data.allowClose === false)\n\nfunction normalizeStyle(style: any): Record<string, any> {\n if (!style) return {}\n if (Array.isArray(style)) {\n return style.reduce<Record<string, any>>(\n (accumulator, item) => Object.assign(accumulator, normalizeStyle(item)),\n {},\n )\n }\n return typeof style === 'object' ? style : {}\n}\n\nfunction getNotificationProps() {\n const omittedKeys = new Set([\n 'autoClose',\n 'message',\n 'allowClose',\n 'position',\n 'style',\n 'withCloseButton',\n 'onOpen',\n 'onClose',\n 'id',\n ])\n return Object.fromEntries(\n Object.entries(props.data)\n .filter(([key]) => !omittedKeys.has(key))\n .map(([key, value]) => [key, cloneRenderable(value)]),\n )\n}\n\nfunction cloneRenderable(value: any): any {\n if (isVNode(value)) return cloneVNode(value)\n if (Array.isArray(value)) return value.map(cloneRenderable)\n return value\n}\n\nconst renderMessage = () =>\n cloneRenderable(\n typeof props.data.message === 'function' ? props.data.message() : props.data.message,\n )\n\nconst notificationStyle = computed(() => {\n const baseStyle = { ...normalizeStyle(attrs.style), ...normalizeStyle(props.data.style) }\n const baseOpacity = typeof baseStyle.opacity === 'number' ? baseStyle.opacity : 1\n const swipeOpacity = dismissed.value ? 0 : 1 - Math.min(Math.abs(offset.value) / 200, 1) * 0.6\n const transitionDuration =\n baseStyle.transitionDuration ??\n `${props.transitionDuration}ms, ${props.transitionDuration}ms, ${props.transitionDuration}ms`\n\n return {\n ...baseStyle,\n '--notifications-state-transform':\n typeof baseStyle.transform === 'string' ? baseStyle.transform : 'translateX(0)',\n '--notifications-state-opacity': String(baseOpacity),\n '--notifications-swipe-offset': `${offset.value}px`,\n '--notifications-swipe-opacity': String(swipeOpacity),\n transform:\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)',\n opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration:\n active.value || scrollDismissActive.value ? '0ms, 0ms, 0ms' : transitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n }\n})\n\nconst cancelAutoClose = () => window.clearTimeout(autoCloseTimeout)\nconst cancelHide = () => window.clearTimeout(hideTimeout)\nconst cancelScrollDismissReset = () => window.clearTimeout(scrollDismissTimeout)\n\nfunction handleHide() {\n emit('hide', props.data.id!)\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n}\n\nfunction handleAutoClose() {\n if (\n typeof window === 'undefined' ||\n dismissed.value ||\n active.value ||\n props.paused ||\n hovered.value ||\n typeof autoCloseDuration.value !== 'number'\n )\n return\n\n cancelAutoClose()\n autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value)\n}\n\nfunction getExitOffset(direction: -1 | 1) {\n return direction * ((notificationRef.value?.offsetWidth ?? 440) + 40)\n}\n\nfunction shouldDismiss(movement: number, velocity: number) {\n return Math.abs(movement) > (notificationRef.value?.offsetWidth ?? 440) * 0.35 || velocity > 0.5\n}\n\nfunction resetSwipe() {\n cancelScrollDismissReset()\n scrollDismissActive.value = false\n offset.value = 0\n}\n\nfunction dismissNotification(direction: -1 | 1) {\n dismissDirection.value = direction\n dismissed.value = true\n scrollDismissActive.value = false\n offset.value = getExitOffset(direction)\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n hideTimeout = window.setTimeout(handleHide, props.transitionDuration)\n}\n\nfunction scheduleScrollDismissReset() {\n cancelScrollDismissReset()\n scrollDismissTimeout = window.setTimeout(() => {\n scrollDismissActive.value = false\n offset.value = 0\n handleAutoClose()\n }, SCROLL_DISMISS_RESET_TIMEOUT)\n}\n\nfunction handlePointerMove(event: PointerEvent) {\n if (active.value && !dismissed.value) offset.value = event.clientX - startX.value\n}\n\nfunction finishPointerDrag(event: PointerEvent) {\n if (!active.value) return\n active.value = false\n removePointerListeners()\n const movement = event.clientX - startX.value\n const velocity = Math.abs(movement) / Math.max(Date.now() - startTime.value, 1)\n if (shouldDismiss(movement, velocity)) dismissNotification(movement >= 0 ? 1 : -1)\n else {\n offset.value = 0\n handleAutoClose()\n }\n}\n\nfunction removePointerListeners() {\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', finishPointerDrag)\n window.removeEventListener('pointercancel', cancelPointerDragEvent)\n}\n\nfunction cancelPointerDrag(restartAutoClose = true) {\n active.value = false\n removePointerListeners()\n offset.value = 0\n if (restartAutoClose) handleAutoClose()\n}\n\nconst cancelPointerDragEvent = () => cancelPointerDrag()\n\nfunction handlePointerDown(event: PointerEvent) {\n if (!props.allowDragDismiss || isCloseDisabled.value || dismissed.value || event.button !== 0)\n return\n cancelAutoClose()\n active.value = true\n startX.value = event.clientX\n startTime.value = Date.now()\n window.addEventListener('pointermove', handlePointerMove)\n window.addEventListener('pointerup', finishPointerDrag)\n window.addEventListener('pointercancel', cancelPointerDragEvent)\n}\n\nfunction handleWheel(event: WheelEvent) {\n if (dismissed.value || active.value) return\n const documentEvent = event.currentTarget === document\n if ((!documentEvent && !hovered.value) || Math.abs(event.deltaX) <= Math.abs(event.deltaY)) return\n if (!props.allowScrollDismiss || isCloseDisabled.value) return\n if (!documentEvent) {\n event.preventDefault()\n event.stopPropagation()\n }\n cancelAutoClose()\n scrollDismissActive.value = true\n const nextOffset = offset.value - event.deltaX\n if (shouldDismiss(nextOffset, 0)) dismissNotification(nextOffset > 0 ? 1 : -1)\n else {\n offset.value = nextOffset\n scheduleScrollDismissReset()\n }\n}\n\nfunction handleMouseEnter() {\n hovered.value = true\n cancelAutoClose()\n emit('hoverStart')\n}\n\nfunction handleMouseLeave() {\n hovered.value = false\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n emit('hoverEnd')\n}\n\nwatch(scrollDismissActive, (enabled, _, onCleanup) => {\n if (!enabled) return\n document.addEventListener('wheel', handleWheel, { passive: false })\n onCleanup(() => document.removeEventListener('wheel', handleWheel))\n})\n\nwatch(\n [autoCloseDuration, active, dismissed, () => props.paused],\n () => {\n if (props.paused) cancelAutoClose()\n else handleAutoClose()\n },\n { immediate: true },\n)\n\nonMounted(() => {\n props.data.onOpen?.(props.data)\n notificationRef.value?.addEventListener('wheel', handleWheel, { passive: false })\n window.addEventListener('resize', handleResize)\n})\n\nfunction handleResize() {\n if (dismissed.value) offset.value = getExitOffset(dismissDirection.value)\n}\n\nonBeforeUnmount(() => {\n if (hovered.value) emit('hoverEnd')\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n})\n</script>\n\n<template>\n <Notification\n v-bind=\"{ ...attrs, ...getNotificationProps() }\"\n :ref=\"(node: any) => (notificationRef = node?.$el ?? node)\"\n :style=\"notificationStyle\"\n :with-close-button=\"isCloseDisabled ? false : props.data.withCloseButton\"\n @close=\"handleHide\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderMessage\" />\n </Notification>\n</template>\n","import type { NotificationData, NotificationPosition } from '../notifications.store'\n\nexport type GroupedNotifications = Record<NotificationPosition, NotificationData[]>\n\nexport const positions: NotificationPosition[] = [\n 'bottom-center',\n 'bottom-left',\n 'bottom-right',\n 'top-center',\n 'top-left',\n 'top-right',\n]\n\nexport function getGroupedNotifications(\n notifications: NotificationData[],\n defaultPosition: NotificationPosition,\n) {\n return notifications.reduce<GroupedNotifications>(\n (acc, notification) => {\n acc[notification.position || defaultPosition].push(notification)\n return acc\n },\n positions.reduce<GroupedNotifications>((acc, item) => {\n acc[item] = []\n return acc\n }, {} as GroupedNotifications),\n )\n}\n","import type { CSSProperties } from 'vue'\nimport type { NotificationPosition } from './notifications.store'\n\nexport type NotificationTransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited'\n\ninterface NotificationStateStylesProps {\n state: NotificationTransitionStatus\n maxHeight: number | string\n position: NotificationPosition\n transitionDuration: number\n}\n\nconst transforms = {\n left: 'translateX(-100%)',\n right: 'translateX(100%)',\n 'top-center': 'translateY(-100%)',\n 'bottom-center': 'translateY(100%)',\n}\n\nconst noTransform = {\n left: 'translateX(0)',\n right: 'translateX(0)',\n 'top-center': 'translateY(0)',\n 'bottom-center': 'translateY(0)',\n}\n\nfunction toCssLength(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nexport function getNotificationStateStyles({\n state,\n maxHeight,\n position,\n transitionDuration,\n}: NotificationStateStylesProps): CSSProperties {\n const [vertical, horizontal] = position.split('-')\n const property = (\n horizontal === 'center' ? `${vertical}-center` : horizontal\n ) as keyof typeof transforms\n\n const commonStyles: CSSProperties = {\n opacity: 0,\n maxHeight: toCssLength(maxHeight),\n transform: transforms[property],\n transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,\n transitionTimingFunction: 'cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear',\n transitionProperty: 'opacity, transform, max-height',\n }\n\n const inState: CSSProperties = {\n opacity: 1,\n transform: noTransform[property],\n }\n\n const outState: CSSProperties = {\n opacity: 0,\n maxHeight: toCssLength(0),\n transform: transforms[property],\n }\n\n const transitionStyles = {\n entering: inState,\n entered: inState,\n exiting: outState,\n exited: outState,\n }\n\n return { ...commonStyles, ...transitionStyles[state] }\n}\n",".root {\n width: calc(100% - var(--mantine-spacing-md) * 2);\n position: fixed;\n z-index: var(--notifications-z-index);\n max-width: var(--notifications-container-width);\n\n &:where([data-position='top-center']) {\n top: var(--mantine-spacing-md);\n left: 50%;\n transform: translateX(-50%);\n }\n\n &:where([data-position='top-left']) {\n top: var(--mantine-spacing-md);\n left: var(--mantine-spacing-md);\n }\n\n &:where([data-position='top-right']) {\n top: var(--mantine-spacing-md);\n right: var(--mantine-spacing-md);\n }\n\n &:where([data-position='bottom-center']) {\n bottom: var(--mantine-spacing-md);\n left: 50%;\n transform: translateX(-50%);\n }\n\n &:where([data-position='bottom-left']) {\n bottom: var(--mantine-spacing-md);\n left: var(--mantine-spacing-md);\n }\n\n &:where([data-position='bottom-right']) {\n bottom: var(--mantine-spacing-md);\n right: var(--mantine-spacing-md);\n }\n}\n\n.notification {\n & + & {\n margin-top: var(--mantine-spacing-md);\n }\n}\n","<script lang=\"ts\">\nimport { createVarsResolver, rem } from '@mantine-vue/core'\n\nconst varsResolver = createVarsResolver<any>((_, { zIndex, containerWidth }) => ({\n root: {\n '--notifications-z-index': zIndex?.toString(),\n '--notifications-container-width': rem(containerWidth),\n },\n}))\n\nexport { varsResolver }\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport {\n Box,\n OptionalPortal,\n getDefaultZIndex,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine-vue/core'\nimport { useReducedMotion } from '@mantine-vue/hooks'\nimport NotificationContainer from '../NotificationContainer/NotificationContainer.vue'\nimport {\n getGroupedNotifications,\n positions,\n} from '../../get-grouped-notifications/get-grouped-notifications'\nimport { getNotificationStateStyles } from '../../get-notification-state-styles'\nimport { hideNotification, notificationsStore, useNotifications } from '../../notifications.store'\nimport type { NotificationData, NotificationPosition } from '../../notifications.store'\nimport type { NotificationsProps } from './Notifications.types'\nimport classes from '../../Notifications.module.css'\n\ndefineOptions({ name: 'Notifications', inheritAttrs: false })\n\nconst rawProps = withDefaults(defineProps<NotificationsProps>(), {\n position: 'bottom-right',\n autoClose: 4000,\n transitionDuration: 250,\n allowDragDismiss: true,\n allowScrollDismiss: true,\n containerWidth: 440,\n notificationMaxHeight: 200,\n limit: 5,\n zIndex: () => getDefaultZIndex('overlay'),\n store: () => notificationsStore,\n withinPortal: true,\n pauseResetOnHover: 'all',\n})\nconst attrs = useAttrs()\nconst props = useProps('Notifications', null, rawProps)\nconst theme = useMantineTheme()\nconst shouldReduceMotion = useReducedMotion()\nconst hoveredCount = ref(0)\nconst data = useNotifications(props.store)\nconst duration = computed(() =>\n theme.value.respectReducedMotion && shouldReduceMotion.value ? 1 : props.transitionDuration,\n)\nconst grouped = computed(() => getGroupedNotifications(data.value.notifications, props.position))\n\nconst getStyles = useStyles({\n name: 'Notifications',\n classes,\n props,\n className: attrs.class,\n style: attrs.style as any,\n classNames: props.classNames as any,\n styles: props.styles as any,\n unstyled: props.unstyled,\n vars: props.vars as any,\n varsResolver,\n})\n\nwatch(\n () => [props.limit, props.position, props.store] as const,\n () => {\n props.store.setState((current) => ({\n ...current,\n limit: props.limit || 5,\n defaultPosition: props.position,\n }))\n },\n { immediate: true },\n)\n\nfunction applyTransitionStyles(\n element: Element,\n state: 'entered' | 'exited' | 'exiting',\n position: NotificationPosition,\n) {\n Object.assign(\n (element as HTMLElement).style,\n getNotificationStateStyles({\n state,\n position,\n transitionDuration: duration.value,\n maxHeight: props.notificationMaxHeight,\n }),\n )\n}\n\nfunction enter(element: Element, done: () => void, position: NotificationPosition) {\n void (element as HTMLElement).offsetHeight\n applyTransitionStyles(element, 'entered', position)\n window.setTimeout(done, duration.value)\n}\n\nfunction leave(element: Element, done: () => void, position: NotificationPosition) {\n applyTransitionStyles(element, 'exiting', position)\n window.setTimeout(done, duration.value)\n}\n\nfunction notificationData(notification: NotificationData) {\n const data = { ...notification }\n delete data.style\n return data\n}\n</script>\n\n<template>\n <OptionalPortal v-bind=\"props.portalProps\" :within-portal=\"props.withinPortal\">\n <Box\n v-for=\"position in positions\"\n :key=\"position\"\n v-bind=\"{ ...attrs, ...getStyles('root') }\"\n :data-position=\"position\"\n >\n <TransitionGroup\n :css=\"false\"\n @before-enter=\"(element) => applyTransitionStyles(element, 'exited', position)\"\n @enter=\"(element, done) => enter(element, done, position)\"\n @leave=\"(element, done) => leave(element, done, position)\"\n >\n <NotificationContainer\n v-for=\"notification in grouped[position]\"\n :key=\"notification.id\"\n v-bind=\"getStyles('notification', { style: notification.style })\"\n :data=\"notificationData(notification)\"\n :auto-close=\"props.autoClose\"\n :transition-duration=\"duration\"\n :allow-drag-dismiss=\"props.allowDragDismiss\"\n :allow-scroll-dismiss=\"props.allowScrollDismiss\"\n :paused=\"props.pauseResetOnHover === 'all' && hoveredCount > 0\"\n @hide=\"(id) => hideNotification(id, props.store)\"\n @hover-start=\"hoveredCount += 1\"\n @hover-end=\"hoveredCount = Math.max(0, hoveredCount - 1)\"\n />\n </TransitionGroup>\n </Box>\n </OptionalPortal>\n</template>\n","<script lang=\"ts\">\nimport { createVarsResolver, rem } from '@mantine-vue/core'\n\nconst varsResolver = createVarsResolver<any>((_, { zIndex, containerWidth }) => ({\n root: {\n '--notifications-z-index': zIndex?.toString(),\n '--notifications-container-width': rem(containerWidth),\n },\n}))\n\nexport { varsResolver }\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport {\n Box,\n OptionalPortal,\n getDefaultZIndex,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine-vue/core'\nimport { useReducedMotion } from '@mantine-vue/hooks'\nimport NotificationContainer from '../NotificationContainer/NotificationContainer.vue'\nimport {\n getGroupedNotifications,\n positions,\n} from '../../get-grouped-notifications/get-grouped-notifications'\nimport { getNotificationStateStyles } from '../../get-notification-state-styles'\nimport { hideNotification, notificationsStore, useNotifications } from '../../notifications.store'\nimport type { NotificationData, NotificationPosition } from '../../notifications.store'\nimport type { NotificationsProps } from './Notifications.types'\nimport classes from '../../Notifications.module.css'\n\ndefineOptions({ name: 'Notifications', inheritAttrs: false })\n\nconst rawProps = withDefaults(defineProps<NotificationsProps>(), {\n position: 'bottom-right',\n autoClose: 4000,\n transitionDuration: 250,\n allowDragDismiss: true,\n allowScrollDismiss: true,\n containerWidth: 440,\n notificationMaxHeight: 200,\n limit: 5,\n zIndex: () => getDefaultZIndex('overlay'),\n store: () => notificationsStore,\n withinPortal: true,\n pauseResetOnHover: 'all',\n})\nconst attrs = useAttrs()\nconst props = useProps('Notifications', null, rawProps)\nconst theme = useMantineTheme()\nconst shouldReduceMotion = useReducedMotion()\nconst hoveredCount = ref(0)\nconst data = useNotifications(props.store)\nconst duration = computed(() =>\n theme.value.respectReducedMotion && shouldReduceMotion.value ? 1 : props.transitionDuration,\n)\nconst grouped = computed(() => getGroupedNotifications(data.value.notifications, props.position))\n\nconst getStyles = useStyles({\n name: 'Notifications',\n classes,\n props,\n className: attrs.class,\n style: attrs.style as any,\n classNames: props.classNames as any,\n styles: props.styles as any,\n unstyled: props.unstyled,\n vars: props.vars as any,\n varsResolver,\n})\n\nwatch(\n () => [props.limit, props.position, props.store] as const,\n () => {\n props.store.setState((current) => ({\n ...current,\n limit: props.limit || 5,\n defaultPosition: props.position,\n }))\n },\n { immediate: true },\n)\n\nfunction applyTransitionStyles(\n element: Element,\n state: 'entered' | 'exited' | 'exiting',\n position: NotificationPosition,\n) {\n Object.assign(\n (element as HTMLElement).style,\n getNotificationStateStyles({\n state,\n position,\n transitionDuration: duration.value,\n maxHeight: props.notificationMaxHeight,\n }),\n )\n}\n\nfunction enter(element: Element, done: () => void, position: NotificationPosition) {\n void (element as HTMLElement).offsetHeight\n applyTransitionStyles(element, 'entered', position)\n window.setTimeout(done, duration.value)\n}\n\nfunction leave(element: Element, done: () => void, position: NotificationPosition) {\n applyTransitionStyles(element, 'exiting', position)\n window.setTimeout(done, duration.value)\n}\n\nfunction notificationData(notification: NotificationData) {\n const data = { ...notification }\n delete data.style\n return data\n}\n</script>\n\n<template>\n <OptionalPortal v-bind=\"props.portalProps\" :within-portal=\"props.withinPortal\">\n <Box\n v-for=\"position in positions\"\n :key=\"position\"\n v-bind=\"{ ...attrs, ...getStyles('root') }\"\n :data-position=\"position\"\n >\n <TransitionGroup\n :css=\"false\"\n @before-enter=\"(element) => applyTransitionStyles(element, 'exited', position)\"\n @enter=\"(element, done) => enter(element, done, position)\"\n @leave=\"(element, done) => leave(element, done, position)\"\n >\n <NotificationContainer\n v-for=\"notification in grouped[position]\"\n :key=\"notification.id\"\n v-bind=\"getStyles('notification', { style: notification.style })\"\n :data=\"notificationData(notification)\"\n :auto-close=\"props.autoClose\"\n :transition-duration=\"duration\"\n :allow-drag-dismiss=\"props.allowDragDismiss\"\n :allow-scroll-dismiss=\"props.allowScrollDismiss\"\n :paused=\"props.pauseResetOnHover === 'all' && hoveredCount > 0\"\n @hide=\"(id) => hideNotification(id, props.store)\"\n @hover-start=\"hoveredCount += 1\"\n @hover-end=\"hoveredCount = Math.max(0, hoveredCount - 1)\"\n />\n </TransitionGroup>\n </Box>\n </OptionalPortal>\n</template>\n","import NotificationsComponent, { varsResolver } from './Notifications.vue'\nimport { notifications } from '../../notifications.store'\nimport classes from '../../Notifications.module.css'\n\nexport const Notifications = Object.assign(NotificationsComponent, {\n classes,\n varsResolver,\n show: notifications.show,\n hide: notifications.hide,\n update: notifications.update,\n clean: notifications.clean,\n cleanQueue: notifications.cleanQueue,\n updateState: notifications.updateState,\n})\n\nexport type {\n NotificationsCssVariables,\n NotificationsProps,\n NotificationsStylesNames,\n} from './Notifications.types'\n"],"mappings":";;;;;AA0CA,SAAS,WAAW;CAClB,OAAO,WAAW,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE;AAC1D;AAMA,IAAI,uBAAuB;AAE3B,SAAS,4BACP,MACA,iBACA,OACA;CACA,MAAM,QAA4B,CAAC;CACnC,MAAM,gBAAoC,CAAC;CAC3C,MAAM,yBAAS,IAAI,IAAyC;CAE5D,KAAK,MAAM,QAAQ,MAAM;EACvB,MAAM,WAAW,KAAK,YAAY;EAClC,MAAM,QAAQ,OAAO,IAAI,QAAQ;EACjC,IAAI,OACF,MAAM,KAAK,IAAI;OAEf,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC;CAE/B;CAEA,KAAK,MAAM,SAAS,OAAO,OAAO,GAAG;EACnC,MAAM,MACH,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,OAAO,EAAE,cAAc,MAAM,EAAE,cAAc,EAC5F;EACA,MAAM,SAAS,MAAM,UAAU;GAC7B,IAAI,QAAQ,OAAO,cAAc,KAAK,IAAI;QACrC,MAAM,KAAK,IAAI;EACtB,CAAC;CACH;CAEA,OAAO;EAAE;EAAe;CAAM;AAChC;AAEA,IAAa,iCACX,YAAgC;CAC9B,eAAe,CAAC;CAChB,OAAO,CAAC;CACR,iBAAiB;CACjB,OAAO;AACT,CAAC;AAEH,IAAa,qBAAqB,yBAAyB;AAC3D,IAAa,oBACX,QAA4B,uBACU,MAAM;AAE9C,SAAgB,yBACd,OACA,QACA;CACA,MAAM,QAAQ,MAAM,SAAS;CAC7B,MAAM,gBAAgB,OAAO,CAAC,GAAG,MAAM,eA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AA;;;;;;;;;;;;;;;;;;;;;;;CE/IlB,GAAwB;CACjE,SAAA;CACA;CACA,MAAM,cAAc;CACpB,MAAM,cAAc;CACpB,QAAQ,cAAc;CACtB,OAAO,cAAc;CACrB,YAAY,cAAc;CAC1B,aAAa,cAAc;AAC7B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NotificationData } from '../../notifications.store';
|
|
2
|
+
/** Internal props accepted by `NotificationContainer`. */
|
|
3
|
+
export interface NotificationContainerProps {
|
|
4
|
+
/** Notification data rendered by the container. */
|
|
5
|
+
data: NotificationData;
|
|
6
|
+
/** Default auto-close timeout. */
|
|
7
|
+
autoClose: number | false;
|
|
8
|
+
/** Exit transition duration in milliseconds. */
|
|
9
|
+
transitionDuration: number;
|
|
10
|
+
/** Enables pointer-drag dismissal. */
|
|
11
|
+
allowDragDismiss: boolean;
|
|
12
|
+
/** Enables horizontal scroll dismissal. */
|
|
13
|
+
allowScrollDismiss: boolean;
|
|
14
|
+
/** Pauses the auto-close timer. */
|
|
15
|
+
paused: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Events emitted by `NotificationContainer`. */
|
|
18
|
+
export interface NotificationContainerEmits {
|
|
19
|
+
/** Emitted when the notification should be removed. */
|
|
20
|
+
hide: [id: string];
|
|
21
|
+
/** Emitted when the pointer enters the notification. */
|
|
22
|
+
hoverStart: [];
|
|
23
|
+
/** Emitted when the pointer leaves the notification. */
|
|
24
|
+
hoverEnd: [];
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NotificationContainerProps } from './NotificationContainer.types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NotificationContainerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
hide: (id: string) => any;
|
|
4
|
+
hoverStart: () => any;
|
|
5
|
+
hoverEnd: () => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<NotificationContainerProps> & Readonly<{
|
|
7
|
+
onHide?: ((id: string) => any) | undefined;
|
|
8
|
+
onHoverStart?: (() => any) | undefined;
|
|
9
|
+
onHoverEnd?: (() => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const Notifications: {
|
|
2
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./Notifications.types").NotificationsProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
3
|
+
P: {};
|
|
4
|
+
B: {};
|
|
5
|
+
D: {};
|
|
6
|
+
C: {};
|
|
7
|
+
M: {};
|
|
8
|
+
Defaults: {};
|
|
9
|
+
}, Readonly<import("./Notifications.types").NotificationsProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
10
|
+
__isFragment?: never;
|
|
11
|
+
__isTeleport?: never;
|
|
12
|
+
__isSuspense?: never;
|
|
13
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./Notifications.types").NotificationsProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
14
|
+
classes: Record<string, string>;
|
|
15
|
+
varsResolver: (theme: import("@mantine-vue/core").MantineTheme, props: any, ctx: Record<string, any>) => Record<string, Record<string, string | undefined>>;
|
|
16
|
+
show: typeof import("../../notifications.store").showNotification;
|
|
17
|
+
hide: typeof import("../../notifications.store").hideNotification;
|
|
18
|
+
update: typeof import("../../notifications.store").updateNotification;
|
|
19
|
+
clean: typeof import("../../notifications.store").cleanNotifications;
|
|
20
|
+
cleanQueue: typeof import("../../notifications.store").cleanNotificationsQueue;
|
|
21
|
+
updateState: typeof import("../../notifications.store").updateNotificationsState;
|
|
22
|
+
};
|
|
23
|
+
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './Notifications.types';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ClassNames, Styles, Vars } from '@mantine-vue/core';
|
|
2
|
+
import type { NotificationPosition, NotificationsStore } from '../../notifications.store';
|
|
3
|
+
export type NotificationsStylesNames = 'root' | 'notification';
|
|
4
|
+
export type NotificationsCssVariables = {
|
|
5
|
+
root: '--notifications-z-index' | '--notifications-container-width';
|
|
6
|
+
};
|
|
7
|
+
/** Props accepted by `Notifications`. */
|
|
8
|
+
export interface NotificationsProps {
|
|
9
|
+
/** Notifications default position. @default 'bottom-right' */
|
|
10
|
+
position?: NotificationPosition;
|
|
11
|
+
/** Auto close timeout for all notifications in ms, `false` to disable auto close, can be overwritten for individual notifications in `notifications.show` function. @default 4000 */
|
|
12
|
+
autoClose?: number | false;
|
|
13
|
+
/** Notification transition duration in ms. @default 250 */
|
|
14
|
+
transitionDuration?: number;
|
|
15
|
+
/** Determines whether notifications can be dismissed by dragging left or right. @default true */
|
|
16
|
+
allowDragDismiss?: boolean;
|
|
17
|
+
/** Determines whether notifications can be dismissed with horizontal scroll gesture while hovered. @default true */
|
|
18
|
+
allowScrollDismiss?: boolean;
|
|
19
|
+
/** Notification width, cannot exceed 100%. @default 440 */
|
|
20
|
+
containerWidth?: number | string;
|
|
21
|
+
/** Notification `max-height`, used for transitions. @default 200 */
|
|
22
|
+
notificationMaxHeight?: number | string;
|
|
23
|
+
/** Maximum number of notifications displayed at a time, other new notifications will be added to queue. @default 5 */
|
|
24
|
+
limit?: number;
|
|
25
|
+
/** Notifications container z-index. @default 400 */
|
|
26
|
+
zIndex?: string | number;
|
|
27
|
+
/** Props passed down to the `Portal` component. */
|
|
28
|
+
portalProps?: Record<string, any>;
|
|
29
|
+
/** Store for notifications state, can be used to create multiple instances of notifications system in your application. */
|
|
30
|
+
store?: NotificationsStore;
|
|
31
|
+
/** Determines whether notifications container should be rendered inside `Portal`. @default true */
|
|
32
|
+
withinPortal?: boolean;
|
|
33
|
+
/** Determines which notifications should pause auto close on hover, `'all'` – pauses auto close for all notifications when any notification is hovered, `'notification'` – pauses auto close only for the hovered notification. @default 'all' */
|
|
34
|
+
pauseResetOnHover?: 'all' | 'notification';
|
|
35
|
+
/** CSS classes applied to component elements. */
|
|
36
|
+
classNames?: ClassNames<NotificationsProps>;
|
|
37
|
+
/** Inline styles applied to component elements. */
|
|
38
|
+
styles?: Styles<NotificationsProps>;
|
|
39
|
+
/** CSS variables resolver. */
|
|
40
|
+
vars?: Vars<NotificationsProps>;
|
|
41
|
+
/** Removes default component styles. @default false */
|
|
42
|
+
unstyled?: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NotificationsProps } from './Notifications.types';
|
|
2
|
+
declare const varsResolver: (theme: import("@mantine-vue/core").MantineTheme, props: any, ctx: Record<string, any>) => Record<string, Record<string, string | undefined>>;
|
|
3
|
+
export { varsResolver };
|
|
4
|
+
declare const _default: typeof __VLS_export;
|
|
5
|
+
export default _default;
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<NotificationsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NotificationsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Notifications';
|
package/lib/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { notifications, showNotification, hideNotification, cleanNotifications, cleanNotificationsQueue, updateNotification, updateNotificationsState, createNotificationsStore, notificationsStore, useNotifications, } from './notifications.store';
|
|
2
|
-
export { Notifications } from './Notifications';
|
|
2
|
+
export { Notifications } from './components/Notifications';
|
|
3
3
|
export type { NotificationData, NotificationPosition, NotificationsState, NotificationsStore, } from './notifications.store';
|
|
4
|
-
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './Notifications';
|
|
4
|
+
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './components/Notifications';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { notifications, showNotification, hideNotification, cleanNotifications, cleanNotificationsQueue, updateNotification, updateNotificationsState, createNotificationsStore, notificationsStore, useNotifications, } from './notifications.store';
|
|
2
|
-
export { Notifications } from './Notifications';
|
|
2
|
+
export { Notifications } from './components/Notifications';
|
|
3
3
|
export type { NotificationData, NotificationPosition, NotificationsState, NotificationsStore, } from './notifications.store';
|
|
4
|
-
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './Notifications';
|
|
4
|
+
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './components/Notifications';
|
|
@@ -2,12 +2,21 @@ import { type Ref } from 'vue';
|
|
|
2
2
|
import { type MantineStore } from '@mantine-vue/store';
|
|
3
3
|
export type NotificationPosition = 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center';
|
|
4
4
|
export interface NotificationData extends Record<`data-${string}`, any> {
|
|
5
|
+
/** Notification id, can be used to close or update notification. */
|
|
5
6
|
id?: string;
|
|
7
|
+
/** Position of the notification, if not set, the position is determined based on `position` prop on Notifications component. */
|
|
6
8
|
position?: NotificationPosition;
|
|
9
|
+
/** Notification message, required for all notifications. */
|
|
7
10
|
message: any;
|
|
11
|
+
/** Display priority. Higher numbers are shown before lower ones when the number of active notifications exceeds `limit`. Notifications with equal priority keep insertion order (FIFO). @default 0 */
|
|
12
|
+
priority?: number;
|
|
13
|
+
/** Determines whether notification should be closed automatically, number is auto close timeout in ms, overrides `autoClose` from `Notifications`. */
|
|
8
14
|
autoClose?: boolean | number;
|
|
15
|
+
/** Determines whether notification can be closed with close button, drag or horizontal scroll swipe. @default true */
|
|
9
16
|
allowClose?: boolean;
|
|
17
|
+
/** Called when notification closes. */
|
|
10
18
|
onClose?: (props: NotificationData) => void;
|
|
19
|
+
/** Called when notification opens. */
|
|
11
20
|
onOpen?: (props: NotificationData) => void;
|
|
12
21
|
style?: any;
|
|
13
22
|
withCloseButton?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine-vue/notifications",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Vue notifications system equivalent to @mantine/notifications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"vue": "^3.5.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@mantine-vue/core": "3.
|
|
44
|
-
"@mantine-vue/hooks": "3.
|
|
45
|
-
"@mantine-vue/store": "3.
|
|
43
|
+
"@mantine-vue/core": "3.2.0",
|
|
44
|
+
"@mantine-vue/hooks": "3.2.0",
|
|
45
|
+
"@mantine-vue/store": "3.2.0",
|
|
46
46
|
"vue": "^3.5.0"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { type PropType } from 'vue';
|
|
2
|
-
import type { NotificationData } from './notifications.store';
|
|
3
|
-
export declare const NotificationContainer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
data: {
|
|
5
|
-
type: PropType<NotificationData>;
|
|
6
|
-
required: true;
|
|
7
|
-
};
|
|
8
|
-
autoClose: {
|
|
9
|
-
type: PropType<number | false>;
|
|
10
|
-
required: true;
|
|
11
|
-
};
|
|
12
|
-
transitionDuration: {
|
|
13
|
-
type: NumberConstructor;
|
|
14
|
-
required: true;
|
|
15
|
-
};
|
|
16
|
-
allowDragDismiss: {
|
|
17
|
-
type: BooleanConstructor;
|
|
18
|
-
required: true;
|
|
19
|
-
};
|
|
20
|
-
allowScrollDismiss: {
|
|
21
|
-
type: BooleanConstructor;
|
|
22
|
-
required: true;
|
|
23
|
-
};
|
|
24
|
-
paused: {
|
|
25
|
-
type: BooleanConstructor;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
onHide: {
|
|
29
|
-
type: PropType<(id: string) => void>;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
onHoverStart: {
|
|
33
|
-
type: PropType<() => void>;
|
|
34
|
-
default: undefined;
|
|
35
|
-
};
|
|
36
|
-
onHoverEnd: {
|
|
37
|
-
type: PropType<() => void>;
|
|
38
|
-
default: undefined;
|
|
39
|
-
};
|
|
40
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
41
|
-
[key: string]: any;
|
|
42
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
|
-
data: {
|
|
44
|
-
type: PropType<NotificationData>;
|
|
45
|
-
required: true;
|
|
46
|
-
};
|
|
47
|
-
autoClose: {
|
|
48
|
-
type: PropType<number | false>;
|
|
49
|
-
required: true;
|
|
50
|
-
};
|
|
51
|
-
transitionDuration: {
|
|
52
|
-
type: NumberConstructor;
|
|
53
|
-
required: true;
|
|
54
|
-
};
|
|
55
|
-
allowDragDismiss: {
|
|
56
|
-
type: BooleanConstructor;
|
|
57
|
-
required: true;
|
|
58
|
-
};
|
|
59
|
-
allowScrollDismiss: {
|
|
60
|
-
type: BooleanConstructor;
|
|
61
|
-
required: true;
|
|
62
|
-
};
|
|
63
|
-
paused: {
|
|
64
|
-
type: BooleanConstructor;
|
|
65
|
-
required: true;
|
|
66
|
-
};
|
|
67
|
-
onHide: {
|
|
68
|
-
type: PropType<(id: string) => void>;
|
|
69
|
-
required: true;
|
|
70
|
-
};
|
|
71
|
-
onHoverStart: {
|
|
72
|
-
type: PropType<() => void>;
|
|
73
|
-
default: undefined;
|
|
74
|
-
};
|
|
75
|
-
onHoverEnd: {
|
|
76
|
-
type: PropType<() => void>;
|
|
77
|
-
default: undefined;
|
|
78
|
-
};
|
|
79
|
-
}>> & Readonly<{}>, {
|
|
80
|
-
onHoverStart: () => void;
|
|
81
|
-
onHoverEnd: () => void;
|
|
82
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|