@mantine-vue/notifications 3.4.0 → 3.6.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 +82 -8
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +83 -10
- package/esm/index.mjs.map +1 -1
- package/lib/components/NotificationContainer/NotificationContainer.types.d.ts +4 -0
- package/lib/components/Notifications/Notifications.d.ts +1 -0
- package/lib/components/Notifications/Notifications.types.d.ts +3 -1
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/notifications.store.d.ts +15 -0
- package/package.json +4 -4
- package/styles.css +50 -10
- package/styles.layer.css +50 -10
package/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createStore } from "@mantine-vue/store";
|
|
2
|
-
import { Fragment, TransitionGroup, cloneVNode, computed, createBlock, createElementBlock, createVNode, defineComponent, isVNode, mergeProps, onBeforeUnmount, onMounted, openBlock, ref, renderList, resolveDynamicComponent, unref, useAttrs, watch, withCtx } from "vue";
|
|
2
|
+
import { Fragment, TransitionGroup, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, isVNode, mergeProps, onBeforeUnmount, onMounted, openBlock, ref, renderList, resolveDynamicComponent, unref, useAttrs, watch, withCtx } from "vue";
|
|
3
3
|
import { Box, Notification, OptionalPortal, createVarsResolver, getDefaultZIndex, rem, useMantineTheme, useProps, useStyles } from "@mantine-vue/core";
|
|
4
4
|
import { useReducedMotion } from "@mantine-vue/hooks";
|
|
5
5
|
//#region src/notifications.store.ts
|
|
@@ -80,6 +80,46 @@ function updateNotification(notification, store = notificationsStore) {
|
|
|
80
80
|
} : item));
|
|
81
81
|
return notification.id;
|
|
82
82
|
}
|
|
83
|
+
function resolvePromiseNotificationData(data, value) {
|
|
84
|
+
return typeof data === "function" ? data(value) : data;
|
|
85
|
+
}
|
|
86
|
+
function upsertNotification(notification, store) {
|
|
87
|
+
const state = store.getState();
|
|
88
|
+
return [...state.notifications, ...state.queue].some((item) => item.id === notification.id) ? updateNotification(notification, store) : showNotification(notification, store);
|
|
89
|
+
}
|
|
90
|
+
var pendingPromises = /* @__PURE__ */ new WeakMap();
|
|
91
|
+
function promiseNotification(promise, options, store = notificationsStore) {
|
|
92
|
+
const id = options.id || randomId();
|
|
93
|
+
const owners = pendingPromises.get(store) || /* @__PURE__ */ new Map();
|
|
94
|
+
const owner = {};
|
|
95
|
+
pendingPromises.set(store, owners);
|
|
96
|
+
owners.set(id, owner);
|
|
97
|
+
upsertNotification({
|
|
98
|
+
loading: true,
|
|
99
|
+
autoClose: false,
|
|
100
|
+
...options.loading,
|
|
101
|
+
id
|
|
102
|
+
}, store);
|
|
103
|
+
const settle = (data) => {
|
|
104
|
+
if (owners.get(id) !== owner) return;
|
|
105
|
+
owners.delete(id);
|
|
106
|
+
upsertNotification({
|
|
107
|
+
...options.loading,
|
|
108
|
+
loading: false,
|
|
109
|
+
autoClose: void 0,
|
|
110
|
+
...data,
|
|
111
|
+
id
|
|
112
|
+
}, store);
|
|
113
|
+
};
|
|
114
|
+
promise.then((value) => settle({
|
|
115
|
+
color: "teal",
|
|
116
|
+
...resolvePromiseNotificationData(options.success, value)
|
|
117
|
+
}), (error) => settle({
|
|
118
|
+
color: "red",
|
|
119
|
+
...resolvePromiseNotificationData(options.error, error)
|
|
120
|
+
}));
|
|
121
|
+
return promise;
|
|
122
|
+
}
|
|
83
123
|
function cleanNotifications(store = notificationsStore) {
|
|
84
124
|
updateNotificationsState(store, () => []);
|
|
85
125
|
}
|
|
@@ -91,6 +131,7 @@ var notifications = {
|
|
|
91
131
|
show: showNotification,
|
|
92
132
|
hide: hideNotification,
|
|
93
133
|
update: updateNotification,
|
|
134
|
+
promise: promiseNotification,
|
|
94
135
|
clean: cleanNotifications,
|
|
95
136
|
cleanQueue: cleanNotificationsQueue,
|
|
96
137
|
updateState: updateNotificationsState
|
|
@@ -105,6 +146,7 @@ function getAutoClose(autoClose, notificationAutoClose) {
|
|
|
105
146
|
//#endregion
|
|
106
147
|
//#region src/components/NotificationContainer/NotificationContainer.vue?vue&type=script&setup=true&lang.ts
|
|
107
148
|
var _hoisted_1 = ["role", "inert"];
|
|
149
|
+
var _hoisted_2 = ["data-paused"];
|
|
108
150
|
var SCROLL_DISMISS_RESET_TIMEOUT = 120;
|
|
109
151
|
var MAX_VISIBLE_STACK_DEPTH = 4;
|
|
110
152
|
//#endregion
|
|
@@ -120,6 +162,8 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
120
162
|
allowDragDismiss: { type: Boolean },
|
|
121
163
|
allowScrollDismiss: { type: Boolean },
|
|
122
164
|
paused: { type: Boolean },
|
|
165
|
+
withAutoCloseProgress: { type: Boolean },
|
|
166
|
+
progressProps: {},
|
|
123
167
|
renderNotification: { type: [Function, null] },
|
|
124
168
|
layout: {},
|
|
125
169
|
stackIndex: {},
|
|
@@ -148,6 +192,8 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
148
192
|
const scrollDismissActive = ref(false);
|
|
149
193
|
const hovered = ref(false);
|
|
150
194
|
const focused = ref(false);
|
|
195
|
+
const progressRunning = ref(false);
|
|
196
|
+
const progressCycle = ref(0);
|
|
151
197
|
const contributedActive = ref(false);
|
|
152
198
|
const startX = ref(0);
|
|
153
199
|
const startTime = ref(0);
|
|
@@ -156,6 +202,7 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
156
202
|
let scrollDismissTimeout = -1;
|
|
157
203
|
let resizeObserver;
|
|
158
204
|
const autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose));
|
|
205
|
+
const hasAutoCloseProgress = computed(() => (props.data.withAutoCloseProgress ?? props.withAutoCloseProgress) && typeof autoCloseDuration.value === "number");
|
|
159
206
|
const isCloseDisabled = computed(() => props.data.allowClose === false);
|
|
160
207
|
function normalizeStyle(style) {
|
|
161
208
|
if (!style) return {};
|
|
@@ -175,7 +222,8 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
175
222
|
"id",
|
|
176
223
|
"renderNotification",
|
|
177
224
|
"priority",
|
|
178
|
-
"__sequence"
|
|
225
|
+
"__sequence",
|
|
226
|
+
"withAutoCloseProgress"
|
|
179
227
|
]);
|
|
180
228
|
return Object.fromEntries(Object.entries(props.data).filter(([key]) => !omittedKeys.has(key)).map(([key, value]) => [key, cloneRenderable(value)]));
|
|
181
229
|
}
|
|
@@ -232,7 +280,10 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
232
280
|
};
|
|
233
281
|
});
|
|
234
282
|
const isCollapsed = computed(() => props.layout === "stacked" && (props.stackIndex ?? 0) > 0 && !props.stackExpanded);
|
|
235
|
-
const cancelAutoClose = () =>
|
|
283
|
+
const cancelAutoClose = () => {
|
|
284
|
+
window.clearTimeout(autoCloseTimeout);
|
|
285
|
+
progressRunning.value = false;
|
|
286
|
+
};
|
|
236
287
|
const cancelHide = () => window.clearTimeout(hideTimeout);
|
|
237
288
|
const cancelScrollDismissReset = () => window.clearTimeout(scrollDismissTimeout);
|
|
238
289
|
function handleHide() {
|
|
@@ -245,6 +296,10 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
245
296
|
if (typeof window === "undefined" || dismissed.value || active.value || props.paused || hovered.value || focused.value || typeof autoCloseDuration.value !== "number") return;
|
|
246
297
|
cancelAutoClose();
|
|
247
298
|
autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value);
|
|
299
|
+
if (hasAutoCloseProgress.value) {
|
|
300
|
+
progressCycle.value += 1;
|
|
301
|
+
progressRunning.value = true;
|
|
302
|
+
}
|
|
248
303
|
}
|
|
249
304
|
function getExitOffset(direction) {
|
|
250
305
|
return direction * ((notificationRef.value?.offsetWidth ?? 440) + 40);
|
|
@@ -378,7 +433,8 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
378
433
|
autoCloseDuration,
|
|
379
434
|
active,
|
|
380
435
|
dismissed,
|
|
381
|
-
() => props.paused
|
|
436
|
+
() => props.paused,
|
|
437
|
+
hasAutoCloseProgress
|
|
382
438
|
], () => {
|
|
383
439
|
if (props.paused) cancelAutoClose();
|
|
384
440
|
else handleAutoClose();
|
|
@@ -443,7 +499,13 @@ var NotificationContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
443
499
|
onPointerdownCapture: handlePointerDownCapture,
|
|
444
500
|
onPointerdown: handlePointerDown
|
|
445
501
|
}), {
|
|
446
|
-
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(renderMessage)))
|
|
502
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(renderMessage))), hasAutoCloseProgress.value ? (openBlock(), createElementBlock("div", mergeProps({
|
|
503
|
+
key: progressCycle.value,
|
|
504
|
+
"aria-hidden": "true"
|
|
505
|
+
}, props.progressProps, {
|
|
506
|
+
"data-paused": !progressRunning.value || void 0,
|
|
507
|
+
style: [props.progressProps.style, { "--notifications-progress-duration": `${autoCloseDuration.value}ms` }]
|
|
508
|
+
}), null, 16, _hoisted_2)) : createCommentVNode("", true)]),
|
|
447
509
|
_: 1
|
|
448
510
|
}, 16, [
|
|
449
511
|
"style",
|
|
@@ -521,8 +583,11 @@ function getNotificationStateStyles({ state, maxHeight, position, transitionDura
|
|
|
521
583
|
};
|
|
522
584
|
}
|
|
523
585
|
var Notifications_module_default = {
|
|
524
|
-
root: "
|
|
525
|
-
notification: "
|
|
586
|
+
root: "_root_76vbt_1",
|
|
587
|
+
notification: "_notification_76vbt_40",
|
|
588
|
+
progress: "_progress_76vbt_56",
|
|
589
|
+
"notifications-progress": "_notifications-progress_76vbt_1",
|
|
590
|
+
"notifications-progress-fade-in": "_notifications-progress-fade-in_76vbt_1"
|
|
526
591
|
};
|
|
527
592
|
//#endregion
|
|
528
593
|
//#region src/components/Notifications/Notifications.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -564,6 +629,10 @@ var Notifications = Object.assign(/* @__PURE__ */ defineComponent({
|
|
|
564
629
|
pauseResetOnHover: { default: "all" },
|
|
565
630
|
renderNotification: {},
|
|
566
631
|
layout: { default: "default" },
|
|
632
|
+
withAutoCloseProgress: {
|
|
633
|
+
type: Boolean,
|
|
634
|
+
default: false
|
|
635
|
+
},
|
|
567
636
|
classNames: {},
|
|
568
637
|
styles: {},
|
|
569
638
|
vars: {},
|
|
@@ -591,8 +660,7 @@ var Notifications = Object.assign(/* @__PURE__ */ defineComponent({
|
|
|
591
660
|
name: "Notifications",
|
|
592
661
|
classes: Notifications_module_default,
|
|
593
662
|
props,
|
|
594
|
-
|
|
595
|
-
style: attrs.style,
|
|
663
|
+
attrs,
|
|
596
664
|
classNames: props.classNames,
|
|
597
665
|
styles: props.styles,
|
|
598
666
|
unstyled: props.unstyled,
|
|
@@ -740,6 +808,8 @@ var Notifications = Object.assign(/* @__PURE__ */ defineComponent({
|
|
|
740
808
|
paused: unref(props).pauseResetOnHover === "all" && hoveredCount.value > 0 || unref(props).layout === "stacked" && !isStackExpanded(position) && stackIndex > 0,
|
|
741
809
|
"render-notification": "renderNotification" in notification ? notification.renderNotification : unref(props).renderNotification,
|
|
742
810
|
layout: unref(props).layout,
|
|
811
|
+
"with-auto-close-progress": unref(props).withAutoCloseProgress,
|
|
812
|
+
"progress-props": unref(getStyles)("progress"),
|
|
743
813
|
"stack-index": stackIndex,
|
|
744
814
|
"stack-size": orderedGroup(position).length,
|
|
745
815
|
"stack-position": position,
|
|
@@ -763,6 +833,8 @@ var Notifications = Object.assign(/* @__PURE__ */ defineComponent({
|
|
|
763
833
|
"paused",
|
|
764
834
|
"render-notification",
|
|
765
835
|
"layout",
|
|
836
|
+
"with-auto-close-progress",
|
|
837
|
+
"progress-props",
|
|
766
838
|
"stack-index",
|
|
767
839
|
"stack-size",
|
|
768
840
|
"stack-position",
|
|
@@ -801,11 +873,12 @@ var Notifications = Object.assign(/* @__PURE__ */ defineComponent({
|
|
|
801
873
|
show: notifications.show,
|
|
802
874
|
hide: notifications.hide,
|
|
803
875
|
update: notifications.update,
|
|
876
|
+
promise: notifications.promise,
|
|
804
877
|
clean: notifications.clean,
|
|
805
878
|
cleanQueue: notifications.cleanQueue,
|
|
806
879
|
updateState: notifications.updateState
|
|
807
880
|
});
|
|
808
881
|
//#endregion
|
|
809
|
-
export { Notifications, cleanNotifications, cleanNotificationsQueue, createNotificationsStore, hideNotification, notifications, notificationsStore, showNotification, updateNotification, updateNotificationsState, useNotifications };
|
|
882
|
+
export { Notifications, cleanNotifications, cleanNotificationsQueue, createNotificationsStore, hideNotification, notifications, notificationsStore, promiseNotification, showNotification, updateNotification, updateNotificationsState, useNotifications };
|
|
810
883
|
|
|
811
884
|
//# sourceMappingURL=index.mjs.map
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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, type VNodeChild } 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 /** Custom renderer that replaces the default notification. Set to `null` to use default rendering when a global renderer is configured. */\n renderNotification?: ((notification: NotificationData) => VNodeChild) | null\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\nexport interface 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 type CSSProperties,\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\nconst MAX_VISIBLE_STACK_DEPTH = 4\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 focused = ref(false)\nconst contributedActive = ref(false)\nconst startX = ref(0)\nconst startTime = ref(0)\nlet autoCloseTimeout = -1\nlet hideTimeout = -1\nlet scrollDismissTimeout = -1\nlet resizeObserver: ResizeObserver | undefined\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 'renderNotification',\n 'priority',\n '__sequence',\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 renderCustomNotification = () => cloneRenderable(props.renderNotification?.(props.data))\n\nconst notificationStyle = computed<CSSProperties>(() => {\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 const isStackedLayout = props.layout === 'stacked'\n const isStacked = isStackedLayout && (props.stackIndex ?? 0) > 0\n const isCollapsed = isStacked && !props.stackExpanded\n const isExiting = props.transitionState === 'exiting' || props.transitionState === 'exited'\n const stackDirection = props.stackPosition?.startsWith('top') ? 1 : -1\n const stackDepth = Math.min(props.stackIndex ?? 0, MAX_VISIBLE_STACK_DEPTH)\n const collapsedOffset = isCollapsed ? stackDepth * 10 * stackDirection : 0\n const staggerDelay = isStackedLayout ? (props.stackIndex ?? 0) * 30 : 0\n const isDragging = active.value || scrollDismissActive.value\n\n let transform =\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)'\n\n if (isStackedLayout) {\n if (isExiting) {\n const exitOffset = props.stackExpanded ? (props.stackExpandedOffset ?? 0) : collapsedOffset\n transform = `translateY(${exitOffset}px) ${transform}`\n } else if (props.stackExpanded) {\n transform = `translateY(${props.stackExpandedOffset ?? 0}px) translate3d(var(--notifications-swipe-offset), 0, 0)`\n } else if (isStacked) {\n transform = `scale(${1 - stackDepth * 0.03}) translateY(${collapsedOffset}px)`\n }\n }\n\n return {\n ...baseStyle,\n ...(isStackedLayout ? { maxHeight: undefined } : {}),\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 opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration: isDragging ? '0ms, 0ms, 0ms' : transitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n ...(isStackedLayout\n ? {\n gridArea: '1 / 1',\n zIndex: (props.stackSize ?? 5) - (props.stackIndex ?? 0),\n pointerEvents: isCollapsed ? ('none' as const) : undefined,\n alignSelf: stackDirection === 1 ? ('start' as const) : ('end' as const),\n transition: isDragging\n ? 'none'\n : `transform ${props.transitionDuration}ms cubic-bezier(.51,.3,0,1.21), opacity ${props.transitionDuration}ms ease`,\n transitionDelay: isDragging || isExiting ? '0ms' : `${staggerDelay}ms`,\n }\n : {}),\n }\n})\n\nconst isCollapsed = computed(\n () => props.layout === 'stacked' && (props.stackIndex ?? 0) > 0 && !props.stackExpanded,\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 focused.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 syncActiveContribution()\n}\n\nfunction syncActiveContribution() {\n const isActive = hovered.value || focused.value\n if (isActive && !contributedActive.value) {\n contributedActive.value = true\n emit('hoverStart')\n } else if (!isActive && contributedActive.value) {\n contributedActive.value = false\n emit('hoverEnd')\n }\n}\n\nfunction handleFocusIn() {\n if (props.layout !== 'stacked') return\n focused.value = true\n cancelAutoClose()\n syncActiveContribution()\n}\n\nfunction handleFocusOut(event: FocusEvent) {\n if (props.layout !== 'stacked') return\n const next = event.relatedTarget as Node | null\n if (next && notificationRef.value?.contains(next)) return\n focused.value = false\n if (!scrollDismissActive.value) handleAutoClose()\n syncActiveContribution()\n}\n\nfunction handlePointerDownCapture(event: PointerEvent) {\n if (\n props.layout === 'stacked' &&\n (event.pointerType === 'touch' || event.pointerType === 'pen')\n ) {\n emit('expandRequest')\n }\n}\n\nfunction handleMouseLeave() {\n hovered.value = false\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n syncActiveContribution()\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 if (notificationRef.value) {\n emit('heightChange', notificationRef.value.offsetHeight)\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => {\n if (notificationRef.value) emit('heightChange', notificationRef.value.offsetHeight)\n })\n resizeObserver.observe(notificationRef.value)\n }\n }\n})\n\nfunction handleResize() {\n if (dismissed.value) offset.value = getExitOffset(dismissDirection.value)\n}\n\nonBeforeUnmount(() => {\n hovered.value = false\n focused.value = false\n syncActiveContribution()\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n resizeObserver?.disconnect()\n})\n\nfunction setNotificationRef(node: any) {\n notificationRef.value = node?.$el ?? node ?? null\n}\n</script>\n\n<template>\n <div\n v-if=\"props.renderNotification\"\n v-bind=\"attrs\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :role=\"(attrs.role as string) || 'alert'\"\n :inert=\"isCollapsed || undefined\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderCustomNotification\" />\n </div>\n <Notification\n v-else\n v-bind=\"{ ...attrs, ...getNotificationProps() }\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :inert=\"isCollapsed || undefined\"\n :with-close-button=\"isCloseDisabled ? false : props.data.withCloseButton\"\n @close=\"handleHide\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\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 type CSSProperties,\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\nconst MAX_VISIBLE_STACK_DEPTH = 4\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 focused = ref(false)\nconst contributedActive = ref(false)\nconst startX = ref(0)\nconst startTime = ref(0)\nlet autoCloseTimeout = -1\nlet hideTimeout = -1\nlet scrollDismissTimeout = -1\nlet resizeObserver: ResizeObserver | undefined\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 'renderNotification',\n 'priority',\n '__sequence',\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 renderCustomNotification = () => cloneRenderable(props.renderNotification?.(props.data))\n\nconst notificationStyle = computed<CSSProperties>(() => {\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 const isStackedLayout = props.layout === 'stacked'\n const isStacked = isStackedLayout && (props.stackIndex ?? 0) > 0\n const isCollapsed = isStacked && !props.stackExpanded\n const isExiting = props.transitionState === 'exiting' || props.transitionState === 'exited'\n const stackDirection = props.stackPosition?.startsWith('top') ? 1 : -1\n const stackDepth = Math.min(props.stackIndex ?? 0, MAX_VISIBLE_STACK_DEPTH)\n const collapsedOffset = isCollapsed ? stackDepth * 10 * stackDirection : 0\n const staggerDelay = isStackedLayout ? (props.stackIndex ?? 0) * 30 : 0\n const isDragging = active.value || scrollDismissActive.value\n\n let transform =\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)'\n\n if (isStackedLayout) {\n if (isExiting) {\n const exitOffset = props.stackExpanded ? (props.stackExpandedOffset ?? 0) : collapsedOffset\n transform = `translateY(${exitOffset}px) ${transform}`\n } else if (props.stackExpanded) {\n transform = `translateY(${props.stackExpandedOffset ?? 0}px) translate3d(var(--notifications-swipe-offset), 0, 0)`\n } else if (isStacked) {\n transform = `scale(${1 - stackDepth * 0.03}) translateY(${collapsedOffset}px)`\n }\n }\n\n return {\n ...baseStyle,\n ...(isStackedLayout ? { maxHeight: undefined } : {}),\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 opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration: isDragging ? '0ms, 0ms, 0ms' : transitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n ...(isStackedLayout\n ? {\n gridArea: '1 / 1',\n zIndex: (props.stackSize ?? 5) - (props.stackIndex ?? 0),\n pointerEvents: isCollapsed ? ('none' as const) : undefined,\n alignSelf: stackDirection === 1 ? ('start' as const) : ('end' as const),\n transition: isDragging\n ? 'none'\n : `transform ${props.transitionDuration}ms cubic-bezier(.51,.3,0,1.21), opacity ${props.transitionDuration}ms ease`,\n transitionDelay: isDragging || isExiting ? '0ms' : `${staggerDelay}ms`,\n }\n : {}),\n }\n})\n\nconst isCollapsed = computed(\n () => props.layout === 'stacked' && (props.stackIndex ?? 0) > 0 && !props.stackExpanded,\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 focused.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 syncActiveContribution()\n}\n\nfunction syncActiveContribution() {\n const isActive = hovered.value || focused.value\n if (isActive && !contributedActive.value) {\n contributedActive.value = true\n emit('hoverStart')\n } else if (!isActive && contributedActive.value) {\n contributedActive.value = false\n emit('hoverEnd')\n }\n}\n\nfunction handleFocusIn() {\n if (props.layout !== 'stacked') return\n focused.value = true\n cancelAutoClose()\n syncActiveContribution()\n}\n\nfunction handleFocusOut(event: FocusEvent) {\n if (props.layout !== 'stacked') return\n const next = event.relatedTarget as Node | null\n if (next && notificationRef.value?.contains(next)) return\n focused.value = false\n if (!scrollDismissActive.value) handleAutoClose()\n syncActiveContribution()\n}\n\nfunction handlePointerDownCapture(event: PointerEvent) {\n if (\n props.layout === 'stacked' &&\n (event.pointerType === 'touch' || event.pointerType === 'pen')\n ) {\n emit('expandRequest')\n }\n}\n\nfunction handleMouseLeave() {\n hovered.value = false\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n syncActiveContribution()\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 if (notificationRef.value) {\n emit('heightChange', notificationRef.value.offsetHeight)\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => {\n if (notificationRef.value) emit('heightChange', notificationRef.value.offsetHeight)\n })\n resizeObserver.observe(notificationRef.value)\n }\n }\n})\n\nfunction handleResize() {\n if (dismissed.value) offset.value = getExitOffset(dismissDirection.value)\n}\n\nonBeforeUnmount(() => {\n hovered.value = false\n focused.value = false\n syncActiveContribution()\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n resizeObserver?.disconnect()\n})\n\nfunction setNotificationRef(node: any) {\n notificationRef.value = node?.$el ?? node ?? null\n}\n</script>\n\n<template>\n <div\n v-if=\"props.renderNotification\"\n v-bind=\"attrs\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :role=\"(attrs.role as string) || 'alert'\"\n :inert=\"isCollapsed || undefined\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderCustomNotification\" />\n </div>\n <Notification\n v-else\n v-bind=\"{ ...attrs, ...getNotificationProps() }\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :inert=\"isCollapsed || undefined\"\n :with-close-button=\"isCloseDisabled ? false : props.data.withCloseButton\"\n @close=\"handleHide\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\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 :where([data-layout='stacked']) & {\n margin-top: 0;\n }\n}\n\n.root:where([data-layout='stacked']) {\n & > * {\n display: grid;\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, onBeforeUnmount, onMounted, 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 {\n NotificationData,\n NotificationPosition,\n SequencedNotificationData,\n} 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 layout: 'default',\n})\nconst attrs = useAttrs()\nconst props = useProps('Notifications', null, rawProps)\nconst theme = useMantineTheme()\nconst shouldReduceMotion = useReducedMotion()\nconst STACK_EXPANDED_GAP = 16\nconst FALLBACK_NOTIFICATION_HEIGHT = 80\nconst hoveredCounts = ref<Partial<Record<NotificationPosition, number>>>({})\nconst hoveredGroups = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst expandedPositions = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst pinnedPosition = ref<NotificationPosition | null>(null)\nconst notificationHeights = ref<Record<string, number>>({})\nconst collapseTimeouts: Partial<Record<NotificationPosition, number>> = {}\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))\nconst hoveredCount = computed(\n () =>\n Object.values(hoveredCounts.value).reduce((sum, value) => sum + (value ?? 0), 0) +\n Object.values(hoveredGroups.value).filter(Boolean).length,\n)\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\nfunction isStackExpanded(position: NotificationPosition) {\n return props.layout === 'stacked' && Boolean(expandedPositions.value[position])\n}\n\nfunction orderedGroup(position: NotificationPosition) {\n const items = grouped.value[position]\n if (props.layout !== 'stacked') return items\n return [...(items as SequencedNotificationData[])].sort(\n (a, b) => (b.priority ?? 0) - (a.priority ?? 0) || (b.__sequence ?? 0) - (a.__sequence ?? 0),\n )\n}\n\nfunction expandedOffset(position: NotificationPosition, index: number) {\n if (!isStackExpanded(position)) return 0\n const direction = position.startsWith('top') ? 1 : -1\n return (\n orderedGroup(position)\n .slice(0, index)\n .reduce(\n (sum, item) =>\n sum +\n (notificationHeights.value[item.id!] ?? FALLBACK_NOTIFICATION_HEIGHT) +\n STACK_EXPANDED_GAP,\n 0,\n ) * direction\n )\n}\n\nfunction setExpanded(position: NotificationPosition, expanded: boolean) {\n expandedPositions.value = { ...expandedPositions.value, [position]: expanded }\n}\n\nfunction scheduleCollapse(position: NotificationPosition) {\n window.clearTimeout(collapseTimeouts[position])\n if (\n (hoveredCounts.value[position] ?? 0) > 0 ||\n hoveredGroups.value[position] ||\n pinnedPosition.value === position\n )\n return\n collapseTimeouts[position] = window.setTimeout(() => setExpanded(position, false), 200)\n}\n\nfunction handleHoverStart(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: (hoveredCounts.value[position] ?? 0) + 1,\n }\n if (props.layout === 'stacked') setExpanded(position, true)\n}\n\nfunction handleHoverEnd(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: Math.max(0, (hoveredCounts.value[position] ?? 0) - 1),\n }\n if (props.layout === 'stacked') scheduleCollapse(position)\n}\n\nfunction handleGroupHover(position: NotificationPosition, hovered: boolean) {\n if (props.layout !== 'stacked') return\n hoveredGroups.value = { ...hoveredGroups.value, [position]: hovered }\n if (hovered) {\n window.clearTimeout(collapseTimeouts[position])\n setExpanded(position, true)\n } else scheduleCollapse(position)\n}\n\nfunction handleExpandRequest(position: NotificationPosition) {\n pinnedPosition.value = position\n setExpanded(position, true)\n}\n\nfunction handleDocumentPointerDown(event: PointerEvent) {\n if (!pinnedPosition.value) return\n const target = event.target as Element | null\n if (!target?.closest(`[data-notifications-position=\"${pinnedPosition.value}\"]`)) {\n const previous = pinnedPosition.value\n pinnedPosition.value = null\n scheduleCollapse(previous)\n }\n}\n\nwatch(\n () => props.layout,\n (layout) => {\n if (layout !== 'stacked') {\n pinnedPosition.value = null\n hoveredGroups.value = {}\n expandedPositions.value = {}\n }\n },\n)\n\nwatch(grouped, (groups) => {\n if (pinnedPosition.value && groups[pinnedPosition.value].length === 0) {\n pinnedPosition.value = null\n }\n})\n\nonMounted(() => document.addEventListener('pointerdown', handleDocumentPointerDown))\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleDocumentPointerDown)\n positions.forEach((position) => window.clearTimeout(collapseTimeouts[position]))\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 :data-notifications-position=\"position\"\n :data-layout=\"props.layout\"\n >\n <TransitionGroup\n tag=\"div\"\n :css=\"false\"\n @mouseenter=\"handleGroupHover(position, true)\"\n @mouseleave=\"handleGroupHover(position, false)\"\n @focusin=\"handleGroupHover(position, true)\"\n @focusout=\"handleGroupHover(position, 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, stackIndex) in orderedGroup(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=\"\n (props.pauseResetOnHover === 'all' && hoveredCount > 0) ||\n (props.layout === 'stacked' && !isStackExpanded(position) && stackIndex > 0)\n \"\n :render-notification=\"\n 'renderNotification' in notification\n ? notification.renderNotification\n : props.renderNotification\n \"\n :layout=\"props.layout\"\n :stack-index=\"stackIndex\"\n :stack-size=\"orderedGroup(position).length\"\n :stack-position=\"position\"\n :stack-expanded=\"isStackExpanded(position)\"\n :stack-expanded-offset=\"expandedOffset(position, stackIndex)\"\n transition-state=\"entered\"\n @hide=\"(id) => hideNotification(id, props.store)\"\n @hover-start=\"handleHoverStart(position)\"\n @hover-end=\"handleHoverEnd(position)\"\n @expand-request=\"handleExpandRequest(position)\"\n @height-change=\"\n (height) =>\n (notificationHeights = { ...notificationHeights, [notification.id!]: height })\n \"\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, onBeforeUnmount, onMounted, 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 {\n NotificationData,\n NotificationPosition,\n SequencedNotificationData,\n} 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 layout: 'default',\n})\nconst attrs = useAttrs()\nconst props = useProps('Notifications', null, rawProps)\nconst theme = useMantineTheme()\nconst shouldReduceMotion = useReducedMotion()\nconst STACK_EXPANDED_GAP = 16\nconst FALLBACK_NOTIFICATION_HEIGHT = 80\nconst hoveredCounts = ref<Partial<Record<NotificationPosition, number>>>({})\nconst hoveredGroups = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst expandedPositions = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst pinnedPosition = ref<NotificationPosition | null>(null)\nconst notificationHeights = ref<Record<string, number>>({})\nconst collapseTimeouts: Partial<Record<NotificationPosition, number>> = {}\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))\nconst hoveredCount = computed(\n () =>\n Object.values(hoveredCounts.value).reduce((sum, value) => sum + (value ?? 0), 0) +\n Object.values(hoveredGroups.value).filter(Boolean).length,\n)\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\nfunction isStackExpanded(position: NotificationPosition) {\n return props.layout === 'stacked' && Boolean(expandedPositions.value[position])\n}\n\nfunction orderedGroup(position: NotificationPosition) {\n const items = grouped.value[position]\n if (props.layout !== 'stacked') return items\n return [...(items as SequencedNotificationData[])].sort(\n (a, b) => (b.priority ?? 0) - (a.priority ?? 0) || (b.__sequence ?? 0) - (a.__sequence ?? 0),\n )\n}\n\nfunction expandedOffset(position: NotificationPosition, index: number) {\n if (!isStackExpanded(position)) return 0\n const direction = position.startsWith('top') ? 1 : -1\n return (\n orderedGroup(position)\n .slice(0, index)\n .reduce(\n (sum, item) =>\n sum +\n (notificationHeights.value[item.id!] ?? FALLBACK_NOTIFICATION_HEIGHT) +\n STACK_EXPANDED_GAP,\n 0,\n ) * direction\n )\n}\n\nfunction setExpanded(position: NotificationPosition, expanded: boolean) {\n expandedPositions.value = { ...expandedPositions.value, [position]: expanded }\n}\n\nfunction scheduleCollapse(position: NotificationPosition) {\n window.clearTimeout(collapseTimeouts[position])\n if (\n (hoveredCounts.value[position] ?? 0) > 0 ||\n hoveredGroups.value[position] ||\n pinnedPosition.value === position\n )\n return\n collapseTimeouts[position] = window.setTimeout(() => setExpanded(position, false), 200)\n}\n\nfunction handleHoverStart(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: (hoveredCounts.value[position] ?? 0) + 1,\n }\n if (props.layout === 'stacked') setExpanded(position, true)\n}\n\nfunction handleHoverEnd(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: Math.max(0, (hoveredCounts.value[position] ?? 0) - 1),\n }\n if (props.layout === 'stacked') scheduleCollapse(position)\n}\n\nfunction handleGroupHover(position: NotificationPosition, hovered: boolean) {\n if (props.layout !== 'stacked') return\n hoveredGroups.value = { ...hoveredGroups.value, [position]: hovered }\n if (hovered) {\n window.clearTimeout(collapseTimeouts[position])\n setExpanded(position, true)\n } else scheduleCollapse(position)\n}\n\nfunction handleExpandRequest(position: NotificationPosition) {\n pinnedPosition.value = position\n setExpanded(position, true)\n}\n\nfunction handleDocumentPointerDown(event: PointerEvent) {\n if (!pinnedPosition.value) return\n const target = event.target as Element | null\n if (!target?.closest(`[data-notifications-position=\"${pinnedPosition.value}\"]`)) {\n const previous = pinnedPosition.value\n pinnedPosition.value = null\n scheduleCollapse(previous)\n }\n}\n\nwatch(\n () => props.layout,\n (layout) => {\n if (layout !== 'stacked') {\n pinnedPosition.value = null\n hoveredGroups.value = {}\n expandedPositions.value = {}\n }\n },\n)\n\nwatch(grouped, (groups) => {\n if (pinnedPosition.value && groups[pinnedPosition.value].length === 0) {\n pinnedPosition.value = null\n }\n})\n\nonMounted(() => document.addEventListener('pointerdown', handleDocumentPointerDown))\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleDocumentPointerDown)\n positions.forEach((position) => window.clearTimeout(collapseTimeouts[position]))\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 :data-notifications-position=\"position\"\n :data-layout=\"props.layout\"\n >\n <TransitionGroup\n tag=\"div\"\n :css=\"false\"\n @mouseenter=\"handleGroupHover(position, true)\"\n @mouseleave=\"handleGroupHover(position, false)\"\n @focusin=\"handleGroupHover(position, true)\"\n @focusout=\"handleGroupHover(position, 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, stackIndex) in orderedGroup(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=\"\n (props.pauseResetOnHover === 'all' && hoveredCount > 0) ||\n (props.layout === 'stacked' && !isStackExpanded(position) && stackIndex > 0)\n \"\n :render-notification=\"\n 'renderNotification' in notification\n ? notification.renderNotification\n : props.renderNotification\n \"\n :layout=\"props.layout\"\n :stack-index=\"stackIndex\"\n :stack-size=\"orderedGroup(position).length\"\n :stack-position=\"position\"\n :stack-expanded=\"isStackExpanded(position)\"\n :stack-expanded-offset=\"expandedOffset(position, stackIndex)\"\n transition-state=\"entered\"\n @hide=\"(id) => hideNotification(id, props.store)\"\n @hover-start=\"handleHoverStart(position)\"\n @hover-end=\"handleHoverEnd(position)\"\n @expand-request=\"handleExpandRequest(position)\"\n @height-change=\"\n (height) =>\n (notificationHeights = { ...notificationHeights, [notification.id!]: height })\n \"\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":";;;;;AA4CA,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,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AK,aAAa,GAAA,GAAA,EAAA,SAAA,KAAA,GACX,MAAA,SAAA,EAAS,gBAAA,EAAA,OAA0B,aAAa,MAAK,CAAA,GAAA;SAC5D,MAAM,iBAAiB,YAAY;SACnC,cAAY,MAAA,KAAA,EAAM;SAClB,uBAAqB,SAAA;SACrB,sBAAoB,MAAA,KAAA,EAAM;SAC1B,wBAAsB,MAAA,KAAA,EAAM;SAC5B,QAAsB,MAAA,KAAA,EAAM,sBAAiB,SAAc,aAAA,QAAY,KAAsB,MAAA,KAAA,EAAM,WAAM,aAAA,CAAmB,gBAAgB,QAAQ,KAAK,aAAU;SAInK,uBAAA,wBAA0D,eAA6B,aAAa,qBAAmC,MAAA,KAAA,EAAM;SAK7I,QAAQ,MAAA,KAAA,EAAM;SACd,eAAa;SACb,cAAY,aAAa,QAAQ,EAAE;SACnC,kBAAgB;SAChB,kBAAgB,gBAAgB,QAAQ;SACxC,yBAAuB,eAAe,UAAU,UAAU;SAC3D,oBAAiB;SAChB,QAAI,OAAA,OAAA,OAAA,MAAG,OAAO,MAAA,gBAAA,EAAiB,IAAI,MAAA,KAAA,EAAM,KAAK;SAC9C,eAAW,WAAE,iBAAiB,QAAQ;SACtC,aAAS,WAAE,eAAe,QAAQ;SAClC,kBAAc,WAAE,oBAAoB,QAAQ;SAC5C,iBAA6B,WAA0B,oBAAA,QAAmB;UAAA,GAAQ,oBAAA;WAAsB,aAAa,KAAM;SAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CElSjG,GAAwB;CACjE,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, type VNodeChild } 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 /** Displays an auto-close progress line, overriding the Notifications default. */\n withAutoCloseProgress?: boolean\n /** Called when notification closes. */\n onClose?: (props: NotificationData) => void\n /** Called when notification opens. */\n onOpen?: (props: NotificationData) => void\n /** Custom renderer that replaces the default notification. Set to `null` to use default rendering when a global renderer is configured. */\n renderNotification?: ((notification: NotificationData) => VNodeChild) | null\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\nexport interface 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 type PromiseNotificationData = Omit<NotificationData, 'id'> &\n Pick<NotificationData, 'message'>\n\nexport interface PromiseNotificationOptions<T> {\n /** Notification id shared by all promise states. */\n id?: string\n /** Notification displayed while the promise is pending. */\n loading: PromiseNotificationData\n /** Notification displayed after resolution, or a function of the resolved value. */\n success: PromiseNotificationData | ((value: T) => PromiseNotificationData)\n /** Notification displayed after rejection, or a function of the rejection reason. */\n error: PromiseNotificationData | ((error: unknown) => PromiseNotificationData)\n}\n\nfunction resolvePromiseNotificationData<T>(\n data: PromiseNotificationData | ((value: T) => PromiseNotificationData),\n value: T,\n) {\n return typeof data === 'function' ? data(value) : data\n}\n\nfunction upsertNotification(notification: NotificationData, store: NotificationsStore) {\n const state = store.getState()\n const exists = [...state.notifications, ...state.queue].some(\n (item) => item.id === notification.id,\n )\n return exists ? updateNotification(notification, store) : showNotification(notification, store)\n}\n\nconst pendingPromises = new WeakMap<NotificationsStore, Map<string, object>>()\n\nexport function promiseNotification<T>(\n promise: Promise<T>,\n options: PromiseNotificationOptions<T>,\n store: NotificationsStore = notificationsStore,\n): Promise<T> {\n const id = options.id || randomId()\n const owners = pendingPromises.get(store) || new Map<string, object>()\n const owner = {}\n pendingPromises.set(store, owners)\n owners.set(id, owner)\n\n upsertNotification(\n { loading: true, autoClose: false, ...options.loading, id } as NotificationData,\n store,\n )\n\n const settle = (data: PromiseNotificationData) => {\n if (owners.get(id) !== owner) return\n owners.delete(id)\n upsertNotification(\n { ...options.loading, loading: false, autoClose: undefined, ...data, id } as NotificationData,\n store,\n )\n }\n\n promise.then(\n (value) => settle({ color: 'teal', ...resolvePromiseNotificationData(options.success, value) }),\n (error) => settle({ color: 'red', ...resolvePromiseNotificationData(options.error, error) }),\n )\n\n return promise\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 promise: promiseNotification,\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 type CSSProperties,\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\nconst MAX_VISIBLE_STACK_DEPTH = 4\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 focused = ref(false)\nconst progressRunning = ref(false)\nconst progressCycle = ref(0)\nconst contributedActive = ref(false)\nconst startX = ref(0)\nconst startTime = ref(0)\nlet autoCloseTimeout = -1\nlet hideTimeout = -1\nlet scrollDismissTimeout = -1\nlet resizeObserver: ResizeObserver | undefined\n\nconst autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose))\nconst hasAutoCloseProgress = computed(\n () =>\n (props.data.withAutoCloseProgress ?? props.withAutoCloseProgress) &&\n typeof autoCloseDuration.value === 'number',\n)\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 'renderNotification',\n 'priority',\n '__sequence',\n 'withAutoCloseProgress',\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 renderCustomNotification = () => cloneRenderable(props.renderNotification?.(props.data))\n\nconst notificationStyle = computed<CSSProperties>(() => {\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 const isStackedLayout = props.layout === 'stacked'\n const isStacked = isStackedLayout && (props.stackIndex ?? 0) > 0\n const isCollapsed = isStacked && !props.stackExpanded\n const isExiting = props.transitionState === 'exiting' || props.transitionState === 'exited'\n const stackDirection = props.stackPosition?.startsWith('top') ? 1 : -1\n const stackDepth = Math.min(props.stackIndex ?? 0, MAX_VISIBLE_STACK_DEPTH)\n const collapsedOffset = isCollapsed ? stackDepth * 10 * stackDirection : 0\n const staggerDelay = isStackedLayout ? (props.stackIndex ?? 0) * 30 : 0\n const isDragging = active.value || scrollDismissActive.value\n\n let transform =\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)'\n\n if (isStackedLayout) {\n if (isExiting) {\n const exitOffset = props.stackExpanded ? (props.stackExpandedOffset ?? 0) : collapsedOffset\n transform = `translateY(${exitOffset}px) ${transform}`\n } else if (props.stackExpanded) {\n transform = `translateY(${props.stackExpandedOffset ?? 0}px) translate3d(var(--notifications-swipe-offset), 0, 0)`\n } else if (isStacked) {\n transform = `scale(${1 - stackDepth * 0.03}) translateY(${collapsedOffset}px)`\n }\n }\n\n return {\n ...baseStyle,\n ...(isStackedLayout ? { maxHeight: undefined } : {}),\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 opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration: isDragging ? '0ms, 0ms, 0ms' : transitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n ...(isStackedLayout\n ? {\n gridArea: '1 / 1',\n zIndex: (props.stackSize ?? 5) - (props.stackIndex ?? 0),\n pointerEvents: isCollapsed ? ('none' as const) : undefined,\n alignSelf: stackDirection === 1 ? ('start' as const) : ('end' as const),\n transition: isDragging\n ? 'none'\n : `transform ${props.transitionDuration}ms cubic-bezier(.51,.3,0,1.21), opacity ${props.transitionDuration}ms ease`,\n transitionDelay: isDragging || isExiting ? '0ms' : `${staggerDelay}ms`,\n }\n : {}),\n }\n})\n\nconst isCollapsed = computed(\n () => props.layout === 'stacked' && (props.stackIndex ?? 0) > 0 && !props.stackExpanded,\n)\n\nconst cancelAutoClose = () => {\n window.clearTimeout(autoCloseTimeout)\n progressRunning.value = false\n}\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 focused.value ||\n typeof autoCloseDuration.value !== 'number'\n )\n return\n\n cancelAutoClose()\n autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value)\n if (hasAutoCloseProgress.value) {\n progressCycle.value += 1\n progressRunning.value = true\n }\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 syncActiveContribution()\n}\n\nfunction syncActiveContribution() {\n const isActive = hovered.value || focused.value\n if (isActive && !contributedActive.value) {\n contributedActive.value = true\n emit('hoverStart')\n } else if (!isActive && contributedActive.value) {\n contributedActive.value = false\n emit('hoverEnd')\n }\n}\n\nfunction handleFocusIn() {\n if (props.layout !== 'stacked') return\n focused.value = true\n cancelAutoClose()\n syncActiveContribution()\n}\n\nfunction handleFocusOut(event: FocusEvent) {\n if (props.layout !== 'stacked') return\n const next = event.relatedTarget as Node | null\n if (next && notificationRef.value?.contains(next)) return\n focused.value = false\n if (!scrollDismissActive.value) handleAutoClose()\n syncActiveContribution()\n}\n\nfunction handlePointerDownCapture(event: PointerEvent) {\n if (\n props.layout === 'stacked' &&\n (event.pointerType === 'touch' || event.pointerType === 'pen')\n ) {\n emit('expandRequest')\n }\n}\n\nfunction handleMouseLeave() {\n hovered.value = false\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n syncActiveContribution()\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, hasAutoCloseProgress],\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 if (notificationRef.value) {\n emit('heightChange', notificationRef.value.offsetHeight)\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => {\n if (notificationRef.value) emit('heightChange', notificationRef.value.offsetHeight)\n })\n resizeObserver.observe(notificationRef.value)\n }\n }\n})\n\nfunction handleResize() {\n if (dismissed.value) offset.value = getExitOffset(dismissDirection.value)\n}\n\nonBeforeUnmount(() => {\n hovered.value = false\n focused.value = false\n syncActiveContribution()\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n resizeObserver?.disconnect()\n})\n\nfunction setNotificationRef(node: any) {\n notificationRef.value = node?.$el ?? node ?? null\n}\n</script>\n\n<template>\n <div\n v-if=\"props.renderNotification\"\n v-bind=\"attrs\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :role=\"(attrs.role as string) || 'alert'\"\n :inert=\"isCollapsed || undefined\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderCustomNotification\" />\n </div>\n <Notification\n v-else\n v-bind=\"{ ...attrs, ...getNotificationProps() }\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :inert=\"isCollapsed || undefined\"\n :with-close-button=\"isCloseDisabled ? false : props.data.withCloseButton\"\n @close=\"handleHide\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderMessage\" />\n <div\n v-if=\"hasAutoCloseProgress\"\n :key=\"progressCycle\"\n aria-hidden=\"true\"\n v-bind=\"props.progressProps\"\n :data-paused=\"!progressRunning || undefined\"\n :style=\"[\n props.progressProps.style,\n { '--notifications-progress-duration': `${autoCloseDuration}ms` },\n ]\"\n />\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 type CSSProperties,\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\nconst MAX_VISIBLE_STACK_DEPTH = 4\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 focused = ref(false)\nconst progressRunning = ref(false)\nconst progressCycle = ref(0)\nconst contributedActive = ref(false)\nconst startX = ref(0)\nconst startTime = ref(0)\nlet autoCloseTimeout = -1\nlet hideTimeout = -1\nlet scrollDismissTimeout = -1\nlet resizeObserver: ResizeObserver | undefined\n\nconst autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose))\nconst hasAutoCloseProgress = computed(\n () =>\n (props.data.withAutoCloseProgress ?? props.withAutoCloseProgress) &&\n typeof autoCloseDuration.value === 'number',\n)\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 'renderNotification',\n 'priority',\n '__sequence',\n 'withAutoCloseProgress',\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 renderCustomNotification = () => cloneRenderable(props.renderNotification?.(props.data))\n\nconst notificationStyle = computed<CSSProperties>(() => {\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 const isStackedLayout = props.layout === 'stacked'\n const isStacked = isStackedLayout && (props.stackIndex ?? 0) > 0\n const isCollapsed = isStacked && !props.stackExpanded\n const isExiting = props.transitionState === 'exiting' || props.transitionState === 'exited'\n const stackDirection = props.stackPosition?.startsWith('top') ? 1 : -1\n const stackDepth = Math.min(props.stackIndex ?? 0, MAX_VISIBLE_STACK_DEPTH)\n const collapsedOffset = isCollapsed ? stackDepth * 10 * stackDirection : 0\n const staggerDelay = isStackedLayout ? (props.stackIndex ?? 0) * 30 : 0\n const isDragging = active.value || scrollDismissActive.value\n\n let transform =\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)'\n\n if (isStackedLayout) {\n if (isExiting) {\n const exitOffset = props.stackExpanded ? (props.stackExpandedOffset ?? 0) : collapsedOffset\n transform = `translateY(${exitOffset}px) ${transform}`\n } else if (props.stackExpanded) {\n transform = `translateY(${props.stackExpandedOffset ?? 0}px) translate3d(var(--notifications-swipe-offset), 0, 0)`\n } else if (isStacked) {\n transform = `scale(${1 - stackDepth * 0.03}) translateY(${collapsedOffset}px)`\n }\n }\n\n return {\n ...baseStyle,\n ...(isStackedLayout ? { maxHeight: undefined } : {}),\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 opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration: isDragging ? '0ms, 0ms, 0ms' : transitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n ...(isStackedLayout\n ? {\n gridArea: '1 / 1',\n zIndex: (props.stackSize ?? 5) - (props.stackIndex ?? 0),\n pointerEvents: isCollapsed ? ('none' as const) : undefined,\n alignSelf: stackDirection === 1 ? ('start' as const) : ('end' as const),\n transition: isDragging\n ? 'none'\n : `transform ${props.transitionDuration}ms cubic-bezier(.51,.3,0,1.21), opacity ${props.transitionDuration}ms ease`,\n transitionDelay: isDragging || isExiting ? '0ms' : `${staggerDelay}ms`,\n }\n : {}),\n }\n})\n\nconst isCollapsed = computed(\n () => props.layout === 'stacked' && (props.stackIndex ?? 0) > 0 && !props.stackExpanded,\n)\n\nconst cancelAutoClose = () => {\n window.clearTimeout(autoCloseTimeout)\n progressRunning.value = false\n}\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 focused.value ||\n typeof autoCloseDuration.value !== 'number'\n )\n return\n\n cancelAutoClose()\n autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value)\n if (hasAutoCloseProgress.value) {\n progressCycle.value += 1\n progressRunning.value = true\n }\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 syncActiveContribution()\n}\n\nfunction syncActiveContribution() {\n const isActive = hovered.value || focused.value\n if (isActive && !contributedActive.value) {\n contributedActive.value = true\n emit('hoverStart')\n } else if (!isActive && contributedActive.value) {\n contributedActive.value = false\n emit('hoverEnd')\n }\n}\n\nfunction handleFocusIn() {\n if (props.layout !== 'stacked') return\n focused.value = true\n cancelAutoClose()\n syncActiveContribution()\n}\n\nfunction handleFocusOut(event: FocusEvent) {\n if (props.layout !== 'stacked') return\n const next = event.relatedTarget as Node | null\n if (next && notificationRef.value?.contains(next)) return\n focused.value = false\n if (!scrollDismissActive.value) handleAutoClose()\n syncActiveContribution()\n}\n\nfunction handlePointerDownCapture(event: PointerEvent) {\n if (\n props.layout === 'stacked' &&\n (event.pointerType === 'touch' || event.pointerType === 'pen')\n ) {\n emit('expandRequest')\n }\n}\n\nfunction handleMouseLeave() {\n hovered.value = false\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n syncActiveContribution()\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, hasAutoCloseProgress],\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 if (notificationRef.value) {\n emit('heightChange', notificationRef.value.offsetHeight)\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => {\n if (notificationRef.value) emit('heightChange', notificationRef.value.offsetHeight)\n })\n resizeObserver.observe(notificationRef.value)\n }\n }\n})\n\nfunction handleResize() {\n if (dismissed.value) offset.value = getExitOffset(dismissDirection.value)\n}\n\nonBeforeUnmount(() => {\n hovered.value = false\n focused.value = false\n syncActiveContribution()\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n resizeObserver?.disconnect()\n})\n\nfunction setNotificationRef(node: any) {\n notificationRef.value = node?.$el ?? node ?? null\n}\n</script>\n\n<template>\n <div\n v-if=\"props.renderNotification\"\n v-bind=\"attrs\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :role=\"(attrs.role as string) || 'alert'\"\n :inert=\"isCollapsed || undefined\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderCustomNotification\" />\n </div>\n <Notification\n v-else\n v-bind=\"{ ...attrs, ...getNotificationProps() }\"\n :ref=\"setNotificationRef\"\n :style=\"notificationStyle\"\n :inert=\"isCollapsed || undefined\"\n :with-close-button=\"isCloseDisabled ? false : props.data.withCloseButton\"\n @close=\"handleHide\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @pointerdown.capture=\"handlePointerDownCapture\"\n @pointerdown=\"handlePointerDown\"\n >\n <component :is=\"renderMessage\" />\n <div\n v-if=\"hasAutoCloseProgress\"\n :key=\"progressCycle\"\n aria-hidden=\"true\"\n v-bind=\"props.progressProps\"\n :data-paused=\"!progressRunning || undefined\"\n :style=\"[\n props.progressProps.style,\n { '--notifications-progress-duration': `${autoCloseDuration}ms` },\n ]\"\n />\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 &:where(& + &) {\n margin-top: var(--mantine-spacing-md);\n }\n\n :where([data-layout='stacked']) & {\n margin-top: 0;\n }\n}\n\n.root:where([data-layout='stacked']) {\n & > * {\n display: grid;\n }\n}\n\n.progress {\n position: absolute;\n bottom: 0;\n inset-inline-start: 0;\n width: 100%;\n height: 3px;\n background-color: var(--notification-color);\n transform: scaleX(0);\n transform-origin: left center;\n transition: opacity 200ms ease;\n animation:\n notifications-progress var(--notifications-progress-duration) linear forwards,\n notifications-progress-fade-in 200ms ease;\n\n @mixin rtl {\n transform-origin: right center;\n }\n\n &:where([data-paused]) {\n opacity: 0;\n animation-play-state: paused, running;\n }\n}\n\n@keyframes notifications-progress {\n from {\n transform: scaleX(0);\n }\n\n to {\n transform: scaleX(1);\n }\n}\n\n@keyframes notifications-progress-fade-in {\n from {\n opacity: 0;\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, onBeforeUnmount, onMounted, 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 {\n NotificationData,\n NotificationPosition,\n SequencedNotificationData,\n} 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 layout: 'default',\n withAutoCloseProgress: false,\n})\nconst attrs = useAttrs()\nconst props = useProps('Notifications', null, rawProps)\nconst theme = useMantineTheme()\nconst shouldReduceMotion = useReducedMotion()\nconst STACK_EXPANDED_GAP = 16\nconst FALLBACK_NOTIFICATION_HEIGHT = 80\nconst hoveredCounts = ref<Partial<Record<NotificationPosition, number>>>({})\nconst hoveredGroups = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst expandedPositions = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst pinnedPosition = ref<NotificationPosition | null>(null)\nconst notificationHeights = ref<Record<string, number>>({})\nconst collapseTimeouts: Partial<Record<NotificationPosition, number>> = {}\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))\nconst hoveredCount = computed(\n () =>\n Object.values(hoveredCounts.value).reduce((sum, value) => sum + (value ?? 0), 0) +\n Object.values(hoveredGroups.value).filter(Boolean).length,\n)\n\nconst getStyles = useStyles({\n name: 'Notifications',\n classes,\n props,\n attrs,\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\nfunction isStackExpanded(position: NotificationPosition) {\n return props.layout === 'stacked' && Boolean(expandedPositions.value[position])\n}\n\nfunction orderedGroup(position: NotificationPosition) {\n const items = grouped.value[position]\n if (props.layout !== 'stacked') return items\n return [...(items as SequencedNotificationData[])].sort(\n (a, b) => (b.priority ?? 0) - (a.priority ?? 0) || (b.__sequence ?? 0) - (a.__sequence ?? 0),\n )\n}\n\nfunction expandedOffset(position: NotificationPosition, index: number) {\n if (!isStackExpanded(position)) return 0\n const direction = position.startsWith('top') ? 1 : -1\n return (\n orderedGroup(position)\n .slice(0, index)\n .reduce(\n (sum, item) =>\n sum +\n (notificationHeights.value[item.id!] ?? FALLBACK_NOTIFICATION_HEIGHT) +\n STACK_EXPANDED_GAP,\n 0,\n ) * direction\n )\n}\n\nfunction setExpanded(position: NotificationPosition, expanded: boolean) {\n expandedPositions.value = { ...expandedPositions.value, [position]: expanded }\n}\n\nfunction scheduleCollapse(position: NotificationPosition) {\n window.clearTimeout(collapseTimeouts[position])\n if (\n (hoveredCounts.value[position] ?? 0) > 0 ||\n hoveredGroups.value[position] ||\n pinnedPosition.value === position\n )\n return\n collapseTimeouts[position] = window.setTimeout(() => setExpanded(position, false), 200)\n}\n\nfunction handleHoverStart(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: (hoveredCounts.value[position] ?? 0) + 1,\n }\n if (props.layout === 'stacked') setExpanded(position, true)\n}\n\nfunction handleHoverEnd(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: Math.max(0, (hoveredCounts.value[position] ?? 0) - 1),\n }\n if (props.layout === 'stacked') scheduleCollapse(position)\n}\n\nfunction handleGroupHover(position: NotificationPosition, hovered: boolean) {\n if (props.layout !== 'stacked') return\n hoveredGroups.value = { ...hoveredGroups.value, [position]: hovered }\n if (hovered) {\n window.clearTimeout(collapseTimeouts[position])\n setExpanded(position, true)\n } else scheduleCollapse(position)\n}\n\nfunction handleExpandRequest(position: NotificationPosition) {\n pinnedPosition.value = position\n setExpanded(position, true)\n}\n\nfunction handleDocumentPointerDown(event: PointerEvent) {\n if (!pinnedPosition.value) return\n const target = event.target as Element | null\n if (!target?.closest(`[data-notifications-position=\"${pinnedPosition.value}\"]`)) {\n const previous = pinnedPosition.value\n pinnedPosition.value = null\n scheduleCollapse(previous)\n }\n}\n\nwatch(\n () => props.layout,\n (layout) => {\n if (layout !== 'stacked') {\n pinnedPosition.value = null\n hoveredGroups.value = {}\n expandedPositions.value = {}\n }\n },\n)\n\nwatch(grouped, (groups) => {\n if (pinnedPosition.value && groups[pinnedPosition.value].length === 0) {\n pinnedPosition.value = null\n }\n})\n\nonMounted(() => document.addEventListener('pointerdown', handleDocumentPointerDown))\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleDocumentPointerDown)\n positions.forEach((position) => window.clearTimeout(collapseTimeouts[position]))\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 :data-notifications-position=\"position\"\n :data-layout=\"props.layout\"\n >\n <TransitionGroup\n tag=\"div\"\n :css=\"false\"\n @mouseenter=\"handleGroupHover(position, true)\"\n @mouseleave=\"handleGroupHover(position, false)\"\n @focusin=\"handleGroupHover(position, true)\"\n @focusout=\"handleGroupHover(position, 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, stackIndex) in orderedGroup(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=\"\n (props.pauseResetOnHover === 'all' && hoveredCount > 0) ||\n (props.layout === 'stacked' && !isStackExpanded(position) && stackIndex > 0)\n \"\n :render-notification=\"\n 'renderNotification' in notification\n ? notification.renderNotification\n : props.renderNotification\n \"\n :layout=\"props.layout\"\n :with-auto-close-progress=\"props.withAutoCloseProgress\"\n :progress-props=\"getStyles('progress')\"\n :stack-index=\"stackIndex\"\n :stack-size=\"orderedGroup(position).length\"\n :stack-position=\"position\"\n :stack-expanded=\"isStackExpanded(position)\"\n :stack-expanded-offset=\"expandedOffset(position, stackIndex)\"\n transition-state=\"entered\"\n @hide=\"(id) => hideNotification(id, props.store)\"\n @hover-start=\"handleHoverStart(position)\"\n @hover-end=\"handleHoverEnd(position)\"\n @expand-request=\"handleExpandRequest(position)\"\n @height-change=\"\n (height) =>\n (notificationHeights = { ...notificationHeights, [notification.id!]: height })\n \"\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, onBeforeUnmount, onMounted, 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 {\n NotificationData,\n NotificationPosition,\n SequencedNotificationData,\n} 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 layout: 'default',\n withAutoCloseProgress: false,\n})\nconst attrs = useAttrs()\nconst props = useProps('Notifications', null, rawProps)\nconst theme = useMantineTheme()\nconst shouldReduceMotion = useReducedMotion()\nconst STACK_EXPANDED_GAP = 16\nconst FALLBACK_NOTIFICATION_HEIGHT = 80\nconst hoveredCounts = ref<Partial<Record<NotificationPosition, number>>>({})\nconst hoveredGroups = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst expandedPositions = ref<Partial<Record<NotificationPosition, boolean>>>({})\nconst pinnedPosition = ref<NotificationPosition | null>(null)\nconst notificationHeights = ref<Record<string, number>>({})\nconst collapseTimeouts: Partial<Record<NotificationPosition, number>> = {}\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))\nconst hoveredCount = computed(\n () =>\n Object.values(hoveredCounts.value).reduce((sum, value) => sum + (value ?? 0), 0) +\n Object.values(hoveredGroups.value).filter(Boolean).length,\n)\n\nconst getStyles = useStyles({\n name: 'Notifications',\n classes,\n props,\n attrs,\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\nfunction isStackExpanded(position: NotificationPosition) {\n return props.layout === 'stacked' && Boolean(expandedPositions.value[position])\n}\n\nfunction orderedGroup(position: NotificationPosition) {\n const items = grouped.value[position]\n if (props.layout !== 'stacked') return items\n return [...(items as SequencedNotificationData[])].sort(\n (a, b) => (b.priority ?? 0) - (a.priority ?? 0) || (b.__sequence ?? 0) - (a.__sequence ?? 0),\n )\n}\n\nfunction expandedOffset(position: NotificationPosition, index: number) {\n if (!isStackExpanded(position)) return 0\n const direction = position.startsWith('top') ? 1 : -1\n return (\n orderedGroup(position)\n .slice(0, index)\n .reduce(\n (sum, item) =>\n sum +\n (notificationHeights.value[item.id!] ?? FALLBACK_NOTIFICATION_HEIGHT) +\n STACK_EXPANDED_GAP,\n 0,\n ) * direction\n )\n}\n\nfunction setExpanded(position: NotificationPosition, expanded: boolean) {\n expandedPositions.value = { ...expandedPositions.value, [position]: expanded }\n}\n\nfunction scheduleCollapse(position: NotificationPosition) {\n window.clearTimeout(collapseTimeouts[position])\n if (\n (hoveredCounts.value[position] ?? 0) > 0 ||\n hoveredGroups.value[position] ||\n pinnedPosition.value === position\n )\n return\n collapseTimeouts[position] = window.setTimeout(() => setExpanded(position, false), 200)\n}\n\nfunction handleHoverStart(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: (hoveredCounts.value[position] ?? 0) + 1,\n }\n if (props.layout === 'stacked') setExpanded(position, true)\n}\n\nfunction handleHoverEnd(position: NotificationPosition) {\n hoveredCounts.value = {\n ...hoveredCounts.value,\n [position]: Math.max(0, (hoveredCounts.value[position] ?? 0) - 1),\n }\n if (props.layout === 'stacked') scheduleCollapse(position)\n}\n\nfunction handleGroupHover(position: NotificationPosition, hovered: boolean) {\n if (props.layout !== 'stacked') return\n hoveredGroups.value = { ...hoveredGroups.value, [position]: hovered }\n if (hovered) {\n window.clearTimeout(collapseTimeouts[position])\n setExpanded(position, true)\n } else scheduleCollapse(position)\n}\n\nfunction handleExpandRequest(position: NotificationPosition) {\n pinnedPosition.value = position\n setExpanded(position, true)\n}\n\nfunction handleDocumentPointerDown(event: PointerEvent) {\n if (!pinnedPosition.value) return\n const target = event.target as Element | null\n if (!target?.closest(`[data-notifications-position=\"${pinnedPosition.value}\"]`)) {\n const previous = pinnedPosition.value\n pinnedPosition.value = null\n scheduleCollapse(previous)\n }\n}\n\nwatch(\n () => props.layout,\n (layout) => {\n if (layout !== 'stacked') {\n pinnedPosition.value = null\n hoveredGroups.value = {}\n expandedPositions.value = {}\n }\n },\n)\n\nwatch(grouped, (groups) => {\n if (pinnedPosition.value && groups[pinnedPosition.value].length === 0) {\n pinnedPosition.value = null\n }\n})\n\nonMounted(() => document.addEventListener('pointerdown', handleDocumentPointerDown))\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleDocumentPointerDown)\n positions.forEach((position) => window.clearTimeout(collapseTimeouts[position]))\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 :data-notifications-position=\"position\"\n :data-layout=\"props.layout\"\n >\n <TransitionGroup\n tag=\"div\"\n :css=\"false\"\n @mouseenter=\"handleGroupHover(position, true)\"\n @mouseleave=\"handleGroupHover(position, false)\"\n @focusin=\"handleGroupHover(position, true)\"\n @focusout=\"handleGroupHover(position, 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, stackIndex) in orderedGroup(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=\"\n (props.pauseResetOnHover === 'all' && hoveredCount > 0) ||\n (props.layout === 'stacked' && !isStackExpanded(position) && stackIndex > 0)\n \"\n :render-notification=\"\n 'renderNotification' in notification\n ? notification.renderNotification\n : props.renderNotification\n \"\n :layout=\"props.layout\"\n :with-auto-close-progress=\"props.withAutoCloseProgress\"\n :progress-props=\"getStyles('progress')\"\n :stack-index=\"stackIndex\"\n :stack-size=\"orderedGroup(position).length\"\n :stack-position=\"position\"\n :stack-expanded=\"isStackExpanded(position)\"\n :stack-expanded-offset=\"expandedOffset(position, stackIndex)\"\n transition-state=\"entered\"\n @hide=\"(id) => hideNotification(id, props.store)\"\n @hover-start=\"handleHoverStart(position)\"\n @hover-end=\"handleHoverEnd(position)\"\n @expand-request=\"handleExpandRequest(position)\"\n @height-change=\"\n (height) =>\n (notificationHeights = { ...notificationHeights, [notification.id!]: height })\n \"\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 promise: notifications.promise,\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":";;;;;AA8CA,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,QA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,SAAc,aAAA,QAAY,KAAsB,MAAA,KAAA,EAAM,WAAM,aAAA,CAAmB,gBAAgB,QAAQ,KAAK,aAAU;SAInK,uBAAA,wBAA0D,eAA6B,aAAa,qBAAmC,MAAA,KAAA,EAAM;SAK7I,QAAQ,MAAA,KAAA,EAAM;SACd,4BAA0B,MAAA,KAAA,EAAM;SAChC,kBAAgB,MAAA,SAAA,EAAS,UAAA;SACzB,eAAa;SACb,cAAY,aAAa,QAAQ,EAAE;SACnC,kBAAgB;SAChB,kBAAgB,gBAAgB,QAAQ;SACxC,yBAAuB,eAAe,UAAU,UAAU;SAC3D,oBAAiB;SAChB,QAAI,OAAA,OAAA,OAAA,MAAG,OAAO,MAAA,gBAAA,EAAiB,IAAI,MAAA,KAAA,EAAM,KAAK;SAC9C,eAAW,WAAE,iBAAiB,QAAQ;SACtC,aAAS,WAAE,eAAe,QAAQ;SAClC,kBAAc,WAAE,oBAAoB,QAAQ;SAC5C,iBAA6B,WAA0B,oBAAA,QAAmB;UAAA,GAAQ,oBAAA;WAAsB,aAAa,KAAM;SAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CEpSjG,GAAwB;CACjE,SAAA;CACA;CACA,MAAM,cAAc;CACpB,MAAM,cAAc;CACpB,QAAQ,cAAc;CACtB,SAAS,cAAc;CACvB,OAAO,cAAc;CACrB,YAAY,cAAc;CAC1B,aAAa,cAAc;AAC7B,CAAC"}
|
|
@@ -14,6 +14,10 @@ export interface NotificationContainerProps {
|
|
|
14
14
|
allowScrollDismiss: boolean;
|
|
15
15
|
/** Pauses the auto-close timer. */
|
|
16
16
|
paused: boolean;
|
|
17
|
+
/** Default visibility of the auto-close progress line. */
|
|
18
|
+
withAutoCloseProgress: boolean;
|
|
19
|
+
/** Styles API props applied to the progress line. */
|
|
20
|
+
progressProps: Record<string, any>;
|
|
17
21
|
/** Custom renderer used instead of the default Notification component. */
|
|
18
22
|
renderNotification?: ((notification: NotificationData) => VNodeChild) | null;
|
|
19
23
|
/** Notification layout inherited from the notifications container. */
|