@v-c/notification 1.0.0 → 2.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/Notification.d.ts +59 -0
  2. package/dist/Notification.js +301 -0
  3. package/dist/NotificationList/Content.d.ts +11 -0
  4. package/dist/NotificationList/Content.js +60 -0
  5. package/dist/NotificationList/index.d.ts +35 -0
  6. package/dist/NotificationList/index.js +224 -0
  7. package/dist/NotificationProvider.js +3 -1
  8. package/dist/Notifications.d.ts +9 -3
  9. package/dist/Notifications.js +45 -21
  10. package/dist/Progress.d.ts +8 -0
  11. package/dist/Progress.js +31 -0
  12. package/dist/hooks/useClosable.d.ts +17 -0
  13. package/dist/hooks/useClosable.js +34 -0
  14. package/dist/hooks/useListPosition/index.d.ts +18 -0
  15. package/dist/hooks/useListPosition/index.js +41 -0
  16. package/dist/hooks/useListPosition/useSizes.d.ts +10 -0
  17. package/dist/hooks/useListPosition/useSizes.js +31 -0
  18. package/dist/hooks/useNoticeTimer.d.ts +7 -0
  19. package/dist/hooks/useNoticeTimer.js +63 -0
  20. package/dist/hooks/useNotification.d.ts +10 -8
  21. package/dist/hooks/useNotification.js +10 -4
  22. package/dist/hooks/useStack.d.ts +5 -0
  23. package/dist/hooks/useStack.js +13 -10
  24. package/dist/index.d.ts +9 -6
  25. package/dist/index.js +5 -3
  26. package/dist/interface.d.ts +18 -43
  27. package/package.json +3 -3
  28. package/src/Notification.tsx +326 -0
  29. package/src/NotificationList/Content.tsx +66 -0
  30. package/src/NotificationList/index.tsx +282 -0
  31. package/src/Notifications.tsx +58 -64
  32. package/src/Progress.tsx +27 -0
  33. package/src/hooks/useClosable.ts +53 -0
  34. package/src/hooks/useListPosition/index.ts +69 -0
  35. package/src/hooks/useListPosition/useSizes.ts +43 -0
  36. package/src/hooks/useNoticeTimer.ts +85 -0
  37. package/src/hooks/useNotification.tsx +30 -28
  38. package/src/hooks/useStack.ts +12 -8
  39. package/src/index.ts +47 -6
  40. package/src/interface.ts +28 -44
  41. package/vite.config.ts +4 -3
  42. package/dist/Notice.cjs +0 -235
  43. package/dist/Notice.d.ts +0 -15
  44. package/dist/Notice.js +0 -227
  45. package/dist/NoticeList.cjs +0 -170
  46. package/dist/NoticeList.d.ts +0 -13
  47. package/dist/NoticeList.js +0 -164
  48. package/dist/NotificationProvider.cjs +0 -14
  49. package/dist/Notifications.cjs +0 -146
  50. package/dist/_virtual/rolldown_runtime.cjs +0 -21
  51. package/dist/hooks/useNotification.cjs +0 -93
  52. package/dist/hooks/useStack.cjs +0 -27
  53. package/dist/index.cjs +0 -7
  54. package/dist/interface.cjs +0 -1
  55. package/src/Notice.tsx +0 -212
  56. package/src/NoticeList.tsx +0 -219
