reka-ui 2.0.2 → 2.1.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/dist/AlertDialog/AlertDialogRoot.cjs +2 -2
- package/dist/AlertDialog/AlertDialogRoot.cjs.map +1 -1
- package/dist/AlertDialog/AlertDialogRoot.js +3 -3
- package/dist/AlertDialog/AlertDialogRoot.js.map +1 -1
- package/dist/Calendar/CalendarCellTrigger.cjs +7 -5
- package/dist/Calendar/CalendarCellTrigger.cjs.map +1 -1
- package/dist/Calendar/CalendarCellTrigger.js +7 -5
- package/dist/Calendar/CalendarCellTrigger.js.map +1 -1
- package/dist/Combobox/ComboboxItem.cjs +0 -3
- package/dist/Combobox/ComboboxItem.cjs.map +1 -1
- package/dist/Combobox/ComboboxItem.js +1 -3
- package/dist/Combobox/ComboboxItem.js.map +1 -1
- package/dist/Combobox/ComboboxRoot.cjs +9 -1
- package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
- package/dist/Combobox/ComboboxRoot.js +10 -2
- package/dist/Combobox/ComboboxRoot.js.map +1 -1
- package/dist/HoverCard/HoverCardRoot.cjs.map +1 -1
- package/dist/HoverCard/HoverCardRoot.js.map +1 -1
- package/dist/NavigationMenu/NavigationMenuSub.cjs +11 -1
- package/dist/NavigationMenu/NavigationMenuSub.cjs.map +1 -1
- package/dist/NavigationMenu/NavigationMenuSub.js +12 -2
- package/dist/NavigationMenu/NavigationMenuSub.js.map +1 -1
- package/dist/NavigationMenu/NavigationMenuViewport.cjs +2 -3
- package/dist/NavigationMenu/NavigationMenuViewport.cjs.map +1 -1
- package/dist/NavigationMenu/NavigationMenuViewport.js +2 -3
- package/dist/NavigationMenu/NavigationMenuViewport.js.map +1 -1
- package/dist/NumberField/NumberFieldInput.cjs +2 -0
- package/dist/NumberField/NumberFieldInput.cjs.map +1 -1
- package/dist/NumberField/NumberFieldInput.js +2 -0
- package/dist/NumberField/NumberFieldInput.js.map +1 -1
- package/dist/NumberField/NumberFieldRoot.cjs +5 -2
- package/dist/NumberField/NumberFieldRoot.cjs.map +1 -1
- package/dist/NumberField/NumberFieldRoot.js +5 -2
- package/dist/NumberField/NumberFieldRoot.js.map +1 -1
- package/dist/RangeCalendar/RangeCalendarCellTrigger.cjs +6 -4
- package/dist/RangeCalendar/RangeCalendarCellTrigger.cjs.map +1 -1
- package/dist/RangeCalendar/RangeCalendarCellTrigger.js +6 -4
- package/dist/RangeCalendar/RangeCalendarCellTrigger.js.map +1 -1
- package/dist/RangeCalendar/RangeCalendarRoot.cjs +3 -3
- package/dist/RangeCalendar/RangeCalendarRoot.cjs.map +1 -1
- package/dist/RangeCalendar/RangeCalendarRoot.js +3 -3
- package/dist/RangeCalendar/RangeCalendarRoot.js.map +1 -1
- package/dist/Select/SelectContentImpl.cjs +15 -5
- package/dist/Select/SelectContentImpl.cjs.map +1 -1
- package/dist/Select/SelectContentImpl.js +15 -5
- package/dist/Select/SelectContentImpl.js.map +1 -1
- package/dist/Slider/SliderHorizontal.cjs +19 -9
- package/dist/Slider/SliderHorizontal.cjs.map +1 -1
- package/dist/Slider/SliderHorizontal.js +20 -10
- package/dist/Slider/SliderHorizontal.js.map +1 -1
- package/dist/Slider/SliderRoot.cjs +5 -3
- package/dist/Slider/SliderRoot.cjs.map +1 -1
- package/dist/Slider/SliderRoot.js +5 -3
- package/dist/Slider/SliderRoot.js.map +1 -1
- package/dist/Slider/SliderThumb.cjs +2 -2
- package/dist/Slider/SliderThumb.cjs.map +1 -1
- package/dist/Slider/SliderThumb.js +2 -2
- package/dist/Slider/SliderThumb.js.map +1 -1
- package/dist/Slider/SliderThumbImpl.cjs +7 -1
- package/dist/Slider/SliderThumbImpl.cjs.map +1 -1
- package/dist/Slider/SliderThumbImpl.js +7 -1
- package/dist/Slider/SliderThumbImpl.js.map +1 -1
- package/dist/Slider/SliderVertical.cjs +19 -9
- package/dist/Slider/SliderVertical.cjs.map +1 -1
- package/dist/Slider/SliderVertical.js +20 -10
- package/dist/Slider/SliderVertical.js.map +1 -1
- package/dist/TagsInput/TagsInputItemDelete.cjs +2 -1
- package/dist/TagsInput/TagsInputItemDelete.cjs.map +1 -1
- package/dist/TagsInput/TagsInputItemDelete.js +2 -1
- package/dist/TagsInput/TagsInputItemDelete.js.map +1 -1
- package/dist/Toast/ToastClose.cjs +2 -2
- package/dist/Toast/ToastClose.cjs.map +1 -1
- package/dist/Toast/ToastClose.js +2 -2
- package/dist/Toast/ToastClose.js.map +1 -1
- package/dist/Toast/ToastRoot.cjs +3 -0
- package/dist/Toast/ToastRoot.cjs.map +1 -1
- package/dist/Toast/ToastRoot.js +3 -0
- package/dist/Toast/ToastRoot.js.map +1 -1
- package/dist/Toast/ToastRootImpl.cjs +6 -3
- package/dist/Toast/ToastRootImpl.cjs.map +1 -1
- package/dist/Toast/ToastRootImpl.js +6 -3
- package/dist/Toast/ToastRootImpl.js.map +1 -1
- package/dist/Toggle/Toggle.cjs +6 -1
- package/dist/Toggle/Toggle.cjs.map +1 -1
- package/dist/Toggle/Toggle.js +6 -1
- package/dist/Toggle/Toggle.js.map +1 -1
- package/dist/ToggleGroup/ToggleGroupItem.cjs +2 -2
- package/dist/ToggleGroup/ToggleGroupItem.cjs.map +1 -1
- package/dist/ToggleGroup/ToggleGroupItem.js +3 -3
- package/dist/ToggleGroup/ToggleGroupItem.js.map +1 -1
- package/dist/date.d.ts +2 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +59 -16
- package/dist/index.js +2 -2
- package/package.json +2 -2
|
@@ -4,6 +4,7 @@ const vue = require('vue');
|
|
|
4
4
|
const Slider_SliderImpl = require('./SliderImpl.cjs');
|
|
5
5
|
const Slider_utils = require('./utils.cjs');
|
|
6
6
|
const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
|
|
7
|
+
const Slider_SliderRoot = require('./SliderRoot.cjs');
|
|
7
8
|
|
|
8
9
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
9
10
|
__name: "SliderVertical",
|
|
@@ -17,16 +18,24 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
17
18
|
const props = __props;
|
|
18
19
|
const emits = __emit;
|
|
19
20
|
const { max, min, inverted } = vue.toRefs(props);
|
|
21
|
+
const rootContext = Slider_SliderRoot.injectSliderRootContext();
|
|
20
22
|
const { forwardRef, currentElement: sliderElement } = shared_useForwardExpose.useForwardExpose();
|
|
23
|
+
const offsetPosition = vue.ref();
|
|
21
24
|
const rectRef = vue.ref();
|
|
22
25
|
const isSlidingFromBottom = vue.computed(() => !inverted.value);
|
|
23
|
-
function
|
|
26
|
+
function getValueFromPointerEvent(event, slideStart) {
|
|
24
27
|
const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
|
|
25
|
-
const
|
|
28
|
+
const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value];
|
|
29
|
+
const thumbHeight = rootContext.thumbAlignment.value === "contain" ? thumb.clientHeight : 0;
|
|
30
|
+
if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === "contain") {
|
|
31
|
+
offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top;
|
|
32
|
+
}
|
|
33
|
+
const input = [0, rect.height - thumbHeight];
|
|
26
34
|
const output = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value];
|
|
27
35
|
const value = Slider_utils.linearScale(input, output);
|
|
36
|
+
const position = slideStart ? event.clientY - rect.top - thumbHeight / 2 : event.clientY - rect.top - (offsetPosition.value ?? 0);
|
|
28
37
|
rectRef.value = rect;
|
|
29
|
-
return value(
|
|
38
|
+
return value(position);
|
|
30
39
|
}
|
|
31
40
|
Slider_utils.provideSliderOrientationContext({
|
|
32
41
|
startEdge: isSlidingFromBottom.value ? "bottom" : "top",
|
|
@@ -38,19 +47,20 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
38
47
|
return vue.openBlock(), vue.createBlock(Slider_SliderImpl._sfc_main, {
|
|
39
48
|
ref: vue.unref(forwardRef),
|
|
40
49
|
"data-orientation": "vertical",
|
|
41
|
-
style: {
|
|
42
|
-
["--reka-slider-thumb-transform"]: "translateY(50%)"
|
|
43
|
-
},
|
|
50
|
+
style: vue.normalizeStyle({
|
|
51
|
+
["--reka-slider-thumb-transform"]: !isSlidingFromBottom.value && vue.unref(rootContext).thumbAlignment.value === "overflow" ? "translateY(-50%)" : "translateY(50%)"
|
|
52
|
+
}),
|
|
44
53
|
onSlideStart: _cache[0] || (_cache[0] = (event) => {
|
|
45
|
-
const value =
|
|
54
|
+
const value = getValueFromPointerEvent(event, true);
|
|
46
55
|
emits("slideStart", value);
|
|
47
56
|
}),
|
|
48
57
|
onSlideMove: _cache[1] || (_cache[1] = (event) => {
|
|
49
|
-
const value =
|
|
58
|
+
const value = getValueFromPointerEvent(event);
|
|
50
59
|
emits("slideMove", value);
|
|
51
60
|
}),
|
|
52
61
|
onSlideEnd: _cache[2] || (_cache[2] = () => {
|
|
53
62
|
rectRef.value = undefined;
|
|
63
|
+
offsetPosition.value = undefined;
|
|
54
64
|
emits("slideEnd");
|
|
55
65
|
}),
|
|
56
66
|
onStepKeyDown: _cache[3] || (_cache[3] = (event) => {
|
|
@@ -65,7 +75,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
65
75
|
vue.renderSlot(_ctx.$slots, "default")
|
|
66
76
|
]),
|
|
67
77
|
_: 3
|
|
68
|
-
},
|
|
78
|
+
}, 8, ["style"]);
|
|
69
79
|
};
|
|
70
80
|
}
|
|
71
81
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderVertical.cjs","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction
|
|
1
|
+
{"version":3,"file":"SliderVertical.cjs","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\nimport { injectSliderRootContext } from './SliderRoot.vue'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst rootContext = injectSliderRootContext()\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst offsetPosition = ref<number>()\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction getValueFromPointerEvent(event: PointerEvent, slideStart?: boolean) {\n const rect = rectRef.value || sliderElement.value!.getBoundingClientRect()\n\n // Get the currently active thumb element\n const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value]\n const thumbHeight = rootContext.thumbAlignment.value === 'contain' ? thumb.clientHeight : 0\n\n // Calculate offset for dragging, but only when needed\n if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === 'contain') {\n offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top\n }\n\n // Define the input range (slider track width minus thumb width)\n const input: [number, number] = [0, rect.height - thumbHeight]\n const output: [number, number] = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value]\n const value = linearScale(input, output)\n\n const position = slideStart\n ? event.clientY - rect.top - thumbHeight / 2\n : event.clientY - rect.top - (offsetPosition.value ?? 0)\n\n rectRef.value = rect\n return value(position)\n}\n\nprovideSliderOrientationContext({\n startEdge: isSlidingFromBottom.value ? 'bottom' : 'top',\n endEdge: isSlidingFromBottom.value ? 'top' : 'bottom',\n size: 'height',\n direction: isSlidingFromBottom.value ? 1 : -1,\n})\n</script>\n\n<template>\n <SliderImpl\n :ref=\"forwardRef\"\n data-orientation=\"vertical\"\n :style=\"{\n ['--reka-slider-thumb-transform' as any]:\n !isSlidingFromBottom && rootContext.thumbAlignment.value === 'overflow' ? 'translateY(-50%)' : 'translateY(50%)',\n }\"\n @slide-start=\"(event) => {\n const value = getValueFromPointerEvent(event, true);\n emits('slideStart', value)\n }\"\n @slide-move=\"(event) => {\n const value = getValueFromPointerEvent(event);\n emits('slideMove', value)\n }\"\n @slide-end=\"() => {\n rectRef = undefined;\n offsetPosition = undefined\n emits('slideEnd')\n }\"\n @step-key-down=\"(event) => {\n const slideDirection = isSlidingFromBottom ? 'from-bottom' : 'from-top';\n const isBackKey = BACK_KEYS[slideDirection].includes(event.key);\n emits('stepKeyDown', event, isBackKey ? -1 : 1)\n }\"\n @end-key-down=\"emits('endKeyDown', $event)\"\n @home-key-down=\"emits('homeKeyDown', $event)\"\n >\n <slot />\n </SliderImpl>\n</template>\n"],"names":["toRefs","injectSliderRootContext","useForwardExpose","ref","computed","linearScale","provideSliderOrientationContext"],"mappings":";;;;;;;;;;;;;;;;;AASA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,GAAK,EAAA,GAAA,EAAK,QAAS,EAAA,GAAIA,WAAO,KAAK,CAAA;AAE3C,IAAA,MAAM,cAAcC,yCAAwB,EAAA;AAC5C,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,aAAA,KAAkBC,wCAAiB,EAAA;AAEvE,IAAA,MAAM,iBAAi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GAAA,IAAA;AAChB,MAAA,OAAO,MAAM,QAAQ,CAAA;AAAA;AAGvB,IAAgCC,4CAAA,CAAA;AAAA,MAC9B,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,QAAW,GAAA,KAAA;AAAA,MAClD,OAAA,EAAS,mBAAoB,CAAA,KAAA,GAAQ,KAAQ,GAAA,QAAA;AAAA,MAC7C,IAAM,EAAA,QAAA;AAAA,MACN,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,CAAI,GAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent, toRefs, ref, computed, openBlock, createBlock, unref, withCtx, renderSlot } from 'vue';
|
|
1
|
+
import { defineComponent, toRefs, ref, computed, openBlock, createBlock, unref, normalizeStyle, withCtx, renderSlot } from 'vue';
|
|
2
2
|
import { _ as _sfc_main$1 } from './SliderImpl.js';
|
|
3
3
|
import { p as provideSliderOrientationContext, B as BACK_KEYS, l as linearScale } from './utils.js';
|
|
4
4
|
import { u as useForwardExpose } from '../shared/useForwardExpose.js';
|
|
5
|
+
import { i as injectSliderRootContext } from './SliderRoot.js';
|
|
5
6
|
|
|
6
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
8
|
__name: "SliderVertical",
|
|
@@ -15,16 +16,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
16
|
const props = __props;
|
|
16
17
|
const emits = __emit;
|
|
17
18
|
const { max, min, inverted } = toRefs(props);
|
|
19
|
+
const rootContext = injectSliderRootContext();
|
|
18
20
|
const { forwardRef, currentElement: sliderElement } = useForwardExpose();
|
|
21
|
+
const offsetPosition = ref();
|
|
19
22
|
const rectRef = ref();
|
|
20
23
|
const isSlidingFromBottom = computed(() => !inverted.value);
|
|
21
|
-
function
|
|
24
|
+
function getValueFromPointerEvent(event, slideStart) {
|
|
22
25
|
const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
|
|
23
|
-
const
|
|
26
|
+
const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value];
|
|
27
|
+
const thumbHeight = rootContext.thumbAlignment.value === "contain" ? thumb.clientHeight : 0;
|
|
28
|
+
if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === "contain") {
|
|
29
|
+
offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top;
|
|
30
|
+
}
|
|
31
|
+
const input = [0, rect.height - thumbHeight];
|
|
24
32
|
const output = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value];
|
|
25
33
|
const value = linearScale(input, output);
|
|
34
|
+
const position = slideStart ? event.clientY - rect.top - thumbHeight / 2 : event.clientY - rect.top - (offsetPosition.value ?? 0);
|
|
26
35
|
rectRef.value = rect;
|
|
27
|
-
return value(
|
|
36
|
+
return value(position);
|
|
28
37
|
}
|
|
29
38
|
provideSliderOrientationContext({
|
|
30
39
|
startEdge: isSlidingFromBottom.value ? "bottom" : "top",
|
|
@@ -36,19 +45,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
36
45
|
return openBlock(), createBlock(_sfc_main$1, {
|
|
37
46
|
ref: unref(forwardRef),
|
|
38
47
|
"data-orientation": "vertical",
|
|
39
|
-
style: {
|
|
40
|
-
["--reka-slider-thumb-transform"]: "translateY(50%)"
|
|
41
|
-
},
|
|
48
|
+
style: normalizeStyle({
|
|
49
|
+
["--reka-slider-thumb-transform"]: !isSlidingFromBottom.value && unref(rootContext).thumbAlignment.value === "overflow" ? "translateY(-50%)" : "translateY(50%)"
|
|
50
|
+
}),
|
|
42
51
|
onSlideStart: _cache[0] || (_cache[0] = (event) => {
|
|
43
|
-
const value =
|
|
52
|
+
const value = getValueFromPointerEvent(event, true);
|
|
44
53
|
emits("slideStart", value);
|
|
45
54
|
}),
|
|
46
55
|
onSlideMove: _cache[1] || (_cache[1] = (event) => {
|
|
47
|
-
const value =
|
|
56
|
+
const value = getValueFromPointerEvent(event);
|
|
48
57
|
emits("slideMove", value);
|
|
49
58
|
}),
|
|
50
59
|
onSlideEnd: _cache[2] || (_cache[2] = () => {
|
|
51
60
|
rectRef.value = undefined;
|
|
61
|
+
offsetPosition.value = undefined;
|
|
52
62
|
emits("slideEnd");
|
|
53
63
|
}),
|
|
54
64
|
onStepKeyDown: _cache[3] || (_cache[3] = (event) => {
|
|
@@ -63,7 +73,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
63
73
|
renderSlot(_ctx.$slots, "default")
|
|
64
74
|
]),
|
|
65
75
|
_: 3
|
|
66
|
-
},
|
|
76
|
+
}, 8, ["style"]);
|
|
67
77
|
};
|
|
68
78
|
}
|
|
69
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderVertical.js","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction
|
|
1
|
+
{"version":3,"file":"SliderVertical.js","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\nimport { injectSliderRootContext } from './SliderRoot.vue'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst rootContext = injectSliderRootContext()\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst offsetPosition = ref<number>()\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction getValueFromPointerEvent(event: PointerEvent, slideStart?: boolean) {\n const rect = rectRef.value || sliderElement.value!.getBoundingClientRect()\n\n // Get the currently active thumb element\n const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value]\n const thumbHeight = rootContext.thumbAlignment.value === 'contain' ? thumb.clientHeight : 0\n\n // Calculate offset for dragging, but only when needed\n if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === 'contain') {\n offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top\n }\n\n // Define the input range (slider track width minus thumb width)\n const input: [number, number] = [0, rect.height - thumbHeight]\n const output: [number, number] = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value]\n const value = linearScale(input, output)\n\n const position = slideStart\n ? event.clientY - rect.top - thumbHeight / 2\n : event.clientY - rect.top - (offsetPosition.value ?? 0)\n\n rectRef.value = rect\n return value(position)\n}\n\nprovideSliderOrientationContext({\n startEdge: isSlidingFromBottom.value ? 'bottom' : 'top',\n endEdge: isSlidingFromBottom.value ? 'top' : 'bottom',\n size: 'height',\n direction: isSlidingFromBottom.value ? 1 : -1,\n})\n</script>\n\n<template>\n <SliderImpl\n :ref=\"forwardRef\"\n data-orientation=\"vertical\"\n :style=\"{\n ['--reka-slider-thumb-transform' as any]:\n !isSlidingFromBottom && rootContext.thumbAlignment.value === 'overflow' ? 'translateY(-50%)' : 'translateY(50%)',\n }\"\n @slide-start=\"(event) => {\n const value = getValueFromPointerEvent(event, true);\n emits('slideStart', value)\n }\"\n @slide-move=\"(event) => {\n const value = getValueFromPointerEvent(event);\n emits('slideMove', value)\n }\"\n @slide-end=\"() => {\n rectRef = undefined;\n offsetPosition = undefined\n emits('slideEnd')\n }\"\n @step-key-down=\"(event) => {\n const slideDirection = isSlidingFromBottom ? 'from-bottom' : 'from-top';\n const isBackKey = BACK_KEYS[slideDirection].includes(event.key);\n emits('stepKeyDown', event, isBackKey ? -1 : 1)\n }\"\n @end-key-down=\"emits('endKeyDown', $event)\"\n @home-key-down=\"emits('homeKeyDown', $event)\"\n >\n <slot />\n </SliderImpl>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AASA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,GAAK,EAAA,GAAA,EAAK,QAAS,EAAA,GAAI,OAAO,KAAK,CAAA;AAE3C,IAAA,MAAM,cAAc,uBAAwB,EAAA;AAC5C,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,aAAA,KAAkB,gBAAiB,EAAA;AAEvE,IAAA,MAAM,iBAAiB,GAAY,EAAA;AACnC,IAAA,MAAM,UAAU,GAAgB,EAAA;AAChC,IAAA,MAAM,mBAAsB,GAAA,QAAA,CAAS,MAAM,CAAC,SAAS,KAAK,CAAA;AAE1D,IAAS,SAAA,wBAAA,CAAyB,OAAqB,UAAsB,EAAA;AAC3E,MAAA,MAAM,IAAO,GAAA,OAAA,CAAQ,KAAS,IAAA,aAAA,CAAc,MAAO,qBAAsB,EAAA;AAGzE,MAAM,MAAA,KAAA,GAAQ,CAAC,GAAG,WAAA,CAAY,cAAc,KAAK,CAAA,CAAE,WAAY,CAAA,qBAAA,CAAsB,KAAK,CAAA;AAC1F,MAAA,MAAM,cAAc,WAAY,CAAA,cAAA,CAAe,KAAU,KAAA,SAAA,GAAY,MAAM,YAAe,GAAA,CAAA;AAG1F,MAAI,IAAA,CAAC,eAAe,KAAS,IAAA,CAAC,cAAc,WA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|
5
6
|
const Primitive_Primitive = require('../Primitive/Primitive.cjs');
|
|
6
7
|
const TagsInput_TagsInputRoot = require('./TagsInputRoot.cjs');
|
|
@@ -21,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
21
22
|
function handleDelete() {
|
|
22
23
|
if (disabled.value)
|
|
23
24
|
return;
|
|
24
|
-
const index = context.modelValue.value.findIndex((i) => i
|
|
25
|
+
const index = context.modelValue.value.findIndex((i) => ohash.isEqual(i, itemContext.value.value));
|
|
25
26
|
context.onRemoveValue(index);
|
|
26
27
|
}
|
|
27
28
|
return (_ctx, _cache) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInputItemDelete.cjs","sources":["../../src/TagsInput/TagsInputItemDelete.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { injectTagsInputItemContext } from './TagsInputItem.vue'\nimport { injectTagsInputRootContext } from './TagsInputRoot.vue'\nimport { computed } from 'vue'\nimport { useForwardExpose } from '@/shared'\n\nexport interface TagsInputItemDeleteProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<TagsInputItemDeleteProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst context = injectTagsInputRootContext()\nconst itemContext = injectTagsInputItemContext()\n\nconst disabled = computed(() => itemContext.disabled?.value || context.disabled.value)\n\nfunction handleDelete() {\n if (disabled.value)\n return\n const index = context.modelValue.value.findIndex(i => i
|
|
1
|
+
{"version":3,"file":"TagsInputItemDelete.cjs","sources":["../../src/TagsInput/TagsInputItemDelete.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { injectTagsInputItemContext } from './TagsInputItem.vue'\nimport { injectTagsInputRootContext } from './TagsInputRoot.vue'\nimport { computed } from 'vue'\nimport { useForwardExpose } from '@/shared'\nimport { isEqual } from 'ohash'\n\nexport interface TagsInputItemDeleteProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<TagsInputItemDeleteProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst context = injectTagsInputRootContext()\nconst itemContext = injectTagsInputItemContext()\n\nconst disabled = computed(() => itemContext.disabled?.value || context.disabled.value)\n\nfunction handleDelete() {\n if (disabled.value)\n return\n const index = context.modelValue.value.findIndex(i => isEqual(i, itemContext.value.value))\n context.onRemoveValue(index)\n}\n</script>\n\n<template>\n <Primitive\n tabindex=\"-1\"\n v-bind=\"props\"\n :aria-labelledby=\"itemContext.textId\"\n :aria-current=\"itemContext.isSelected.value\"\n :data-state=\"itemContext.isSelected.value ? 'active' : 'inactive'\"\n :data-disabled=\"disabled ? '' : undefined\"\n :type=\"as === 'button' ? 'button' : undefined\"\n @click=\"handleDelete\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":["useForwardExpose","injectTagsInputRootContext","injectTagsInputItemContext","computed","isEqual"],"mappings":";;;;;;;;;;;;;;;;AAcA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAiBA,wCAAA,EAAA;AACjB,IAAA,MAAM,UAAUC,kDAA2B,EAAA;AAC3C,IAAA,MAAM,cAAcC,kDAA2B,EAAA;AAE/C,IAAM,MAAA,QAAA,GAAWC,aAAS,MAAM,WAAA,CAAY,UAAU,KAAS,IAAA,OAAA,CAAQ,SAAS,KAAK,CAAA;AAErF,IAAA,SAAS,YAAe,GAAA;AACtB,MAAA,IAAI,QAAS,CAAA,KAAA;AACX,QAAA;AACF,MAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,UAAA,CAAW,KAAM,CAAA,SAAA,CAAU,CAAK,CAAA,KAAAC,aAAA,CAAQ,CAAG,EAAA,WAAA,CAAY,KAAM,CAAA,KAAK,CAAC,CAAA;AACzF,MAAA,OAAA,CAAQ,cAAc,KAAK,CAAA;AAAA;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
|
|
2
|
+
import { isEqual } from 'ohash';
|
|
2
3
|
import { u as useForwardExpose } from '../shared/useForwardExpose.js';
|
|
3
4
|
import { P as Primitive } from '../Primitive/Primitive.js';
|
|
4
5
|
import { i as injectTagsInputRootContext } from './TagsInputRoot.js';
|
|
@@ -19,7 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
19
20
|
function handleDelete() {
|
|
20
21
|
if (disabled.value)
|
|
21
22
|
return;
|
|
22
|
-
const index = context.modelValue.value.findIndex((i) => i
|
|
23
|
+
const index = context.modelValue.value.findIndex((i) => isEqual(i, itemContext.value.value));
|
|
23
24
|
context.onRemoveValue(index);
|
|
24
25
|
}
|
|
25
26
|
return (_ctx, _cache) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInputItemDelete.js","sources":["../../src/TagsInput/TagsInputItemDelete.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { injectTagsInputItemContext } from './TagsInputItem.vue'\nimport { injectTagsInputRootContext } from './TagsInputRoot.vue'\nimport { computed } from 'vue'\nimport { useForwardExpose } from '@/shared'\n\nexport interface TagsInputItemDeleteProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<TagsInputItemDeleteProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst context = injectTagsInputRootContext()\nconst itemContext = injectTagsInputItemContext()\n\nconst disabled = computed(() => itemContext.disabled?.value || context.disabled.value)\n\nfunction handleDelete() {\n if (disabled.value)\n return\n const index = context.modelValue.value.findIndex(i => i
|
|
1
|
+
{"version":3,"file":"TagsInputItemDelete.js","sources":["../../src/TagsInput/TagsInputItemDelete.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { injectTagsInputItemContext } from './TagsInputItem.vue'\nimport { injectTagsInputRootContext } from './TagsInputRoot.vue'\nimport { computed } from 'vue'\nimport { useForwardExpose } from '@/shared'\nimport { isEqual } from 'ohash'\n\nexport interface TagsInputItemDeleteProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<TagsInputItemDeleteProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst context = injectTagsInputRootContext()\nconst itemContext = injectTagsInputItemContext()\n\nconst disabled = computed(() => itemContext.disabled?.value || context.disabled.value)\n\nfunction handleDelete() {\n if (disabled.value)\n return\n const index = context.modelValue.value.findIndex(i => isEqual(i, itemContext.value.value))\n context.onRemoveValue(index)\n}\n</script>\n\n<template>\n <Primitive\n tabindex=\"-1\"\n v-bind=\"props\"\n :aria-labelledby=\"itemContext.textId\"\n :aria-current=\"itemContext.isSelected.value\"\n :data-state=\"itemContext.isSelected.value ? 'active' : 'inactive'\"\n :data-disabled=\"disabled ? '' : undefined\"\n :type=\"as === 'button' ? 'button' : undefined\"\n @click=\"handleDelete\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAcA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAiB,gBAAA,EAAA;AACjB,IAAA,MAAM,UAAU,0BAA2B,EAAA;AAC3C,IAAA,MAAM,cAAc,0BAA2B,EAAA;AAE/C,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM,WAAA,CAAY,UAAU,KAAS,IAAA,OAAA,CAAQ,SAAS,KAAK,CAAA;AAErF,IAAA,SAAS,YAAe,GAAA;AACtB,MAAA,IAAI,QAAS,CAAA,KAAA;AACX,QAAA;AACF,MAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,UAAA,CAAW,KAAM,CAAA,SAAA,CAAU,CAAK,CAAA,KAAA,OAAA,CAAQ,CAAG,EAAA,WAAA,CAAY,KAAM,CAAA,KAAK,CAAC,CAAA;AACzF,MAAA,OAAA,CAAQ,cAAc,KAAK,CAAA;AAAA;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -22,13 +22,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
22
22
|
vue.createVNode(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(props, {
|
|
23
23
|
ref: vue.unref(forwardRef),
|
|
24
24
|
type: _ctx.as === "button" ? "button" : undefined,
|
|
25
|
-
onClick:
|
|
25
|
+
onClick: vue.unref(rootContext).onClose
|
|
26
26
|
}), {
|
|
27
27
|
default: vue.withCtx(() => [
|
|
28
28
|
vue.renderSlot(_ctx.$slots, "default")
|
|
29
29
|
]),
|
|
30
30
|
_: 3
|
|
31
|
-
}, 16, ["type"])
|
|
31
|
+
}, 16, ["type", "onClick"])
|
|
32
32
|
]),
|
|
33
33
|
_: 3
|
|
34
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastClose.cjs","sources":["../../src/Toast/ToastClose.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToastCloseProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport ToastAnnounceExclude from './ToastAnnounceExclude.vue'\nimport { injectToastRootContext } from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastCloseProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToastRootContext()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToastAnnounceExclude as-child>\n <Primitive\n v-bind=\"props\"\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined \"\n @click=\"rootContext.onClose
|
|
1
|
+
{"version":3,"file":"ToastClose.cjs","sources":["../../src/Toast/ToastClose.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToastCloseProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport ToastAnnounceExclude from './ToastAnnounceExclude.vue'\nimport { injectToastRootContext } from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastCloseProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToastRootContext()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToastAnnounceExclude as-child>\n <Primitive\n v-bind=\"props\"\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined \"\n @click=\"rootContext.onClose\"\n >\n <slot />\n </Primitive>\n </ToastAnnounceExclude>\n</template>\n"],"names":["injectToastRootContext","useForwardExpose"],"mappings":";;;;;;;;;;;;;;;AAYA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAcA,0CAAuB,EAAA;AAC3C,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIC,wCAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Toast/ToastClose.js
CHANGED
|
@@ -20,13 +20,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20
20
|
createVNode(unref(Primitive), mergeProps(props, {
|
|
21
21
|
ref: unref(forwardRef),
|
|
22
22
|
type: _ctx.as === "button" ? "button" : undefined,
|
|
23
|
-
onClick:
|
|
23
|
+
onClick: unref(rootContext).onClose
|
|
24
24
|
}), {
|
|
25
25
|
default: withCtx(() => [
|
|
26
26
|
renderSlot(_ctx.$slots, "default")
|
|
27
27
|
]),
|
|
28
28
|
_: 3
|
|
29
|
-
}, 16, ["type"])
|
|
29
|
+
}, 16, ["type", "onClick"])
|
|
30
30
|
]),
|
|
31
31
|
_: 3
|
|
32
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastClose.js","sources":["../../src/Toast/ToastClose.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToastCloseProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport ToastAnnounceExclude from './ToastAnnounceExclude.vue'\nimport { injectToastRootContext } from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastCloseProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToastRootContext()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToastAnnounceExclude as-child>\n <Primitive\n v-bind=\"props\"\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined \"\n @click=\"rootContext.onClose
|
|
1
|
+
{"version":3,"file":"ToastClose.js","sources":["../../src/Toast/ToastClose.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToastCloseProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport ToastAnnounceExclude from './ToastAnnounceExclude.vue'\nimport { injectToastRootContext } from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastCloseProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToastRootContext()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToastAnnounceExclude as-child>\n <Primitive\n v-bind=\"props\"\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined \"\n @click=\"rootContext.onClose\"\n >\n <slot />\n </Primitive>\n </ToastAnnounceExclude>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAYA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAc,sBAAuB,EAAA;AAC3C,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Toast/ToastRoot.cjs
CHANGED
|
@@ -48,6 +48,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
48
48
|
event.currentTarget.setAttribute("data-swipe", "start");
|
|
49
49
|
}),
|
|
50
50
|
onSwipeMove: _cache[5] || (_cache[5] = (event) => {
|
|
51
|
+
emits("swipeMove", event);
|
|
51
52
|
const { x, y } = event.detail.delta;
|
|
52
53
|
const target = event.currentTarget;
|
|
53
54
|
target.setAttribute("data-swipe", "move");
|
|
@@ -55,6 +56,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
55
56
|
target.style.setProperty("--reka-toast-swipe-move-y", `${y}px`);
|
|
56
57
|
}),
|
|
57
58
|
onSwipeCancel: _cache[6] || (_cache[6] = (event) => {
|
|
59
|
+
emits("swipeCancel", event);
|
|
58
60
|
const target = event.currentTarget;
|
|
59
61
|
target.setAttribute("data-swipe", "cancel");
|
|
60
62
|
target.style.removeProperty("--reka-toast-swipe-move-x");
|
|
@@ -63,6 +65,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
63
65
|
target.style.removeProperty("--reka-toast-swipe-end-y");
|
|
64
66
|
}),
|
|
65
67
|
onSwipeEnd: _cache[7] || (_cache[7] = (event) => {
|
|
68
|
+
emits("swipeEnd", event);
|
|
66
69
|
const { x, y } = event.detail.delta;
|
|
67
70
|
const target = event.currentTarget;
|
|
68
71
|
target.setAttribute("data-swipe", "end");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRoot.cjs","sources":["../../src/Toast/ToastRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ToastRootImplEmits, ToastRootImplProps } from './ToastRootImpl.vue'\nimport { useForwardExpose } from '@/shared'\n\nexport type ToastRootEmits = Omit<ToastRootImplEmits, 'close'> & {\n /** Event handler called when the open state changes */\n 'update:open': [value: boolean]\n}\n\nexport interface ToastRootProps extends ToastRootImplProps {\n /** The open state of the dialog when it is initially rendered. Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with Vue animation libraries.\n */\n forceMount?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { Presence } from '@/Presence'\nimport ToastRootImpl from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastRootProps>(), {\n type: 'foreground',\n open: undefined,\n defaultOpen: true,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Remaining time (in ms) */\n remaining: number\n /** Total time the toast will remain visible for (in ms) */\n duration: number\n }) => any\n}>()\n\nconst { forwardRef } = useForwardExpose()\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n</script>\n\n<template>\n <Presence :present=\"forceMount || open\">\n <ToastRootImpl\n :ref=\"forwardRef\"\n v-slot=\"{ remaining, duration: _duration }\"\n :open=\"open\"\n :type=\"type\"\n :as=\"as\"\n :as-child=\"asChild\"\n :duration=\"duration\"\n v-bind=\"$attrs\"\n @close=\"open = false\"\n @pause=\"emits('pause')\"\n @resume=\"emits('resume')\"\n @escape-key-down=\"emits('escapeKeyDown', $event)\"\n @swipe-start=\"(event) => {\n emits('swipeStart', event);\n (event.currentTarget as HTMLElement).setAttribute('data-swipe', 'start');\n }\"\n @swipe-move=\"(event) => {\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'move');\n target.style.setProperty('--reka-toast-swipe-move-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-move-y', `${y}px`);\n }\"\n @swipe-cancel=\"(event) => {\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'cancel');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.removeProperty('--reka-toast-swipe-end-x');\n target.style.removeProperty('--reka-toast-swipe-end-y');\n }\"\n @swipe-end=\"(event) => {\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'end');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.setProperty('--reka-toast-swipe-end-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-end-y', `${y}px`);\n open = false;\n }\"\n >\n <slot\n :remaining=\"remaining\"\n :duration=\"_duration\"\n :open=\"open\"\n />\n </ToastRootImpl>\n </Presence>\n</template>\n"],"names":["useForwardExpose","useVModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAOd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAad,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIA,wCAAiB,EAAA;AACxC,IAAA,MAAM,IAAO,GAAAC,cAAA,CAAU,KAAO,EAAA,MAAA,EAAQ,KAAO,EAAA;AAAA,MAC3C,cAAc,KAAM,CAAA,WAAA;AAAA,MACpB,OAAA,EAAU,MAAM,IAAS,KAAA;AAAA,KAC1B,CAAA
|
|
1
|
+
{"version":3,"file":"ToastRoot.cjs","sources":["../../src/Toast/ToastRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ToastRootImplEmits, ToastRootImplProps } from './ToastRootImpl.vue'\nimport { useForwardExpose } from '@/shared'\n\nexport type ToastRootEmits = Omit<ToastRootImplEmits, 'close'> & {\n /** Event handler called when the open state changes */\n 'update:open': [value: boolean]\n}\n\nexport interface ToastRootProps extends ToastRootImplProps {\n /** The open state of the dialog when it is initially rendered. Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with Vue animation libraries.\n */\n forceMount?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { Presence } from '@/Presence'\nimport ToastRootImpl from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastRootProps>(), {\n type: 'foreground',\n open: undefined,\n defaultOpen: true,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Remaining time (in ms) */\n remaining: number\n /** Total time the toast will remain visible for (in ms) */\n duration: number\n }) => any\n}>()\n\nconst { forwardRef } = useForwardExpose()\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n</script>\n\n<template>\n <Presence :present=\"forceMount || open\">\n <ToastRootImpl\n :ref=\"forwardRef\"\n v-slot=\"{ remaining, duration: _duration }\"\n :open=\"open\"\n :type=\"type\"\n :as=\"as\"\n :as-child=\"asChild\"\n :duration=\"duration\"\n v-bind=\"$attrs\"\n @close=\"open = false\"\n @pause=\"emits('pause')\"\n @resume=\"emits('resume')\"\n @escape-key-down=\"emits('escapeKeyDown', $event)\"\n @swipe-start=\"(event) => {\n emits('swipeStart', event);\n (event.currentTarget as HTMLElement).setAttribute('data-swipe', 'start');\n }\"\n @swipe-move=\"(event) => {\n emits('swipeMove', event);\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'move');\n target.style.setProperty('--reka-toast-swipe-move-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-move-y', `${y}px`);\n }\"\n @swipe-cancel=\"(event) => {\n emits('swipeCancel', event);\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'cancel');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.removeProperty('--reka-toast-swipe-end-x');\n target.style.removeProperty('--reka-toast-swipe-end-y');\n }\"\n @swipe-end=\"(event) => {\n emits('swipeEnd', event);\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'end');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.setProperty('--reka-toast-swipe-end-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-end-y', `${y}px`);\n open = false;\n }\"\n >\n <slot\n :remaining=\"remaining\"\n :duration=\"_duration\"\n :open=\"open\"\n />\n </ToastRootImpl>\n </Presence>\n</template>\n"],"names":["useForwardExpose","useVModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAOd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAad,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIA,wCAAiB,EAAA;AACxC,IAAA,MAAM,IAAO,GAAAC,cAAA,CAAU,KAAO,EAAA,MAAA,EAAQ,KAAO,EAAA;AAAA,MAC3C,cAAc,KAAM,CAAA,WAAA;AAAA,MACpB,OAAA,EAAU,MAAM,IAAS,KAAA;AAAA,KAC1B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Toast/ToastRoot.js
CHANGED
|
@@ -46,6 +46,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
46
|
event.currentTarget.setAttribute("data-swipe", "start");
|
|
47
47
|
}),
|
|
48
48
|
onSwipeMove: _cache[5] || (_cache[5] = (event) => {
|
|
49
|
+
emits("swipeMove", event);
|
|
49
50
|
const { x, y } = event.detail.delta;
|
|
50
51
|
const target = event.currentTarget;
|
|
51
52
|
target.setAttribute("data-swipe", "move");
|
|
@@ -53,6 +54,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
53
54
|
target.style.setProperty("--reka-toast-swipe-move-y", `${y}px`);
|
|
54
55
|
}),
|
|
55
56
|
onSwipeCancel: _cache[6] || (_cache[6] = (event) => {
|
|
57
|
+
emits("swipeCancel", event);
|
|
56
58
|
const target = event.currentTarget;
|
|
57
59
|
target.setAttribute("data-swipe", "cancel");
|
|
58
60
|
target.style.removeProperty("--reka-toast-swipe-move-x");
|
|
@@ -61,6 +63,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
63
|
target.style.removeProperty("--reka-toast-swipe-end-y");
|
|
62
64
|
}),
|
|
63
65
|
onSwipeEnd: _cache[7] || (_cache[7] = (event) => {
|
|
66
|
+
emits("swipeEnd", event);
|
|
64
67
|
const { x, y } = event.detail.delta;
|
|
65
68
|
const target = event.currentTarget;
|
|
66
69
|
target.setAttribute("data-swipe", "end");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRoot.js","sources":["../../src/Toast/ToastRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ToastRootImplEmits, ToastRootImplProps } from './ToastRootImpl.vue'\nimport { useForwardExpose } from '@/shared'\n\nexport type ToastRootEmits = Omit<ToastRootImplEmits, 'close'> & {\n /** Event handler called when the open state changes */\n 'update:open': [value: boolean]\n}\n\nexport interface ToastRootProps extends ToastRootImplProps {\n /** The open state of the dialog when it is initially rendered. Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with Vue animation libraries.\n */\n forceMount?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { Presence } from '@/Presence'\nimport ToastRootImpl from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastRootProps>(), {\n type: 'foreground',\n open: undefined,\n defaultOpen: true,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Remaining time (in ms) */\n remaining: number\n /** Total time the toast will remain visible for (in ms) */\n duration: number\n }) => any\n}>()\n\nconst { forwardRef } = useForwardExpose()\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n</script>\n\n<template>\n <Presence :present=\"forceMount || open\">\n <ToastRootImpl\n :ref=\"forwardRef\"\n v-slot=\"{ remaining, duration: _duration }\"\n :open=\"open\"\n :type=\"type\"\n :as=\"as\"\n :as-child=\"asChild\"\n :duration=\"duration\"\n v-bind=\"$attrs\"\n @close=\"open = false\"\n @pause=\"emits('pause')\"\n @resume=\"emits('resume')\"\n @escape-key-down=\"emits('escapeKeyDown', $event)\"\n @swipe-start=\"(event) => {\n emits('swipeStart', event);\n (event.currentTarget as HTMLElement).setAttribute('data-swipe', 'start');\n }\"\n @swipe-move=\"(event) => {\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'move');\n target.style.setProperty('--reka-toast-swipe-move-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-move-y', `${y}px`);\n }\"\n @swipe-cancel=\"(event) => {\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'cancel');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.removeProperty('--reka-toast-swipe-end-x');\n target.style.removeProperty('--reka-toast-swipe-end-y');\n }\"\n @swipe-end=\"(event) => {\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'end');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.setProperty('--reka-toast-swipe-end-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-end-y', `${y}px`);\n open = false;\n }\"\n >\n <slot\n :remaining=\"remaining\"\n :duration=\"_duration\"\n :open=\"open\"\n />\n </ToastRootImpl>\n </Presence>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAOd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAad,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;AACxC,IAAA,MAAM,IAAO,GAAA,SAAA,CAAU,KAAO,EAAA,MAAA,EAAQ,KAAO,EAAA;AAAA,MAC3C,cAAc,KAAM,CAAA,WAAA;AAAA,MACpB,OAAA,EAAU,MAAM,IAAS,KAAA;AAAA,KAC1B,CAAA
|
|
1
|
+
{"version":3,"file":"ToastRoot.js","sources":["../../src/Toast/ToastRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ToastRootImplEmits, ToastRootImplProps } from './ToastRootImpl.vue'\nimport { useForwardExpose } from '@/shared'\n\nexport type ToastRootEmits = Omit<ToastRootImplEmits, 'close'> & {\n /** Event handler called when the open state changes */\n 'update:open': [value: boolean]\n}\n\nexport interface ToastRootProps extends ToastRootImplProps {\n /** The open state of the dialog when it is initially rendered. Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with Vue animation libraries.\n */\n forceMount?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { Presence } from '@/Presence'\nimport ToastRootImpl from './ToastRootImpl.vue'\n\nconst props = withDefaults(defineProps<ToastRootProps>(), {\n type: 'foreground',\n open: undefined,\n defaultOpen: true,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Remaining time (in ms) */\n remaining: number\n /** Total time the toast will remain visible for (in ms) */\n duration: number\n }) => any\n}>()\n\nconst { forwardRef } = useForwardExpose()\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n</script>\n\n<template>\n <Presence :present=\"forceMount || open\">\n <ToastRootImpl\n :ref=\"forwardRef\"\n v-slot=\"{ remaining, duration: _duration }\"\n :open=\"open\"\n :type=\"type\"\n :as=\"as\"\n :as-child=\"asChild\"\n :duration=\"duration\"\n v-bind=\"$attrs\"\n @close=\"open = false\"\n @pause=\"emits('pause')\"\n @resume=\"emits('resume')\"\n @escape-key-down=\"emits('escapeKeyDown', $event)\"\n @swipe-start=\"(event) => {\n emits('swipeStart', event);\n (event.currentTarget as HTMLElement).setAttribute('data-swipe', 'start');\n }\"\n @swipe-move=\"(event) => {\n emits('swipeMove', event);\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'move');\n target.style.setProperty('--reka-toast-swipe-move-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-move-y', `${y}px`);\n }\"\n @swipe-cancel=\"(event) => {\n emits('swipeCancel', event);\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'cancel');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.removeProperty('--reka-toast-swipe-end-x');\n target.style.removeProperty('--reka-toast-swipe-end-y');\n }\"\n @swipe-end=\"(event) => {\n emits('swipeEnd', event);\n const { x, y } = event.detail.delta;\n const target = event.currentTarget as HTMLElement\n target.setAttribute('data-swipe', 'end');\n target.style.removeProperty('--reka-toast-swipe-move-x');\n target.style.removeProperty('--reka-toast-swipe-move-y');\n target.style.setProperty('--reka-toast-swipe-end-x', `${x}px`);\n target.style.setProperty('--reka-toast-swipe-end-y', `${y}px`);\n open = false;\n }\"\n >\n <slot\n :remaining=\"remaining\"\n :duration=\"_duration\"\n :open=\"open\"\n />\n </ToastRootImpl>\n </Presence>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAOd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAad,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;AACxC,IAAA,MAAM,IAAO,GAAA,SAAA,CAAU,KAAO,EAAA,MAAA,EAAQ,KAAO,EAAA;AAAA,MAC3C,cAAc,KAAM,CAAA,WAAA;AAAA,MACpB,OAAA,EAAU,MAAM,IAAS,KAAA;AAAA,KAC1B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -54,11 +54,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
54
54
|
closeTimerStartTimeRef.value = (/* @__PURE__ */ new Date()).getTime();
|
|
55
55
|
closeTimerRef.value = window.setTimeout(handleClose, duration2);
|
|
56
56
|
}
|
|
57
|
-
function handleClose() {
|
|
57
|
+
function handleClose(event) {
|
|
58
|
+
const isNonPointerEvent = event?.pointerType === "";
|
|
58
59
|
const isFocusInToast = currentElement.value?.contains(shared_getActiveElement.getActiveElement());
|
|
59
|
-
if (isFocusInToast)
|
|
60
|
+
if (isFocusInToast && isNonPointerEvent)
|
|
60
61
|
providerContext.viewport.value?.focus();
|
|
61
|
-
|
|
62
|
+
if (isNonPointerEvent) {
|
|
63
|
+
providerContext.isClosePausedRef.value = false;
|
|
64
|
+
}
|
|
62
65
|
emits("close");
|
|
63
66
|
}
|
|
64
67
|
const announceTextContent = vue.computed(() => currentElement.value ? Toast_utils.getAnnounceTextContent(currentElement.value) : null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRootImpl.cjs","sources":["../../src/Toast/ToastRootImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { isClient } from '@vueuse/shared'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { SwipeEvent } from './utils'\nimport { createContext, getActiveElement, useForwardExpose } from '@/shared'\nimport { useCollection } from '@/Collection'\n\nexport type ToastRootImplEmits = {\n close: []\n /** Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. */\n escapeKeyDown: [event: KeyboardEvent]\n /** Event handler called when the dismiss timer is paused. This occurs when the pointer is moved over the viewport, the viewport is focused or when the window is blurred. */\n pause: []\n /** Event handler called when the dismiss timer is resumed. This occurs when the pointer is moved away from the viewport, the viewport is blurred or when the window is focused. */\n resume: []\n /** Event handler called when starting a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeStart: [event: SwipeEvent]\n /** Event handler called during a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeMove: [event: SwipeEvent]\n swipeCancel: [event: SwipeEvent]\n /** Event handler called at the end of a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeEnd: [event: SwipeEvent]\n}\n\nexport interface ToastRootImplProps extends PrimitiveProps {\n /**\n * Control the sensitivity of the toast for accessibility purposes.\n *\n * For toasts that are the result of a user action, choose `foreground`. Toasts generated from background tasks should use `background`.\n */\n type?: 'foreground' | 'background'\n /**\n * The controlled open state of the dialog. Can be bind as `v-model:open`.\n */\n open?: boolean\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number\n}\n\nexport const [injectToastRootContext, provideToastRootContext]\n = createContext<{ onClose: () => void }>('ToastRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { computed, onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'\nimport { injectToastProviderContext } from './ToastProvider.vue'\nimport { TOAST_SWIPE_CANCEL, TOAST_SWIPE_END, TOAST_SWIPE_MOVE, TOAST_SWIPE_START, VIEWPORT_PAUSE, VIEWPORT_RESUME, getAnnounceTextContent, handleAndDispatchCustomEvent, isDeltaInDirection } from './utils'\nimport { onKeyStroke, useRafFn } from '@vueuse/core'\nimport ToastAnnounce from './ToastAnnounce.vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ToastRootImplProps>(), {\n open: false,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootImplEmits>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst providerContext = injectToastProviderContext()\nconst pointerStartRef = ref<{ x: number, y: number } | null>(null)\nconst swipeDeltaRef = ref<{ x: number, y: number } | null>(null)\nconst duration = computed(\n () => typeof props.duration === 'number'\n ? props.duration\n : providerContext.duration.value,\n)\n\nconst closeTimerStartTimeRef = ref(0)\nconst closeTimerRemainingTimeRef = ref(duration.value)\nconst closeTimerRef = ref(0)\nconst remainingTime = ref(duration.value)\n\nconst remainingRaf = useRafFn(() => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n remainingTime.value = Math.max(closeTimerRemainingTimeRef.value - elapsedTime, 0)\n}, { fpsLimit: 60 })\n\nfunction startTimer(duration: number) {\n if (duration <= 0 || duration === Number.POSITIVE_INFINITY)\n return\n // startTimer is used inside a watch with immediate set to true.\n // This results in code execution during SSR.\n // Ensure this code only runs in a browser environment\n if (!isClient)\n return\n window.clearTimeout(closeTimerRef.value)\n closeTimerStartTimeRef.value = new Date().getTime()\n closeTimerRef.value = window.setTimeout(handleClose, duration)\n}\n\nfunction handleClose() {\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = currentElement.value?.contains(getActiveElement())\n if (isFocusInToast)\n providerContext.viewport.value?.focus()\n\n // when manually close the toast, we reset isClosePausedRef\n providerContext.isClosePausedRef.value = false\n emits('close')\n}\n\nconst announceTextContent = computed(() => currentElement.value ? getAnnounceTextContent(currentElement.value) : null)\n\nif (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = 'Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.'\n throw new Error(error)\n}\n\nwatchEffect((cleanupFn) => {\n const viewport = providerContext.viewport.value\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.value)\n remainingRaf.resume()\n emits('resume')\n }\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n closeTimerRemainingTimeRef.value = closeTimerRemainingTimeRef.value - elapsedTime\n window.clearTimeout(closeTimerRef.value)\n remainingRaf.pause()\n emits('pause')\n }\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.addEventListener(VIEWPORT_RESUME, handleResume)\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume)\n }\n }\n})\n\n// start timer when toast opens or duration changes.\n// we include `open` in deps because closed !== unmounted when animating\n// so it could reopen before being completely unmounted\nwatch(() => [props.open, duration.value], () => {\n // Reset the timer when the toast is rerendered with the new duration\n closeTimerRemainingTimeRef.value = duration.value\n\n if (props.open && !providerContext.isClosePausedRef.value)\n startTimer(duration.value)\n}, { immediate: true })\n\nonKeyStroke('Escape', (event) => {\n emits('escapeKeyDown', event)\n if (!event.defaultPrevented) {\n providerContext.isFocusedToastEscapeKeyDownRef.value = true\n handleClose()\n }\n})\n\nonMounted(() => {\n providerContext.onToastAdd()\n})\nonUnmounted(() => {\n providerContext.onToastRemove()\n})\n\nprovideToastRootContext({ onClose: handleClose })\n</script>\n\n<template>\n <ToastAnnounce\n v-if=\"announceTextContent\"\n role=\"alert\"\n :aria-live=\"type === 'foreground' ? 'assertive' : 'polite'\"\n aria-atomic=\"true\"\n >\n {{ announceTextContent }}\n </ToastAnnounce>\n\n <Teleport\n v-if=\"providerContext.viewport.value\"\n :to=\"providerContext.viewport.value\"\n >\n <CollectionItem>\n <Primitive\n :ref=\"forwardRef\"\n role=\"alert\"\n aria-live=\"off\"\n aria-atomic=\"true\"\n tabindex=\"0\"\n v-bind=\"$attrs\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-state=\"open ? 'open' : 'closed'\"\n :data-swipe-direction=\"providerContext.swipeDirection.value\"\n :style=\"{ userSelect: 'none', touchAction: 'none' }\"\n @pointerdown.left=\"(event: PointerEvent) => {\n pointerStartRef = { x: event.clientX, y: event.clientY };\n }\"\n @pointermove=\"(event: PointerEvent) => {\n if (!pointerStartRef) return;\n const x = event.clientX - pointerStartRef.x;\n const y = event.clientY - pointerStartRef.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef);\n const isHorizontalSwipe = ['left', 'right'].includes(providerContext.swipeDirection.value);\n const clamp = ['left', 'up'].includes(providerContext.swipeDirection.value)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, (ev: SwipeEvent) => emits('swipeMove', ev), eventDetail);\n }\n else if (isDeltaInDirection(delta, providerContext.swipeDirection.value, moveStartBuffer)) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, (ev: SwipeEvent) => emits('swipeStart', ev), eventDetail);\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n }\n else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef = null;\n }\n }\"\n @pointerup=\"(event: PointerEvent) => {\n const delta = swipeDeltaRef;\n const target = event.target as HTMLElement;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n swipeDeltaRef = null;\n pointerStartRef = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (\n isDeltaInDirection(delta, providerContext.swipeDirection.value, providerContext.swipeThreshold.value)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, (ev: SwipeEvent) => emits('swipeEnd', ev), eventDetail);\n }\n else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, (ev: SwipeEvent) => emits('swipeCancel', ev), eventDetail);\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast?.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n }\"\n >\n <slot\n :remaining=\"remainingTime\"\n :duration=\"duration\"\n />\n </Primitive>\n </CollectionItem>\n </Teleport>\n</template>\n"],"names":["createContext","useForwardExpose","useCollection","injectToastProviderContext","ref","computed","useRafFn","duration","isClient","getActiveElement","getAnnounceTextContent","watchEffect","VIEWPORT_PAUSE","VIEWPORT_RESUME","watch","onKeyStroke","onMounted","onUnmounted"],"mappings":";;;;;;;;;;;;;;AA0CO,MAAM,CAAC,sBAAA,EAAwB,uBAAuB,CAAA,GACzDA,mCAAuC,WAAW;;;;;;;;;;;;;;;AAetD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAIC,wCAAiB,EAAA;AACxD,IAAM,MAAA,EAAE,cAAe,EAAA,GAAIC,mCAAc,EAAA;AAEzC,IAAA,MAAM,kBAAkBC,8CAA2B,EAAA;AACnD,IAAM,MAAA,eAAA,GAAkBC,QAAqC,IAAI,CAAA;AACjE,IAAM,MAAA,aAAA,GAAgBA,QAAqC,IAAI,CAAA;AAC/D,IAAA,MAAM,QAAW,GAAAC,YAAA;AAAA,MACf,MAAM,OAAO,KAAM,CAAA,QAAA,KAAa,WAC5B,KAAM,CAAA,QAAA,GACN,gBAAgB,QAAS,CAAA;AAAA,KAC/B;AAEA,IAAM,MAAA,sBAAA,GAAyBD,QAAI,CAAC,CAAA;AACpC,IAAM,MAAA,0BAAA,GAA6BA,OAAI,CAAA,QAAA,CAAS,KAAK,CAAA;AACrD,IAAM,MAAA,aAAA,GAAgBA,QAAI,CAAC,CAAA;AAC3B,IAAM,MAAA,aAAA,GAAgBA,OAAI,CAAA,QAAA,CAAS,KAAK,CAAA;AAExC,IAAM,MAAA,YAAA,GAAeE,cAAS,MAAM;AAClC,MAAA,MAAM,+BAAkB,IAAA,IAAA,EAAO,EAAA,OAAA,KAAY,sBAAuB,CAAA,KAAA;AACl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A;AAC/B,MAAA,KAAA,CAAM,iBAAiB,KAAK,CAAA;AAC5B,MAAI,IAAA,CAAC,MAAM,gBAAkB,EAAA;AAC3B,QAAA,eAAA,CAAgB,+BAA+B,KAAQ,GAAA,IAAA;AACvD,QAAY,WAAA,EAAA;AAAA;AACd,KACD,CAAA;AAED,IAAAC,aAAA,CAAU,MAAM;AACd,MAAA,eAAA,CAAgB,UAAW,EAAA;AAAA,KAC5B,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAA,eAAA,CAAgB,aAAc,EAAA;AAAA,KAC/B,CAAA;AAED,IAAwB,uBAAA,CAAA,EAAE,OAAS,EAAA,WAAA,EAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ToastRootImpl.cjs","sources":["../../src/Toast/ToastRootImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { isClient } from '@vueuse/shared'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { SwipeEvent } from './utils'\nimport { createContext, getActiveElement, useForwardExpose } from '@/shared'\nimport { useCollection } from '@/Collection'\n\nexport type ToastRootImplEmits = {\n close: []\n /** Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. */\n escapeKeyDown: [event: KeyboardEvent]\n /** Event handler called when the dismiss timer is paused. This occurs when the pointer is moved over the viewport, the viewport is focused or when the window is blurred. */\n pause: []\n /** Event handler called when the dismiss timer is resumed. This occurs when the pointer is moved away from the viewport, the viewport is blurred or when the window is focused. */\n resume: []\n /** Event handler called when starting a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeStart: [event: SwipeEvent]\n /** Event handler called during a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeMove: [event: SwipeEvent]\n swipeCancel: [event: SwipeEvent]\n /** Event handler called at the end of a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeEnd: [event: SwipeEvent]\n}\n\nexport interface ToastRootImplProps extends PrimitiveProps {\n /**\n * Control the sensitivity of the toast for accessibility purposes.\n *\n * For toasts that are the result of a user action, choose `foreground`. Toasts generated from background tasks should use `background`.\n */\n type?: 'foreground' | 'background'\n /**\n * The controlled open state of the dialog. Can be bind as `v-model:open`.\n */\n open?: boolean\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number\n}\n\nexport const [injectToastRootContext, provideToastRootContext]\n = createContext<{ onClose: () => void }>('ToastRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { computed, onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'\nimport { injectToastProviderContext } from './ToastProvider.vue'\nimport { TOAST_SWIPE_CANCEL, TOAST_SWIPE_END, TOAST_SWIPE_MOVE, TOAST_SWIPE_START, VIEWPORT_PAUSE, VIEWPORT_RESUME, getAnnounceTextContent, handleAndDispatchCustomEvent, isDeltaInDirection } from './utils'\nimport { onKeyStroke, useRafFn } from '@vueuse/core'\nimport ToastAnnounce from './ToastAnnounce.vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ToastRootImplProps>(), {\n open: false,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootImplEmits>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst providerContext = injectToastProviderContext()\nconst pointerStartRef = ref<{ x: number, y: number } | null>(null)\nconst swipeDeltaRef = ref<{ x: number, y: number } | null>(null)\nconst duration = computed(\n () => typeof props.duration === 'number'\n ? props.duration\n : providerContext.duration.value,\n)\n\nconst closeTimerStartTimeRef = ref(0)\nconst closeTimerRemainingTimeRef = ref(duration.value)\nconst closeTimerRef = ref(0)\nconst remainingTime = ref(duration.value)\n\nconst remainingRaf = useRafFn(() => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n remainingTime.value = Math.max(closeTimerRemainingTimeRef.value - elapsedTime, 0)\n}, { fpsLimit: 60 })\n\nfunction startTimer(duration: number) {\n if (duration <= 0 || duration === Number.POSITIVE_INFINITY)\n return\n // startTimer is used inside a watch with immediate set to true.\n // This results in code execution during SSR.\n // Ensure this code only runs in a browser environment\n if (!isClient)\n return\n window.clearTimeout(closeTimerRef.value)\n closeTimerStartTimeRef.value = new Date().getTime()\n closeTimerRef.value = window.setTimeout(handleClose, duration)\n}\n\nfunction handleClose(event?: PointerEvent) {\n const isNonPointerEvent = event?.pointerType === ''\n\n // reka: update to only perform focus when user focus via keyboard\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = currentElement.value?.contains(getActiveElement())\n if (isFocusInToast && isNonPointerEvent)\n providerContext.viewport.value?.focus()\n\n if (isNonPointerEvent) {\n // when manually close the toast, we reset isClosePausedRef\n providerContext.isClosePausedRef.value = false\n }\n\n emits('close')\n}\n\nconst announceTextContent = computed(() => currentElement.value ? getAnnounceTextContent(currentElement.value) : null)\n\nif (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = 'Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.'\n throw new Error(error)\n}\n\nwatchEffect((cleanupFn) => {\n const viewport = providerContext.viewport.value\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.value)\n remainingRaf.resume()\n emits('resume')\n }\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n closeTimerRemainingTimeRef.value = closeTimerRemainingTimeRef.value - elapsedTime\n window.clearTimeout(closeTimerRef.value)\n remainingRaf.pause()\n emits('pause')\n }\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.addEventListener(VIEWPORT_RESUME, handleResume)\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume)\n }\n }\n})\n\n// start timer when toast opens or duration changes.\n// we include `open` in deps because closed !== unmounted when animating\n// so it could reopen before being completely unmounted\nwatch(() => [props.open, duration.value], () => {\n // Reset the timer when the toast is rerendered with the new duration\n closeTimerRemainingTimeRef.value = duration.value\n\n if (props.open && !providerContext.isClosePausedRef.value)\n startTimer(duration.value)\n}, { immediate: true })\n\nonKeyStroke('Escape', (event) => {\n emits('escapeKeyDown', event)\n if (!event.defaultPrevented) {\n providerContext.isFocusedToastEscapeKeyDownRef.value = true\n handleClose()\n }\n})\n\nonMounted(() => {\n providerContext.onToastAdd()\n})\nonUnmounted(() => {\n providerContext.onToastRemove()\n})\n\nprovideToastRootContext({ onClose: handleClose })\n</script>\n\n<template>\n <ToastAnnounce\n v-if=\"announceTextContent\"\n role=\"alert\"\n :aria-live=\"type === 'foreground' ? 'assertive' : 'polite'\"\n aria-atomic=\"true\"\n >\n {{ announceTextContent }}\n </ToastAnnounce>\n\n <Teleport\n v-if=\"providerContext.viewport.value\"\n :to=\"providerContext.viewport.value\"\n >\n <CollectionItem>\n <Primitive\n :ref=\"forwardRef\"\n role=\"alert\"\n aria-live=\"off\"\n aria-atomic=\"true\"\n tabindex=\"0\"\n v-bind=\"$attrs\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-state=\"open ? 'open' : 'closed'\"\n :data-swipe-direction=\"providerContext.swipeDirection.value\"\n :style=\"{ userSelect: 'none', touchAction: 'none' }\"\n @pointerdown.left=\"(event: PointerEvent) => {\n pointerStartRef = { x: event.clientX, y: event.clientY };\n }\"\n @pointermove=\"(event: PointerEvent) => {\n if (!pointerStartRef) return;\n const x = event.clientX - pointerStartRef.x;\n const y = event.clientY - pointerStartRef.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef);\n const isHorizontalSwipe = ['left', 'right'].includes(providerContext.swipeDirection.value);\n const clamp = ['left', 'up'].includes(providerContext.swipeDirection.value)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, (ev: SwipeEvent) => emits('swipeMove', ev), eventDetail);\n }\n else if (isDeltaInDirection(delta, providerContext.swipeDirection.value, moveStartBuffer)) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, (ev: SwipeEvent) => emits('swipeStart', ev), eventDetail);\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n }\n else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef = null;\n }\n }\"\n @pointerup=\"(event: PointerEvent) => {\n const delta = swipeDeltaRef;\n const target = event.target as HTMLElement;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n swipeDeltaRef = null;\n pointerStartRef = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (\n isDeltaInDirection(delta, providerContext.swipeDirection.value, providerContext.swipeThreshold.value)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, (ev: SwipeEvent) => emits('swipeEnd', ev), eventDetail);\n }\n else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, (ev: SwipeEvent) => emits('swipeCancel', ev), eventDetail);\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast?.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n }\"\n >\n <slot\n :remaining=\"remainingTime\"\n :duration=\"duration\"\n />\n </Primitive>\n </CollectionItem>\n </Teleport>\n</template>\n"],"names":["createContext","useForwardExpose","useCollection","injectToastProviderContext","ref","computed","useRafFn","duration","isClient","getActiveElement","getAnnounceTextContent","watchEffect","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MAAM,gBAAkB,EAAA;AAC3B,QAAA,eAAA,CAAgB,+BAA+B,KAAQ,GAAA,IAAA;AACvD,QAAY,WAAA,EAAA;AAAA;AACd,KACD,CAAA;AAED,IAAAC,aAAA,CAAU,MAAM;AACd,MAAA,eAAA,CAAgB,UAAW,EAAA;AAAA,KAC5B,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAA,eAAA,CAAgB,aAAc,EAAA;AAAA,KAC/B,CAAA;AAED,IAAwB,uBAAA,CAAA,EAAE,OAAS,EAAA,WAAA,EAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -52,11 +52,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
52
|
closeTimerStartTimeRef.value = (/* @__PURE__ */ new Date()).getTime();
|
|
53
53
|
closeTimerRef.value = window.setTimeout(handleClose, duration2);
|
|
54
54
|
}
|
|
55
|
-
function handleClose() {
|
|
55
|
+
function handleClose(event) {
|
|
56
|
+
const isNonPointerEvent = event?.pointerType === "";
|
|
56
57
|
const isFocusInToast = currentElement.value?.contains(getActiveElement());
|
|
57
|
-
if (isFocusInToast)
|
|
58
|
+
if (isFocusInToast && isNonPointerEvent)
|
|
58
59
|
providerContext.viewport.value?.focus();
|
|
59
|
-
|
|
60
|
+
if (isNonPointerEvent) {
|
|
61
|
+
providerContext.isClosePausedRef.value = false;
|
|
62
|
+
}
|
|
60
63
|
emits("close");
|
|
61
64
|
}
|
|
62
65
|
const announceTextContent = computed(() => currentElement.value ? getAnnounceTextContent(currentElement.value) : null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRootImpl.js","sources":["../../src/Toast/ToastRootImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { isClient } from '@vueuse/shared'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { SwipeEvent } from './utils'\nimport { createContext, getActiveElement, useForwardExpose } from '@/shared'\nimport { useCollection } from '@/Collection'\n\nexport type ToastRootImplEmits = {\n close: []\n /** Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. */\n escapeKeyDown: [event: KeyboardEvent]\n /** Event handler called when the dismiss timer is paused. This occurs when the pointer is moved over the viewport, the viewport is focused or when the window is blurred. */\n pause: []\n /** Event handler called when the dismiss timer is resumed. This occurs when the pointer is moved away from the viewport, the viewport is blurred or when the window is focused. */\n resume: []\n /** Event handler called when starting a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeStart: [event: SwipeEvent]\n /** Event handler called during a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeMove: [event: SwipeEvent]\n swipeCancel: [event: SwipeEvent]\n /** Event handler called at the end of a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeEnd: [event: SwipeEvent]\n}\n\nexport interface ToastRootImplProps extends PrimitiveProps {\n /**\n * Control the sensitivity of the toast for accessibility purposes.\n *\n * For toasts that are the result of a user action, choose `foreground`. Toasts generated from background tasks should use `background`.\n */\n type?: 'foreground' | 'background'\n /**\n * The controlled open state of the dialog. Can be bind as `v-model:open`.\n */\n open?: boolean\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number\n}\n\nexport const [injectToastRootContext, provideToastRootContext]\n = createContext<{ onClose: () => void }>('ToastRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { computed, onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'\nimport { injectToastProviderContext } from './ToastProvider.vue'\nimport { TOAST_SWIPE_CANCEL, TOAST_SWIPE_END, TOAST_SWIPE_MOVE, TOAST_SWIPE_START, VIEWPORT_PAUSE, VIEWPORT_RESUME, getAnnounceTextContent, handleAndDispatchCustomEvent, isDeltaInDirection } from './utils'\nimport { onKeyStroke, useRafFn } from '@vueuse/core'\nimport ToastAnnounce from './ToastAnnounce.vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ToastRootImplProps>(), {\n open: false,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootImplEmits>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst providerContext = injectToastProviderContext()\nconst pointerStartRef = ref<{ x: number, y: number } | null>(null)\nconst swipeDeltaRef = ref<{ x: number, y: number } | null>(null)\nconst duration = computed(\n () => typeof props.duration === 'number'\n ? props.duration\n : providerContext.duration.value,\n)\n\nconst closeTimerStartTimeRef = ref(0)\nconst closeTimerRemainingTimeRef = ref(duration.value)\nconst closeTimerRef = ref(0)\nconst remainingTime = ref(duration.value)\n\nconst remainingRaf = useRafFn(() => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n remainingTime.value = Math.max(closeTimerRemainingTimeRef.value - elapsedTime, 0)\n}, { fpsLimit: 60 })\n\nfunction startTimer(duration: number) {\n if (duration <= 0 || duration === Number.POSITIVE_INFINITY)\n return\n // startTimer is used inside a watch with immediate set to true.\n // This results in code execution during SSR.\n // Ensure this code only runs in a browser environment\n if (!isClient)\n return\n window.clearTimeout(closeTimerRef.value)\n closeTimerStartTimeRef.value = new Date().getTime()\n closeTimerRef.value = window.setTimeout(handleClose, duration)\n}\n\nfunction handleClose() {\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = currentElement.value?.contains(getActiveElement())\n if (isFocusInToast)\n providerContext.viewport.value?.focus()\n\n // when manually close the toast, we reset isClosePausedRef\n providerContext.isClosePausedRef.value = false\n emits('close')\n}\n\nconst announceTextContent = computed(() => currentElement.value ? getAnnounceTextContent(currentElement.value) : null)\n\nif (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = 'Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.'\n throw new Error(error)\n}\n\nwatchEffect((cleanupFn) => {\n const viewport = providerContext.viewport.value\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.value)\n remainingRaf.resume()\n emits('resume')\n }\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n closeTimerRemainingTimeRef.value = closeTimerRemainingTimeRef.value - elapsedTime\n window.clearTimeout(closeTimerRef.value)\n remainingRaf.pause()\n emits('pause')\n }\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.addEventListener(VIEWPORT_RESUME, handleResume)\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume)\n }\n }\n})\n\n// start timer when toast opens or duration changes.\n// we include `open` in deps because closed !== unmounted when animating\n// so it could reopen before being completely unmounted\nwatch(() => [props.open, duration.value], () => {\n // Reset the timer when the toast is rerendered with the new duration\n closeTimerRemainingTimeRef.value = duration.value\n\n if (props.open && !providerContext.isClosePausedRef.value)\n startTimer(duration.value)\n}, { immediate: true })\n\nonKeyStroke('Escape', (event) => {\n emits('escapeKeyDown', event)\n if (!event.defaultPrevented) {\n providerContext.isFocusedToastEscapeKeyDownRef.value = true\n handleClose()\n }\n})\n\nonMounted(() => {\n providerContext.onToastAdd()\n})\nonUnmounted(() => {\n providerContext.onToastRemove()\n})\n\nprovideToastRootContext({ onClose: handleClose })\n</script>\n\n<template>\n <ToastAnnounce\n v-if=\"announceTextContent\"\n role=\"alert\"\n :aria-live=\"type === 'foreground' ? 'assertive' : 'polite'\"\n aria-atomic=\"true\"\n >\n {{ announceTextContent }}\n </ToastAnnounce>\n\n <Teleport\n v-if=\"providerContext.viewport.value\"\n :to=\"providerContext.viewport.value\"\n >\n <CollectionItem>\n <Primitive\n :ref=\"forwardRef\"\n role=\"alert\"\n aria-live=\"off\"\n aria-atomic=\"true\"\n tabindex=\"0\"\n v-bind=\"$attrs\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-state=\"open ? 'open' : 'closed'\"\n :data-swipe-direction=\"providerContext.swipeDirection.value\"\n :style=\"{ userSelect: 'none', touchAction: 'none' }\"\n @pointerdown.left=\"(event: PointerEvent) => {\n pointerStartRef = { x: event.clientX, y: event.clientY };\n }\"\n @pointermove=\"(event: PointerEvent) => {\n if (!pointerStartRef) return;\n const x = event.clientX - pointerStartRef.x;\n const y = event.clientY - pointerStartRef.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef);\n const isHorizontalSwipe = ['left', 'right'].includes(providerContext.swipeDirection.value);\n const clamp = ['left', 'up'].includes(providerContext.swipeDirection.value)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, (ev: SwipeEvent) => emits('swipeMove', ev), eventDetail);\n }\n else if (isDeltaInDirection(delta, providerContext.swipeDirection.value, moveStartBuffer)) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, (ev: SwipeEvent) => emits('swipeStart', ev), eventDetail);\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n }\n else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef = null;\n }\n }\"\n @pointerup=\"(event: PointerEvent) => {\n const delta = swipeDeltaRef;\n const target = event.target as HTMLElement;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n swipeDeltaRef = null;\n pointerStartRef = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (\n isDeltaInDirection(delta, providerContext.swipeDirection.value, providerContext.swipeThreshold.value)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, (ev: SwipeEvent) => emits('swipeEnd', ev), eventDetail);\n }\n else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, (ev: SwipeEvent) => emits('swipeCancel', ev), eventDetail);\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast?.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n }\"\n >\n <slot\n :remaining=\"remainingTime\"\n :duration=\"duration\"\n />\n </Primitive>\n </CollectionItem>\n </Teleport>\n</template>\n"],"names":["duration"],"mappings":";;;;;;;;;;;;AA0CO,MAAM,CAAC,sBAAA,EAAwB,uBAAuB,CAAA,GACzD,cAAuC,WAAW;;;;;;;;;;;;;;;AAetD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAI,gBAAiB,EAAA;AACxD,IAAM,MAAA,EAAE,cAAe,EAAA,GAAI,aAAc,EAAA;AAEzC,IAAA,MAAM,kBAAkB,0BAA2B,EAAA;AACnD,IAAM,MAAA,eAAA,GAAkB,IAAqC,IAAI,CAAA;AACjE,IAAM,MAAA,aAAA,GAAgB,IAAqC,IAAI,CAAA;AAC/D,IAAA,MAAM,QAAW,GAAA,QAAA;AAAA,MACf,MAAM,OAAO,KAAM,CAAA,QAAA,KAAa,WAC5B,KAAM,CAAA,QAAA,GACN,gBAAgB,QAAS,CAAA;AAAA,KAC/B;AAEA,IAAM,MAAA,sBAAA,GAAyB,IAAI,CAAC,CAAA;AACpC,IAAM,MAAA,0BAAA,GAA6B,GAAI,CAAA,QAAA,CAAS,KAAK,CAAA;AACrD,IAAM,MAAA,aAAA,GAAgB,IAAI,CAAC,CAAA;AAC3B,IAAM,MAAA,aAAA,GAAgB,GAAI,CAAA,QAAA,CAAS,KAAK,CAAA;AAExC,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM;AAClC,MAAA,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AM,CAAA;AAEtB,IAAY,WAAA,CAAA,QAAA,EAAU,CAAC,KAAU,KAAA;AAC/B,MAAA,KAAA,CAAM,iBAAiB,KAAK,CAAA;AAC5B,MAAI,IAAA,CAAC,MAAM,gBAAkB,EAAA;AAC3B,QAAA,eAAA,CAAgB,+BAA+B,KAAQ,GAAA,IAAA;AACvD,QAAY,WAAA,EAAA;AAAA;AACd,KACD,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,eAAA,CAAgB,UAAW,EAAA;AAAA,KAC5B,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAA,eAAA,CAAgB,aAAc,EAAA;AAAA,KAC/B,CAAA;AAED,IAAwB,uBAAA,CAAA,EAAE,OAAS,EAAA,WAAA,EAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ToastRootImpl.js","sources":["../../src/Toast/ToastRootImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { isClient } from '@vueuse/shared'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { SwipeEvent } from './utils'\nimport { createContext, getActiveElement, useForwardExpose } from '@/shared'\nimport { useCollection } from '@/Collection'\n\nexport type ToastRootImplEmits = {\n close: []\n /** Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. */\n escapeKeyDown: [event: KeyboardEvent]\n /** Event handler called when the dismiss timer is paused. This occurs when the pointer is moved over the viewport, the viewport is focused or when the window is blurred. */\n pause: []\n /** Event handler called when the dismiss timer is resumed. This occurs when the pointer is moved away from the viewport, the viewport is blurred or when the window is focused. */\n resume: []\n /** Event handler called when starting a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeStart: [event: SwipeEvent]\n /** Event handler called during a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeMove: [event: SwipeEvent]\n swipeCancel: [event: SwipeEvent]\n /** Event handler called at the end of a swipe interaction. It can be prevented by calling `event.preventDefault`. */\n swipeEnd: [event: SwipeEvent]\n}\n\nexport interface ToastRootImplProps extends PrimitiveProps {\n /**\n * Control the sensitivity of the toast for accessibility purposes.\n *\n * For toasts that are the result of a user action, choose `foreground`. Toasts generated from background tasks should use `background`.\n */\n type?: 'foreground' | 'background'\n /**\n * The controlled open state of the dialog. Can be bind as `v-model:open`.\n */\n open?: boolean\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number\n}\n\nexport const [injectToastRootContext, provideToastRootContext]\n = createContext<{ onClose: () => void }>('ToastRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { computed, onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'\nimport { injectToastProviderContext } from './ToastProvider.vue'\nimport { TOAST_SWIPE_CANCEL, TOAST_SWIPE_END, TOAST_SWIPE_MOVE, TOAST_SWIPE_START, VIEWPORT_PAUSE, VIEWPORT_RESUME, getAnnounceTextContent, handleAndDispatchCustomEvent, isDeltaInDirection } from './utils'\nimport { onKeyStroke, useRafFn } from '@vueuse/core'\nimport ToastAnnounce from './ToastAnnounce.vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ToastRootImplProps>(), {\n open: false,\n as: 'li',\n})\n\nconst emits = defineEmits<ToastRootImplEmits>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst providerContext = injectToastProviderContext()\nconst pointerStartRef = ref<{ x: number, y: number } | null>(null)\nconst swipeDeltaRef = ref<{ x: number, y: number } | null>(null)\nconst duration = computed(\n () => typeof props.duration === 'number'\n ? props.duration\n : providerContext.duration.value,\n)\n\nconst closeTimerStartTimeRef = ref(0)\nconst closeTimerRemainingTimeRef = ref(duration.value)\nconst closeTimerRef = ref(0)\nconst remainingTime = ref(duration.value)\n\nconst remainingRaf = useRafFn(() => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n remainingTime.value = Math.max(closeTimerRemainingTimeRef.value - elapsedTime, 0)\n}, { fpsLimit: 60 })\n\nfunction startTimer(duration: number) {\n if (duration <= 0 || duration === Number.POSITIVE_INFINITY)\n return\n // startTimer is used inside a watch with immediate set to true.\n // This results in code execution during SSR.\n // Ensure this code only runs in a browser environment\n if (!isClient)\n return\n window.clearTimeout(closeTimerRef.value)\n closeTimerStartTimeRef.value = new Date().getTime()\n closeTimerRef.value = window.setTimeout(handleClose, duration)\n}\n\nfunction handleClose(event?: PointerEvent) {\n const isNonPointerEvent = event?.pointerType === ''\n\n // reka: update to only perform focus when user focus via keyboard\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = currentElement.value?.contains(getActiveElement())\n if (isFocusInToast && isNonPointerEvent)\n providerContext.viewport.value?.focus()\n\n if (isNonPointerEvent) {\n // when manually close the toast, we reset isClosePausedRef\n providerContext.isClosePausedRef.value = false\n }\n\n emits('close')\n}\n\nconst announceTextContent = computed(() => currentElement.value ? getAnnounceTextContent(currentElement.value) : null)\n\nif (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = 'Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.'\n throw new Error(error)\n}\n\nwatchEffect((cleanupFn) => {\n const viewport = providerContext.viewport.value\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.value)\n remainingRaf.resume()\n emits('resume')\n }\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.value\n closeTimerRemainingTimeRef.value = closeTimerRemainingTimeRef.value - elapsedTime\n window.clearTimeout(closeTimerRef.value)\n remainingRaf.pause()\n emits('pause')\n }\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.addEventListener(VIEWPORT_RESUME, handleResume)\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause)\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume)\n }\n }\n})\n\n// start timer when toast opens or duration changes.\n// we include `open` in deps because closed !== unmounted when animating\n// so it could reopen before being completely unmounted\nwatch(() => [props.open, duration.value], () => {\n // Reset the timer when the toast is rerendered with the new duration\n closeTimerRemainingTimeRef.value = duration.value\n\n if (props.open && !providerContext.isClosePausedRef.value)\n startTimer(duration.value)\n}, { immediate: true })\n\nonKeyStroke('Escape', (event) => {\n emits('escapeKeyDown', event)\n if (!event.defaultPrevented) {\n providerContext.isFocusedToastEscapeKeyDownRef.value = true\n handleClose()\n }\n})\n\nonMounted(() => {\n providerContext.onToastAdd()\n})\nonUnmounted(() => {\n providerContext.onToastRemove()\n})\n\nprovideToastRootContext({ onClose: handleClose })\n</script>\n\n<template>\n <ToastAnnounce\n v-if=\"announceTextContent\"\n role=\"alert\"\n :aria-live=\"type === 'foreground' ? 'assertive' : 'polite'\"\n aria-atomic=\"true\"\n >\n {{ announceTextContent }}\n </ToastAnnounce>\n\n <Teleport\n v-if=\"providerContext.viewport.value\"\n :to=\"providerContext.viewport.value\"\n >\n <CollectionItem>\n <Primitive\n :ref=\"forwardRef\"\n role=\"alert\"\n aria-live=\"off\"\n aria-atomic=\"true\"\n tabindex=\"0\"\n v-bind=\"$attrs\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-state=\"open ? 'open' : 'closed'\"\n :data-swipe-direction=\"providerContext.swipeDirection.value\"\n :style=\"{ userSelect: 'none', touchAction: 'none' }\"\n @pointerdown.left=\"(event: PointerEvent) => {\n pointerStartRef = { x: event.clientX, y: event.clientY };\n }\"\n @pointermove=\"(event: PointerEvent) => {\n if (!pointerStartRef) return;\n const x = event.clientX - pointerStartRef.x;\n const y = event.clientY - pointerStartRef.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef);\n const isHorizontalSwipe = ['left', 'right'].includes(providerContext.swipeDirection.value);\n const clamp = ['left', 'up'].includes(providerContext.swipeDirection.value)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, (ev: SwipeEvent) => emits('swipeMove', ev), eventDetail);\n }\n else if (isDeltaInDirection(delta, providerContext.swipeDirection.value, moveStartBuffer)) {\n swipeDeltaRef = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, (ev: SwipeEvent) => emits('swipeStart', ev), eventDetail);\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n }\n else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef = null;\n }\n }\"\n @pointerup=\"(event: PointerEvent) => {\n const delta = swipeDeltaRef;\n const target = event.target as HTMLElement;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n swipeDeltaRef = null;\n pointerStartRef = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (\n isDeltaInDirection(delta, providerContext.swipeDirection.value, providerContext.swipeThreshold.value)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, (ev: SwipeEvent) => emits('swipeEnd', ev), eventDetail);\n }\n else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, (ev: SwipeEvent) => emits('swipeCancel', ev), eventDetail);\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast?.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n }\"\n >\n <slot\n :remaining=\"remainingTime\"\n :duration=\"duration\"\n />\n </Primitive>\n </CollectionItem>\n </Teleport>\n</template>\n"],"names":["duration"],"mappings":";;;;;;;;;;;;AA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