mood-ui 0.13.0 → 0.13.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/components/feedback/liquid-toast/LiquidToast.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToast.mjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.cjs +7 -6
- package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.mjs +7 -6
- package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToastShape.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToastShape.mjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.mjs +1 -0
- package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToaster.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToaster.mjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/liquid-toast/liquidToast2.cjs +3 -3
- package/dist/components/feedback/liquid-toast/liquidToast2.cjs.map +1 -1
- package/dist/components/feedback/liquid-toast/liquidToast2.mjs +3 -3
- package/dist/components/feedback/liquid-toast/liquidToast2.mjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltip.cjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltip.mjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.cjs +9 -4
- package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.mjs +9 -4
- package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltipContent.cjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltipContent.mjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.cjs +8 -4
- package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.mjs +8 -4
- package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/glass-switch/GlassSwitch.cjs.map +1 -1
- package/dist/components/forms/glass-switch/GlassSwitch.mjs.map +1 -1
- package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.cjs +21 -25
- package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.mjs +21 -25
- package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs +3 -1
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs +3 -1
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +11 -6
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +11 -6
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/mood-ui.css +315 -89
- package/dist/types/components/feedback/liquid-toast/liquidToast.d.ts +1 -1
- package/dist/types/interfaces/feedback/LiquidToast.interface.d.ts +9 -9
- package/dist/types/interfaces/feedback/MorphTooltip.interface.d.ts +4 -4
- package/dist/types/interfaces/forms/GlassSwitch.interface.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToast.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration:
|
|
1
|
+
{"version":3,"file":"LiquidToast.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration: 4000, defaultVariant: 'liquid' })\nconst emit = defineEmits<{ dismiss: [id: string | number]; remove: [id: string | number] }>()\nconst loc = useModoLocale()\nconst resolvedRadius = useResolvedRadius(() => props.item.radius ?? props.radius)\nconst resolvedSize = useResolvedSize(() => props.item.size ?? props.size)\nconst variant = computed(() => props.item.variant ?? props.defaultVariant)\nconst duration = computed(() => props.item.duration ?? props.defaultDuration)\nconst dismissable = computed(() => props.item.dismissable ?? true)\n\n// Same steps as the native Toast (rounded-none / sm / lg / xl / 2xl). The pill\n// keeps its capsule from medium up; none/small square it, and the goo filter is\n// tightened (small) or dropped (none) so it can't re-round square corners.\nconst PANEL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-lg, var(--radius))',\n large: 'var(--radius-xl, calc(var(--radius) + 4px))',\n full: '1rem',\n}\nconst PILL_RADIUS: Record<ModoRadius, string> = { none: '0px', small: 'var(--radius-sm, calc(var(--radius) - 4px))', medium: '9999px', large: '9999px', full: '9999px' }\nconst CONTROL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-md, calc(var(--radius) - 2px))',\n large: 'var(--radius-lg, var(--radius))',\n full: '9999px',\n}\nconst style = computed(() => ({\n '--modo-liquid-toast-radius': variant.value === 'liquid' && resolvedRadius.value === 'medium' ? '1.25rem' : PANEL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-pill-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-seed-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-control-radius': CONTROL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-duration': `${duration.value}ms`,\n}))\n\nconst card = ref<HTMLElement | null>(null)\nconst bornRevision = props.item.revision, bornAsPeek = props.peek > 0\nconst phase = computed(() => props.peek > 0 ? 'peek' : props.item.leaving ? 'leaving' : props.item.revision > bornRevision ? 'updating' : bornAsPeek ? 'promoted' : 'entering')\nconst running = ref(false)\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet exitTimer: ReturnType<typeof setTimeout> | undefined\nlet started = 0, remaining = duration.value\nlet hovered = false, focused = false, windowActive = true, mounted = false\nlet pointer: { id: number; x: number; lastX: number; t: number; velocity: number; moved: boolean } | undefined\nlet animation: Animation | undefined\nlet suppressClick = false\n/** Stops the clock and keeps the time that was left (like the native Toast). */\nfunction pause() {\n if (!timer) return\n clearTimeout(timer); timer = undefined\n remaining = variant.value === 'liquid' ? duration.value : Math.max(0, remaining - (Date.now() - started))\n running.value = false\n}\nfunction resume() {\n if (!mounted || timer || hovered || focused || !windowActive || document.hidden || props.peek || props.item.leaving || props.item.loading || duration.value <= 0) return\n started = Date.now(); running.value = true\n timer = setTimeout(() => { timer = undefined; running.value = false; emit('dismiss', props.item.id) }, remaining)\n}\nfunction hover(value: boolean) { hovered = value && (props.item.pauseOnHover ?? true); hovered ? pause() : resume() }\nfunction focus(value: boolean) { focused = value; value ? pause() : resume() }\nfunction visibility() { document.hidden ? pause() : resume() }\nfunction blur() { windowActive = false; pause() }\nfunction wake() { windowActive = true; resume() }\nwatch(() => [props.item.revision, duration.value, props.peek, props.item.leaving, props.item.loading], () => {\n pause(); remaining = duration.value; clearTimeout(exitTimer)\n if (props.item.leaving) {\n if (props.peek || prefersReducedMotion()) emit('remove', props.item.id)\n else exitTimer = setTimeout(() => emit('remove', props.item.id), 650)\n } else resume()\n})\nonMounted(() => {\n mounted = true\n if (props.item.leaving) emit('remove', props.item.id)\n else resume()\n document.addEventListener('visibilitychange', visibility); window.addEventListener('blur', blur); window.addEventListener('focus', wake)\n})\nonBeforeUnmount(() => {\n clearTimeout(timer); clearTimeout(exitTimer); animation?.cancel()\n document.removeEventListener('visibilitychange', visibility); window.removeEventListener('blur', blur); window.removeEventListener('focus', wake)\n})\nfunction start(e: PointerEvent) {\n if (props.peek || props.item.leaving || !dismissable.value || e.button > 0 || (e.target as HTMLElement).closest('button')) return\n suppressClick = false\n pointer = { id: e.pointerId, x: e.clientX, lastX: e.clientX, t: e.timeStamp, velocity: 0, moved: false }\n pause()\n}\nfunction move(e: PointerEvent) {\n if (!pointer || pointer.id !== e.pointerId || !card.value) return\n const dx = e.clientX - pointer.x\n if (Math.abs(dx) > 10) { pointer.moved = true; card.value.setPointerCapture?.(e.pointerId) }\n if (!pointer.moved) return\n pointer.velocity = (e.clientX - pointer.lastX) / Math.max(1, e.timeStamp - pointer.t)\n pointer.lastX = e.clientX; pointer.t = e.timeStamp\n card.value.style.transform = `translateX(${dx}px)`\n card.value.style.opacity = String(Math.max(.2, 1 - Math.abs(dx) / 260))\n}\nfunction end(e: PointerEvent) {\n const p = pointer, el = card.value\n if (!p || p.id !== e.pointerId || !el) return\n pointer = undefined\n if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)\n const dx = e.clientX - p.x\n suppressClick = p.moved\n const dismiss = e.type !== 'pointercancel' && p.moved && (Math.abs(dx) > 90 || Math.abs(p.velocity) > .55)\n el.style.transform = ''; el.style.opacity = ''\n if (dismiss) {\n if (prefersReducedMotion() || !el.animate) { emit('remove', props.item.id); return }\n animation = el.animate([{ transform: `translateX(${dx}px)`, opacity: 1 }, { transform: `translateX(${Math.sign(dx) * (el.offsetWidth + 48)}px)`, opacity: 0 }], { duration: 200, fill: 'forwards' })\n animation.onfinish = () => emit('remove', props.item.id)\n } else {\n if (p.moved && !prefersReducedMotion() && el.animate) animation = el.animate([{ transform: `translateX(${dx}px)` }, { transform: 'translateX(0)' }], { duration: 240, easing: 'cubic-bezier(.25,.8,.3,1)' })\n resume()\n }\n}\nfunction click() { if (!suppressClick && !props.peek && dismissable.value) emit('dismiss', props.item.id); suppressClick = false }\nfunction close() { emit('dismiss', props.item.id) }\nfunction action() {\n const a = props.item.action\n if (!a) return\n a.onClick?.(close)\n if (!a.keepOpen) close()\n}\n</script>\n<template>\n <!-- No live role here: the toaster announces through its own two live\n regions, so a toast is never read twice. -->\n <div ref=\"card\" class=\"modo-liquid-toast\" data-modo-liquid-toast=\"\"\n :data-modo-color=\"item.color\" :data-modo-variant=\"variant\" :data-modo-radius=\"resolvedRadius\" :data-modo-size=\"resolvedSize\"\n :data-modo-phase=\"phase\" :data-modo-running=\"running || undefined\"\n :data-modo-peek=\"peek || undefined\" :aria-hidden=\"peek ? true : undefined\" :inert=\"peek > 0 || item.leaving\" :style=\"style\"\n @pointerenter=\"hover(true)\" @pointerleave=\"hover(false)\" @focusin=\"focus(true)\" @focusout=\"focus(false)\"\n @pointerdown=\"start\" @pointermove=\"move\" @pointerup=\"end\" @pointercancel=\"end\" @click=\"click\">\n <div class=\"modo-liquid-toast__shade\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__goo\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__ink\"><LiquidToastShape :item=\"item\" ink :dismissable=\"dismissable\" :progress=\"variant !== 'liquid' && duration > 0 && !item.loading\" :close-label=\"loc.common.dismiss\" @action=\"action\" @dismiss=\"close\" /></div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToast.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration:
|
|
1
|
+
{"version":3,"file":"LiquidToast.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration: 4000, defaultVariant: 'liquid' })\nconst emit = defineEmits<{ dismiss: [id: string | number]; remove: [id: string | number] }>()\nconst loc = useModoLocale()\nconst resolvedRadius = useResolvedRadius(() => props.item.radius ?? props.radius)\nconst resolvedSize = useResolvedSize(() => props.item.size ?? props.size)\nconst variant = computed(() => props.item.variant ?? props.defaultVariant)\nconst duration = computed(() => props.item.duration ?? props.defaultDuration)\nconst dismissable = computed(() => props.item.dismissable ?? true)\n\n// Same steps as the native Toast (rounded-none / sm / lg / xl / 2xl). The pill\n// keeps its capsule from medium up; none/small square it, and the goo filter is\n// tightened (small) or dropped (none) so it can't re-round square corners.\nconst PANEL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-lg, var(--radius))',\n large: 'var(--radius-xl, calc(var(--radius) + 4px))',\n full: '1rem',\n}\nconst PILL_RADIUS: Record<ModoRadius, string> = { none: '0px', small: 'var(--radius-sm, calc(var(--radius) - 4px))', medium: '9999px', large: '9999px', full: '9999px' }\nconst CONTROL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-md, calc(var(--radius) - 2px))',\n large: 'var(--radius-lg, var(--radius))',\n full: '9999px',\n}\nconst style = computed(() => ({\n '--modo-liquid-toast-radius': variant.value === 'liquid' && resolvedRadius.value === 'medium' ? '1.25rem' : PANEL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-pill-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-seed-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-control-radius': CONTROL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-duration': `${duration.value}ms`,\n}))\n\nconst card = ref<HTMLElement | null>(null)\nconst bornRevision = props.item.revision, bornAsPeek = props.peek > 0\nconst phase = computed(() => props.peek > 0 ? 'peek' : props.item.leaving ? 'leaving' : props.item.revision > bornRevision ? 'updating' : bornAsPeek ? 'promoted' : 'entering')\nconst running = ref(false)\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet exitTimer: ReturnType<typeof setTimeout> | undefined\nlet started = 0, remaining = duration.value\nlet hovered = false, focused = false, windowActive = true, mounted = false\nlet pointer: { id: number; x: number; lastX: number; t: number; velocity: number; moved: boolean } | undefined\nlet animation: Animation | undefined\nlet suppressClick = false\n/** Stops the clock and keeps the time that was left (like the native Toast). */\nfunction pause() {\n if (!timer) return\n clearTimeout(timer); timer = undefined\n remaining = variant.value === 'liquid' ? duration.value : Math.max(0, remaining - (Date.now() - started))\n running.value = false\n}\nfunction resume() {\n if (!mounted || timer || hovered || focused || !windowActive || document.hidden || props.peek || props.item.leaving || props.item.loading || duration.value <= 0) return\n started = Date.now(); running.value = true\n timer = setTimeout(() => { timer = undefined; running.value = false; emit('dismiss', props.item.id) }, remaining)\n}\nfunction hover(value: boolean) { hovered = value && (props.item.pauseOnHover ?? true); hovered ? pause() : resume() }\nfunction focus(value: boolean) { focused = value; value ? pause() : resume() }\nfunction visibility() { document.hidden ? pause() : resume() }\nfunction blur() { windowActive = false; pause() }\nfunction wake() { windowActive = true; resume() }\nwatch(() => [props.item.revision, duration.value, props.peek, props.item.leaving, props.item.loading], () => {\n pause(); remaining = duration.value; clearTimeout(exitTimer)\n if (props.item.leaving) {\n if (props.peek || prefersReducedMotion()) emit('remove', props.item.id)\n else exitTimer = setTimeout(() => emit('remove', props.item.id), 650)\n } else resume()\n})\nonMounted(() => {\n mounted = true\n if (props.item.leaving) emit('remove', props.item.id)\n else resume()\n document.addEventListener('visibilitychange', visibility); window.addEventListener('blur', blur); window.addEventListener('focus', wake)\n})\nonBeforeUnmount(() => {\n clearTimeout(timer); clearTimeout(exitTimer); animation?.cancel()\n document.removeEventListener('visibilitychange', visibility); window.removeEventListener('blur', blur); window.removeEventListener('focus', wake)\n})\nfunction start(e: PointerEvent) {\n if (props.peek || props.item.leaving || !dismissable.value || e.button > 0 || (e.target as HTMLElement).closest('button')) return\n suppressClick = false\n pointer = { id: e.pointerId, x: e.clientX, lastX: e.clientX, t: e.timeStamp, velocity: 0, moved: false }\n pause()\n}\nfunction move(e: PointerEvent) {\n if (!pointer || pointer.id !== e.pointerId || !card.value) return\n const dx = e.clientX - pointer.x\n if (Math.abs(dx) > 10) { pointer.moved = true; card.value.setPointerCapture?.(e.pointerId) }\n if (!pointer.moved) return\n pointer.velocity = (e.clientX - pointer.lastX) / Math.max(1, e.timeStamp - pointer.t)\n pointer.lastX = e.clientX; pointer.t = e.timeStamp\n card.value.style.transform = `translateX(${dx}px)`\n card.value.style.opacity = String(Math.max(.2, 1 - Math.abs(dx) / 260))\n}\nfunction end(e: PointerEvent) {\n const p = pointer, el = card.value\n if (!p || p.id !== e.pointerId || !el) return\n pointer = undefined\n if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)\n const dx = e.clientX - p.x\n suppressClick = p.moved\n const dismiss = e.type !== 'pointercancel' && p.moved && (Math.abs(dx) > 90 || Math.abs(p.velocity) > .55)\n el.style.transform = ''; el.style.opacity = ''\n if (dismiss) {\n if (prefersReducedMotion() || !el.animate) { emit('remove', props.item.id); return }\n animation = el.animate([{ transform: `translateX(${dx}px)`, opacity: 1 }, { transform: `translateX(${Math.sign(dx) * (el.offsetWidth + 48)}px)`, opacity: 0 }], { duration: 200, fill: 'forwards' })\n animation.onfinish = () => emit('remove', props.item.id)\n } else {\n if (p.moved && !prefersReducedMotion() && el.animate) animation = el.animate([{ transform: `translateX(${dx}px)` }, { transform: 'translateX(0)' }], { duration: 240, easing: 'cubic-bezier(.25,.8,.3,1)' })\n resume()\n }\n}\nfunction click() { if (!suppressClick && !props.peek && dismissable.value) emit('dismiss', props.item.id); suppressClick = false }\nfunction close() { emit('dismiss', props.item.id) }\nfunction action() {\n const a = props.item.action\n if (!a) return\n a.onClick?.(close)\n if (!a.keepOpen) close()\n}\n</script>\n<template>\n <!-- No live role here: the toaster announces through its own two live\n regions, so a toast is never read twice. -->\n <div ref=\"card\" class=\"modo-liquid-toast\" data-modo-liquid-toast=\"\"\n :data-modo-color=\"item.color\" :data-modo-variant=\"variant\" :data-modo-radius=\"resolvedRadius\" :data-modo-size=\"resolvedSize\"\n :data-modo-phase=\"phase\" :data-modo-running=\"running || undefined\"\n :data-modo-peek=\"peek || undefined\" :aria-hidden=\"peek ? true : undefined\" :inert=\"peek > 0 || item.leaving\" :style=\"style\"\n @pointerenter=\"hover(true)\" @pointerleave=\"hover(false)\" @focusin=\"focus(true)\" @focusout=\"focus(false)\"\n @pointerdown=\"start\" @pointermove=\"move\" @pointerup=\"end\" @pointercancel=\"end\" @click=\"click\">\n <div class=\"modo-liquid-toast__shade\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__goo\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__ink\"><LiquidToastShape :item=\"item\" ink :dismissable=\"dismissable\" :progress=\"variant !== 'liquid' && duration > 0 && !item.loading\" :close-label=\"loc.common.dismiss\" @action=\"action\" @dismiss=\"close\" /></div>\n </div>\n</template>\n"],"mappings":""}
|
package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.cjs
CHANGED
|
@@ -30,8 +30,8 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
30
30
|
props: {
|
|
31
31
|
item: {},
|
|
32
32
|
peek: { default: 0 },
|
|
33
|
-
defaultDuration: { default:
|
|
34
|
-
defaultVariant: { default: "
|
|
33
|
+
defaultDuration: { default: 4e3 },
|
|
34
|
+
defaultVariant: { default: "liquid" },
|
|
35
35
|
radius: {},
|
|
36
36
|
size: {}
|
|
37
37
|
},
|
|
@@ -67,7 +67,7 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
67
67
|
full: "9999px"
|
|
68
68
|
};
|
|
69
69
|
const style = (0, vue.computed)(() => ({
|
|
70
|
-
"--modo-liquid-toast-radius": PANEL_RADIUS[resolvedRadius.value],
|
|
70
|
+
"--modo-liquid-toast-radius": variant.value === "liquid" && resolvedRadius.value === "medium" ? "1.25rem" : PANEL_RADIUS[resolvedRadius.value],
|
|
71
71
|
"--modo-liquid-toast-pill-radius": PILL_RADIUS[resolvedRadius.value],
|
|
72
72
|
"--modo-liquid-toast-seed-radius": PILL_RADIUS[resolvedRadius.value],
|
|
73
73
|
"--modo-liquid-toast-control-radius": CONTROL_RADIUS[resolvedRadius.value],
|
|
@@ -89,7 +89,7 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
89
89
|
if (!timer) return;
|
|
90
90
|
clearTimeout(timer);
|
|
91
91
|
timer = void 0;
|
|
92
|
-
remaining = Math.max(0, remaining - (Date.now() - started));
|
|
92
|
+
remaining = variant.value === "liquid" ? duration.value : Math.max(0, remaining - (Date.now() - started));
|
|
93
93
|
running.value = false;
|
|
94
94
|
}
|
|
95
95
|
function resume() {
|
|
@@ -137,7 +137,8 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
137
137
|
});
|
|
138
138
|
(0, vue.onMounted)(() => {
|
|
139
139
|
mounted = true;
|
|
140
|
-
|
|
140
|
+
if (props.item.leaving) emit("remove", props.item.id);
|
|
141
|
+
else resume();
|
|
141
142
|
document.addEventListener("visibilitychange", visibility);
|
|
142
143
|
window.addEventListener("blur", blur);
|
|
143
144
|
window.addEventListener("focus", wake);
|
|
@@ -262,7 +263,7 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
262
263
|
item: __props.item,
|
|
263
264
|
ink: "",
|
|
264
265
|
dismissable: dismissable.value,
|
|
265
|
-
progress: duration.value > 0 && !__props.item.loading,
|
|
266
|
+
progress: variant.value !== "liquid" && duration.value > 0 && !__props.item.loading,
|
|
266
267
|
"close-label": (0, vue.unref)(loc).common.dismiss,
|
|
267
268
|
onAction: action,
|
|
268
269
|
onDismiss: close
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToast.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration: 4500, defaultVariant: 'subtle' })\nconst emit = defineEmits<{ dismiss: [id: string | number]; remove: [id: string | number] }>()\nconst loc = useModoLocale()\nconst resolvedRadius = useResolvedRadius(() => props.item.radius ?? props.radius)\nconst resolvedSize = useResolvedSize(() => props.item.size ?? props.size)\nconst variant = computed(() => props.item.variant ?? props.defaultVariant)\nconst duration = computed(() => props.item.duration ?? props.defaultDuration)\nconst dismissable = computed(() => props.item.dismissable ?? true)\n\n// Same steps as the native Toast (rounded-none / sm / lg / xl / 2xl). The pill\n// keeps its capsule from medium up; none/small square it, and the goo filter is\n// tightened (small) or dropped (none) so it can't re-round square corners.\nconst PANEL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-lg, var(--radius))',\n large: 'var(--radius-xl, calc(var(--radius) + 4px))',\n full: '1rem',\n}\nconst PILL_RADIUS: Record<ModoRadius, string> = { none: '0px', small: 'var(--radius-sm, calc(var(--radius) - 4px))', medium: '9999px', large: '9999px', full: '9999px' }\nconst CONTROL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-md, calc(var(--radius) - 2px))',\n large: 'var(--radius-lg, var(--radius))',\n full: '9999px',\n}\nconst style = computed(() => ({\n '--modo-liquid-toast-radius': PANEL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-pill-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-seed-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-control-radius': CONTROL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-duration': `${duration.value}ms`,\n}))\n\nconst card = ref<HTMLElement | null>(null)\nconst bornRevision = props.item.revision, bornAsPeek = props.peek > 0\nconst phase = computed(() => props.peek > 0 ? 'peek' : props.item.leaving ? 'leaving' : props.item.revision > bornRevision ? 'updating' : bornAsPeek ? 'promoted' : 'entering')\nconst running = ref(false)\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet exitTimer: ReturnType<typeof setTimeout> | undefined\nlet started = 0, remaining = duration.value\nlet hovered = false, focused = false, windowActive = true, mounted = false\nlet pointer: { id: number; x: number; lastX: number; t: number; velocity: number; moved: boolean } | undefined\nlet animation: Animation | undefined\nlet suppressClick = false\n/** Stops the clock and keeps the time that was left (like the native Toast). */\nfunction pause() {\n if (!timer) return\n clearTimeout(timer); timer = undefined\n remaining = Math.max(0, remaining - (Date.now() - started))\n running.value = false\n}\nfunction resume() {\n if (!mounted || timer || hovered || focused || !windowActive || document.hidden || props.peek || props.item.leaving || props.item.loading || duration.value <= 0) return\n started = Date.now(); running.value = true\n timer = setTimeout(() => { timer = undefined; running.value = false; emit('dismiss', props.item.id) }, remaining)\n}\nfunction hover(value: boolean) { hovered = value && (props.item.pauseOnHover ?? true); hovered ? pause() : resume() }\nfunction focus(value: boolean) { focused = value; value ? pause() : resume() }\nfunction visibility() { document.hidden ? pause() : resume() }\nfunction blur() { windowActive = false; pause() }\nfunction wake() { windowActive = true; resume() }\nwatch(() => [props.item.revision, duration.value, props.peek, props.item.leaving, props.item.loading], () => {\n pause(); remaining = duration.value; clearTimeout(exitTimer)\n if (props.item.leaving) {\n if (props.peek || prefersReducedMotion()) emit('remove', props.item.id)\n else exitTimer = setTimeout(() => emit('remove', props.item.id), 650)\n } else resume()\n})\nonMounted(() => {\n mounted = true; resume()\n document.addEventListener('visibilitychange', visibility); window.addEventListener('blur', blur); window.addEventListener('focus', wake)\n})\nonBeforeUnmount(() => {\n clearTimeout(timer); clearTimeout(exitTimer); animation?.cancel()\n document.removeEventListener('visibilitychange', visibility); window.removeEventListener('blur', blur); window.removeEventListener('focus', wake)\n})\nfunction start(e: PointerEvent) {\n if (props.peek || props.item.leaving || !dismissable.value || e.button > 0 || (e.target as HTMLElement).closest('button')) return\n suppressClick = false\n pointer = { id: e.pointerId, x: e.clientX, lastX: e.clientX, t: e.timeStamp, velocity: 0, moved: false }\n pause()\n}\nfunction move(e: PointerEvent) {\n if (!pointer || pointer.id !== e.pointerId || !card.value) return\n const dx = e.clientX - pointer.x\n if (Math.abs(dx) > 10) { pointer.moved = true; card.value.setPointerCapture?.(e.pointerId) }\n if (!pointer.moved) return\n pointer.velocity = (e.clientX - pointer.lastX) / Math.max(1, e.timeStamp - pointer.t)\n pointer.lastX = e.clientX; pointer.t = e.timeStamp\n card.value.style.transform = `translateX(${dx}px)`\n card.value.style.opacity = String(Math.max(.2, 1 - Math.abs(dx) / 260))\n}\nfunction end(e: PointerEvent) {\n const p = pointer, el = card.value\n if (!p || p.id !== e.pointerId || !el) return\n pointer = undefined\n if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)\n const dx = e.clientX - p.x\n suppressClick = p.moved\n const dismiss = e.type !== 'pointercancel' && p.moved && (Math.abs(dx) > 90 || Math.abs(p.velocity) > .55)\n el.style.transform = ''; el.style.opacity = ''\n if (dismiss) {\n if (prefersReducedMotion() || !el.animate) { emit('remove', props.item.id); return }\n animation = el.animate([{ transform: `translateX(${dx}px)`, opacity: 1 }, { transform: `translateX(${Math.sign(dx) * (el.offsetWidth + 48)}px)`, opacity: 0 }], { duration: 200, fill: 'forwards' })\n animation.onfinish = () => emit('remove', props.item.id)\n } else {\n if (p.moved && !prefersReducedMotion() && el.animate) animation = el.animate([{ transform: `translateX(${dx}px)` }, { transform: 'translateX(0)' }], { duration: 240, easing: 'cubic-bezier(.25,.8,.3,1)' })\n resume()\n }\n}\nfunction click() { if (!suppressClick && !props.peek && dismissable.value) emit('dismiss', props.item.id); suppressClick = false }\nfunction close() { emit('dismiss', props.item.id) }\nfunction action() {\n const a = props.item.action\n if (!a) return\n a.onClick?.(close)\n if (!a.keepOpen) close()\n}\n</script>\n<template>\n <!-- No live role here: the toaster announces through its own two live\n regions, so a toast is never read twice. -->\n <div ref=\"card\" class=\"modo-liquid-toast\" data-modo-liquid-toast=\"\"\n :data-modo-color=\"item.color\" :data-modo-variant=\"variant\" :data-modo-radius=\"resolvedRadius\" :data-modo-size=\"resolvedSize\"\n :data-modo-phase=\"phase\" :data-modo-running=\"running || undefined\"\n :data-modo-peek=\"peek || undefined\" :aria-hidden=\"peek ? true : undefined\" :inert=\"peek > 0 || item.leaving\" :style=\"style\"\n @pointerenter=\"hover(true)\" @pointerleave=\"hover(false)\" @focusin=\"focus(true)\" @focusout=\"focus(false)\"\n @pointerdown=\"start\" @pointermove=\"move\" @pointerup=\"end\" @pointercancel=\"end\" @click=\"click\">\n <div class=\"modo-liquid-toast__shade\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__goo\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__ink\"><LiquidToastShape :item=\"item\" ink :dismissable=\"dismissable\" :progress=\"duration > 0 && !item.loading\" :close-label=\"loc.common.dismiss\" @action=\"action\" @dismiss=\"close\" /></div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EASd,MAAM,OAAO;EACb,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,KAAK,UAAU,MAAM,OAAM;EAChF,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK,QAAQ,MAAM,KAAI;EACxE,MAAM,WAAA,GAAA,IAAA,gBAAyB,MAAM,KAAK,WAAW,MAAM,eAAc;EACzE,MAAM,YAAA,GAAA,IAAA,gBAA0B,MAAM,KAAK,YAAY,MAAM,gBAAe;EAC5E,MAAM,eAAA,GAAA,IAAA,gBAA6B,MAAM,KAAK,eAAe,KAAI;EAKjE,MAAM,eAA2C;GAC/C,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,MAAM;GACR;EACA,MAAM,cAA0C;GAAE,MAAM;GAAO,OAAO;GAA+C,QAAQ;GAAU,OAAO;GAAU,MAAM;GAAS;EACvK,MAAM,iBAA6C;GACjD,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,MAAM;GACR;EACA,MAAM,SAAA,GAAA,IAAA,iBAAwB;GAC5B,8BAA8B,aAAa,eAAe;GAC1D,mCAAmC,YAAY,eAAe;GAC9D,mCAAmC,YAAY,eAAe;GAC9D,sCAAsC,eAAe,eAAe;GACpE,gCAAgC,GAAG,SAAS,MAAM;GACnD,EAAC;EAEF,MAAM,QAAA,GAAA,IAAA,KAA+B,KAA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;gCACoH,OAAxN,YAAwN,EAAA,GAAA,IAAA,aAAN,yBAAA,SAAA;KAA3J,MAAM,QAAA;KAAM,KAAA;KAAK,aAAa,YAAA;KAAc,UAAU,SAAA,QAAQ,KAAA,CAAS,QAAA,KAAK;KAAU,gBAAA,GAAA,IAAA,OAAa,IAAG,CAAC,OAAO;KAAU,UAAQ;KAAS,WAAS"}
|
|
1
|
+
{"version":3,"file":"LiquidToast.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration: 4000, defaultVariant: 'liquid' })\nconst emit = defineEmits<{ dismiss: [id: string | number]; remove: [id: string | number] }>()\nconst loc = useModoLocale()\nconst resolvedRadius = useResolvedRadius(() => props.item.radius ?? props.radius)\nconst resolvedSize = useResolvedSize(() => props.item.size ?? props.size)\nconst variant = computed(() => props.item.variant ?? props.defaultVariant)\nconst duration = computed(() => props.item.duration ?? props.defaultDuration)\nconst dismissable = computed(() => props.item.dismissable ?? true)\n\n// Same steps as the native Toast (rounded-none / sm / lg / xl / 2xl). The pill\n// keeps its capsule from medium up; none/small square it, and the goo filter is\n// tightened (small) or dropped (none) so it can't re-round square corners.\nconst PANEL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-lg, var(--radius))',\n large: 'var(--radius-xl, calc(var(--radius) + 4px))',\n full: '1rem',\n}\nconst PILL_RADIUS: Record<ModoRadius, string> = { none: '0px', small: 'var(--radius-sm, calc(var(--radius) - 4px))', medium: '9999px', large: '9999px', full: '9999px' }\nconst CONTROL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-md, calc(var(--radius) - 2px))',\n large: 'var(--radius-lg, var(--radius))',\n full: '9999px',\n}\nconst style = computed(() => ({\n '--modo-liquid-toast-radius': variant.value === 'liquid' && resolvedRadius.value === 'medium' ? '1.25rem' : PANEL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-pill-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-seed-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-control-radius': CONTROL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-duration': `${duration.value}ms`,\n}))\n\nconst card = ref<HTMLElement | null>(null)\nconst bornRevision = props.item.revision, bornAsPeek = props.peek > 0\nconst phase = computed(() => props.peek > 0 ? 'peek' : props.item.leaving ? 'leaving' : props.item.revision > bornRevision ? 'updating' : bornAsPeek ? 'promoted' : 'entering')\nconst running = ref(false)\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet exitTimer: ReturnType<typeof setTimeout> | undefined\nlet started = 0, remaining = duration.value\nlet hovered = false, focused = false, windowActive = true, mounted = false\nlet pointer: { id: number; x: number; lastX: number; t: number; velocity: number; moved: boolean } | undefined\nlet animation: Animation | undefined\nlet suppressClick = false\n/** Stops the clock and keeps the time that was left (like the native Toast). */\nfunction pause() {\n if (!timer) return\n clearTimeout(timer); timer = undefined\n remaining = variant.value === 'liquid' ? duration.value : Math.max(0, remaining - (Date.now() - started))\n running.value = false\n}\nfunction resume() {\n if (!mounted || timer || hovered || focused || !windowActive || document.hidden || props.peek || props.item.leaving || props.item.loading || duration.value <= 0) return\n started = Date.now(); running.value = true\n timer = setTimeout(() => { timer = undefined; running.value = false; emit('dismiss', props.item.id) }, remaining)\n}\nfunction hover(value: boolean) { hovered = value && (props.item.pauseOnHover ?? true); hovered ? pause() : resume() }\nfunction focus(value: boolean) { focused = value; value ? pause() : resume() }\nfunction visibility() { document.hidden ? pause() : resume() }\nfunction blur() { windowActive = false; pause() }\nfunction wake() { windowActive = true; resume() }\nwatch(() => [props.item.revision, duration.value, props.peek, props.item.leaving, props.item.loading], () => {\n pause(); remaining = duration.value; clearTimeout(exitTimer)\n if (props.item.leaving) {\n if (props.peek || prefersReducedMotion()) emit('remove', props.item.id)\n else exitTimer = setTimeout(() => emit('remove', props.item.id), 650)\n } else resume()\n})\nonMounted(() => {\n mounted = true\n if (props.item.leaving) emit('remove', props.item.id)\n else resume()\n document.addEventListener('visibilitychange', visibility); window.addEventListener('blur', blur); window.addEventListener('focus', wake)\n})\nonBeforeUnmount(() => {\n clearTimeout(timer); clearTimeout(exitTimer); animation?.cancel()\n document.removeEventListener('visibilitychange', visibility); window.removeEventListener('blur', blur); window.removeEventListener('focus', wake)\n})\nfunction start(e: PointerEvent) {\n if (props.peek || props.item.leaving || !dismissable.value || e.button > 0 || (e.target as HTMLElement).closest('button')) return\n suppressClick = false\n pointer = { id: e.pointerId, x: e.clientX, lastX: e.clientX, t: e.timeStamp, velocity: 0, moved: false }\n pause()\n}\nfunction move(e: PointerEvent) {\n if (!pointer || pointer.id !== e.pointerId || !card.value) return\n const dx = e.clientX - pointer.x\n if (Math.abs(dx) > 10) { pointer.moved = true; card.value.setPointerCapture?.(e.pointerId) }\n if (!pointer.moved) return\n pointer.velocity = (e.clientX - pointer.lastX) / Math.max(1, e.timeStamp - pointer.t)\n pointer.lastX = e.clientX; pointer.t = e.timeStamp\n card.value.style.transform = `translateX(${dx}px)`\n card.value.style.opacity = String(Math.max(.2, 1 - Math.abs(dx) / 260))\n}\nfunction end(e: PointerEvent) {\n const p = pointer, el = card.value\n if (!p || p.id !== e.pointerId || !el) return\n pointer = undefined\n if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)\n const dx = e.clientX - p.x\n suppressClick = p.moved\n const dismiss = e.type !== 'pointercancel' && p.moved && (Math.abs(dx) > 90 || Math.abs(p.velocity) > .55)\n el.style.transform = ''; el.style.opacity = ''\n if (dismiss) {\n if (prefersReducedMotion() || !el.animate) { emit('remove', props.item.id); return }\n animation = el.animate([{ transform: `translateX(${dx}px)`, opacity: 1 }, { transform: `translateX(${Math.sign(dx) * (el.offsetWidth + 48)}px)`, opacity: 0 }], { duration: 200, fill: 'forwards' })\n animation.onfinish = () => emit('remove', props.item.id)\n } else {\n if (p.moved && !prefersReducedMotion() && el.animate) animation = el.animate([{ transform: `translateX(${dx}px)` }, { transform: 'translateX(0)' }], { duration: 240, easing: 'cubic-bezier(.25,.8,.3,1)' })\n resume()\n }\n}\nfunction click() { if (!suppressClick && !props.peek && dismissable.value) emit('dismiss', props.item.id); suppressClick = false }\nfunction close() { emit('dismiss', props.item.id) }\nfunction action() {\n const a = props.item.action\n if (!a) return\n a.onClick?.(close)\n if (!a.keepOpen) close()\n}\n</script>\n<template>\n <!-- No live role here: the toaster announces through its own two live\n regions, so a toast is never read twice. -->\n <div ref=\"card\" class=\"modo-liquid-toast\" data-modo-liquid-toast=\"\"\n :data-modo-color=\"item.color\" :data-modo-variant=\"variant\" :data-modo-radius=\"resolvedRadius\" :data-modo-size=\"resolvedSize\"\n :data-modo-phase=\"phase\" :data-modo-running=\"running || undefined\"\n :data-modo-peek=\"peek || undefined\" :aria-hidden=\"peek ? true : undefined\" :inert=\"peek > 0 || item.leaving\" :style=\"style\"\n @pointerenter=\"hover(true)\" @pointerleave=\"hover(false)\" @focusin=\"focus(true)\" @focusout=\"focus(false)\"\n @pointerdown=\"start\" @pointermove=\"move\" @pointerup=\"end\" @pointercancel=\"end\" @click=\"click\">\n <div class=\"modo-liquid-toast__shade\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__goo\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__ink\"><LiquidToastShape :item=\"item\" ink :dismissable=\"dismissable\" :progress=\"variant !== 'liquid' && duration > 0 && !item.loading\" :close-label=\"loc.common.dismiss\" @action=\"action\" @dismiss=\"close\" /></div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EASd,MAAM,OAAO;EACb,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,KAAK,UAAU,MAAM,OAAM;EAChF,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK,QAAQ,MAAM,KAAI;EACxE,MAAM,WAAA,GAAA,IAAA,gBAAyB,MAAM,KAAK,WAAW,MAAM,eAAc;EACzE,MAAM,YAAA,GAAA,IAAA,gBAA0B,MAAM,KAAK,YAAY,MAAM,gBAAe;EAC5E,MAAM,eAAA,GAAA,IAAA,gBAA6B,MAAM,KAAK,eAAe,KAAI;EAKjE,MAAM,eAA2C;GAC/C,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,MAAM;GACR;EACA,MAAM,cAA0C;GAAE,MAAM;GAAO,OAAO;GAA+C,QAAQ;GAAU,OAAO;GAAU,MAAM;GAAS;EACvK,MAAM,iBAA6C;GACjD,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,MAAM;GACR;EACA,MAAM,SAAA,GAAA,IAAA,iBAAwB;GAC5B,8BAA8B,QAAQ,UAAU,YAAY,eAAe,UAAU,WAAW,YAAY,aAAa,eAAe;GACxI,mCAAmC,YAAY,eAAe;GAC9D,mCAAmC,YAAY,eAAe;GAC9D,sCAAsC,eAAe,eAAe;GACpE,g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AA,GAAA,IAAA,aAAN,yBAAA,SAAA;KAAzC,MAAM,QAAA;KAAO,aAAa,YAAA;;gCACmB,OAAzH,YAAyH,EAAA,GAAA,IAAA,aAAN,yBAAA,SAAA;KAAzC,MAAM,QAAA;KAAO,aAAa,YAAA;;gCAC4I,OAAhP,YAAgP,EAAA,GAAA,IAAA,aAAN,yBAAA,SAAA;KAAnL,MAAM,QAAA;KAAM,KAAA;KAAK,aAAa,YAAA;KAAc,UAAU,QAAA,UAAO,YAAiB,SAAA,QAAQ,KAAA,CAAS,QAAA,KAAK;KAAU,gBAAA,GAAA,IAAA,OAAa,IAAG,CAAC,OAAO;KAAU,UAAQ;KAAS,WAAS"}
|
package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.mjs
CHANGED
|
@@ -29,8 +29,8 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
29
29
|
props: {
|
|
30
30
|
item: {},
|
|
31
31
|
peek: { default: 0 },
|
|
32
|
-
defaultDuration: { default:
|
|
33
|
-
defaultVariant: { default: "
|
|
32
|
+
defaultDuration: { default: 4e3 },
|
|
33
|
+
defaultVariant: { default: "liquid" },
|
|
34
34
|
radius: {},
|
|
35
35
|
size: {}
|
|
36
36
|
},
|
|
@@ -66,7 +66,7 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
66
66
|
full: "9999px"
|
|
67
67
|
};
|
|
68
68
|
const style = computed(() => ({
|
|
69
|
-
"--modo-liquid-toast-radius": PANEL_RADIUS[resolvedRadius.value],
|
|
69
|
+
"--modo-liquid-toast-radius": variant.value === "liquid" && resolvedRadius.value === "medium" ? "1.25rem" : PANEL_RADIUS[resolvedRadius.value],
|
|
70
70
|
"--modo-liquid-toast-pill-radius": PILL_RADIUS[resolvedRadius.value],
|
|
71
71
|
"--modo-liquid-toast-seed-radius": PILL_RADIUS[resolvedRadius.value],
|
|
72
72
|
"--modo-liquid-toast-control-radius": CONTROL_RADIUS[resolvedRadius.value],
|
|
@@ -88,7 +88,7 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
88
88
|
if (!timer) return;
|
|
89
89
|
clearTimeout(timer);
|
|
90
90
|
timer = void 0;
|
|
91
|
-
remaining = Math.max(0, remaining - (Date.now() - started));
|
|
91
|
+
remaining = variant.value === "liquid" ? duration.value : Math.max(0, remaining - (Date.now() - started));
|
|
92
92
|
running.value = false;
|
|
93
93
|
}
|
|
94
94
|
function resume() {
|
|
@@ -136,7 +136,8 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
136
136
|
});
|
|
137
137
|
onMounted(() => {
|
|
138
138
|
mounted = true;
|
|
139
|
-
|
|
139
|
+
if (props.item.leaving) emit("remove", props.item.id);
|
|
140
|
+
else resume();
|
|
140
141
|
document.addEventListener("visibilitychange", visibility);
|
|
141
142
|
window.addEventListener("blur", blur);
|
|
142
143
|
window.addEventListener("focus", wake);
|
|
@@ -261,7 +262,7 @@ var LiquidToast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
261
262
|
item: __props.item,
|
|
262
263
|
ink: "",
|
|
263
264
|
dismissable: dismissable.value,
|
|
264
|
-
progress: duration.value > 0 && !__props.item.loading,
|
|
265
|
+
progress: variant.value !== "liquid" && duration.value > 0 && !__props.item.loading,
|
|
265
266
|
"close-label": unref(loc).common.dismiss,
|
|
266
267
|
onAction: action,
|
|
267
268
|
onDismiss: close
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToast.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration: 4500, defaultVariant: 'subtle' })\nconst emit = defineEmits<{ dismiss: [id: string | number]; remove: [id: string | number] }>()\nconst loc = useModoLocale()\nconst resolvedRadius = useResolvedRadius(() => props.item.radius ?? props.radius)\nconst resolvedSize = useResolvedSize(() => props.item.size ?? props.size)\nconst variant = computed(() => props.item.variant ?? props.defaultVariant)\nconst duration = computed(() => props.item.duration ?? props.defaultDuration)\nconst dismissable = computed(() => props.item.dismissable ?? true)\n\n// Same steps as the native Toast (rounded-none / sm / lg / xl / 2xl). The pill\n// keeps its capsule from medium up; none/small square it, and the goo filter is\n// tightened (small) or dropped (none) so it can't re-round square corners.\nconst PANEL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-lg, var(--radius))',\n large: 'var(--radius-xl, calc(var(--radius) + 4px))',\n full: '1rem',\n}\nconst PILL_RADIUS: Record<ModoRadius, string> = { none: '0px', small: 'var(--radius-sm, calc(var(--radius) - 4px))', medium: '9999px', large: '9999px', full: '9999px' }\nconst CONTROL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-md, calc(var(--radius) - 2px))',\n large: 'var(--radius-lg, var(--radius))',\n full: '9999px',\n}\nconst style = computed(() => ({\n '--modo-liquid-toast-radius': PANEL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-pill-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-seed-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-control-radius': CONTROL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-duration': `${duration.value}ms`,\n}))\n\nconst card = ref<HTMLElement | null>(null)\nconst bornRevision = props.item.revision, bornAsPeek = props.peek > 0\nconst phase = computed(() => props.peek > 0 ? 'peek' : props.item.leaving ? 'leaving' : props.item.revision > bornRevision ? 'updating' : bornAsPeek ? 'promoted' : 'entering')\nconst running = ref(false)\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet exitTimer: ReturnType<typeof setTimeout> | undefined\nlet started = 0, remaining = duration.value\nlet hovered = false, focused = false, windowActive = true, mounted = false\nlet pointer: { id: number; x: number; lastX: number; t: number; velocity: number; moved: boolean } | undefined\nlet animation: Animation | undefined\nlet suppressClick = false\n/** Stops the clock and keeps the time that was left (like the native Toast). */\nfunction pause() {\n if (!timer) return\n clearTimeout(timer); timer = undefined\n remaining = Math.max(0, remaining - (Date.now() - started))\n running.value = false\n}\nfunction resume() {\n if (!mounted || timer || hovered || focused || !windowActive || document.hidden || props.peek || props.item.leaving || props.item.loading || duration.value <= 0) return\n started = Date.now(); running.value = true\n timer = setTimeout(() => { timer = undefined; running.value = false; emit('dismiss', props.item.id) }, remaining)\n}\nfunction hover(value: boolean) { hovered = value && (props.item.pauseOnHover ?? true); hovered ? pause() : resume() }\nfunction focus(value: boolean) { focused = value; value ? pause() : resume() }\nfunction visibility() { document.hidden ? pause() : resume() }\nfunction blur() { windowActive = false; pause() }\nfunction wake() { windowActive = true; resume() }\nwatch(() => [props.item.revision, duration.value, props.peek, props.item.leaving, props.item.loading], () => {\n pause(); remaining = duration.value; clearTimeout(exitTimer)\n if (props.item.leaving) {\n if (props.peek || prefersReducedMotion()) emit('remove', props.item.id)\n else exitTimer = setTimeout(() => emit('remove', props.item.id), 650)\n } else resume()\n})\nonMounted(() => {\n mounted = true; resume()\n document.addEventListener('visibilitychange', visibility); window.addEventListener('blur', blur); window.addEventListener('focus', wake)\n})\nonBeforeUnmount(() => {\n clearTimeout(timer); clearTimeout(exitTimer); animation?.cancel()\n document.removeEventListener('visibilitychange', visibility); window.removeEventListener('blur', blur); window.removeEventListener('focus', wake)\n})\nfunction start(e: PointerEvent) {\n if (props.peek || props.item.leaving || !dismissable.value || e.button > 0 || (e.target as HTMLElement).closest('button')) return\n suppressClick = false\n pointer = { id: e.pointerId, x: e.clientX, lastX: e.clientX, t: e.timeStamp, velocity: 0, moved: false }\n pause()\n}\nfunction move(e: PointerEvent) {\n if (!pointer || pointer.id !== e.pointerId || !card.value) return\n const dx = e.clientX - pointer.x\n if (Math.abs(dx) > 10) { pointer.moved = true; card.value.setPointerCapture?.(e.pointerId) }\n if (!pointer.moved) return\n pointer.velocity = (e.clientX - pointer.lastX) / Math.max(1, e.timeStamp - pointer.t)\n pointer.lastX = e.clientX; pointer.t = e.timeStamp\n card.value.style.transform = `translateX(${dx}px)`\n card.value.style.opacity = String(Math.max(.2, 1 - Math.abs(dx) / 260))\n}\nfunction end(e: PointerEvent) {\n const p = pointer, el = card.value\n if (!p || p.id !== e.pointerId || !el) return\n pointer = undefined\n if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)\n const dx = e.clientX - p.x\n suppressClick = p.moved\n const dismiss = e.type !== 'pointercancel' && p.moved && (Math.abs(dx) > 90 || Math.abs(p.velocity) > .55)\n el.style.transform = ''; el.style.opacity = ''\n if (dismiss) {\n if (prefersReducedMotion() || !el.animate) { emit('remove', props.item.id); return }\n animation = el.animate([{ transform: `translateX(${dx}px)`, opacity: 1 }, { transform: `translateX(${Math.sign(dx) * (el.offsetWidth + 48)}px)`, opacity: 0 }], { duration: 200, fill: 'forwards' })\n animation.onfinish = () => emit('remove', props.item.id)\n } else {\n if (p.moved && !prefersReducedMotion() && el.animate) animation = el.animate([{ transform: `translateX(${dx}px)` }, { transform: 'translateX(0)' }], { duration: 240, easing: 'cubic-bezier(.25,.8,.3,1)' })\n resume()\n }\n}\nfunction click() { if (!suppressClick && !props.peek && dismissable.value) emit('dismiss', props.item.id); suppressClick = false }\nfunction close() { emit('dismiss', props.item.id) }\nfunction action() {\n const a = props.item.action\n if (!a) return\n a.onClick?.(close)\n if (!a.keepOpen) close()\n}\n</script>\n<template>\n <!-- No live role here: the toaster announces through its own two live\n regions, so a toast is never read twice. -->\n <div ref=\"card\" class=\"modo-liquid-toast\" data-modo-liquid-toast=\"\"\n :data-modo-color=\"item.color\" :data-modo-variant=\"variant\" :data-modo-radius=\"resolvedRadius\" :data-modo-size=\"resolvedSize\"\n :data-modo-phase=\"phase\" :data-modo-running=\"running || undefined\"\n :data-modo-peek=\"peek || undefined\" :aria-hidden=\"peek ? true : undefined\" :inert=\"peek > 0 || item.leaving\" :style=\"style\"\n @pointerenter=\"hover(true)\" @pointerleave=\"hover(false)\" @focusin=\"focus(true)\" @focusout=\"focus(false)\"\n @pointerdown=\"start\" @pointermove=\"move\" @pointerup=\"end\" @pointercancel=\"end\" @click=\"click\">\n <div class=\"modo-liquid-toast__shade\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__goo\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__ink\"><LiquidToastShape :item=\"item\" ink :dismissable=\"dismissable\" :progress=\"duration > 0 && !item.loading\" :close-label=\"loc.common.dismiss\" @action=\"action\" @dismiss=\"close\" /></div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EASd,MAAM,OAAO;EACb,MAAM,MAAM,eAAc;EAC1B,MAAM,iBAAiB,wBAAwB,MAAM,KAAK,UAAU,MAAM,OAAM;EAChF,MAAM,eAAe,sBAAsB,MAAM,KAAK,QAAQ,MAAM,KAAI;EACxE,MAAM,UAAU,eAAe,MAAM,KAAK,WAAW,MAAM,e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AAE,MAAK,KAAA;IAAS,gBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,MAAK,MAAA;IAAU,WAAO,OAAA,OAAA,OAAA,MAAA,WAAE,MAAK,KAAA;IAAS,YAAQ,OAAA,OAAA,OAAA,MAAA,WAAE,MAAK,MAAA;IAC/F,eAAa;IAAQ,eAAa;IAAO,aAAW;IAAM,iBAAe;IAAM,SAAO;;IACvF,mBAA2H,OAA3H,YAA2H,CAAlE,YAA4D,0BAAA;KAAzC,MAAM,QAAA;KAAO,aAAa,YAAA;;IACtG,mBAAyH,OAAzH,YAAyH,CAAlE,YAA4D,0BAAA;KAAzC,MAAM,QAAA;KAAO,aAAa,YAAA;;IACpG,mBAAwN,OAAxN,YAAwN,CAApL,YAA8K,0BAAA;KAA3J,MAAM,QAAA;KAAM,KAAA;KAAK,aAAa,YAAA;KAAc,UAAU,SAAA,QAAQ,KAAA,CAAS,QAAA,KAAK;KAAU,eAAa,MAAA,IAAG,CAAC,OAAO;KAAU,UAAQ;KAAS,WAAS"}
|
|
1
|
+
{"version":3,"file":"LiquidToast.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToast.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport type { LiquidToastItem, LiquidToastVariant } from '../../../interfaces/feedback/LiquidToast.interface'\nimport type { ModoRadius, ModoSize } from '../../../config/ModoConfig'\nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport { prefersReducedMotion } from '../../../utils/morph/morphEngine'\nimport LiquidToastShape from './LiquidToastShape.vue'\nimport './liquid-toast.css'\n\nconst props = withDefaults(defineProps<{\n item: LiquidToastItem\n peek?: number\n /** Fallbacks from the toaster; the item's own values win. */\n defaultDuration?: number\n defaultVariant?: LiquidToastVariant\n radius?: ModoRadius\n size?: ModoSize\n}>(), { peek: 0, defaultDuration: 4000, defaultVariant: 'liquid' })\nconst emit = defineEmits<{ dismiss: [id: string | number]; remove: [id: string | number] }>()\nconst loc = useModoLocale()\nconst resolvedRadius = useResolvedRadius(() => props.item.radius ?? props.radius)\nconst resolvedSize = useResolvedSize(() => props.item.size ?? props.size)\nconst variant = computed(() => props.item.variant ?? props.defaultVariant)\nconst duration = computed(() => props.item.duration ?? props.defaultDuration)\nconst dismissable = computed(() => props.item.dismissable ?? true)\n\n// Same steps as the native Toast (rounded-none / sm / lg / xl / 2xl). The pill\n// keeps its capsule from medium up; none/small square it, and the goo filter is\n// tightened (small) or dropped (none) so it can't re-round square corners.\nconst PANEL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-lg, var(--radius))',\n large: 'var(--radius-xl, calc(var(--radius) + 4px))',\n full: '1rem',\n}\nconst PILL_RADIUS: Record<ModoRadius, string> = { none: '0px', small: 'var(--radius-sm, calc(var(--radius) - 4px))', medium: '9999px', large: '9999px', full: '9999px' }\nconst CONTROL_RADIUS: Record<ModoRadius, string> = {\n none: '0px',\n small: 'var(--radius-sm, calc(var(--radius) - 4px))',\n medium: 'var(--radius-md, calc(var(--radius) - 2px))',\n large: 'var(--radius-lg, var(--radius))',\n full: '9999px',\n}\nconst style = computed(() => ({\n '--modo-liquid-toast-radius': variant.value === 'liquid' && resolvedRadius.value === 'medium' ? '1.25rem' : PANEL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-pill-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-seed-radius': PILL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-control-radius': CONTROL_RADIUS[resolvedRadius.value],\n '--modo-liquid-toast-duration': `${duration.value}ms`,\n}))\n\nconst card = ref<HTMLElement | null>(null)\nconst bornRevision = props.item.revision, bornAsPeek = props.peek > 0\nconst phase = computed(() => props.peek > 0 ? 'peek' : props.item.leaving ? 'leaving' : props.item.revision > bornRevision ? 'updating' : bornAsPeek ? 'promoted' : 'entering')\nconst running = ref(false)\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet exitTimer: ReturnType<typeof setTimeout> | undefined\nlet started = 0, remaining = duration.value\nlet hovered = false, focused = false, windowActive = true, mounted = false\nlet pointer: { id: number; x: number; lastX: number; t: number; velocity: number; moved: boolean } | undefined\nlet animation: Animation | undefined\nlet suppressClick = false\n/** Stops the clock and keeps the time that was left (like the native Toast). */\nfunction pause() {\n if (!timer) return\n clearTimeout(timer); timer = undefined\n remaining = variant.value === 'liquid' ? duration.value : Math.max(0, remaining - (Date.now() - started))\n running.value = false\n}\nfunction resume() {\n if (!mounted || timer || hovered || focused || !windowActive || document.hidden || props.peek || props.item.leaving || props.item.loading || duration.value <= 0) return\n started = Date.now(); running.value = true\n timer = setTimeout(() => { timer = undefined; running.value = false; emit('dismiss', props.item.id) }, remaining)\n}\nfunction hover(value: boolean) { hovered = value && (props.item.pauseOnHover ?? true); hovered ? pause() : resume() }\nfunction focus(value: boolean) { focused = value; value ? pause() : resume() }\nfunction visibility() { document.hidden ? pause() : resume() }\nfunction blur() { windowActive = false; pause() }\nfunction wake() { windowActive = true; resume() }\nwatch(() => [props.item.revision, duration.value, props.peek, props.item.leaving, props.item.loading], () => {\n pause(); remaining = duration.value; clearTimeout(exitTimer)\n if (props.item.leaving) {\n if (props.peek || prefersReducedMotion()) emit('remove', props.item.id)\n else exitTimer = setTimeout(() => emit('remove', props.item.id), 650)\n } else resume()\n})\nonMounted(() => {\n mounted = true\n if (props.item.leaving) emit('remove', props.item.id)\n else resume()\n document.addEventListener('visibilitychange', visibility); window.addEventListener('blur', blur); window.addEventListener('focus', wake)\n})\nonBeforeUnmount(() => {\n clearTimeout(timer); clearTimeout(exitTimer); animation?.cancel()\n document.removeEventListener('visibilitychange', visibility); window.removeEventListener('blur', blur); window.removeEventListener('focus', wake)\n})\nfunction start(e: PointerEvent) {\n if (props.peek || props.item.leaving || !dismissable.value || e.button > 0 || (e.target as HTMLElement).closest('button')) return\n suppressClick = false\n pointer = { id: e.pointerId, x: e.clientX, lastX: e.clientX, t: e.timeStamp, velocity: 0, moved: false }\n pause()\n}\nfunction move(e: PointerEvent) {\n if (!pointer || pointer.id !== e.pointerId || !card.value) return\n const dx = e.clientX - pointer.x\n if (Math.abs(dx) > 10) { pointer.moved = true; card.value.setPointerCapture?.(e.pointerId) }\n if (!pointer.moved) return\n pointer.velocity = (e.clientX - pointer.lastX) / Math.max(1, e.timeStamp - pointer.t)\n pointer.lastX = e.clientX; pointer.t = e.timeStamp\n card.value.style.transform = `translateX(${dx}px)`\n card.value.style.opacity = String(Math.max(.2, 1 - Math.abs(dx) / 260))\n}\nfunction end(e: PointerEvent) {\n const p = pointer, el = card.value\n if (!p || p.id !== e.pointerId || !el) return\n pointer = undefined\n if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)\n const dx = e.clientX - p.x\n suppressClick = p.moved\n const dismiss = e.type !== 'pointercancel' && p.moved && (Math.abs(dx) > 90 || Math.abs(p.velocity) > .55)\n el.style.transform = ''; el.style.opacity = ''\n if (dismiss) {\n if (prefersReducedMotion() || !el.animate) { emit('remove', props.item.id); return }\n animation = el.animate([{ transform: `translateX(${dx}px)`, opacity: 1 }, { transform: `translateX(${Math.sign(dx) * (el.offsetWidth + 48)}px)`, opacity: 0 }], { duration: 200, fill: 'forwards' })\n animation.onfinish = () => emit('remove', props.item.id)\n } else {\n if (p.moved && !prefersReducedMotion() && el.animate) animation = el.animate([{ transform: `translateX(${dx}px)` }, { transform: 'translateX(0)' }], { duration: 240, easing: 'cubic-bezier(.25,.8,.3,1)' })\n resume()\n }\n}\nfunction click() { if (!suppressClick && !props.peek && dismissable.value) emit('dismiss', props.item.id); suppressClick = false }\nfunction close() { emit('dismiss', props.item.id) }\nfunction action() {\n const a = props.item.action\n if (!a) return\n a.onClick?.(close)\n if (!a.keepOpen) close()\n}\n</script>\n<template>\n <!-- No live role here: the toaster announces through its own two live\n regions, so a toast is never read twice. -->\n <div ref=\"card\" class=\"modo-liquid-toast\" data-modo-liquid-toast=\"\"\n :data-modo-color=\"item.color\" :data-modo-variant=\"variant\" :data-modo-radius=\"resolvedRadius\" :data-modo-size=\"resolvedSize\"\n :data-modo-phase=\"phase\" :data-modo-running=\"running || undefined\"\n :data-modo-peek=\"peek || undefined\" :aria-hidden=\"peek ? true : undefined\" :inert=\"peek > 0 || item.leaving\" :style=\"style\"\n @pointerenter=\"hover(true)\" @pointerleave=\"hover(false)\" @focusin=\"focus(true)\" @focusout=\"focus(false)\"\n @pointerdown=\"start\" @pointermove=\"move\" @pointerup=\"end\" @pointercancel=\"end\" @click=\"click\">\n <div class=\"modo-liquid-toast__shade\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__goo\" aria-hidden=\"true\"><LiquidToastShape :item=\"item\" :dismissable=\"dismissable\" /></div>\n <div class=\"modo-liquid-toast__ink\"><LiquidToastShape :item=\"item\" ink :dismissable=\"dismissable\" :progress=\"variant !== 'liquid' && duration > 0 && !item.loading\" :close-label=\"loc.common.dismiss\" @action=\"action\" @dismiss=\"close\" /></div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EASd,MAAM,OAAO;EACb,MAAM,MAAM,eAAc;EAC1B,MAAM,iBAAiB,wBAAwB,MAAM,KAAK,UAAU,MAAM,OAAM;EAChF,MAAM,eAAe,sBAAsB,MAAM,KAAK,QAAQ,MAAM,KAAI;EACxE,MAAM,UAAU,eAAe,MAAM,KAAK,WAAW,MAAM,eAAc;EACzE,MAAM,WAAW,eAAe,MAAM,KAAK,YAAY,MAAM,gBAAe;EAC5E,MAAM,cAAc,eAAe,MAAM,KAAK,eAAe,KAAI;EAKjE,MAAM,eAA2C;GAC/C,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,MAAM;GACR;EACA,MAAM,cAA0C;GAAE,MAAM;G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OAAA,OAAA,MAAA,WAAE,MAAK,KAAA;IAAS,YAAQ,OAAA,OAAA,OAAA,MAAA,WAAE,MAAK,MAAA;IAC/F,eAAa;IAAQ,eAAa;IAAO,aAAW;IAAM,iBAAe;IAAM,SAAO;;IACvF,mBAA2H,OAA3H,YAA2H,CAAlE,YAA4D,0BAAA;KAAzC,MAAM,QAAA;KAAO,aAAa,YAAA;;IACtG,mBAAyH,OAAzH,YAAyH,CAAlE,YAA4D,0BAAA;KAAzC,MAAM,QAAA;KAAO,aAAa,YAAA;;IACpG,mBAAgP,OAAhP,YAAgP,CAA5M,YAAsM,0BAAA;KAAnL,MAAM,QAAA;KAAM,KAAA;KAAK,aAAa,YAAA;KAAc,UAAU,QAAA,UAAO,YAAiB,SAAA,QAAQ,KAAA,CAAS,QAAA,KAAK;KAAU,eAAa,MAAA,IAAG,CAAC,OAAO;KAAU,UAAQ;KAAS,WAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToastShape.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"LiquidToastShape.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { neutral: 'M4 8h8', success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToastShape.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"LiquidToastShape.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { neutral: 'M4 8h8', success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -58,6 +58,7 @@ var LiquidToastShape_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
58
58
|
const props = __props;
|
|
59
59
|
const emit = __emit;
|
|
60
60
|
const glyphs = {
|
|
61
|
+
neutral: "M4 8h8",
|
|
61
62
|
success: "M3.5 8.5l3 3 6-7",
|
|
62
63
|
danger: "M4.5 4.5l7 7m0-7l-7 7",
|
|
63
64
|
warning: "M8 4v5m0 3v.01",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToastShape.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EACd,MAAM,OAAO;EACb,MAAM,SAAS;GAAE,SAAS;GAAoB,QAAQ;GAAyB,SAAS;GAAkB,MAAM;GAAiB;
|
|
1
|
+
{"version":3,"file":"LiquidToastShape.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { neutral: 'M4 8h8', success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EACd,MAAM,OAAO;EACb,MAAM,SAAS;GAAE,SAAS;GAAU,SAAS;GAAoB,QAAQ;GAAyB,SAAS;GAAkB,MAAM;GAAiB;EACpJ,MAAM,iBAAiB,CAAC,EAAE,MAAM,KAAK,eAAe,MAAM,KAAK;;6GAiBvD,OAdN,YAcM;KAbS,QAAA,KAAK,YAAY,QAAA,KAAK,YAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAI5B,QAAA;KAJsC,KAAG,OAAS,QAAA,KAAK;KAAY,OAAM;KAAyB,eAAY;QACxG,QAAA,KAAK,YAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAA+N,OAA/O,YAA+O,CAAA,GAAA,OAAA,OAAA,OAAA,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
success: "M3.5 8.5l3 3 6-7",
|
|
61
62
|
danger: "M4.5 4.5l7 7m0-7l-7 7",
|
|
62
63
|
warning: "M8 4v5m0 3v.01",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToastShape.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EACd,MAAM,OAAO;EACb,MAAM,SAAS;GAAE,SAAS;GAAoB,QAAQ;GAAyB,SAAS;GAAkB,MAAM;GAAiB;
|
|
1
|
+
{"version":3,"file":"LiquidToastShape.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToastShape.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport RenderContent from '../../../utils/RenderContent'\nimport type { LiquidToastItem } from '../../../interfaces/feedback/LiquidToast.interface'\n/**\n * One copy of the toast silhouette. LiquidToast renders it three times: a\n * shade layer (shadow token), the goo layer (fused fill) and the ink layer\n * (text and controls). Only the ink copy is interactive; the others are\n * sizing twins, so every control exists in all of them as a plain span.\n */\nconst props = defineProps<{ item: LiquidToastItem; ink?: boolean; dismissable?: boolean; progress?: boolean; closeLabel?: string }>()\nconst emit = defineEmits<{ action: []; dismiss: [] }>()\nconst glyphs = { neutral: 'M4 8h8', success: 'M3.5 8.5l3 3 6-7', danger: 'M4.5 4.5l7 7m0-7l-7 7', warning: 'M8 4v5m0 3v.01', info: 'M8 7v5m0-8v.01' }\nconst hasPanel = () => !!(props.item.description || props.item.action)\n</script>\n<template>\n <div class=\"modo-liquid-toast__pill\">\n <span v-if=\"!item.hideIcon || item.loading\" :key=\"`dot-${item.revision}`\" class=\"modo-liquid-toast__dot\" aria-hidden=\"true\">\n <svg v-if=\"item.loading\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"modo-liquid-toast__spinner\"><circle cx=\"8\" cy=\"8\" r=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-dasharray=\"26\" stroke-dashoffset=\"18\" /></svg>\n <component :is=\"item.icon\" v-else-if=\"item.icon\" class=\"modo-liquid-toast__glyph\" />\n <svg v-else viewBox=\"0 0 16 16\" fill=\"none\"><path :d=\"glyphs[item.color]\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg>\n </span>\n <span :key=\"`title-${item.revision}`\" class=\"modo-liquid-toast__title\"><RenderContent :content=\"item.title\" /></span>\n <template v-if=\"dismissable\">\n <button v-if=\"ink\" type=\"button\" class=\"modo-liquid-toast__close\" :aria-label=\"closeLabel\" @click.stop=\"emit('dismiss')\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7m0-7l-7 7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" /></svg>\n </button>\n <span v-else class=\"modo-liquid-toast__close\" />\n </template>\n <span v-if=\"ink && progress && !hasPanel()\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n <div v-if=\"hasPanel()\" :key=\"`panel-${item.revision}`\" class=\"modo-liquid-toast__panel\">\n <p v-if=\"item.description\" class=\"modo-liquid-toast__description\"><RenderContent :content=\"item.description\" /></p>\n <button v-if=\"item.action && ink\" type=\"button\" class=\"modo-liquid-toast__action\" @click.stop=\"emit('action')\">{{ item.action.label }}</button>\n <span v-else-if=\"item.action\" class=\"modo-liquid-toast__action\">{{ item.action.label }}</span>\n <span v-if=\"ink && progress\" class=\"modo-liquid-toast__progress\" aria-hidden=\"true\"><span :key=\"`bar-${item.revision}`\" class=\"modo-liquid-toast__bar\" /></span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EACd,MAAM,OAAO;EACb,MAAM,SAAS;GAAE,SAAS;GAAU,SAAS;GAAoB,QAAQ;GAAyB,SAAS;GAAkB,MAAM;GAAiB;EACpJ,MAAM,iBAAiB,CAAC,EAAE,MAAM,KAAK,eAAe,MAAM,KAAK;;2DAG7D,mBAcM,OAdN,YAcM;KAbS,QAAA,KAAK,YAAY,QAAA,KAAK,WAAA,WAAA,EAAnC,mBAIO,QAAA;KAJsC,KAAG,OAAS,QAAA,KAAK;KAAY,OAAM;KAAyB,eAAY;QACxG,QAAA,KAAK,WAAA,WAAA,EAAhB,mBAA+O,OAA/O,YAA+O,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAnJ,mBAA6I,UAAA;KAArI,IAAG;KAAI,IAAG;KAAI,GAAE;KAAM,QAAO;KAAe,gBAAa;KAAM,kBAAe;KAAQ,oBAAiB;KAAK,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A,KAAK,aAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;IAClF,QAAA,KAAK,UAAU,QAAA,OAAA,WAAA,EAA7B,mBAA+I,UAAA;;KAA7G,MAAK;KAAS,OAAM;KAA6B,SAAK,OAAA,OAAA,OAAA,KAAA,eAAA,WAAO,KAAI,SAAA,EAAA,CAAA,OAAA,CAAA;uBAAe,QAAA,KAAK,OAAO,MAAK,EAAA,EAAA,IAClH,QAAA,KAAK,UAAA,WAAA,EAAtB,mBAA8F,QAA9F,YAA8F,gBAA3B,QAAA,KAAK,OAAO,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;IACxE,QAAA,OAAO,QAAA,YAAA,WAAA,EAAnB,mBAAgK,QAAhK,aAAgK,EAAA,WAAA,EAA5E,mBAAqE,QAAA;KAA9D,KAAG,OAAS,QAAA,KAAK;KAAY,OAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToaster.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useId } from 'vue'\nimport type { LiquidToasterProps, LiquidToastItem, LiquidToastPlacement } from '../../../interfaces/feedback/LiquidToast.interface'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { liquidToast } from './liquidToast'\nimport LiquidToast from './LiquidToast.vue'\n\nconst props = withDefaults(defineProps<LiquidToasterProps>(), {\n placement: 'top-center', max: 1, defaultDuration:
|
|
1
|
+
{"version":3,"file":"LiquidToaster.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useId } from 'vue'\nimport type { LiquidToasterProps, LiquidToastItem, LiquidToastPlacement } from '../../../interfaces/feedback/LiquidToast.interface'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { liquidToast } from './liquidToast'\nimport LiquidToast from './LiquidToast.vue'\n\nconst props = withDefaults(defineProps<LiquidToasterProps>(), {\n placement: 'top-center', max: 1, defaultDuration: 4000, defaultVariant: 'liquid', offset: 16,\n})\nconst loc = useModoLocale()\nconst store = computed(() => props.controller ?? liquidToast)\nconst count = computed(() => Math.max(1, Math.floor(props.max) || 1))\nconst PLACEMENTS: LiquidToastPlacement[] = ['top-center', 'top-left', 'top-right', 'bottom-center', 'bottom-left', 'bottom-right']\n// One zone per placement in use; inside it the first `max` toasts are on stage\n// and the next two wait as peeks behind the last stage card.\nconst zones = computed(() => PLACEMENTS.map(placement => {\n const items = store.value.items.value.filter(item => (item.placement ?? props.placement) === placement)\n const visible = items.slice(0, count.value)\n const stacks: LiquidToastItem[][] = visible.map((item, index) => index === visible.length - 1 ? [item, ...items.slice(count.value, count.value + 2)] : [item])\n return { placement, stacks }\n}).filter(zone => zone.stacks.length))\nconst zoneStyle = (placement: LiquidToastPlacement) => {\n const o = `${props.offset}px`\n return {\n [placement.startsWith('top') ? 'top' : 'bottom']: placement.startsWith('top') ? `max(${o}, env(safe-area-inset-top))` : `max(${o}, env(safe-area-inset-bottom))`,\n ...(placement.endsWith('left') ? { left: o } : placement.endsWith('right') ? { right: o } : {}),\n }\n}\nconst latest = computed(() => store.value.items.value.filter(item => !item.leaving).at(-1))\nconst announcement = computed(() => latest.value ? [latest.value.title, latest.value.description].filter(part => typeof part === 'string').join('. ') : '')\nconst urgent = computed(() => latest.value?.color === 'danger' || latest.value?.color === 'warning')\nconst ready = ref(false)\nonMounted(() => { ready.value = true })\nconst uid = useId().replace(/[^a-zA-Z0-9_-]/g, '')\nconst gooId = `modo-liquid-toast-goo-${uid}`\nconst tightId = `modo-liquid-toast-goo-tight-${uid}`\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius: () => props.radius, size: () => props.size })\nconst rootStyle = computed(() => [providerStyle.value, {\n '--modo-liquid-toast-goo': `url(#${gooId})`,\n '--modo-liquid-toast-goo-tight': `url(#${tightId})`,\n}])\n</script>\n<template>\n <Teleport v-if=\"ready\" to=\"body\">\n <div data-modo-liquid-toast-region=\"\" role=\"region\" :aria-label=\"ariaLabel ?? loc.liquidToast.region\" :data-modo-theme=\"scopedTheme\" :style=\"rootStyle\">\n <div aria-live=\"polite\" aria-atomic=\"true\" data-modo-announcer=\"\">{{ !urgent ? announcement : '' }}</div>\n <div aria-live=\"assertive\" aria-atomic=\"true\" data-modo-announcer=\"\">{{ urgent ? announcement : '' }}</div>\n <svg width=\"0\" height=\"0\" aria-hidden=\"true\" focusable=\"false\" style=\"position:absolute\">\n <defs>\n <filter :id=\"gooId\" color-interpolation-filters=\"sRGB\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"5\" result=\"blur\" /><feColorMatrix in=\"blur\" mode=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 40 -19\" /></filter>\n <filter :id=\"tightId\" color-interpolation-filters=\"sRGB\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"2\" result=\"blur\" /><feColorMatrix in=\"blur\" mode=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 40 -19\" /></filter>\n </defs>\n </svg>\n <div v-for=\"zone in zones\" :key=\"zone.placement\" data-modo-liquid-toaster=\"\" :data-modo-position=\"zone.placement\" :style=\"zoneStyle(zone.placement)\">\n <div v-for=\"(stack, index) in zone.stacks\" :key=\"index\" class=\"modo-liquid-toast-slot\">\n <LiquidToast v-for=\"(item, depth) in stack\" :key=\"item.id\" :item=\"item\" :peek=\"depth\"\n :default-duration=\"defaultDuration\" :default-variant=\"defaultVariant\" :radius=\"radius\" :size=\"size\"\n @dismiss=\"store.dismiss\" @remove=\"store.remove\" />\n </div>\n </div>\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToaster.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useId } from 'vue'\nimport type { LiquidToasterProps, LiquidToastItem, LiquidToastPlacement } from '../../../interfaces/feedback/LiquidToast.interface'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { liquidToast } from './liquidToast'\nimport LiquidToast from './LiquidToast.vue'\n\nconst props = withDefaults(defineProps<LiquidToasterProps>(), {\n placement: 'top-center', max: 1, defaultDuration:
|
|
1
|
+
{"version":3,"file":"LiquidToaster.mjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/LiquidToaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useId } from 'vue'\nimport type { LiquidToasterProps, LiquidToastItem, LiquidToastPlacement } from '../../../interfaces/feedback/LiquidToast.interface'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { liquidToast } from './liquidToast'\nimport LiquidToast from './LiquidToast.vue'\n\nconst props = withDefaults(defineProps<LiquidToasterProps>(), {\n placement: 'top-center', max: 1, defaultDuration: 4000, defaultVariant: 'liquid', offset: 16,\n})\nconst loc = useModoLocale()\nconst store = computed(() => props.controller ?? liquidToast)\nconst count = computed(() => Math.max(1, Math.floor(props.max) || 1))\nconst PLACEMENTS: LiquidToastPlacement[] = ['top-center', 'top-left', 'top-right', 'bottom-center', 'bottom-left', 'bottom-right']\n// One zone per placement in use; inside it the first `max` toasts are on stage\n// and the next two wait as peeks behind the last stage card.\nconst zones = computed(() => PLACEMENTS.map(placement => {\n const items = store.value.items.value.filter(item => (item.placement ?? props.placement) === placement)\n const visible = items.slice(0, count.value)\n const stacks: LiquidToastItem[][] = visible.map((item, index) => index === visible.length - 1 ? [item, ...items.slice(count.value, count.value + 2)] : [item])\n return { placement, stacks }\n}).filter(zone => zone.stacks.length))\nconst zoneStyle = (placement: LiquidToastPlacement) => {\n const o = `${props.offset}px`\n return {\n [placement.startsWith('top') ? 'top' : 'bottom']: placement.startsWith('top') ? `max(${o}, env(safe-area-inset-top))` : `max(${o}, env(safe-area-inset-bottom))`,\n ...(placement.endsWith('left') ? { left: o } : placement.endsWith('right') ? { right: o } : {}),\n }\n}\nconst latest = computed(() => store.value.items.value.filter(item => !item.leaving).at(-1))\nconst announcement = computed(() => latest.value ? [latest.value.title, latest.value.description].filter(part => typeof part === 'string').join('. ') : '')\nconst urgent = computed(() => latest.value?.color === 'danger' || latest.value?.color === 'warning')\nconst ready = ref(false)\nonMounted(() => { ready.value = true })\nconst uid = useId().replace(/[^a-zA-Z0-9_-]/g, '')\nconst gooId = `modo-liquid-toast-goo-${uid}`\nconst tightId = `modo-liquid-toast-goo-tight-${uid}`\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius: () => props.radius, size: () => props.size })\nconst rootStyle = computed(() => [providerStyle.value, {\n '--modo-liquid-toast-goo': `url(#${gooId})`,\n '--modo-liquid-toast-goo-tight': `url(#${tightId})`,\n}])\n</script>\n<template>\n <Teleport v-if=\"ready\" to=\"body\">\n <div data-modo-liquid-toast-region=\"\" role=\"region\" :aria-label=\"ariaLabel ?? loc.liquidToast.region\" :data-modo-theme=\"scopedTheme\" :style=\"rootStyle\">\n <div aria-live=\"polite\" aria-atomic=\"true\" data-modo-announcer=\"\">{{ !urgent ? announcement : '' }}</div>\n <div aria-live=\"assertive\" aria-atomic=\"true\" data-modo-announcer=\"\">{{ urgent ? announcement : '' }}</div>\n <svg width=\"0\" height=\"0\" aria-hidden=\"true\" focusable=\"false\" style=\"position:absolute\">\n <defs>\n <filter :id=\"gooId\" color-interpolation-filters=\"sRGB\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"5\" result=\"blur\" /><feColorMatrix in=\"blur\" mode=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 40 -19\" /></filter>\n <filter :id=\"tightId\" color-interpolation-filters=\"sRGB\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"2\" result=\"blur\" /><feColorMatrix in=\"blur\" mode=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 40 -19\" /></filter>\n </defs>\n </svg>\n <div v-for=\"zone in zones\" :key=\"zone.placement\" data-modo-liquid-toaster=\"\" :data-modo-position=\"zone.placement\" :style=\"zoneStyle(zone.placement)\">\n <div v-for=\"(stack, index) in zone.stacks\" :key=\"index\" class=\"modo-liquid-toast-slot\">\n <LiquidToast v-for=\"(item, depth) in stack\" :key=\"item.id\" :item=\"item\" :peek=\"depth\"\n :default-duration=\"defaultDuration\" :default-variant=\"defaultVariant\" :radius=\"radius\" :size=\"size\"\n @dismiss=\"store.dismiss\" @remove=\"store.remove\" />\n </div>\n </div>\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
|
package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.cjs
CHANGED
|
@@ -29,8 +29,8 @@ var LiquidToaster_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
29
29
|
props: {
|
|
30
30
|
placement: { default: "top-center" },
|
|
31
31
|
max: { default: 1 },
|
|
32
|
-
defaultDuration: { default:
|
|
33
|
-
defaultVariant: { default: "
|
|
32
|
+
defaultDuration: { default: 4e3 },
|
|
33
|
+
defaultVariant: { default: "liquid" },
|
|
34
34
|
offset: { default: 16 },
|
|
35
35
|
radius: {},
|
|
36
36
|
size: {},
|