akar 2.0.20 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete/AutocompleteRoot.cjs +8 -2
- package/dist/Autocomplete/AutocompleteRoot.cjs.map +1 -1
- package/dist/Autocomplete/AutocompleteRoot.js +8 -2
- package/dist/Autocomplete/AutocompleteRoot.js.map +1 -1
- package/dist/ColorSwatchPicker/ColorSwatchPickerRoot.cjs +5 -0
- package/dist/ColorSwatchPicker/ColorSwatchPickerRoot.cjs.map +1 -1
- package/dist/ColorSwatchPicker/ColorSwatchPickerRoot.js +5 -0
- package/dist/ColorSwatchPicker/ColorSwatchPickerRoot.js.map +1 -1
- package/dist/Combobox/ComboboxRoot.cjs +7 -1
- package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
- package/dist/Combobox/ComboboxRoot.js +7 -1
- package/dist/Combobox/ComboboxRoot.js.map +1 -1
- package/dist/ContextMenu/ContextMenuRoot.cjs +12 -6
- package/dist/ContextMenu/ContextMenuRoot.cjs.map +1 -1
- package/dist/ContextMenu/ContextMenuRoot.js +13 -7
- package/dist/ContextMenu/ContextMenuRoot.js.map +1 -1
- package/dist/ContextMenu/ContextMenuTrigger.cjs +18 -2
- package/dist/ContextMenu/ContextMenuTrigger.cjs.map +1 -1
- package/dist/ContextMenu/ContextMenuTrigger.js +19 -3
- package/dist/ContextMenu/ContextMenuTrigger.js.map +1 -1
- package/dist/DateField/DateFieldRoot.cjs +1 -0
- package/dist/DateField/DateFieldRoot.cjs.map +1 -1
- package/dist/DateField/DateFieldRoot.js +1 -0
- package/dist/DateField/DateFieldRoot.js.map +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.cjs +1 -0
- package/dist/DateRangeField/DateRangeFieldRoot.cjs.map +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.js +1 -0
- package/dist/DateRangeField/DateRangeFieldRoot.js.map +1 -1
- package/dist/DismissableLayer/DismissableLayer.cjs +1 -1
- package/dist/DismissableLayer/DismissableLayer.cjs.map +1 -1
- package/dist/DismissableLayer/DismissableLayer.js +1 -1
- package/dist/DismissableLayer/DismissableLayer.js.map +1 -1
- package/dist/DismissableLayer/utils.cjs +8 -3
- package/dist/DismissableLayer/utils.cjs.map +1 -1
- package/dist/DismissableLayer/utils.js +8 -3
- package/dist/DismissableLayer/utils.js.map +1 -1
- package/dist/Drawer/DrawerContent.cjs +2 -1
- package/dist/Drawer/DrawerContent.cjs.map +1 -1
- package/dist/Drawer/DrawerContent.js +2 -1
- package/dist/Drawer/DrawerContent.js.map +1 -1
- package/dist/Drawer/DrawerContentImpl.cjs +10 -4
- package/dist/Drawer/DrawerContentImpl.cjs.map +1 -1
- package/dist/Drawer/DrawerContentImpl.js +11 -5
- package/dist/Drawer/DrawerContentImpl.js.map +1 -1
- package/dist/Drawer/DrawerRoot.cjs +14 -3
- package/dist/Drawer/DrawerRoot.cjs.map +1 -1
- package/dist/Drawer/DrawerRoot.js +14 -3
- package/dist/Drawer/DrawerRoot.js.map +1 -1
- package/dist/Drawer/DrawerSwipeArea.cjs +5 -2
- package/dist/Drawer/DrawerSwipeArea.cjs.map +1 -1
- package/dist/Drawer/DrawerSwipeArea.js +6 -3
- package/dist/Drawer/DrawerSwipeArea.js.map +1 -1
- package/dist/DropdownMenu/DropdownMenuTrigger.cjs +2 -1
- package/dist/DropdownMenu/DropdownMenuTrigger.cjs.map +1 -1
- package/dist/DropdownMenu/DropdownMenuTrigger.js +2 -1
- package/dist/DropdownMenu/DropdownMenuTrigger.js.map +1 -1
- package/dist/Listbox/ListboxRoot.cjs +25 -2
- package/dist/Listbox/ListboxRoot.cjs.map +1 -1
- package/dist/Listbox/ListboxRoot.js +25 -2
- package/dist/Listbox/ListboxRoot.js.map +1 -1
- package/dist/Menubar/MenubarTrigger.cjs +2 -1
- package/dist/Menubar/MenubarTrigger.cjs.map +1 -1
- package/dist/Menubar/MenubarTrigger.js +2 -1
- package/dist/Menubar/MenubarTrigger.js.map +1 -1
- package/dist/NavigationMenu/NavigationMenuTrigger.cjs +3 -2
- package/dist/NavigationMenu/NavigationMenuTrigger.cjs.map +1 -1
- package/dist/NavigationMenu/NavigationMenuTrigger.js +3 -2
- package/dist/NavigationMenu/NavigationMenuTrigger.js.map +1 -1
- package/dist/NumberField/NumberFieldRoot.cjs +12 -3
- package/dist/NumberField/NumberFieldRoot.cjs.map +1 -1
- package/dist/NumberField/NumberFieldRoot.js +12 -3
- package/dist/NumberField/NumberFieldRoot.js.map +1 -1
- package/dist/PinInput/PinInputRoot.cjs +1 -0
- package/dist/PinInput/PinInputRoot.cjs.map +1 -1
- package/dist/PinInput/PinInputRoot.js +1 -0
- package/dist/PinInput/PinInputRoot.js.map +1 -1
- package/dist/RovingFocus/RovingFocusItem.cjs +7 -2
- package/dist/RovingFocus/RovingFocusItem.cjs.map +1 -1
- package/dist/RovingFocus/RovingFocusItem.js +7 -2
- package/dist/RovingFocus/RovingFocusItem.js.map +1 -1
- package/dist/Select/SelectContent.cjs +4 -0
- package/dist/Select/SelectContent.cjs.map +1 -1
- package/dist/Select/SelectContent.js +4 -0
- package/dist/Select/SelectContent.js.map +1 -1
- package/dist/Select/SelectContentImpl.cjs +7 -2
- package/dist/Select/SelectContentImpl.cjs.map +1 -1
- package/dist/Select/SelectContentImpl.js +9 -4
- package/dist/Select/SelectContentImpl.js.map +1 -1
- package/dist/Select/SelectTrigger.cjs +24 -15
- package/dist/Select/SelectTrigger.cjs.map +1 -1
- package/dist/Select/SelectTrigger.js +25 -16
- package/dist/Select/SelectTrigger.js.map +1 -1
- package/dist/Tabs/TabsTrigger.cjs +4 -1
- package/dist/Tabs/TabsTrigger.cjs.map +1 -1
- package/dist/Tabs/TabsTrigger.js +4 -1
- package/dist/Tabs/TabsTrigger.js.map +1 -1
- package/dist/TimeField/TimeFieldRoot.cjs +1 -0
- package/dist/TimeField/TimeFieldRoot.cjs.map +1 -1
- package/dist/TimeField/TimeFieldRoot.js +1 -0
- package/dist/TimeField/TimeFieldRoot.js.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.cjs +1 -0
- package/dist/TimeRangeField/TimeRangeFieldRoot.cjs.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.js +1 -0
- package/dist/TimeRangeField/TimeRangeFieldRoot.js.map +1 -1
- package/dist/Toast/ToastAction.cjs +14 -6
- package/dist/Toast/ToastAction.cjs.map +1 -1
- package/dist/Toast/ToastAction.js +15 -7
- package/dist/Toast/ToastAction.js.map +1 -1
- package/dist/Toast/ToastArrow.cjs +53 -0
- package/dist/Toast/ToastArrow.cjs.map +1 -0
- package/dist/Toast/ToastArrow.js +47 -0
- package/dist/Toast/ToastArrow.js.map +1 -0
- package/dist/Toast/ToastDescription.cjs +5 -3
- package/dist/Toast/ToastDescription.cjs.map +1 -1
- package/dist/Toast/ToastDescription.js +6 -4
- package/dist/Toast/ToastDescription.js.map +1 -1
- package/dist/Toast/ToastPositioner.cjs +166 -0
- package/dist/Toast/ToastPositioner.cjs.map +1 -0
- package/dist/Toast/ToastPositioner.js +154 -0
- package/dist/Toast/ToastPositioner.js.map +1 -0
- package/dist/Toast/ToastProvider.cjs +74 -3
- package/dist/Toast/ToastProvider.cjs.map +1 -1
- package/dist/Toast/ToastProvider.js +75 -4
- package/dist/Toast/ToastProvider.js.map +1 -1
- package/dist/Toast/ToastRoot.cjs +38 -15
- package/dist/Toast/ToastRoot.cjs.map +1 -1
- package/dist/Toast/ToastRoot.js +39 -16
- package/dist/Toast/ToastRoot.js.map +1 -1
- package/dist/Toast/ToastRootImpl.cjs +69 -12
- package/dist/Toast/ToastRootImpl.cjs.map +1 -1
- package/dist/Toast/ToastRootImpl.js +74 -17
- package/dist/Toast/ToastRootImpl.js.map +1 -1
- package/dist/Toast/ToastTitle.cjs +5 -3
- package/dist/Toast/ToastTitle.cjs.map +1 -1
- package/dist/Toast/ToastTitle.js +6 -4
- package/dist/Toast/ToastTitle.js.map +1 -1
- package/dist/Toast/ToastViewport.cjs +40 -5
- package/dist/Toast/ToastViewport.cjs.map +1 -1
- package/dist/Toast/ToastViewport.js +41 -6
- package/dist/Toast/ToastViewport.js.map +1 -1
- package/dist/Toast/createToastManager.cjs +119 -0
- package/dist/Toast/createToastManager.cjs.map +1 -0
- package/dist/Toast/createToastManager.js +95 -0
- package/dist/Toast/createToastManager.js.map +1 -0
- package/dist/Toast/useToastManager.cjs +25 -0
- package/dist/Toast/useToastManager.cjs.map +1 -0
- package/dist/Toast/useToastManager.js +20 -0
- package/dist/Toast/useToastManager.js.map +1 -0
- package/dist/Toast/useToastStore.cjs +87 -0
- package/dist/Toast/useToastStore.cjs.map +1 -0
- package/dist/Toast/useToastStore.js +81 -0
- package/dist/Toast/useToastStore.js.map +1 -0
- package/dist/Toast/utils.cjs +2 -4
- package/dist/Toast/utils.cjs.map +1 -1
- package/dist/Toast/utils.js +2 -3
- package/dist/Toast/utils.js.map +1 -1
- package/dist/Tree/TreeRoot.cjs +9 -3
- package/dist/Tree/TreeRoot.cjs.map +1 -1
- package/dist/Tree/TreeRoot.js +9 -3
- package/dist/Tree/TreeRoot.js.map +1 -1
- package/dist/Tree/TreeVirtualizer.cjs +10 -1
- package/dist/Tree/TreeVirtualizer.cjs.map +1 -1
- package/dist/Tree/TreeVirtualizer.js +11 -2
- package/dist/Tree/TreeVirtualizer.js.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.cjs +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.cjs.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/composables/useSwipeDismiss.cjs +26 -6
- package/dist/composables/useSwipeDismiss.cjs.map +1 -1
- package/dist/composables/useSwipeDismiss.js +26 -6
- package/dist/composables/useSwipeDismiss.js.map +1 -1
- package/dist/constant/components.cjs +6 -2
- package/dist/constant/components.cjs.map +1 -1
- package/dist/constant/components.js +6 -2
- package/dist/constant/components.js.map +1 -1
- package/dist/constant.d.cts +2 -2
- package/dist/constant.d.cts.map +1 -1
- package/dist/constant.d.ts +2 -2
- package/dist/constant.d.ts.map +1 -1
- package/dist/index.cjs +10 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -1
- package/dist/index2.d.cts +21 -9
- package/dist/index2.d.cts.map +1 -1
- package/dist/index2.d.ts +33 -21
- package/dist/index2.d.ts.map +1 -1
- package/dist/index3.d.cts +1681 -1435
- package/dist/index3.d.cts.map +1 -1
- package/dist/index3.d.ts +1678 -1432
- package/dist/index3.d.ts.map +1 -1
- package/dist/internal.cjs +1 -0
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.cts.map +1 -1
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +1 -0
- package/dist/namespaced/index.cjs +3 -1
- package/dist/namespaced/index.d.cts +3 -1
- package/dist/namespaced/index.d.mts +3 -1
- package/dist/namespaced/index.mjs +4 -2
- package/dist/shared/isHTMLElement.cjs +16 -0
- package/dist/shared/isHTMLElement.cjs.map +1 -0
- package/dist/shared/isHTMLElement.js +10 -0
- package/dist/shared/isHTMLElement.js.map +1 -0
- package/dist/shared/useForwardPropsEmits.cjs.map +1 -1
- package/dist/shared/useForwardPropsEmits.js.map +1 -1
- package/dist/shared.cjs +2 -0
- package/dist/shared.d.cts +2 -2
- package/dist/shared.d.ts +2 -2
- package/dist/shared.js +2 -1
- package/package.json +18 -18
- package/src/Autocomplete/AutocompleteRoot.vue +4 -1
- package/src/Combobox/ComboboxRoot.vue +2 -1
- package/src/ContextMenu/ContextMenuRoot.vue +8 -7
- package/src/ContextMenu/ContextMenuTrigger.vue +37 -3
- package/src/DateField/DateFieldRoot.vue +1 -0
- package/src/DatePicker/DatePickerContent.vue +1 -1
- package/src/DateRangeField/DateRangeFieldRoot.vue +1 -0
- package/src/DateRangePicker/DateRangePickerContent.vue +1 -1
- package/src/DismissableLayer/DismissableLayer.vue +4 -0
- package/src/DismissableLayer/utils.ts +20 -7
- package/src/Drawer/DrawerContent.vue +2 -2
- package/src/Drawer/DrawerContentImpl.vue +19 -8
- package/src/Drawer/DrawerRoot.vue +23 -5
- package/src/Drawer/DrawerSwipeArea.vue +10 -3
- package/src/Drawer/composables/useSwipeDismiss.ts +51 -5
- package/src/DropdownMenu/DropdownMenuTrigger.vue +2 -1
- package/src/Listbox/ListboxRoot.vue +30 -2
- package/src/Menubar/MenubarTrigger.vue +2 -1
- package/src/NavigationMenu/NavigationMenuTrigger.vue +7 -2
- package/src/NumberField/NumberFieldRoot.vue +28 -4
- package/src/PinInput/PinInputRoot.vue +1 -0
- package/src/RovingFocus/RovingFocusItem.vue +13 -2
- package/src/Select/SelectContentImpl.vue +13 -3
- package/src/Select/SelectTrigger.vue +52 -21
- package/src/Tabs/TabsTrigger.vue +4 -1
- package/src/TimeField/TimeFieldRoot.vue +1 -0
- package/src/TimeRangeField/TimeRangeFieldRoot.vue +1 -0
- package/src/Toast/ToastAction.vue +22 -7
- package/src/Toast/ToastArrow.vue +38 -0
- package/src/Toast/ToastDescription.vue +10 -1
- package/src/Toast/ToastPositioner.vue +76 -0
- package/src/Toast/ToastProvider.vue +113 -5
- package/src/Toast/ToastRoot.vue +39 -8
- package/src/Toast/ToastRootImpl.vue +67 -17
- package/src/Toast/ToastTitle.vue +8 -2
- package/src/Toast/ToastViewport.vue +41 -3
- package/src/Toast/createToastManager.ts +207 -0
- package/src/Toast/index.ts +15 -0
- package/src/Toast/useToastManager.ts +23 -0
- package/src/Toast/useToastStore.ts +92 -0
- package/src/Toast/utils.ts +2 -4
- package/src/Tree/TreeRoot.vue +6 -1
- package/src/Tree/TreeVirtualizer.vue +17 -2
- package/src/VisuallyHidden/VisuallyHidden.vue +11 -1
- package/src/internal.ts +2 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/isHTMLElement.ts +9 -0
- package/src/shared/useForwardPropsEmits.ts +12 -5
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../rolldown-runtime.cjs');
|
|
2
2
|
const require_shared_createContext = require('../shared/createContext.cjs');
|
|
3
3
|
const require_Collection_Collection = require('../Collection/Collection.cjs');
|
|
4
|
+
const require_Toast_createToastManager = require('./createToastManager.cjs');
|
|
5
|
+
const require_Toast_useToastStore = require('./useToastStore.cjs');
|
|
4
6
|
const vue = require_rolldown_runtime.__toESM(require("vue"));
|
|
5
|
-
const __vinicunca_perkakas = require_rolldown_runtime.__toESM(require("@vinicunca/perkakas"));
|
|
6
7
|
|
|
7
8
|
//#region src/Toast/ToastProvider.vue?vue&type=script&setup=true&lang.ts
|
|
8
9
|
const [injectToastProviderContext, provideToastProviderContext] = require_shared_createContext.createContext("ToastProvider");
|
|
@@ -33,6 +34,14 @@ var ToastProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
33
34
|
type: Number,
|
|
34
35
|
required: false,
|
|
35
36
|
default: 50
|
|
37
|
+
},
|
|
38
|
+
limit: {
|
|
39
|
+
type: Number,
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
toastManager: {
|
|
43
|
+
type: Object,
|
|
44
|
+
required: false
|
|
36
45
|
}
|
|
37
46
|
},
|
|
38
47
|
setup(__props) {
|
|
@@ -43,7 +52,45 @@ var ToastProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
43
52
|
const toastCount = (0, vue.ref)(0);
|
|
44
53
|
const isFocusedToastEscapeKeyDownRef = (0, vue.ref)(false);
|
|
45
54
|
const isClosePausedRef = (0, vue.ref)(false);
|
|
46
|
-
|
|
55
|
+
const toastStore = require_Toast_useToastStore.useToastStore();
|
|
56
|
+
(0, vue.onMounted)(() => {
|
|
57
|
+
(0, vue.watch)(() => props.toastManager, (manager, _, onCleanup) => {
|
|
58
|
+
if (!manager) return;
|
|
59
|
+
const unsubscribe = manager[require_Toast_createToastManager.TOAST_MANAGER_SUBSCRIBE]((event) => {
|
|
60
|
+
if (event.action === "add") toastStore.add(event.options);
|
|
61
|
+
else if (event.action === "close") toastStore.close(event.id);
|
|
62
|
+
else toastStore.update(event.id, event.updates);
|
|
63
|
+
});
|
|
64
|
+
onCleanup(unsubscribe);
|
|
65
|
+
}, { immediate: true });
|
|
66
|
+
});
|
|
67
|
+
const entries = (0, vue.shallowReactive)([]);
|
|
68
|
+
let seq = 0;
|
|
69
|
+
const stack = (0, vue.computed)(() => {
|
|
70
|
+
const ordered = [...entries].sort((a, b) => b.seq - a.seq);
|
|
71
|
+
const states = /* @__PURE__ */ new Map();
|
|
72
|
+
let visibleIndex = 0;
|
|
73
|
+
let offsetY = 0;
|
|
74
|
+
ordered.forEach((entry, index) => {
|
|
75
|
+
const closing = !entry.open;
|
|
76
|
+
states.set(entry, {
|
|
77
|
+
index: closing ? index : visibleIndex,
|
|
78
|
+
offsetY,
|
|
79
|
+
limited: !closing && props.limit !== void 0 && visibleIndex >= props.limit
|
|
80
|
+
});
|
|
81
|
+
if (!closing) {
|
|
82
|
+
offsetY += entry.height;
|
|
83
|
+
visibleIndex++;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
ordered,
|
|
88
|
+
states
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
const hovering = (0, vue.ref)(false);
|
|
92
|
+
const focused = (0, vue.ref)(false);
|
|
93
|
+
if (props.label && typeof props.label === "string" && !props.label.trim()) {
|
|
47
94
|
const error = "Invalid prop `label` supplied to `ToastProvider`. Expected non-empty `string`.";
|
|
48
95
|
throw new Error(error);
|
|
49
96
|
}
|
|
@@ -65,7 +112,31 @@ var ToastProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
65
112
|
toastCount.value--;
|
|
66
113
|
},
|
|
67
114
|
isFocusedToastEscapeKeyDownRef,
|
|
68
|
-
isClosePausedRef
|
|
115
|
+
isClosePausedRef,
|
|
116
|
+
toastStore,
|
|
117
|
+
hovering,
|
|
118
|
+
focused,
|
|
119
|
+
expanded: (0, vue.computed)(() => hovering.value || focused.value),
|
|
120
|
+
frontmostHeight: (0, vue.computed)(() => stack.value.ordered.find((entry) => entry.open)?.height || void 0),
|
|
121
|
+
closingCount: (0, vue.computed)(() => entries.filter((entry) => !entry.open).length),
|
|
122
|
+
registerToast(entry) {
|
|
123
|
+
entry.seq = ++seq;
|
|
124
|
+
entries.push(entry);
|
|
125
|
+
return () => {
|
|
126
|
+
const index = entries.indexOf(entry);
|
|
127
|
+
if (index !== -1) entries.splice(index, 1);
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
reopenToast(entry) {
|
|
131
|
+
entry.seq = ++seq;
|
|
132
|
+
},
|
|
133
|
+
getToastStack(entry) {
|
|
134
|
+
return stack.value.states.get(entry) ?? {
|
|
135
|
+
index: 0,
|
|
136
|
+
offsetY: 0,
|
|
137
|
+
limited: false
|
|
138
|
+
};
|
|
139
|
+
}
|
|
69
140
|
});
|
|
70
141
|
return (_ctx, _cache) => {
|
|
71
142
|
return (0, vue.renderSlot)(_ctx.$slots, "default");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastProvider.cjs","names":[],"sources":["../../src/Toast/ToastProvider.vue","../../src/Toast/ToastProvider.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastProvider.cjs","names":[],"sources":["../../src/Toast/ToastProvider.vue","../../src/Toast/ToastProvider.vue"],"sourcesContent":[],"mappings":";;;;;;;;AAyFA,MAAa,CAAC,4BAA4B,4BAA2B,GACjE,2CAAoC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYxD,MAAM,QAAQ;EAMd,MAAM,EAAE,OAAO,UAAU,cAAc,gBAAgB,gBAAgB,GAAG,gBAAO,MAAM;AACvF,8CAAc,EAAE,YAAY,KAAM,EAAC;EAEnC,MAAM,WAAW,cAAkB;EACnC,MAAM,aAAa,aAAI,EAAE;EACzB,MAAM,iCAAiC,aAAI,MAAM;EACjD,MAAM,mBAAmB,aAAI,MAAM;EAE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AW;GACZ;GACD;GACA;GACA;GACA;GACA;GACA,UAAU,kBAAS,MAAM,SAAS,SAAS,QAAQ,MAAM;GACzD,iBAAiB,kBAAS,MAAM,MAAM,MAAM,QAAQ,KAAK,CAAC,UAAU,MAAM,KAAK,EAAE,iBAAoB;GACrG,cAAc,kBAAS,MAAM,QAAQ,OAAO,CAAC,WAAW,MAAM,KAAK,CAAC,OAAO;GAC3E,cAAc,OAAO;AACnB,UAAM,MAAM,EAAE;AACd,YAAQ,KAAK,MAAM;AACnB,WAAO,MAAM;KACX,MAAM,QAAQ,QAAQ,QAAQ,MAAM;AACpC,SAAI,UAAU,GACZ,SAAQ,OAAO,OAAO,EAAE;IAE3B;GACF;GACD,YAAY,OAAO;AACjB,UAAM,MAAM,EAAE;GACf;GACD,cAAc,OAAO;AACnB,WAAO,MAAM,MAAM,OAAO,IAAI,MAAM,IAAI;KAAE,OAAO;KAAG,SAAS;KAAG,SAAS;IAAO;GACjF;EACF,EAAC;;UAIA,oBAAQ,KAAA,QAAA,UAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createContext } from "../shared/createContext.js";
|
|
2
2
|
import { useCollection } from "../Collection/Collection.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { TOAST_MANAGER_SUBSCRIBE } from "./createToastManager.js";
|
|
4
|
+
import { useToastStore } from "./useToastStore.js";
|
|
5
|
+
import { computed, defineComponent, onMounted, ref, renderSlot, shallowReactive, toRefs, watch } from "vue";
|
|
5
6
|
|
|
6
7
|
//#region src/Toast/ToastProvider.vue?vue&type=script&setup=true&lang.ts
|
|
7
8
|
const [injectToastProviderContext, provideToastProviderContext] = /*#__PURE__*/ createContext("ToastProvider");
|
|
@@ -32,6 +33,14 @@ var ToastProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
32
33
|
type: Number,
|
|
33
34
|
required: false,
|
|
34
35
|
default: 50
|
|
36
|
+
},
|
|
37
|
+
limit: {
|
|
38
|
+
type: Number,
|
|
39
|
+
required: false
|
|
40
|
+
},
|
|
41
|
+
toastManager: {
|
|
42
|
+
type: Object,
|
|
43
|
+
required: false
|
|
35
44
|
}
|
|
36
45
|
},
|
|
37
46
|
setup(__props) {
|
|
@@ -42,7 +51,45 @@ var ToastProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
42
51
|
const toastCount = ref(0);
|
|
43
52
|
const isFocusedToastEscapeKeyDownRef = ref(false);
|
|
44
53
|
const isClosePausedRef = ref(false);
|
|
45
|
-
|
|
54
|
+
const toastStore = useToastStore();
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
watch(() => props.toastManager, (manager, _, onCleanup) => {
|
|
57
|
+
if (!manager) return;
|
|
58
|
+
const unsubscribe = manager[TOAST_MANAGER_SUBSCRIBE]((event) => {
|
|
59
|
+
if (event.action === "add") toastStore.add(event.options);
|
|
60
|
+
else if (event.action === "close") toastStore.close(event.id);
|
|
61
|
+
else toastStore.update(event.id, event.updates);
|
|
62
|
+
});
|
|
63
|
+
onCleanup(unsubscribe);
|
|
64
|
+
}, { immediate: true });
|
|
65
|
+
});
|
|
66
|
+
const entries = shallowReactive([]);
|
|
67
|
+
let seq = 0;
|
|
68
|
+
const stack = computed(() => {
|
|
69
|
+
const ordered = [...entries].sort((a, b) => b.seq - a.seq);
|
|
70
|
+
const states = /* @__PURE__ */ new Map();
|
|
71
|
+
let visibleIndex = 0;
|
|
72
|
+
let offsetY = 0;
|
|
73
|
+
ordered.forEach((entry, index) => {
|
|
74
|
+
const closing = !entry.open;
|
|
75
|
+
states.set(entry, {
|
|
76
|
+
index: closing ? index : visibleIndex,
|
|
77
|
+
offsetY,
|
|
78
|
+
limited: !closing && props.limit !== void 0 && visibleIndex >= props.limit
|
|
79
|
+
});
|
|
80
|
+
if (!closing) {
|
|
81
|
+
offsetY += entry.height;
|
|
82
|
+
visibleIndex++;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
ordered,
|
|
87
|
+
states
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
const hovering = ref(false);
|
|
91
|
+
const focused = ref(false);
|
|
92
|
+
if (props.label && typeof props.label === "string" && !props.label.trim()) {
|
|
46
93
|
const error = "Invalid prop `label` supplied to `ToastProvider`. Expected non-empty `string`.";
|
|
47
94
|
throw new Error(error);
|
|
48
95
|
}
|
|
@@ -64,7 +111,31 @@ var ToastProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
64
111
|
toastCount.value--;
|
|
65
112
|
},
|
|
66
113
|
isFocusedToastEscapeKeyDownRef,
|
|
67
|
-
isClosePausedRef
|
|
114
|
+
isClosePausedRef,
|
|
115
|
+
toastStore,
|
|
116
|
+
hovering,
|
|
117
|
+
focused,
|
|
118
|
+
expanded: computed(() => hovering.value || focused.value),
|
|
119
|
+
frontmostHeight: computed(() => stack.value.ordered.find((entry) => entry.open)?.height || void 0),
|
|
120
|
+
closingCount: computed(() => entries.filter((entry) => !entry.open).length),
|
|
121
|
+
registerToast(entry) {
|
|
122
|
+
entry.seq = ++seq;
|
|
123
|
+
entries.push(entry);
|
|
124
|
+
return () => {
|
|
125
|
+
const index = entries.indexOf(entry);
|
|
126
|
+
if (index !== -1) entries.splice(index, 1);
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
reopenToast(entry) {
|
|
130
|
+
entry.seq = ++seq;
|
|
131
|
+
},
|
|
132
|
+
getToastStack(entry) {
|
|
133
|
+
return stack.value.states.get(entry) ?? {
|
|
134
|
+
index: 0,
|
|
135
|
+
offsetY: 0,
|
|
136
|
+
limited: false
|
|
137
|
+
};
|
|
138
|
+
}
|
|
68
139
|
});
|
|
69
140
|
return (_ctx, _cache) => {
|
|
70
141
|
return renderSlot(_ctx.$slots, "default");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastProvider.js","names":[],"sources":["../../src/Toast/ToastProvider.vue","../../src/Toast/ToastProvider.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastProvider.js","names":[],"sources":["../../src/Toast/ToastProvider.vue","../../src/Toast/ToastProvider.vue"],"sourcesContent":[],"mappings":";;;;;;;AAyFA,MAAa,CAAC,4BAA4B,4BAA2B,GACjE,cAAoC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYxD,MAAM,QAAQ;EAMd,MAAM,EAAE,OAAO,UAAU,cAAc,gBAAgB,gBAAgB,GAAG,OAAO,MAAM;AACvF,gBAAc,EAAE,YAAY,KAAM,EAAC;EAEnC,MAAM,WAAW,KAAkB;EACnC,MAAM,aAAa,IAAI,EAAE;EACzB,MAAM,iCAAiC,IAAI,MAAM;EACjD,MAAM,mBAAmB,IAAI,MAAM;EAEnC,MAAM,aAAa,eAAe;AAElC,YAAU,MAAM;AAEd,SAAM,MAAM,MAAM,cAAc,CAAC,SAAS,GAAG,cAAc;AACzD,SAAK,QACH;IAEF,MAAM,cAAc,QAAQ,yBAAyB,CAAC,UAAU;AAC9D,SAAI,MAAM,WAAW,MACnB,YAAW,IAAI,MAAM,QAAQ;cACpB,MAAM,WAAW,QAC1B,YAAW,MAAM,MAAM,GAAG;SAE1B,YAAW,OAAO,MAAM,IAAI,MAAM,QAAQ;IAE7C,EAAC;AACF,cAAU,YAAY;GACvB,GAAE,EAAE,WAAW,KAAM,EAAC;EACxB,EAAC;EAEF,MAAM,UAAU,gBAAwC,CAAE,EAAC;EAC3D,IAAI,MAAM;EAEV,MAAM,QAAQ,SAAS,MAAM;GAC3B,MAAM,UAAU,CAAC,GAAG,OAAQ,EAAC,KAAK,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI;GAC1D,MAAM,yBAAS,IAAI;GACnB,IAAI,eAAe;GACnB,IAAI,UAAU;AACd,WAAQ,QAAQ,CAAC,OAAO,UAAU;IAChC,MAAM,WAAW,MAAM;AACvB,WAAO,IAAI,OAAO;KAChB,OAAO,UAAU,QAAQ;KAC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2
|
const require_shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
|
|
3
3
|
const require_Presence_Presence = require('../Presence/Presence.cjs');
|
|
4
|
+
const require_Toast_ToastProvider = require('./ToastProvider.cjs');
|
|
4
5
|
const require_Toast_ToastRootImpl = require('./ToastRootImpl.cjs');
|
|
5
6
|
const vue = require_rolldown_runtime.__toESM(require("vue"));
|
|
6
7
|
const __vueuse_core = require_rolldown_runtime.__toESM(require("@vueuse/core"));
|
|
@@ -32,6 +33,10 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
32
33
|
type: Number,
|
|
33
34
|
required: false
|
|
34
35
|
},
|
|
36
|
+
toast: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
35
40
|
asChild: {
|
|
36
41
|
type: Boolean,
|
|
37
42
|
required: false
|
|
@@ -60,25 +65,42 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
60
65
|
defaultValue: props.defaultOpen,
|
|
61
66
|
passive: props.open === void 0
|
|
62
67
|
});
|
|
68
|
+
const providerContext = require_Toast_ToastProvider.injectToastProviderContext();
|
|
69
|
+
const isOpen = (0, vue.computed)(() => props.toast ? props.toast.open : open.value);
|
|
70
|
+
const resolvedType = (0, vue.computed)(() => props.toast?.type ?? props.type);
|
|
71
|
+
const resolvedDuration = (0, vue.computed)(() => props.toast?.status === "loading" ? Number.POSITIVE_INFINITY : props.toast?.duration ?? props.duration);
|
|
72
|
+
function close() {
|
|
73
|
+
if (props.toast) {
|
|
74
|
+
providerContext.toastStore.close(props.toast.id);
|
|
75
|
+
emits("update:open", false);
|
|
76
|
+
} else open.value = false;
|
|
77
|
+
}
|
|
78
|
+
const isContentMounted = (0, vue.ref)(false);
|
|
79
|
+
(0, vue.watch)([() => props.toast, isContentMounted], ([toast, mounted]) => {
|
|
80
|
+
if (toast && !toast.open && !mounted) providerContext.toastStore.remove(toast.id);
|
|
81
|
+
}, { immediate: true });
|
|
63
82
|
return (_ctx, _cache) => {
|
|
64
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(require_Presence_Presence.Presence_default), { present: __props.forceMount ||
|
|
83
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(require_Presence_Presence.Presence_default), { present: __props.forceMount || isOpen.value }, {
|
|
65
84
|
default: (0, vue.withCtx)(() => [(0, vue.createVNode)(require_Toast_ToastRootImpl.ToastRootImpl_default, (0, vue.mergeProps)({
|
|
66
85
|
ref: (0, vue.unref)(forwardRef),
|
|
67
|
-
open:
|
|
68
|
-
type:
|
|
86
|
+
open: isOpen.value,
|
|
87
|
+
type: resolvedType.value,
|
|
69
88
|
as: __props.as,
|
|
70
89
|
"as-child": __props.asChild,
|
|
71
|
-
duration:
|
|
90
|
+
duration: resolvedDuration.value,
|
|
91
|
+
toast: __props.toast
|
|
72
92
|
}, _ctx.$attrs, {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
93
|
+
onVnodeMounted: _cache[0] || (_cache[0] = ($event) => isContentMounted.value = true),
|
|
94
|
+
onVnodeUnmounted: _cache[1] || (_cache[1] = ($event) => isContentMounted.value = false),
|
|
95
|
+
onClose: close,
|
|
96
|
+
onPause: _cache[2] || (_cache[2] = ($event) => emits("pause")),
|
|
97
|
+
onResume: _cache[3] || (_cache[3] = ($event) => emits("resume")),
|
|
98
|
+
onEscapeKeyDown: _cache[4] || (_cache[4] = ($event) => emits("escapeKeyDown", $event)),
|
|
99
|
+
onSwipeStart: _cache[5] || (_cache[5] = (event) => {
|
|
78
100
|
emits("swipeStart", event);
|
|
79
101
|
if (!event.defaultPrevented) event.currentTarget.setAttribute("data-swipe", "start");
|
|
80
102
|
}),
|
|
81
|
-
onSwipeMove: _cache[
|
|
103
|
+
onSwipeMove: _cache[6] || (_cache[6] = (event) => {
|
|
82
104
|
emits("swipeMove", event);
|
|
83
105
|
if (!event.defaultPrevented) {
|
|
84
106
|
const { x, y } = event.detail.delta;
|
|
@@ -88,7 +110,7 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
88
110
|
target.style.setProperty("--akar-toast-swipe-move-y", `${y}px`);
|
|
89
111
|
}
|
|
90
112
|
}),
|
|
91
|
-
onSwipeCancel: _cache[
|
|
113
|
+
onSwipeCancel: _cache[7] || (_cache[7] = (event) => {
|
|
92
114
|
emits("swipeCancel", event);
|
|
93
115
|
if (!event.defaultPrevented) {
|
|
94
116
|
const target = event.currentTarget;
|
|
@@ -99,7 +121,7 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
99
121
|
target.style.removeProperty("--akar-toast-swipe-end-y");
|
|
100
122
|
}
|
|
101
123
|
}),
|
|
102
|
-
onSwipeEnd: _cache[
|
|
124
|
+
onSwipeEnd: _cache[8] || (_cache[8] = (event) => {
|
|
103
125
|
emits("swipeEnd", event);
|
|
104
126
|
if (!event.defaultPrevented) {
|
|
105
127
|
const { x, y } = event.detail.delta;
|
|
@@ -109,14 +131,14 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
109
131
|
target.style.removeProperty("--akar-toast-swipe-move-y");
|
|
110
132
|
target.style.setProperty("--akar-toast-swipe-end-x", `${x}px`);
|
|
111
133
|
target.style.setProperty("--akar-toast-swipe-end-y", `${y}px`);
|
|
112
|
-
|
|
134
|
+
close();
|
|
113
135
|
}
|
|
114
136
|
})
|
|
115
137
|
}), {
|
|
116
138
|
default: (0, vue.withCtx)(({ remaining, duration: _duration }) => [(0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
117
139
|
remaining,
|
|
118
140
|
duration: _duration,
|
|
119
|
-
open:
|
|
141
|
+
open: isOpen.value
|
|
120
142
|
})]),
|
|
121
143
|
_: 3
|
|
122
144
|
}, 16, [
|
|
@@ -124,7 +146,8 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
124
146
|
"type",
|
|
125
147
|
"as",
|
|
126
148
|
"as-child",
|
|
127
|
-
"duration"
|
|
149
|
+
"duration",
|
|
150
|
+
"toast"
|
|
128
151
|
])]),
|
|
129
152
|
_: 3
|
|
130
153
|
}, 8, ["present"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRoot.cjs","names":["$attrs"],"sources":["../../src/Toast/ToastRoot.vue","../../src/Toast/ToastRoot.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastRoot.cjs","names":["$attrs"],"sources":["../../src/Toast/ToastRoot.vue","../../src/Toast/ToastRoot.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BA,MAAM,QAAQ;EAOd,MAAM,QAAQ;EAad,MAAM,EAAE,YAAY,GAAG,kDAAkB;EACzC,MAAM,OAAO,6BAAU,OAAO,QAAQ,OAAO;GAC3C,cAAc,MAAM;GACpB,SAAU,MAAM;EACjB,EAAC;EAEF,MAAM,kBAAkB,wDAA4B;EAEpD,MAAM,SAAS,kBAAS,MAAM,MAAM,QAAQ,MAAM,MAAM,OAAO,KAAK,MAAM;EAC1E,MAAM,eAAe,kBAAS,MAAM,MAAM,OAAO,QAAQ,MAAM,KAAK;EACpE,MAAM,mBAAmB,kBAAS,MAAM,MAAM,OAAO,WAAW,YAC5D,OAAO,oBACP,MAAM,OAAO,YAAY,MAAM,SAAS;EAE5C,SAAS,QAAQ;AACf,OAAI,MAAM,OAAO;AACf,oBAAgB,WAAW,MAAM,MAAM,MAAM,GAAG;AAChD,UAAM,eAAe,MAAM;GAC5B,MACC,MAAK,QAAQ;EAEjB;EAIA,MAAM,mBAAmB,aAAI,MAAM;AACnC,iBAAM,CAAC,MAAM,MAAM,OAAO,gBAAiB,GAAE,CAAC,CAAC,OAAO,QAAQ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AAgB,MAAM,kBAAgB;aAAoB,SAAS,MAAM;AAAuC,cAAO,aAAY,cAAA,SAAA;AAAoC,cAAO,MAAM,eAAc,4BAAA;AAAyC,cAAO,MAAM,eAAc,4BAAA;AAAyC,cAAO,MAAM,eAAc,2BAAA;AAAwC,cAAO,MAAM,eAAc,2BAAA;;;KAW1c,YAAS,OAAA,OAAA,OAAA,KAAA,CAAG,UAAK;AAAe,YAAK,YAAa,MAAK;WAAgB,MAAM,kBAAgB;eAAsB,GAAG,GAAC,GAAK,MAAM,OAAO;aAAuB,SAAS,MAAM;AAAuC,cAAO,aAAY,cAAA,MAAA;AAAiC,cAAO,MAAM,eAAc,4BAAA;AAAyC,cAAO,MAAM,eAAc,4BAAA;AAAyC,cAAO,MAAM,YAAW,4BAAA,GAAgC,EAAC,EAAA,CAAA,CAAA;AAAiB,cAAO,MAAM,YAAW,4BAAA,GAAgC,EAAC,EAAA,CAAA,CAAA;AAAiB,cAAK;;;;+BAc5iB,CAIE,EA3DQ,WAAS,UAAY,WAAS,KAAA,CAuDxC,oBAIE,KAAA,QAAA,WAAA;MAHY;MACX,UAAU;MACV,MAAM,OAAA"}
|
package/dist/Toast/ToastRoot.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useForwardExpose } from "../shared/useForwardExpose.js";
|
|
2
2
|
import { Presence_default } from "../Presence/Presence.js";
|
|
3
|
+
import { injectToastProviderContext } from "./ToastProvider.js";
|
|
3
4
|
import { ToastRootImpl_default } from "./ToastRootImpl.js";
|
|
4
|
-
import { createBlock, createVNode, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
5
|
+
import { computed, createBlock, createVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, unref, watch, withCtx } from "vue";
|
|
5
6
|
import { useVModel } from "@vueuse/core";
|
|
6
7
|
|
|
7
8
|
//#region src/Toast/ToastRoot.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -31,6 +32,10 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
31
32
|
type: Number,
|
|
32
33
|
required: false
|
|
33
34
|
},
|
|
35
|
+
toast: {
|
|
36
|
+
type: Object,
|
|
37
|
+
required: false
|
|
38
|
+
},
|
|
34
39
|
asChild: {
|
|
35
40
|
type: Boolean,
|
|
36
41
|
required: false
|
|
@@ -59,25 +64,42 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
59
64
|
defaultValue: props.defaultOpen,
|
|
60
65
|
passive: props.open === void 0
|
|
61
66
|
});
|
|
67
|
+
const providerContext = injectToastProviderContext();
|
|
68
|
+
const isOpen = computed(() => props.toast ? props.toast.open : open.value);
|
|
69
|
+
const resolvedType = computed(() => props.toast?.type ?? props.type);
|
|
70
|
+
const resolvedDuration = computed(() => props.toast?.status === "loading" ? Number.POSITIVE_INFINITY : props.toast?.duration ?? props.duration);
|
|
71
|
+
function close() {
|
|
72
|
+
if (props.toast) {
|
|
73
|
+
providerContext.toastStore.close(props.toast.id);
|
|
74
|
+
emits("update:open", false);
|
|
75
|
+
} else open.value = false;
|
|
76
|
+
}
|
|
77
|
+
const isContentMounted = ref(false);
|
|
78
|
+
watch([() => props.toast, isContentMounted], ([toast, mounted]) => {
|
|
79
|
+
if (toast && !toast.open && !mounted) providerContext.toastStore.remove(toast.id);
|
|
80
|
+
}, { immediate: true });
|
|
62
81
|
return (_ctx, _cache) => {
|
|
63
|
-
return openBlock(), createBlock(unref(Presence_default), { present: __props.forceMount ||
|
|
82
|
+
return openBlock(), createBlock(unref(Presence_default), { present: __props.forceMount || isOpen.value }, {
|
|
64
83
|
default: withCtx(() => [createVNode(ToastRootImpl_default, mergeProps({
|
|
65
84
|
ref: unref(forwardRef),
|
|
66
|
-
open:
|
|
67
|
-
type:
|
|
85
|
+
open: isOpen.value,
|
|
86
|
+
type: resolvedType.value,
|
|
68
87
|
as: __props.as,
|
|
69
88
|
"as-child": __props.asChild,
|
|
70
|
-
duration:
|
|
89
|
+
duration: resolvedDuration.value,
|
|
90
|
+
toast: __props.toast
|
|
71
91
|
}, _ctx.$attrs, {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
onVnodeMounted: _cache[0] || (_cache[0] = ($event) => isContentMounted.value = true),
|
|
93
|
+
onVnodeUnmounted: _cache[1] || (_cache[1] = ($event) => isContentMounted.value = false),
|
|
94
|
+
onClose: close,
|
|
95
|
+
onPause: _cache[2] || (_cache[2] = ($event) => emits("pause")),
|
|
96
|
+
onResume: _cache[3] || (_cache[3] = ($event) => emits("resume")),
|
|
97
|
+
onEscapeKeyDown: _cache[4] || (_cache[4] = ($event) => emits("escapeKeyDown", $event)),
|
|
98
|
+
onSwipeStart: _cache[5] || (_cache[5] = (event) => {
|
|
77
99
|
emits("swipeStart", event);
|
|
78
100
|
if (!event.defaultPrevented) event.currentTarget.setAttribute("data-swipe", "start");
|
|
79
101
|
}),
|
|
80
|
-
onSwipeMove: _cache[
|
|
102
|
+
onSwipeMove: _cache[6] || (_cache[6] = (event) => {
|
|
81
103
|
emits("swipeMove", event);
|
|
82
104
|
if (!event.defaultPrevented) {
|
|
83
105
|
const { x, y } = event.detail.delta;
|
|
@@ -87,7 +109,7 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
87
109
|
target.style.setProperty("--akar-toast-swipe-move-y", `${y}px`);
|
|
88
110
|
}
|
|
89
111
|
}),
|
|
90
|
-
onSwipeCancel: _cache[
|
|
112
|
+
onSwipeCancel: _cache[7] || (_cache[7] = (event) => {
|
|
91
113
|
emits("swipeCancel", event);
|
|
92
114
|
if (!event.defaultPrevented) {
|
|
93
115
|
const target = event.currentTarget;
|
|
@@ -98,7 +120,7 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
98
120
|
target.style.removeProperty("--akar-toast-swipe-end-y");
|
|
99
121
|
}
|
|
100
122
|
}),
|
|
101
|
-
onSwipeEnd: _cache[
|
|
123
|
+
onSwipeEnd: _cache[8] || (_cache[8] = (event) => {
|
|
102
124
|
emits("swipeEnd", event);
|
|
103
125
|
if (!event.defaultPrevented) {
|
|
104
126
|
const { x, y } = event.detail.delta;
|
|
@@ -108,14 +130,14 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
108
130
|
target.style.removeProperty("--akar-toast-swipe-move-y");
|
|
109
131
|
target.style.setProperty("--akar-toast-swipe-end-x", `${x}px`);
|
|
110
132
|
target.style.setProperty("--akar-toast-swipe-end-y", `${y}px`);
|
|
111
|
-
|
|
133
|
+
close();
|
|
112
134
|
}
|
|
113
135
|
})
|
|
114
136
|
}), {
|
|
115
137
|
default: withCtx(({ remaining, duration: _duration }) => [renderSlot(_ctx.$slots, "default", {
|
|
116
138
|
remaining,
|
|
117
139
|
duration: _duration,
|
|
118
|
-
open:
|
|
140
|
+
open: isOpen.value
|
|
119
141
|
})]),
|
|
120
142
|
_: 3
|
|
121
143
|
}, 16, [
|
|
@@ -123,7 +145,8 @@ var ToastRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
123
145
|
"type",
|
|
124
146
|
"as",
|
|
125
147
|
"as-child",
|
|
126
|
-
"duration"
|
|
148
|
+
"duration",
|
|
149
|
+
"toast"
|
|
127
150
|
])]),
|
|
128
151
|
_: 3
|
|
129
152
|
}, 8, ["present"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRoot.js","names":["$attrs"],"sources":["../../src/Toast/ToastRoot.vue","../../src/Toast/ToastRoot.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastRoot.js","names":["$attrs"],"sources":["../../src/Toast/ToastRoot.vue","../../src/Toast/ToastRoot.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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GAAgC,EAAC,EAAA,CAAA,CAAA;AAAiB,cAAK;;;;sBAc5iB,CAIE,EA3DQ,WAAS,UAAY,WAAS,KAAA,CAuDxC,WAIE,KAAA,QAAA,WAAA;MAHY;MACX,UAAU;MACV,MAAM,OAAA"}
|
|
@@ -6,9 +6,9 @@ const require_Primitive_Primitive = require('../Primitive/Primitive.cjs');
|
|
|
6
6
|
const require_Collection_Collection = require('../Collection/Collection.cjs');
|
|
7
7
|
const require_Toast_ToastProvider = require('./ToastProvider.cjs');
|
|
8
8
|
const require_Toast_ToastAnnounce = require('./ToastAnnounce.cjs');
|
|
9
|
+
const require_Toast_ToastPositioner = require('./ToastPositioner.cjs');
|
|
9
10
|
const require_Toast_utils = require('./utils.cjs');
|
|
10
11
|
const vue = require_rolldown_runtime.__toESM(require("vue"));
|
|
11
|
-
const __vinicunca_perkakas = require_rolldown_runtime.__toESM(require("@vinicunca/perkakas"));
|
|
12
12
|
const __vueuse_core = require_rolldown_runtime.__toESM(require("@vueuse/core"));
|
|
13
13
|
const __vueuse_shared = require_rolldown_runtime.__toESM(require("@vueuse/shared"));
|
|
14
14
|
|
|
@@ -31,6 +31,10 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
31
31
|
type: Number,
|
|
32
32
|
required: false
|
|
33
33
|
},
|
|
34
|
+
toast: {
|
|
35
|
+
type: Object,
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
34
38
|
asChild: {
|
|
35
39
|
type: Boolean,
|
|
36
40
|
required: false
|
|
@@ -59,7 +63,7 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
59
63
|
const providerContext = require_Toast_ToastProvider.injectToastProviderContext();
|
|
60
64
|
const pointerStartRef = (0, vue.ref)(null);
|
|
61
65
|
const swipeDeltaRef = (0, vue.ref)(null);
|
|
62
|
-
const duration = (0, vue.computed)(() =>
|
|
66
|
+
const duration = (0, vue.computed)(() => typeof props.duration === "number" ? props.duration : providerContext.duration.value);
|
|
63
67
|
const closeTimerStartTimeRef = (0, vue.ref)(0);
|
|
64
68
|
const closeTimerRemainingTimeRef = (0, vue.ref)(duration.value);
|
|
65
69
|
const closeTimerRef = (0, vue.ref)(0);
|
|
@@ -82,7 +86,34 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
82
86
|
if (isNonPointerEvent) providerContext.isClosePausedRef.value = false;
|
|
83
87
|
emits("close");
|
|
84
88
|
}
|
|
85
|
-
const
|
|
89
|
+
const positionerContext = require_Toast_ToastPositioner.injectToastPositionerContext(null);
|
|
90
|
+
const announceTextContent = (0, vue.shallowRef)(null);
|
|
91
|
+
(0, vue.watch)([currentElement, () => props.toast?.updateKey], ([element]) => {
|
|
92
|
+
announceTextContent.value = element ? require_Toast_utils.getAnnounceTextContent(element) : null;
|
|
93
|
+
}, {
|
|
94
|
+
flush: "post",
|
|
95
|
+
immediate: true
|
|
96
|
+
});
|
|
97
|
+
const stackEntry = (0, vue.reactive)({
|
|
98
|
+
seq: 0,
|
|
99
|
+
height: 0,
|
|
100
|
+
open: props.open
|
|
101
|
+
});
|
|
102
|
+
const stack = (0, vue.computed)(() => providerContext.getToastStack(stackEntry));
|
|
103
|
+
function measureHeight() {
|
|
104
|
+
const element = currentElement.value;
|
|
105
|
+
if (!element) return;
|
|
106
|
+
const previousHeight = element.style.height;
|
|
107
|
+
element.style.height = "auto";
|
|
108
|
+
stackEntry.height = element.offsetHeight;
|
|
109
|
+
element.style.height = previousHeight;
|
|
110
|
+
}
|
|
111
|
+
(0, __vueuse_core.useResizeObserver)(currentElement, measureHeight);
|
|
112
|
+
(0, vue.watch)(() => props.toast?.updateKey, measureHeight, { flush: "post" });
|
|
113
|
+
(0, vue.watch)(() => props.open, (open, wasOpen) => {
|
|
114
|
+
stackEntry.open = open;
|
|
115
|
+
if (open && !wasOpen) providerContext.reopenToast(stackEntry);
|
|
116
|
+
});
|
|
86
117
|
if (props.type && !["foreground", "background"].includes(props.type)) {
|
|
87
118
|
const error = "Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.";
|
|
88
119
|
throw new Error(error);
|
|
@@ -110,7 +141,12 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
110
141
|
});
|
|
111
142
|
}
|
|
112
143
|
});
|
|
113
|
-
(0, vue.
|
|
144
|
+
const restartKey = (0, vue.computed)(() => props.toast ? providerContext.toastStore.getRestartKey(props.toast.id) : 0);
|
|
145
|
+
(0, vue.watch)([
|
|
146
|
+
() => props.open,
|
|
147
|
+
duration,
|
|
148
|
+
restartKey
|
|
149
|
+
], () => {
|
|
114
150
|
closeTimerRemainingTimeRef.value = duration.value;
|
|
115
151
|
if (props.open && !providerContext.isClosePausedRef.value) startTimer(duration.value);
|
|
116
152
|
}, { immediate: true });
|
|
@@ -121,16 +157,23 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
121
157
|
handleClose();
|
|
122
158
|
}
|
|
123
159
|
});
|
|
160
|
+
let unregisterToast;
|
|
124
161
|
(0, vue.onMounted)(() => {
|
|
125
162
|
providerContext.onToastAdd();
|
|
163
|
+
unregisterToast = providerContext.registerToast(stackEntry);
|
|
164
|
+
measureHeight();
|
|
126
165
|
});
|
|
127
166
|
(0, vue.onUnmounted)(() => {
|
|
128
167
|
providerContext.onToastRemove();
|
|
168
|
+
unregisterToast?.();
|
|
169
|
+
});
|
|
170
|
+
provideToastRootContext({
|
|
171
|
+
onClose: handleClose,
|
|
172
|
+
toast: (0, vue.toRef)(props, "toast")
|
|
129
173
|
});
|
|
130
|
-
provideToastRootContext({ onClose: handleClose });
|
|
131
174
|
return (_ctx, _cache) => {
|
|
132
175
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [announceTextContent.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_Toast_ToastAnnounce.ToastAnnounce_default, {
|
|
133
|
-
key: 0,
|
|
176
|
+
key: __props.toast?.updateKey ?? 0,
|
|
134
177
|
role: "alert",
|
|
135
178
|
"aria-live": __props.type === "foreground" ? "assertive" : "polite"
|
|
136
179
|
}, {
|
|
@@ -138,9 +181,10 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
138
181
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: i }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(text), 1)], 64);
|
|
139
182
|
}), 128))]),
|
|
140
183
|
_: 1
|
|
141
|
-
}, 8, ["aria-live"])) : (0, vue.createCommentVNode)("v-if", true), (0, vue.unref)(providerContext).viewport.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
|
|
184
|
+
}, 8, ["aria-live"])) : (0, vue.createCommentVNode)("v-if", true), (0, vue.unref)(providerContext).viewport.value || (0, vue.unref)(positionerContext) ? ((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
|
|
142
185
|
key: 1,
|
|
143
|
-
to: (0, vue.unref)(providerContext).viewport.value
|
|
186
|
+
to: (0, vue.unref)(providerContext).viewport.value ?? "body",
|
|
187
|
+
disabled: !!(0, vue.unref)(positionerContext)
|
|
144
188
|
}, [(0, vue.createVNode)((0, vue.unref)(CollectionItem), null, {
|
|
145
189
|
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(require_Primitive_Primitive.Primitive), (0, vue.mergeProps)({
|
|
146
190
|
ref: (0, vue.unref)(forwardRef),
|
|
@@ -150,9 +194,18 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
150
194
|
"as-child": __props.asChild,
|
|
151
195
|
"data-state": __props.open ? "open" : "closed",
|
|
152
196
|
"data-swipe-direction": (0, vue.unref)(providerContext).swipeDirection.value,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
197
|
+
"data-status": __props.toast?.status,
|
|
198
|
+
"data-expanded": (0, vue.unref)(providerContext).expanded.value ? "" : void 0,
|
|
199
|
+
"data-limited": stack.value.limited ? "" : void 0,
|
|
200
|
+
inert: stack.value.limited || void 0,
|
|
201
|
+
style: {
|
|
202
|
+
...(0, vue.unref)(providerContext).disableSwipe.value ? void 0 : {
|
|
203
|
+
userSelect: "none",
|
|
204
|
+
touchAction: "none"
|
|
205
|
+
},
|
|
206
|
+
"--reka-toast-index": stack.value.index,
|
|
207
|
+
"--reka-toast-offset-y": `${stack.value.offsetY}px`,
|
|
208
|
+
"--reka-toast-height": stackEntry.height ? `${stackEntry.height}px` : void 0
|
|
156
209
|
},
|
|
157
210
|
onPointerdown: _cache[0] || (_cache[0] = (0, vue.withModifiers)((event) => {
|
|
158
211
|
if ((0, vue.unref)(providerContext).disableSwipe.value) return;
|
|
@@ -217,10 +270,14 @@ var ToastRootImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
217
270
|
"as-child",
|
|
218
271
|
"data-state",
|
|
219
272
|
"data-swipe-direction",
|
|
273
|
+
"data-status",
|
|
274
|
+
"data-expanded",
|
|
275
|
+
"data-limited",
|
|
276
|
+
"inert",
|
|
220
277
|
"style"
|
|
221
278
|
])]),
|
|
222
279
|
_: 3
|
|
223
|
-
})], 8, ["to"])) : (0, vue.createCommentVNode)("v-if", true)], 64);
|
|
280
|
+
})], 8, ["to", "disabled"])) : (0, vue.createCommentVNode)("v-if", true)], 64);
|
|
224
281
|
};
|
|
225
282
|
}
|
|
226
283
|
});
|