@moubing/bing-ui 0.11.2 → 0.12.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.
- package/README.md +300 -171
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/bing-ui.css +1 -1
- package/dist/components/BingAnimatedText/BingAnimatedText.js +7 -0
- package/dist/components/BingAnimatedText/BingAnimatedText.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.js +7 -0
- package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BingAutocomplete/BingAutocomplete.js +7 -0
- package/dist/components/BingAutocomplete/BingAutocomplete.vue.d.ts +4 -4
- package/dist/components/BingAutocomplete/BingAutocomplete.vue_vue_type_script_setup_true_lang.js +560 -0
- package/dist/components/BingButton/BingButton.js +7 -0
- package/dist/components/BingButton/BingButton.vue.d.ts +2 -2
- package/dist/components/BingButton/BingButton.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/BingCard/BingCard.js +7 -0
- package/dist/components/BingCard/BingCard.vue_vue_type_script_setup_true_lang.js +481 -0
- package/dist/components/BingCarouselTransition/BingCarouselTransition.js +7 -0
- package/dist/components/BingCarouselTransition/BingCarouselTransition.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/BingCheckbox/BingCheckbox.js +7 -0
- package/dist/components/BingCheckbox/BingCheckbox.vue.d.ts +4 -4
- package/dist/components/BingCheckbox/BingCheckbox.vue_vue_type_script_setup_true_lang.js +233 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.context.js +4 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.js +7 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.highlight.js +78 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.js +7 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.vue_vue_type_script_setup_true_lang.js +347 -0
- package/dist/components/BingColorPicker/BingColorPicker.js +7 -0
- package/dist/components/BingColorPicker/BingColorPicker.utils.d.ts +70 -0
- package/dist/components/BingColorPicker/BingColorPicker.utils.js +265 -0
- package/dist/components/BingColorPicker/BingColorPicker.vue.d.ts +7 -7
- package/dist/components/BingColorPicker/BingColorPicker.vue_vue_type_script_setup_true_lang.js +540 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.js +7 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue.d.ts +27 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.js +7 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue.d.ts +26 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.js +5 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.types.d.ts +5 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.vue.d.ts +18 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/components/BingConfigProvider/index.d.ts +3 -0
- package/dist/components/BingCursor/BingCursor.controller.js +240 -0
- package/dist/components/BingCursor/BingCursor.js +7 -0
- package/dist/components/BingCursor/BingCursor.native.js +20 -0
- package/dist/components/BingCursor/BingCursor.presets.js +60 -0
- package/dist/components/BingCursor/BingCursor.shapes.js +83 -0
- package/dist/components/BingCursor/BingCursor.styleSource.js +83 -0
- package/dist/components/BingCursor/BingCursor.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/BingDatePicker/BingDatePicker.js +7 -0
- package/dist/components/BingDatePicker/BingDatePicker.utils.d.ts +26 -0
- package/dist/components/BingDatePicker/BingDatePicker.utils.js +137 -0
- package/dist/components/BingDatePicker/BingDatePicker.vue.d.ts +14 -14
- package/dist/components/BingDatePicker/BingDatePicker.vue_vue_type_script_setup_true_lang.js +804 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.js +7 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.vue.d.ts +37 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.vue_vue_type_script_setup_true_lang.js +248 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.js +7 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue.d.ts +26 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/BingDeckTransition/BingDeckTransition.js +7 -0
- package/dist/components/BingDeckTransition/BingDeckTransition.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/BingDialog/BingDialog.js +7 -0
- package/dist/components/BingDialog/BingDialog.vue.d.ts +4 -5
- package/dist/components/BingDialog/BingDialog.vue_vue_type_script_setup_true_lang.js +558 -0
- package/dist/components/BingDropDown/BingDropDown.context.js +4 -0
- package/dist/components/BingDropDown/BingDropDown.js +7 -0
- package/dist/components/BingDropDown/BingDropDown.vue.d.ts +1 -2
- package/dist/components/BingDropDown/BingDropDown.vue_vue_type_script_setup_true_lang.js +649 -0
- package/dist/components/BingDropDown/BingDropDownItem.js +7 -0
- package/dist/components/BingDropDown/BingDropDownItem.vue.d.ts +1 -1
- package/dist/components/BingDropDown/BingDropDownItem.vue_vue_type_script_setup_true_lang.js +308 -0
- package/dist/components/BingFilePreview/BingFilePreview.js +7 -0
- package/dist/components/BingFilePreview/BingFilePreview.vue.d.ts +4 -5
- package/dist/components/BingFilePreview/BingFilePreview.vue_vue_type_script_setup_true_lang.js +589 -0
- package/dist/components/BingForm/BingForm.context.js +7 -0
- package/dist/components/BingForm/BingForm.js +7 -0
- package/dist/components/BingForm/BingForm.vue.d.ts +0 -1
- package/dist/components/BingForm/BingForm.vue_vue_type_script_setup_true_lang.js +300 -0
- package/dist/components/BingForm/formFocus.js +13 -0
- package/dist/components/BingForm/formTabOrder.js +27 -0
- package/dist/components/BingForm/useFormControl.d.ts +1 -1
- package/dist/components/BingForm/useFormControl.js +24 -0
- package/dist/components/BingForm/useFormNextHint.js +135 -0
- package/dist/components/BingFormItem/BingFormItem.js +7 -0
- package/dist/components/BingFormItem/BingFormItem.vue.d.ts +1 -1
- package/dist/components/BingFormItem/BingFormItem.vue_vue_type_script_setup_true_lang.js +252 -0
- package/dist/components/BingIcon/BingIcon.js +7 -0
- package/dist/components/BingIcon/BingIcon.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/BingImage/BingImage.js +7 -0
- package/dist/components/BingImage/BingImage.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BingImagePreview/BingImagePreview.js +7 -0
- package/dist/components/BingImagePreview/BingImagePreview.vue.d.ts +4 -5
- package/dist/components/BingImagePreview/BingImagePreview.vue_vue_type_script_setup_true_lang.js +699 -0
- package/dist/components/BingInput/BingInput.js +7 -0
- package/dist/components/BingInput/BingInput.vue.d.ts +6 -6
- package/dist/components/BingInput/BingInput.vue_vue_type_script_setup_true_lang.js +311 -0
- package/dist/components/BingRadio/BingRadio.js +7 -0
- package/dist/components/BingRadio/BingRadio.vue.d.ts +4 -4
- package/dist/components/BingRadio/BingRadio.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.context.js +4 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.js +7 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.vue.d.ts +4 -4
- package/dist/components/BingRadioGroup/BingRadioGroup.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/BingResizable/BingResizable.js +7 -0
- package/dist/components/BingResizable/BingResizable.vue.d.ts +1 -1
- package/dist/components/BingResizable/BingResizable.vue_vue_type_script_setup_true_lang.js +555 -0
- package/dist/components/BingScrollbar/BingScrollbar.js +7 -0
- package/dist/components/BingScrollbar/BingScrollbar.vue.d.ts +2 -2
- package/dist/components/BingScrollbar/BingScrollbar.vue_vue_type_script_setup_true_lang.js +398 -0
- package/dist/components/BingSelect/BingSelect.js +7 -0
- package/dist/components/BingSelect/BingSelect.vue.d.ts +7 -7
- package/dist/components/BingSelect/BingSelect.vue_vue_type_script_setup_true_lang.js +1066 -0
- package/dist/components/BingSlider/BingSlider.js +7 -0
- package/dist/components/BingSlider/BingSlider.vue.d.ts +6 -6
- package/dist/components/BingSlider/BingSlider.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/components/BingSortableList/BingSortableList.js +7 -0
- package/dist/components/BingSortableList/BingSortableList.vue_vue_type_script_setup_true_lang.js +334 -0
- package/dist/components/BingSortableList/BingSortableListItem.js +7 -0
- package/dist/components/BingSortableList/BingSortableListItem.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/components/BingSplitPane/BingSplitPane.js +7 -0
- package/dist/components/BingSplitPane/BingSplitPane.vue_vue_type_script_setup_true_lang.js +167 -0
- package/dist/components/BingTable/BingTable.js +7 -0
- package/dist/components/BingTable/BingTable.measurements.js +72 -0
- package/dist/components/BingTable/BingTable.vue.d.ts +1 -2
- package/dist/components/BingTable/BingTable.vue_vue_type_script_setup_true_lang.js +1416 -0
- package/dist/components/BingTable/BingTableCellValue.js +7 -0
- package/dist/components/BingTable/BingTableCellValue.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/BingTable/BingTableHeaderCell.js +5 -0
- package/dist/components/BingTable/BingTableHeaderCell.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/BingTable/BingTableHeaderContent.js +7 -0
- package/dist/components/BingTable/BingTableHeaderContent.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/components/BingTable/useTableColumns.js +126 -0
- package/dist/components/BingTableColumnControls/BingTableColumnControls.js +7 -0
- package/dist/components/BingTableColumnControls/BingTableColumnControls.vue.d.ts +1 -1
- package/dist/components/BingTableColumnControls/BingTableColumnControls.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/BingTabs/BingTabs.js +7 -0
- package/dist/components/BingTabs/BingTabs.vue.d.ts +2 -3
- package/dist/components/BingTabs/BingTabs.vue_vue_type_script_setup_true_lang.js +320 -0
- package/dist/components/BingTag/BingTag.js +7 -0
- package/dist/components/BingTag/BingTag.vue.d.ts +0 -1
- package/dist/components/BingTag/BingTag.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BingTextarea/BingTextarea.js +7 -0
- package/dist/components/BingTextarea/BingTextarea.vue.d.ts +6 -6
- package/dist/components/BingTextarea/BingTextarea.vue_vue_type_script_setup_true_lang.js +243 -0
- package/dist/components/BingToast/BingToast.js +7 -0
- package/dist/components/BingToast/BingToast.service.js +132 -0
- package/dist/components/BingToast/BingToast.types.d.ts +1 -1
- package/dist/components/BingToast/BingToast.types.js +19 -0
- package/dist/components/BingToast/BingToast.vue.d.ts +0 -1
- package/dist/components/BingToast/BingToast.vue_vue_type_script_setup_true_lang.js +307 -0
- package/dist/components/BingTooltip/BingTooltip.js +7 -0
- package/dist/components/BingTooltip/BingTooltip.shared.js +14 -0
- package/dist/components/BingTooltip/BingTooltip.vue.d.ts +4 -5
- package/dist/components/BingTooltip/BingTooltip.vue_vue_type_script_setup_true_lang.js +572 -0
- package/dist/components/BingTreeSelect/BingTreeSelect.js +7 -0
- package/dist/components/BingTreeSelect/BingTreeSelect.vue.d.ts +7 -7
- package/dist/components/BingTreeSelect/BingTreeSelect.vue_vue_type_script_setup_true_lang.js +1274 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/icons/LICENSE-lucide.txt +39 -0
- package/dist/icons/createIcon.d.ts +8 -0
- package/dist/icons/createIcon.js +36 -0
- package/dist/icons/icons.d.ts +51 -0
- package/dist/icons/icons.js +252 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/index.js +48 -0
- package/dist/motion/clickParticles.d.ts +1 -1
- package/dist/motion/clickParticles2.js +66 -0
- package/dist/motion/index.d.ts +1 -1
- package/dist/motion/index.js +17 -0
- package/dist/motion/liquidHover.js +36 -0
- package/dist/motion/optionDetailMotion.d.ts +7 -1
- package/dist/motion/optionDetailMotion.js +74 -0
- package/dist/motion/panelMotion.js +19 -0
- package/dist/motion/reducedMotion.d.ts +16 -0
- package/dist/motion/reducedMotion.js +28 -0
- package/dist/motion/selectPanelMotion.js +115 -0
- package/dist/motion/smoothScroll.d.ts +2 -0
- package/dist/motion/smoothScroll.js +276 -0
- package/dist/motion/useClickFeedback.js +47 -0
- package/dist/motion/useTextControlCaret.js +136 -0
- package/dist/utils/clipboard.d.ts +9 -0
- package/dist/utils/clipboard.js +16 -0
- package/dist/utils/config.d.ts +42 -0
- package/dist/utils/config.js +37 -0
- package/dist/utils/controlAttrs.js +37 -0
- package/dist/utils/floating.d.ts +86 -0
- package/dist/utils/floating.js +99 -0
- package/dist/utils/glass.js +25 -0
- package/dist/utils/overlay.js +94 -0
- package/dist/utils/scrollLock.js +44 -0
- package/dist/utils/search.d.ts +16 -0
- package/dist/utils/search.js +23 -0
- package/dist/utils/useClientReady.js +10 -0
- package/dist/utils/useDeferredBlurValidation.d.ts +18 -0
- package/dist/utils/useDeferredBlurValidation.js +34 -0
- package/dist/utils/useKeyboardScrollSync.d.ts +11 -0
- package/dist/utils/useKeyboardScrollSync.js +28 -0
- package/dist/utils/useOptionDetailPanel.d.ts +50 -0
- package/dist/utils/useOptionDetailPanel.js +180 -0
- package/dist/utils/useOutsidePointerDown.d.ts +8 -0
- package/dist/utils/useOutsidePointerDown.js +17 -0
- package/dist/utils/useSearchShortcutFocus.d.ts +18 -0
- package/dist/utils/useSearchShortcutFocus.js +47 -0
- package/dist/utils/useVirtualList.d.ts +42 -0
- package/dist/utils/useVirtualList.js +74 -0
- package/package.json +15 -9
- package/dist/bing-ui.es.js +0 -31278
- package/dist/bing-ui.umd.js +0 -229
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { normalizeBingToastPosition as e } from "./BingToast.types.js";
|
|
2
|
+
import { ref as t } from "vue";
|
|
3
|
+
//#region src/components/BingToast/BingToast.service.ts
|
|
4
|
+
var n = "top-right", r = 120, i = {
|
|
5
|
+
default: 3200,
|
|
6
|
+
success: 2600,
|
|
7
|
+
error: 4200,
|
|
8
|
+
loading: 0,
|
|
9
|
+
warning: 3600,
|
|
10
|
+
info: 3200
|
|
11
|
+
}, a = 0, o = 0, s = 0, c = !1, l = t([]), u = t(), d = [], f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map();
|
|
12
|
+
function m() {
|
|
13
|
+
return typeof window < "u";
|
|
14
|
+
}
|
|
15
|
+
function h(t) {
|
|
16
|
+
return e(t, n);
|
|
17
|
+
}
|
|
18
|
+
function g(e, t) {
|
|
19
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : i[t];
|
|
20
|
+
}
|
|
21
|
+
function _(e, t) {
|
|
22
|
+
return typeof e == "string" ? {
|
|
23
|
+
message: e,
|
|
24
|
+
type: t
|
|
25
|
+
} : {
|
|
26
|
+
...e,
|
|
27
|
+
type: t ?? e.type
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function v(e) {
|
|
31
|
+
let t = p.get(e);
|
|
32
|
+
t?.timer !== void 0 && m() && window.clearTimeout(t.timer), p.delete(e), f.delete(e);
|
|
33
|
+
}
|
|
34
|
+
function y(e, t) {
|
|
35
|
+
let n = Math.max(0, t), r = {
|
|
36
|
+
dueAt: Date.now() + n,
|
|
37
|
+
remaining: n,
|
|
38
|
+
paused: !1,
|
|
39
|
+
timer: window.setTimeout(() => {
|
|
40
|
+
T(e);
|
|
41
|
+
}, n)
|
|
42
|
+
};
|
|
43
|
+
p.set(e, r);
|
|
44
|
+
}
|
|
45
|
+
function b(e, t = !1) {
|
|
46
|
+
if (e.duration <= 0) return;
|
|
47
|
+
let n = p.get(e.id);
|
|
48
|
+
f.add(e.id), n?.timer !== void 0 && m() && window.clearTimeout(n.timer), p.set(e.id, {
|
|
49
|
+
dueAt: Date.now() + e.duration,
|
|
50
|
+
remaining: t || !n ? e.duration : Math.max(0, n.dueAt - Date.now()),
|
|
51
|
+
paused: !0
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function x(e, t = 0) {
|
|
55
|
+
let n = p.get(e.id);
|
|
56
|
+
f.delete(e.id), n?.timer !== void 0 && m() && window.clearTimeout(n.timer), p.delete(e.id), !(!m() || e.duration <= 0) && y(e.id, e.duration + t);
|
|
57
|
+
}
|
|
58
|
+
function S(e) {
|
|
59
|
+
let t = l.value.filter((t) => t.position === e.position).sort((e, t) => e.order - t.order).findIndex((t) => t.id === e.id);
|
|
60
|
+
return Math.max(0, t) * r;
|
|
61
|
+
}
|
|
62
|
+
function C() {
|
|
63
|
+
l.value.forEach((e) => {
|
|
64
|
+
if (c) {
|
|
65
|
+
b(e, !0);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
x(e, S(e));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function w(e, t) {
|
|
72
|
+
let n = _(e, t), r = n.type ?? "default", i = String(n.id ?? `bing-toast-${++a}`), s = l.value.find((e) => e.id === i), c = typeof n.message == "string" ? n.message : void 0, u = !!(c && c.length > 0), d = c && c.length > 0 ? c : n.title ?? "", f = {
|
|
73
|
+
id: i,
|
|
74
|
+
type: r,
|
|
75
|
+
title: u ? n.title : void 0,
|
|
76
|
+
message: d,
|
|
77
|
+
duration: g(n.duration, r),
|
|
78
|
+
closable: n.closable ?? !0,
|
|
79
|
+
position: h(n.position),
|
|
80
|
+
createdAt: s?.createdAt ?? Date.now(),
|
|
81
|
+
order: s?.order ?? ++o,
|
|
82
|
+
ariaLabel: n.ariaLabel,
|
|
83
|
+
closeAriaLabel: n.closeAriaLabel ?? "关闭消息"
|
|
84
|
+
};
|
|
85
|
+
return s ? l.value = l.value.map((e) => e.id === i ? f : e) : l.value = [...l.value, f], C(), i;
|
|
86
|
+
}
|
|
87
|
+
function T(e) {
|
|
88
|
+
let t = String(e);
|
|
89
|
+
v(t), l.value = l.value.filter((e) => e.id !== t);
|
|
90
|
+
}
|
|
91
|
+
function E(e) {
|
|
92
|
+
let t = e ? h(e) : void 0;
|
|
93
|
+
(e ? l.value.filter((e) => e.position === t) : l.value).forEach((e) => {
|
|
94
|
+
v(e.id);
|
|
95
|
+
}), l.value = e ? l.value.filter((e) => e.position !== t) : [];
|
|
96
|
+
}
|
|
97
|
+
function D() {
|
|
98
|
+
c = !0, l.value.forEach((e) => {
|
|
99
|
+
b(e, !0);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function O() {
|
|
103
|
+
c = !1, C();
|
|
104
|
+
}
|
|
105
|
+
function k() {
|
|
106
|
+
return s += 1, `bing-toast-viewport-${s}`;
|
|
107
|
+
}
|
|
108
|
+
function A(e) {
|
|
109
|
+
d.includes(e) || d.push(e), u.value ??= e;
|
|
110
|
+
}
|
|
111
|
+
function j(e) {
|
|
112
|
+
let t = d.indexOf(e);
|
|
113
|
+
t >= 0 && d.splice(t, 1), u.value === e && (u.value = d[0]);
|
|
114
|
+
}
|
|
115
|
+
var M = {
|
|
116
|
+
show: (e) => w(e),
|
|
117
|
+
success: (e) => w(e, "success"),
|
|
118
|
+
error: (e) => w(e, "error"),
|
|
119
|
+
fail: (e) => w(e, "error"),
|
|
120
|
+
failed: (e) => w(e, "error"),
|
|
121
|
+
loading: (e) => w(e, "loading"),
|
|
122
|
+
warning: (e) => w(e, "warning"),
|
|
123
|
+
info: (e) => w(e, "info"),
|
|
124
|
+
close: T,
|
|
125
|
+
clear: E,
|
|
126
|
+
getToasts: () => [...l.value]
|
|
127
|
+
};
|
|
128
|
+
function N() {
|
|
129
|
+
return M;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { u as activeBingToastViewportId, M as bingToast, l as bingToastItems, k as createBingToastViewportId, D as pauseAllBingToastTimers, A as registerBingToastViewport, O as restartAllBingToastTimers, j as unregisterBingToastViewport, N as useBingToast };
|
|
@@ -56,4 +56,4 @@ export interface BingToastService {
|
|
|
56
56
|
clear: (position?: BingToastPosition) => void;
|
|
57
57
|
getToasts: () => BingToastItem[];
|
|
58
58
|
}
|
|
59
|
-
export declare function normalizeBingToastPosition(position: BingToastPosition | undefined, fallback?: BingToastRenderPosition): "left" | "right" | "
|
|
59
|
+
export declare function normalizeBingToastPosition(position: BingToastPosition | undefined, fallback?: BingToastRenderPosition): "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/components/BingToast/BingToast.types.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"top",
|
|
4
|
+
"bottom",
|
|
5
|
+
"left",
|
|
6
|
+
"right",
|
|
7
|
+
"top-left",
|
|
8
|
+
"top-right",
|
|
9
|
+
"bottom-left",
|
|
10
|
+
"bottom-right"
|
|
11
|
+
], t = ["top-center", "bottom-center"], n = [...e, ...t], r = new Set(e), i = {
|
|
12
|
+
"top-center": "top",
|
|
13
|
+
"bottom-center": "bottom"
|
|
14
|
+
};
|
|
15
|
+
function a(e, t = "top-right") {
|
|
16
|
+
return e ? r.has(e) ? e : i[e] ?? t : t;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { e as BING_TOAST_POSITIONS, t as BING_TOAST_POSITION_ALIASES, n as BING_TOAST_POSITION_OPTIONS, a as normalizeBingToastPosition };
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { useConfigZIndex as e } from "../../utils/config.js";
|
|
2
|
+
import { useReducedMotion as t } from "../../motion/reducedMotion.js";
|
|
3
|
+
import n from "../BingButton/BingButton.js";
|
|
4
|
+
import { AlertTriangle as r, CheckCircle2 as i, Info as a, LoaderCircle as ee, Sparkles as te, X as ne, XCircle as re } from "../../icons/icons.js";
|
|
5
|
+
import o from "../BingIcon/BingIcon.js";
|
|
6
|
+
import { compactSmoothScrollOptions as ie, resolveComponentSmoothScroll as ae } from "../../motion/smoothScroll.js";
|
|
7
|
+
import oe from "../BingScrollbar/BingScrollbar.js";
|
|
8
|
+
import { useClientReady as se } from "../../utils/useClientReady.js";
|
|
9
|
+
import { BING_TOAST_POSITIONS as ce, normalizeBingToastPosition as s } from "./BingToast.types.js";
|
|
10
|
+
import { activeBingToastViewportId as le, bingToast as ue, bingToastItems as c, createBingToastViewportId as de, pauseAllBingToastTimers as fe, registerBingToastViewport as pe, restartAllBingToastTimers as l, unregisterBingToastViewport as me } from "./BingToast.service.js";
|
|
11
|
+
import { Fragment as u, Teleport as he, TransitionGroup as ge, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createVNode as g, defineComponent as _, nextTick as v, normalizeClass as y, normalizeStyle as b, onBeforeUnmount as _e, onBeforeUpdate as ve, onMounted as ye, onUpdated as be, openBlock as x, ref as xe, renderList as S, toDisplayString as C, unref as w, watch as Se, withCtx as T } from "vue";
|
|
12
|
+
import { gsap as E } from "gsap";
|
|
13
|
+
//#region src/components/BingToast/BingToast.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
+
var Ce = [
|
|
15
|
+
"data-position",
|
|
16
|
+
"data-depth",
|
|
17
|
+
"role",
|
|
18
|
+
"aria-live",
|
|
19
|
+
"aria-label"
|
|
20
|
+
], D = { class: "bing-toast__card" }, O = {
|
|
21
|
+
class: "bing-toast__icon",
|
|
22
|
+
"aria-hidden": "true"
|
|
23
|
+
}, k = { class: "bing-toast__content" }, A = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "bing-toast__title"
|
|
26
|
+
}, we = { class: "bing-toast__message" }, j = /* @__PURE__ */ _({
|
|
27
|
+
__name: "BingToast",
|
|
28
|
+
props: {
|
|
29
|
+
viewportPosition: { default: "all" },
|
|
30
|
+
zIndex: {},
|
|
31
|
+
offset: { default: 18 },
|
|
32
|
+
gap: { default: 10 },
|
|
33
|
+
width: { default: 360 },
|
|
34
|
+
max: { default: 5 },
|
|
35
|
+
smoothScroll: {
|
|
36
|
+
type: [Boolean, Object],
|
|
37
|
+
default: !0
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
emits: ["close"],
|
|
41
|
+
setup(_, { emit: j }) {
|
|
42
|
+
let M = t(), N = _, Te = j, Ee = e("toast", () => N.zIndex), De = se(), P = xe(null), F = {}, I = de(), L = /* @__PURE__ */ new Set(), R, z = !1, Oe = {
|
|
43
|
+
default: te,
|
|
44
|
+
success: i,
|
|
45
|
+
error: re,
|
|
46
|
+
loading: ee,
|
|
47
|
+
warning: r,
|
|
48
|
+
info: a
|
|
49
|
+
}, B = d(() => Math.max(1, Math.floor(N.max))), ke = d(() => N.viewportPosition === "all" ? ce : [s(N.viewportPosition)]), V = d(() => le.value === I), Ae = d(() => ae(N.smoothScroll, ie, {
|
|
50
|
+
respectReducedMotion: !0,
|
|
51
|
+
smoothTouchpad: !1
|
|
52
|
+
})), H = d(() => ({
|
|
53
|
+
zIndex: Ee.value,
|
|
54
|
+
"--bing-toast-offset": G(N.offset, 18),
|
|
55
|
+
"--bing-toast-gap": G(N.gap, 10),
|
|
56
|
+
"--bing-toast-width": G(N.width, 360)
|
|
57
|
+
})), je = d(() => V.value ? ke.value.map((e) => ({
|
|
58
|
+
position: e,
|
|
59
|
+
toasts: c.value.filter((t) => t.position === e).sort((e, t) => t.order - e.order)
|
|
60
|
+
})) : []);
|
|
61
|
+
function Me(e, t) {
|
|
62
|
+
if (t) {
|
|
63
|
+
F[e] = t;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
delete F[e];
|
|
67
|
+
}
|
|
68
|
+
function U() {
|
|
69
|
+
Object.values(F).forEach((e) => e?.stop());
|
|
70
|
+
}
|
|
71
|
+
function W() {
|
|
72
|
+
Object.values(F).forEach((e) => {
|
|
73
|
+
if (!e) return;
|
|
74
|
+
e.stop();
|
|
75
|
+
let t = e.viewport;
|
|
76
|
+
if (!t) return;
|
|
77
|
+
let n = Math.max(0, t.scrollHeight - t.clientHeight), r = Math.min(n, Math.max(0, t.scrollTop));
|
|
78
|
+
r !== t.scrollTop && e.scrollTo(r), e.update();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
Se(() => [
|
|
82
|
+
c.value,
|
|
83
|
+
V.value,
|
|
84
|
+
N.viewportPosition,
|
|
85
|
+
N.width,
|
|
86
|
+
N.gap
|
|
87
|
+
], () => {
|
|
88
|
+
U(), v(W);
|
|
89
|
+
}, { flush: "sync" });
|
|
90
|
+
function G(e, t) {
|
|
91
|
+
return typeof e == "number" ? `${e}px` : e ?? `${t}px`;
|
|
92
|
+
}
|
|
93
|
+
function Ne(e) {
|
|
94
|
+
return ["bing-toast-region", `bing-toast-region--${e}`];
|
|
95
|
+
}
|
|
96
|
+
function Pe(e, t) {
|
|
97
|
+
let n = Math.min(e, B.value - 1, 5);
|
|
98
|
+
return {
|
|
99
|
+
"--bing-toast-depth": String(n),
|
|
100
|
+
"--bing-toast-stack-scale": "1",
|
|
101
|
+
"--bing-toast-stack-shift": "0px",
|
|
102
|
+
"--bing-toast-stack-opacity": "1",
|
|
103
|
+
"--bing-toast-stack-edge-shadow": "0.035",
|
|
104
|
+
"--bing-toast-stack-outline": "0.035",
|
|
105
|
+
"--bing-toast-stack-z-index": String(20 - n)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function Fe(e) {
|
|
109
|
+
return Oe[e];
|
|
110
|
+
}
|
|
111
|
+
function Ie(e) {
|
|
112
|
+
return e.type === "error" || e.type === "warning" ? "alert" : "status";
|
|
113
|
+
}
|
|
114
|
+
function Le(e) {
|
|
115
|
+
return e.type === "error" || e.type === "warning" ? "assertive" : "polite";
|
|
116
|
+
}
|
|
117
|
+
function K(e) {
|
|
118
|
+
let t = 0, n = 0;
|
|
119
|
+
return e === "right" || e.endsWith("right") ? t = 28 : (e === "left" || e.endsWith("left")) && (t = -28), e === "top" || e.startsWith("top") ? n = -18 : (e === "bottom" || e.startsWith("bottom")) && (n = 18), {
|
|
120
|
+
x: t,
|
|
121
|
+
y: n
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function q(e) {
|
|
125
|
+
return s(e.dataset.position);
|
|
126
|
+
}
|
|
127
|
+
function J(e) {
|
|
128
|
+
return e.querySelector(".bing-toast__card");
|
|
129
|
+
}
|
|
130
|
+
function Y() {
|
|
131
|
+
if (z || R || !P.value) return;
|
|
132
|
+
let e = Array.from(P.value.querySelectorAll(".bing-toast"));
|
|
133
|
+
e.forEach((e) => L.add(e)), R = new Map(e.map((e) => [e, e.getBoundingClientRect()])), e.length && (E.getTweensOf(e).forEach((e) => e.kill()), E.set(e, { clearProps: "transform" }));
|
|
134
|
+
}
|
|
135
|
+
function X() {
|
|
136
|
+
let e = R;
|
|
137
|
+
if (R = void 0, z || !e || !P.value || (W(), M())) return;
|
|
138
|
+
let t = /* @__PURE__ */ new Map();
|
|
139
|
+
e.forEach((e, n) => {
|
|
140
|
+
if (!n.isConnected) return;
|
|
141
|
+
let r = n.getBoundingClientRect(), i = e.left - r.left, a = e.top - r.top;
|
|
142
|
+
(Math.abs(i) > .5 || Math.abs(a) > .5) && t.set(n, {
|
|
143
|
+
x: i,
|
|
144
|
+
y: a
|
|
145
|
+
});
|
|
146
|
+
}), t.size && E.fromTo([...t.keys()], {
|
|
147
|
+
x: (e, n) => t.get(n).x,
|
|
148
|
+
y: (e, n) => t.get(n).y
|
|
149
|
+
}, {
|
|
150
|
+
x: 0,
|
|
151
|
+
y: 0,
|
|
152
|
+
duration: .34,
|
|
153
|
+
ease: "power3.out",
|
|
154
|
+
overwrite: !0,
|
|
155
|
+
clearProps: "transform",
|
|
156
|
+
onComplete: W
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
ve(Y), be(X);
|
|
160
|
+
function Re(e) {
|
|
161
|
+
if (z) return;
|
|
162
|
+
let t = e, n = K(q(t));
|
|
163
|
+
L.add(t), E.set(J(t), {
|
|
164
|
+
autoAlpha: 0,
|
|
165
|
+
x: n.x,
|
|
166
|
+
y: n.y,
|
|
167
|
+
scale: .96,
|
|
168
|
+
force3D: !0
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function ze(e, t) {
|
|
172
|
+
if (z) {
|
|
173
|
+
t();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
let n = J(e);
|
|
177
|
+
E.killTweensOf(n), E.to(n, {
|
|
178
|
+
autoAlpha: 1,
|
|
179
|
+
x: 0,
|
|
180
|
+
y: 0,
|
|
181
|
+
scale: 1,
|
|
182
|
+
duration: M() ? 0 : .34,
|
|
183
|
+
ease: "back.out(1.7)",
|
|
184
|
+
overwrite: "auto",
|
|
185
|
+
clearProps: "visibility,transform",
|
|
186
|
+
onComplete: t
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function Be(e, t) {
|
|
190
|
+
if (z) {
|
|
191
|
+
t();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let n = e, r = K(q(n)), i = J(e);
|
|
195
|
+
L.add(n), E.killTweensOf(i), E.to(i, {
|
|
196
|
+
autoAlpha: 0,
|
|
197
|
+
x: r.x * .55,
|
|
198
|
+
y: r.y,
|
|
199
|
+
scale: .93,
|
|
200
|
+
duration: M() ? 0 : .38,
|
|
201
|
+
ease: "power3.inOut",
|
|
202
|
+
overwrite: "auto",
|
|
203
|
+
onComplete: () => {
|
|
204
|
+
Y(), E.killTweensOf(n), t(), L.delete(n), v(X);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function Z() {
|
|
209
|
+
z || v(W);
|
|
210
|
+
}
|
|
211
|
+
function Ve(e) {
|
|
212
|
+
Te("close", e), ue.close(e.id), l();
|
|
213
|
+
}
|
|
214
|
+
function Q() {
|
|
215
|
+
fe();
|
|
216
|
+
}
|
|
217
|
+
function $() {
|
|
218
|
+
l();
|
|
219
|
+
}
|
|
220
|
+
function He(e) {
|
|
221
|
+
let t = e.currentTarget, n = e.relatedTarget;
|
|
222
|
+
t && n instanceof Node && t.contains(n) || l();
|
|
223
|
+
}
|
|
224
|
+
return ye(() => {
|
|
225
|
+
pe(I);
|
|
226
|
+
}), _e(() => {
|
|
227
|
+
z = !0, R = void 0, U(), me(I);
|
|
228
|
+
let e = [...L].flatMap((e) => [e, J(e)]);
|
|
229
|
+
E.getTweensOf(e).forEach((e) => e.kill()), L.clear();
|
|
230
|
+
}), (e, t) => w(De) ? (x(), f(he, {
|
|
231
|
+
key: 0,
|
|
232
|
+
to: "body"
|
|
233
|
+
}, [h("div", {
|
|
234
|
+
ref_key: "rootRef",
|
|
235
|
+
ref: P,
|
|
236
|
+
class: "bing-toast-root",
|
|
237
|
+
style: b(H.value)
|
|
238
|
+
}, [(x(!0), m(u, null, S(je.value, (e) => (x(), m("div", {
|
|
239
|
+
key: e.position,
|
|
240
|
+
class: y([Ne(e.position), { "is-empty": e.toasts.length === 0 }])
|
|
241
|
+
}, [g(oe, {
|
|
242
|
+
ref_for: !0,
|
|
243
|
+
ref: (t) => Me(e.position, t),
|
|
244
|
+
class: "bing-toast-scroll",
|
|
245
|
+
"max-height": "calc(100vh - var(--bing-toast-offset) - var(--bing-toast-offset))",
|
|
246
|
+
smooth: Ae.value,
|
|
247
|
+
always: "",
|
|
248
|
+
"aria-label": e.toasts.length > 0 ? "消息通知" : void 0,
|
|
249
|
+
onPointerenter: Q,
|
|
250
|
+
onPointerleave: $
|
|
251
|
+
}, {
|
|
252
|
+
default: T(() => [g(ge, {
|
|
253
|
+
tag: "div",
|
|
254
|
+
class: "bing-toast-stack",
|
|
255
|
+
css: !1,
|
|
256
|
+
onBeforeEnter: Re,
|
|
257
|
+
onEnter: ze,
|
|
258
|
+
onLeave: Be,
|
|
259
|
+
onAfterEnter: Z,
|
|
260
|
+
onAfterLeave: Z
|
|
261
|
+
}, {
|
|
262
|
+
default: T(() => [(x(!0), m(u, null, S(e.toasts, (t, r) => (x(), m("article", {
|
|
263
|
+
key: t.id,
|
|
264
|
+
class: y(["bing-toast", [`bing-toast--${t.type}`, { "has-title": !!t.title }]]),
|
|
265
|
+
style: b(Pe(r, t)),
|
|
266
|
+
"data-position": e.position,
|
|
267
|
+
"data-depth": Math.min(r, B.value - 1, 5),
|
|
268
|
+
role: Ie(t),
|
|
269
|
+
"aria-live": Le(t),
|
|
270
|
+
"aria-label": t.ariaLabel,
|
|
271
|
+
onPointerenter: Q,
|
|
272
|
+
onPointerleave: $,
|
|
273
|
+
onFocusin: Q,
|
|
274
|
+
onFocusout: He
|
|
275
|
+
}, [h("div", D, [
|
|
276
|
+
h("span", O, [g(o, {
|
|
277
|
+
icon: Fe(t.type),
|
|
278
|
+
size: "md",
|
|
279
|
+
"stroke-width": 1.75
|
|
280
|
+
}, null, 8, ["icon"])]),
|
|
281
|
+
h("span", k, [t.title ? (x(), m("strong", A, C(t.title), 1)) : p("", !0), h("span", we, C(t.message), 1)]),
|
|
282
|
+
t.closable ? (x(), f(n, {
|
|
283
|
+
key: 0,
|
|
284
|
+
variant: "ghost",
|
|
285
|
+
size: "xs",
|
|
286
|
+
rounded: "sm",
|
|
287
|
+
throttle: !1,
|
|
288
|
+
class: "bing-toast__close",
|
|
289
|
+
"aria-label": t.closeAriaLabel,
|
|
290
|
+
onClick: (e) => Ve(t)
|
|
291
|
+
}, {
|
|
292
|
+
prefix: T(() => [g(o, {
|
|
293
|
+
icon: w(ne),
|
|
294
|
+
size: "sm",
|
|
295
|
+
"stroke-width": 1.75
|
|
296
|
+
}, null, 8, ["icon"])]),
|
|
297
|
+
_: 1
|
|
298
|
+
}, 8, ["aria-label", "onClick"])) : p("", !0)
|
|
299
|
+
])], 46, Ce))), 128))]),
|
|
300
|
+
_: 2
|
|
301
|
+
}, 1024)]),
|
|
302
|
+
_: 2
|
|
303
|
+
}, 1032, ["smooth", "aria-label"])], 2))), 128))], 4)])) : p("", !0);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
//#endregion
|
|
307
|
+
export { j as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./BingTooltip.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/BingTooltip/BingTooltip.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-6325878d"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { shallowRef as e } from "vue";
|
|
2
|
+
//#region src/components/BingTooltip/BingTooltip.shared.ts
|
|
3
|
+
var t = 0, n = /* @__PURE__ */ new Map(), r = e(), i = e(), a = e(null), o = e(), s = e(!1);
|
|
4
|
+
function c() {
|
|
5
|
+
return t += 1, `bing-tooltip-owner-${t}`;
|
|
6
|
+
}
|
|
7
|
+
function l(e) {
|
|
8
|
+
n.set(e.id, e), i.value ||= e.id;
|
|
9
|
+
}
|
|
10
|
+
function u(e) {
|
|
11
|
+
n.delete(e.id), r.value?.id === e.id && (r.value = void 0, s.value = !1), i.value === e.id && (i.value = n.keys().next().value), n.size === 0 && (a.value = null, o.value = void 0, s.value = !1);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { c as createTooltipOwnerId, l as registerTooltipOwner, r as sharedTooltipActiveOwner, i as sharedTooltipHostId, a as sharedTooltipPanelElement, s as sharedTooltipShouldRender, o as sharedTooltipSuppressRootClickOwnerId, u as unregisterTooltipOwner };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BingTooltipCloseReason, BingTooltipExpose, BingTooltipOpenReason, BingTooltipPlacement, BingTooltipProps, BingTooltipTrigger } from './BingTooltip.types';
|
|
2
2
|
declare function show(reason?: BingTooltipOpenReason): void;
|
|
3
3
|
declare function hide(reason?: BingTooltipCloseReason): void;
|
|
4
4
|
declare function toggle(reason?: BingTooltipOpenReason | BingTooltipCloseReason): void;
|
|
@@ -13,21 +13,20 @@ type __VLS_Slots = {} & {
|
|
|
13
13
|
};
|
|
14
14
|
declare const __VLS_base: import('vue').DefineComponent<BingTooltipProps, BingTooltipExpose, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
15
|
close: (reason: BingTooltipCloseReason) => any;
|
|
16
|
-
"update:modelValue": (value: boolean) => any;
|
|
17
16
|
open: (reason: BingTooltipOpenReason) => any;
|
|
17
|
+
"update:modelValue": (value: boolean) => any;
|
|
18
18
|
}, string, import('vue').PublicProps, Readonly<BingTooltipProps> & Readonly<{
|
|
19
19
|
onClose?: ((reason: BingTooltipCloseReason) => any) | undefined;
|
|
20
|
-
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
21
20
|
onOpen?: ((reason: BingTooltipOpenReason) => any) | undefined;
|
|
21
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
23
|
trigger: BingTooltipTrigger | BingTooltipTrigger[];
|
|
24
24
|
disabled: boolean;
|
|
25
25
|
content: string;
|
|
26
26
|
maxWidth: string | number;
|
|
27
|
-
zIndex: number;
|
|
28
27
|
id: string;
|
|
29
28
|
placement: BingTooltipPlacement;
|
|
30
|
-
align: BingTooltipAlign;
|
|
29
|
+
align: import('./BingTooltip.types').BingTooltipAlign;
|
|
31
30
|
ariaLabel: string;
|
|
32
31
|
offset: number;
|
|
33
32
|
glass: boolean;
|