@@ -0,0 +1,59 @@
1
+ import { Component, CSSProperties, HTMLAttributes } from 'vue';
2
+ import { VueNode } from '@v-c/util/dist/type';
3
+ import { ClosableType } from './hooks/useClosable';
4
+ import { NotificationProgressProps } from './Progress';
5
+ export interface NotificationClassNames {
6
+ wrapper?: string;
7
+ root?: string;
8
+ icon?: string;
9
+ section?: string;
10
+ title?: string;
11
+ description?: string;
12
+ actions?: string;
13
+ close?: string;
14
+ progress?: string;
15
+ }
16
+ export interface NotificationStyles {
17
+ wrapper?: CSSProperties;
18
+ root?: CSSProperties;
19
+ icon?: CSSProperties;
20
+ section?: CSSProperties;
21
+ title?: CSSProperties;
22
+ description?: CSSProperties;
23
+ actions?: CSSProperties;
24
+ close?: CSSProperties;
25
+ progress?: CSSProperties;
26
+ }
27
+ export interface ComponentsType {
28
+ progress?: Component<NotificationProgressProps>;
29
+ }
30
+ export interface NotificationProps {
31
+ prefixCls: string;
32
+ className?: string;
33
+ style?: CSSProperties;
34
+ classNames?: NotificationClassNames;
35
+ styles?: NotificationStyles;
36
+ components?: ComponentsType;
37
+ title?: VueNode;
38
+ description?: VueNode;
39
+ icon?: VueNode;
40
+ actions?: VueNode;
41
+ role?: string;
42
+ closable?: ClosableType;
43
+ offset?: number;
44
+ notificationIndex?: number;
45
+ stackInThreshold?: boolean;
46
+ props?: HTMLAttributes & Record<string, any>;
47
+ duration?: number | false | null;
48
+ showProgress?: boolean;
49
+ times?: number;
50
+ hovering?: boolean;
51
+ pauseOnHover?: boolean;
52
+ onClick?: (e: MouseEvent) => void;
53
+ onMouseEnter?: (e: MouseEvent) => void;
54
+ onMouseLeave?: (e: MouseEvent) => void;
55
+ /** @deprecated Please use `closable.onClose` instead. */
56
+ onClose?: () => void;
57
+ }
58
+ declare const Notification: import('vue').DefineSetupFnComponent<NotificationProps, {}, {}, NotificationProps & {}, import('vue').PublicProps>;
59
+ export default Notification;
@@ -0,0 +1,301 @@
1
+ import useClosable from "./hooks/useClosable.js";
2
+ import useNoticeTimer from "./hooks/useNoticeTimer.js";
3
+ import Progress from "./Progress.js";
4
+ import { computed, createVNode, defineComponent, mergeProps, ref, shallowRef, watch } from "vue";
5
+ import { clsx } from "@v-c/util";
6
+ //#region src/Notification.tsx
7
+ var Notification = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
8
+ const nodeRef = ref(null);
9
+ const percent = shallowRef(0);
10
+ const hovering = shallowRef(false);
11
+ expose({ nativeElement: nodeRef });
12
+ const [mergedClosable, closableConfig, closeBtnAriaProps] = useClosable(computed(() => props.closable));
13
+ const onInternalClose = () => {
14
+ closableConfig.value.onClose?.();
15
+ props.onClose?.();
16
+ };
17
+ const [onResume, onPause] = useNoticeTimer(computed(() => {
18
+ if (props.duration === void 0) return 4.5;
19
+ return props.duration;
20
+ }), onInternalClose, (next) => {
21
+ percent.value = next;
22
+ });
23
+ watch([
24
+ () => props.hovering,
25
+ hovering,
26
+ () => props.pauseOnHover
27
+ ], () => {
28
+ if (!(props.pauseOnHover ?? true)) return;
29
+ if (props.hovering) onPause();
30
+ else if (!hovering.value) onResume();
31
+ }, { immediate: true });
32
+ const offsetRef = shallowRef(props.offset);
33
+ const indexRef = shallowRef(props.notificationIndex);
34
+ watch(() => props.offset, (next) => {
35
+ if (next !== void 0) offsetRef.value = next;
36
+ });
37
+ watch(() => props.notificationIndex, (next) => {
38
+ if (next !== void 0) indexRef.value = next;
39
+ });
40
+ const onInternalMouseEnter = (e) => {
41
+ hovering.value = true;
42
+ if (props.pauseOnHover ?? true) onPause();
43
+ props.onMouseEnter?.(e);
44
+ props.props?.onMouseenter?.(e);
45
+ };
46
+ const onInternalMouseLeave = (e) => {
47
+ hovering.value = false;
48
+ if ((props.pauseOnHover ?? true) && !props.hovering) onResume();
49
+ props.onMouseLeave?.(e);
50
+ props.props?.onMouseleave?.(e);
51
+ };
52
+ const onInternalCloseClick = (e) => {
53
+ e.preventDefault();
54
+ e.stopPropagation();
55
+ onInternalClose();
56
+ };
57
+ return () => {
58
+ const { prefixCls, className, style, classNames: ncs, styles: nss, components, title, description, icon, actions, role, stackInThreshold, props: rootProps, showProgress, duration } = props;
59
+ const noticePrefixCls = `${prefixCls}-notice`;
60
+ const titleNode = title !== void 0 && title !== null ? createVNode("div", {
61
+ "class": clsx(`${noticePrefixCls}-title`, ncs?.title),
62
+ "style": nss?.title
63
+ }, [title]) : null;
64
+ const descNode = description !== void 0 && description !== null ? createVNode("div", {
65
+ "class": clsx(`${noticePrefixCls}-description`, ncs?.description),
66
+ "style": nss?.description
67
+ }, [description]) : null;
68
+ const hasTitle = titleNode !== null;
69
+ const hasDescription = descNode !== null;
70
+ let contentNode = null;
71
+ if (hasTitle && hasDescription) contentNode = createVNode("div", {
72
+ "class": clsx(`${noticePrefixCls}-section`, ncs?.section),
73
+ "style": nss?.section
74
+ }, [titleNode, descNode]);
75
+ else contentNode = titleNode || descNode;
76
+ if (icon !== void 0 && icon !== null) contentNode = createVNode("div", {
77
+ "class": clsx(`${noticePrefixCls}-wrapper`, ncs?.wrapper),
78
+ "style": nss?.wrapper
79
+ }, [createVNode("div", {
80
+ "class": clsx(`${noticePrefixCls}-icon`, ncs?.icon),
81
+ "style": nss?.icon
82
+ }, [icon]), contentNode]);
83
+ const actionsNode = actions ? createVNode("div", {
84
+ "class": clsx(`${noticePrefixCls}-actions`, ncs?.actions),
85
+ "style": nss?.actions
86
+ }, [actions]) : null;
87
+ const mergedOffset = props.offset ?? offsetRef.value;
88
+ const mergedIndex = props.notificationIndex ?? indexRef.value ?? 0;
89
+ const validPercent = 100 - Math.min(Math.max(percent.value * 100, 0), 100);
90
+ const ProgressComponent = components?.progress || Progress;
91
+ const mergedStyle = {
92
+ "--notification-index": mergedIndex,
93
+ ...nss?.root,
94
+ ...style
95
+ };
96
+ if (mergedOffset !== void 0) mergedStyle["--notification-y"] = `${mergedOffset}px`;
97
+ const mergedRole = role ?? rootProps?.role ?? "alert";
98
+ return createVNode("div", mergeProps(rootProps, {
99
+ "ref": nodeRef,
100
+ "role": mergedRole,
101
+ "data-notification-index": mergedIndex,
102
+ "class": clsx(noticePrefixCls, className, attrs.class, ncs?.root, {
103
+ [`${noticePrefixCls}-closable`]: mergedClosable.value,
104
+ [`${noticePrefixCls}-stack-in-threshold`]: stackInThreshold
105
+ }),
106
+ "style": {
107
+ ...mergedStyle,
108
+ ...attrs.style
109
+ },
110
+ "onClick": props.onClick,
111
+ "onMouseenter": onInternalMouseEnter,
112
+ "onMouseleave": onInternalMouseLeave
113
+ }), [
114
+ contentNode,
115
+ actionsNode,
116
+ mergedClosable.value && createVNode("button", mergeProps({
117
+ "class": clsx(`${noticePrefixCls}-close`, ncs?.close),
118
+ "aria-label": "Close"
119
+ }, closeBtnAriaProps.value, {
120
+ "style": nss?.close,
121
+ "onClick": onInternalCloseClick
122
+ }), [closableConfig.value.closeIcon]),
123
+ showProgress && typeof duration === "number" && duration > 0 && createVNode(ProgressComponent, {
124
+ className: clsx(`${noticePrefixCls}-progress`, ncs?.progress),
125
+ percent: validPercent,
126
+ style: nss?.progress
127
+ }, null)
128
+ ]);
129
+ };
130
+ }, {
131
+ props: {
132
+ prefixCls: {
133
+ type: String,
134
+ required: true
135
+ },
136
+ className: {
137
+ type: String,
138
+ required: false,
139
+ default: void 0
140
+ },
141
+ style: {
142
+ type: Object,
143
+ required: false,
144
+ default: void 0
145
+ },
146
+ classNames: {
147
+ type: Object,
148
+ required: false,
149
+ default: void 0
150
+ },
151
+ styles: {
152
+ type: Object,
153
+ required: false,
154
+ default: void 0
155
+ },
156
+ components: {
157
+ type: Object,
158
+ required: false,
159
+ default: void 0
160
+ },
161
+ title: {
162
+ type: [
163
+ Object,
164
+ Function,
165
+ String,
166
+ Number,
167
+ null,
168
+ Boolean,
169
+ Array
170
+ ],
171
+ required: false,
172
+ default: void 0
173
+ },
174
+ description: {
175
+ type: [
176
+ Object,
177
+ Function,
178
+ String,
179
+ Number,
180
+ null,
181
+ Boolean,
182
+ Array
183
+ ],
184
+ required: false,
185
+ default: void 0
186
+ },
187
+ icon: {
188
+ type: [
189
+ Object,
190
+ Function,
191
+ String,
192
+ Number,
193
+ null,
194
+ Boolean,
195
+ Array
196
+ ],
197
+ required: false,
198
+ default: void 0
199
+ },
200
+ actions: {
201
+ type: [
202
+ Object,
203
+ Function,
204
+ String,
205
+ Number,
206
+ null,
207
+ Boolean,
208
+ Array
209
+ ],
210
+ required: false,
211
+ default: void 0
212
+ },
213
+ role: {
214
+ type: String,
215
+ required: false,
216
+ default: void 0
217
+ },
218
+ closable: {
219
+ type: [
220
+ Boolean,
221
+ Object,
222
+ null
223
+ ],
224
+ required: false,
225
+ default: void 0
226
+ },
227
+ offset: {
228
+ type: Number,
229
+ required: false,
230
+ default: void 0
231
+ },
232
+ notificationIndex: {
233
+ type: Number,
234
+ required: false,
235
+ default: void 0
236
+ },
237
+ stackInThreshold: {
238
+ type: Boolean,
239
+ required: false,
240
+ default: void 0
241
+ },
242
+ props: {
243
+ type: Object,
244
+ required: false,
245
+ default: void 0
246
+ },
247
+ duration: {
248
+ type: [
249
+ Number,
250
+ Boolean,
251
+ null
252
+ ],
253
+ required: false,
254
+ default: void 0
255
+ },
256
+ showProgress: {
257
+ type: Boolean,
258
+ required: false,
259
+ default: void 0
260
+ },
261
+ times: {
262
+ type: Number,
263
+ required: false,
264
+ default: void 0
265
+ },
266
+ hovering: {
267
+ type: Boolean,
268
+ required: false,
269
+ default: void 0
270
+ },
271
+ pauseOnHover: {
272
+ type: Boolean,
273
+ required: false,
274
+ default: void 0
275
+ },
276
+ onClick: {
277
+ type: Function,
278
+ required: false,
279
+ default: void 0
280
+ },
281
+ onMouseEnter: {
282
+ type: Function,
283
+ required: false,
284
+ default: void 0
285
+ },
286
+ onMouseLeave: {
287
+ type: Function,
288
+ required: false,
289
+ default: void 0
290
+ },
291
+ onClose: {
292
+ type: Function,
293
+ required: false,
294
+ default: void 0
295
+ }
296
+ },
297
+ name: "Notification",
298
+ inheritAttrs: false
299
+ });
300
+ //#endregion
301
+ export { Notification as default };
@@ -0,0 +1,11 @@
1
+ import { CSSProperties } from 'vue';
2
+ export interface ContentProps {
3
+ listPrefixCls: string;
4
+ height: number;
5
+ topNoticeHeight?: number;
6
+ topNoticeWidth?: number;
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ }
10
+ declare const Content: import('vue').DefineSetupFnComponent<ContentProps, {}, {}, ContentProps & {}, import('vue').PublicProps>;
11
+ export default Content;
@@ -0,0 +1,60 @@
1
+ import { createVNode, defineComponent, ref } from "vue";
2
+ import { clsx } from "@v-c/util";
3
+ //#region src/NotificationList/Content.tsx
4
+ var Content = /* @__PURE__ */ defineComponent((props, { slots, expose }) => {
5
+ const contentRef = ref(null);
6
+ let prevHeight = props.height;
7
+ expose({ nativeElement: contentRef });
8
+ return () => {
9
+ const { listPrefixCls, height, topNoticeHeight = 0, topNoticeWidth = 0, className, style } = props;
10
+ const heightStatus = height < prevHeight ? "decrease" : "increase";
11
+ prevHeight = height;
12
+ const contentPrefixCls = `${listPrefixCls}-content`;
13
+ const contentStyle = {
14
+ ...style,
15
+ height,
16
+ "--top-notificiation-height": `${topNoticeHeight}px`,
17
+ "--top-notificiation-width": `${topNoticeWidth}px`
18
+ };
19
+ return createVNode("div", {
20
+ "ref": contentRef,
21
+ "class": clsx(contentPrefixCls, `${contentPrefixCls}-${heightStatus}`, className),
22
+ "style": contentStyle
23
+ }, [slots.default?.()]);
24
+ };
25
+ }, {
26
+ props: {
27
+ listPrefixCls: {
28
+ type: String,
29
+ required: true
30
+ },
31
+ height: {
32
+ type: Number,
33
+ required: true
34
+ },
35
+ topNoticeHeight: {
36
+ type: Number,
37
+ required: false,
38
+ default: void 0
39
+ },
40
+ topNoticeWidth: {
41
+ type: Number,
42
+ required: false,
43
+ default: void 0
44
+ },
45
+ className: {
46
+ type: String,
47
+ required: false,
48
+ default: void 0
49
+ },
50
+ style: {
51
+ type: Object,
52
+ required: false,
53
+ default: void 0
54
+ }
55
+ },
56
+ name: "NotificationListContent",
57
+ inheritAttrs: false
58
+ });
59
+ //#endregion
60
+ export { Content as default };
@@ -0,0 +1,35 @@
1
+ import { CSSProperties, TransitionGroupProps } from 'vue';
2
+ import { Key, StackConfig } from '../interface';
3
+ import { ComponentsType, NotificationClassNames as NoticeClassNames, NotificationProps, NotificationStyles as NoticeStyles } from '../Notification';
4
+ export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
5
+ export type { StackConfig };
6
+ export interface NotificationListConfig extends Omit<NotificationProps, 'prefixCls'> {
7
+ key: Key;
8
+ placement?: Placement;
9
+ times?: number;
10
+ }
11
+ export interface NotificationClassNames extends NoticeClassNames {
12
+ list?: string;
13
+ listContent?: string;
14
+ }
15
+ export interface NotificationStyles extends NoticeStyles {
16
+ list?: CSSProperties;
17
+ listContent?: CSSProperties;
18
+ }
19
+ export interface NotificationListProps {
20
+ configList?: NotificationListConfig[];
21
+ prefixCls?: string;
22
+ placement: Placement;
23
+ pauseOnHover?: boolean;
24
+ classNames?: NotificationClassNames;
25
+ styles?: NotificationStyles;
26
+ components?: ComponentsType;
27
+ stack?: StackConfig;
28
+ motion?: TransitionGroupProps | ((placement: Placement) => TransitionGroupProps);
29
+ className?: string;
30
+ style?: CSSProperties;
31
+ onNoticeClose?: (key: Key) => void;
32
+ onAllRemoved?: (placement: Placement) => void;
33
+ }
34
+ declare const NotificationList: import('vue').DefineSetupFnComponent<NotificationListProps, {}, {}, NotificationListProps & {}, import('vue').PublicProps>;
35
+ export default NotificationList;
@@ -0,0 +1,224 @@
1
+ import Notification from "../Notification.js";
2
+ import { useNotificationContext } from "../NotificationProvider.js";
3
+ import useListPosition from "../hooks/useListPosition/index.js";
4
+ import useStack from "../hooks/useStack.js";
5
+ import Content from "./Content.js";
6
+ import { TransitionGroup, computed, createVNode, defineComponent, isVNode, mergeProps, ref, shallowRef, toRef, watch, watchEffect } from "vue";
7
+ import { clsx } from "@v-c/util";
8
+ import { getTransitionGroupProps } from "@v-c/util/dist/utils/transition";
9
+ import { unrefElement } from "@v-c/util/dist/vueuse/unref-element";
10
+ //#region src/NotificationList/index.tsx
11
+ function _isSlot(s) {
12
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
13
+ }
14
+ var noticeSlotKeys = [
15
+ "wrapper",
16
+ "root",
17
+ "icon",
18
+ "section",
19
+ "title",
20
+ "description",
21
+ "actions",
22
+ "close",
23
+ "progress"
24
+ ];
25
+ function fillClassNames(list) {
26
+ return noticeSlotKeys.reduce((merged, key) => {
27
+ merged[key] = clsx(...list.map((item) => item?.[key]));
28
+ return merged;
29
+ }, {});
30
+ }
31
+ function fillStyles(list) {
32
+ return noticeSlotKeys.reduce((merged, key) => {
33
+ merged[key] = Object.assign({}, ...list.map((item) => item?.[key]));
34
+ return merged;
35
+ }, {});
36
+ }
37
+ function getIndex(keys, key) {
38
+ const strKey = String(key);
39
+ const index = keys.findIndex((item) => String(item.key) === strKey);
40
+ if (index === -1) return;
41
+ return keys.length - index - 1;
42
+ }
43
+ var NotificationList = /* @__PURE__ */ defineComponent((props, { attrs }) => {
44
+ const ctx = useNotificationContext();
45
+ const configList = computed(() => props.configList ?? []);
46
+ const keys = computed(() => configList.value.map((config) => ({
47
+ ...config,
48
+ key: String(config.key)
49
+ })));
50
+ const [stackEnabled, stackParams] = useStack(toRef(props, "stack"));
51
+ const listHovering = shallowRef(false);
52
+ const expanded = computed(() => stackEnabled.value && (listHovering.value || keys.value.length <= (stackParams.threshold?.value ?? 0)));
53
+ const stackPosition = computed(() => {
54
+ if (!stackEnabled.value || expanded.value) return;
55
+ return {
56
+ offset: stackParams.offset?.value,
57
+ threshold: stackParams.threshold?.value
58
+ };
59
+ });
60
+ const gap = ref(0);
61
+ const contentRef = ref(null);
62
+ const [position, setNodeSize] = useListPosition(keys, stackPosition, gap);
63
+ const hasConfigList = computed(() => !!configList.value.length);
64
+ watchEffect(() => {
65
+ if (!hasConfigList.value) return;
66
+ const listNode = unrefElement(contentRef.value?.nativeElement);
67
+ if (!listNode) return;
68
+ const { gap: cssGap, rowGap } = window.getComputedStyle(listNode);
69
+ const nextGap = Number.parseFloat(rowGap || cssGap) || 0;
70
+ if (gap.value !== nextGap) gap.value = nextGap;
71
+ }, { flush: "post" });
72
+ const checkAllClosed = () => {
73
+ if (configList.value.length === 0) props.onAllRemoved?.(props.placement);
74
+ };
75
+ const placementMotion = computed(() => {
76
+ if (typeof props.motion === "function") return props.placement ? props.motion(props.placement) : void 0;
77
+ return props.motion;
78
+ });
79
+ watch(keys, (next, prev) => {
80
+ if (!prev) return;
81
+ const nextKeySet = new Set(next.map((item) => String(item.key)));
82
+ prev.forEach((item) => {
83
+ const key = String(item.key);
84
+ if (!nextKeySet.has(key)) setNodeSize(key, null);
85
+ });
86
+ });
87
+ return () => {
88
+ let _slot;
89
+ const { prefixCls = "vc-notification", pauseOnHover, classNames: ncs, styles: nss, components, placement, className, style, onNoticeClose } = props;
90
+ const listPrefixCls = `${prefixCls}-list`;
91
+ const positionResult = position.value;
92
+ let motionGroupProps = {};
93
+ if (placementMotion.value) motionGroupProps = getTransitionGroupProps(placementMotion.value.name, placementMotion.value);
94
+ const renderItems = () => keys.value.map((config) => {
95
+ const { key, placement: _itemPlacement, classNames: configClassNames, styles: configStyles, className: configClassName, style: configStyle, ...notificationConfig } = config;
96
+ const strKey = String(key);
97
+ const notificationIndex = getIndex(keys.value, key);
98
+ const stackInThreshold = stackEnabled.value && notificationIndex !== void 0 && notificationIndex < (stackParams.threshold?.value ?? 0);
99
+ return createVNode(Notification, mergeProps({ "key": strKey }, notificationConfig, {
100
+ "ref": (el) => {
101
+ setNodeSize(strKey, unrefElement(el?.nativeElement) ?? null);
102
+ },
103
+ "prefixCls": prefixCls,
104
+ "class": clsx(ctx.value?.classNames?.notice, configClassName),
105
+ "style": configStyle,
106
+ "classNames": fillClassNames([ncs, configClassNames]),
107
+ "styles": fillStyles([nss, configStyles]),
108
+ "components": {
109
+ ...components,
110
+ ...config.components
111
+ },
112
+ "hovering": stackEnabled.value && listHovering.value,
113
+ "pauseOnHover": config.pauseOnHover ?? pauseOnHover,
114
+ "offset": positionResult.notificationPosition.get(strKey),
115
+ "notificationIndex": notificationIndex,
116
+ "stackInThreshold": stackInThreshold,
117
+ "onClose": () => {
118
+ config.onClose?.();
119
+ onNoticeClose?.(key);
120
+ }
121
+ }), null);
122
+ });
123
+ return createVNode("div", {
124
+ "class": clsx(prefixCls, listPrefixCls, `${prefixCls}-${placement}`, ctx.value?.classNames?.list, className, ncs?.list, attrs.class, {
125
+ [`${prefixCls}-stack`]: stackEnabled.value,
126
+ [`${prefixCls}-stack-expanded`]: expanded.value,
127
+ [`${listPrefixCls}-hovered`]: listHovering.value
128
+ }),
129
+ "onMouseenter": () => {
130
+ listHovering.value = true;
131
+ },
132
+ "onMouseleave": () => {
133
+ listHovering.value = false;
134
+ },
135
+ "style": {
136
+ ...nss?.list,
137
+ ...style,
138
+ ...attrs.style ?? {}
139
+ }
140
+ }, [createVNode(Content, {
141
+ "ref": contentRef,
142
+ "listPrefixCls": listPrefixCls,
143
+ "height": positionResult.totalHeight,
144
+ "topNoticeHeight": positionResult.topNoticeHeight,
145
+ "topNoticeWidth": positionResult.topNoticeWidth,
146
+ "className": ncs?.listContent,
147
+ "style": nss?.listContent
148
+ }, { default: () => [createVNode(TransitionGroup, mergeProps({
149
+ "tag": false,
150
+ "appear": true
151
+ }, motionGroupProps, { "onAfterLeave": checkAllClosed }), _isSlot(_slot = renderItems()) ? _slot : { default: () => [_slot] })] })]);
152
+ };
153
+ }, {
154
+ props: {
155
+ configList: {
156
+ type: Array,
157
+ required: false,
158
+ default: void 0
159
+ },
160
+ prefixCls: {
161
+ type: String,
162
+ required: false,
163
+ default: void 0
164
+ },
165
+ placement: {
166
+ type: String,
167
+ required: true
168
+ },
169
+ pauseOnHover: {
170
+ type: Boolean,
171
+ required: false,
172
+ default: void 0
173
+ },
174
+ classNames: {
175
+ type: Object,
176
+ required: false,
177
+ default: void 0
178
+ },
179
+ styles: {
180
+ type: Object,
181
+ required: false,
182
+ default: void 0
183
+ },
184
+ components: {
185
+ type: Object,
186
+ required: false,
187
+ default: void 0
188
+ },
189
+ stack: {
190
+ type: [Boolean, Object],
191
+ required: false,
192
+ default: void 0
193
+ },
194
+ motion: {
195
+ type: [Object, Function],
196
+ required: false,
197
+ default: void 0
198
+ },
199
+ className: {
200
+ type: String,
201
+ required: false,
202
+ default: void 0
203
+ },
204
+ style: {
205
+ type: Object,
206
+ required: false,
207
+ default: void 0
208
+ },
209
+ onNoticeClose: {
210
+ type: Function,
211
+ required: false,
212
+ default: void 0
213
+ },
214
+ onAllRemoved: {
215
+ type: Function,
216
+ required: false,
217
+ default: void 0
218
+ }
219
+ },
220
+ name: "NotificationList",
221
+ inheritAttrs: false
222
+ });
223
+ //#endregion
224
+ export { NotificationList as default };
@@ -1,5 +1,6 @@
1
1
  import { inject, provide, ref } from "vue";
2
- const NotificationContext = Symbol("NotificationContext");
2
+ //#region src/NotificationProvider.tsx
3
+ var NotificationContext = Symbol("NotificationContext");
3
4
  function useNotificationProvider(props) {
4
5
  provide(NotificationContext, props);
5
6
  return props;
@@ -7,4 +8,5 @@ function useNotificationProvider(props) {
7
8
  function useNotificationContext() {
8
9
  return inject(NotificationContext, ref({}));
9
10
  }
11
+ //#endregion
10
12
  export { NotificationContext, useNotificationContext, useNotificationProvider };