mood-ui 0.13.0 → 0.14.0
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/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +6 -6
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Drawer.cjs.map +1 -1
- package/dist/components/feedback/Drawer.mjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +11 -7
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +17 -13
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Modal.cjs.map +1 -1
- package/dist/components/feedback/Modal.mjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +10 -3
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +16 -9
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Toast.cjs +1 -1
- package/dist/components/feedback/Toast.cjs.map +1 -1
- package/dist/components/feedback/Toast.mjs +1 -1
- package/dist/components/feedback/Toast.mjs.map +1 -1
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.cjs +4 -2
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.mjs +5 -3
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/ToastContainer.cjs +1 -1
- package/dist/components/feedback/ToastContainer.cjs.map +1 -1
- package/dist/components/feedback/ToastContainer.mjs +1 -1
- package/dist/components/feedback/ToastContainer.mjs.map +1 -1
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.cjs +4 -2
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.mjs +6 -4
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.cjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.mjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- 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/feedback/sheet/SheetTrigger.cjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.mjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
- package/dist/components/feedback/sheet/SheetTrigger.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/MorphSelect.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.cjs +53 -6
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.mjs +54 -7
- package/dist/components/forms/morph-select/MorphSelect.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 +36 -9
- 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 +37 -10
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContext.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContext.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 +39 -17
- 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 +40 -18
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +7 -0
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +7 -0
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/config/ModoLocale.cjs +4 -0
- package/dist/config/ModoLocale.cjs.map +1 -1
- package/dist/config/ModoLocale.mjs +4 -0
- package/dist/config/ModoLocale.mjs.map +1 -1
- package/dist/config/locales/es.cjs +4 -0
- package/dist/config/locales/es.cjs.map +1 -1
- package/dist/config/locales/es.mjs +4 -0
- package/dist/config/locales/es.mjs.map +1 -1
- package/dist/mood-ui.css +349 -115
- package/dist/types/components/feedback/liquid-toast/liquidToast.d.ts +1 -1
- package/dist/types/components/forms/morph-select/MorphSelect.vue.d.ts +8 -7
- package/dist/types/components/forms/morph-select/MorphSelectContext.d.ts +6 -1
- package/dist/types/components/forms/morph-select/MorphSelectTrigger.vue.d.ts +6 -3
- package/dist/types/components/forms/morph-select/index.d.ts +24 -18
- package/dist/types/config/ModoLocale.d.ts +6 -0
- package/dist/types/interfaces/feedback/Drawer.interface.d.ts +2 -0
- package/dist/types/interfaces/feedback/LiquidToast.interface.d.ts +9 -9
- package/dist/types/interfaces/feedback/Modal.interface.d.ts +2 -0
- package/dist/types/interfaces/feedback/MorphTooltip.interface.d.ts +4 -4
- package/dist/types/interfaces/forms/GlassSwitch.interface.d.ts +1 -1
- package/dist/types/interfaces/forms/ModeOrb.interface.d.ts +3 -3
- package/dist/types/interfaces/forms/MorphSelect.interface.d.ts +13 -5
- package/dist/types/utils/morph/morphHelpers.d.ts +6 -0
- package/dist/utils/morph/morphHelpers.cjs +16 -0
- package/dist/utils/morph/morphHelpers.cjs.map +1 -1
- package/dist/utils/morph/morphHelpers.mjs +16 -1
- package/dist/utils/morph/morphHelpers.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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,IA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AAU,QAAA,GAAA,IAAA,gBAAO,MAAA,MAAK;IACzH,gBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,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;;gCACoC,OAA3H,YAA2H,EAAA,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;;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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IAC1H,mBAAiB,MAAA;IAAQ,qBAAmB,QAAA,SAAW,KAAA;IACvD,kBAAgB,QAAA,QAAQ,KAAA;IAAY,eAAa,QAAA,OAAI,OAAU,KAAA;IAAY,OAAO,QAAA,OAAI,KAAQ,QAAA,KAAK;IAAU,QAAA,GAAA,IAAA,gBAAO,MAAA,MAAK;IACzH,gBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,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;;gCACoC,OAA3H,YAA2H,EAAA,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,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;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,QAAQ,gBAAgB;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,OAAO,IAAwB,KAAI;EACzC,MAAM,eAAe,MAAM,KAAK,UAAU,aAAa,MAAM,OAAO;EACpE,MAAM,QAAQ,eAAe,MAAM,OAAO,IAAI,SAAS,MAAM,KAAK,UAAU,YAAY,MAAM,KAA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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\" /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derContent 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":";;;;;;;;;;;;;;;;;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A,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAAwE,QAA9F,aAAA,GAAA,IAAA,iBAAmE,QAAA,KAAK,OAAO,MAAK,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;IACxE,QAAA,OAAO,QAAA,aAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAA6I,QAAhK,aAAgK,GAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAAP,QAAA;KAA9D,KAAG,OAAS,QAAA,KAAK;KAAY,OAAM"}
|
|
@@ -57,6 +57,7 @@ var LiquidToastShape_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
57
57
|
const props = __props;
|
|
58
58
|
const emit = __emit;
|
|
59
59
|
const glyphs = {
|
|
60
|
+
neutral: "M4 8h8",
|
|
60
61
|
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;E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"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: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToaster.vue_vue_type_script_setup_true_lang.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.vue_vue_type_script_setup_true_lang.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA,MAAM,QAAQ;EAGd,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,SAAA,GAAA,IAAA,gBAAuB,MAAM,cAAc,oBAAA,YAAW;EAC5D,MAAM,SAAA,GAAA,IAAA,gBAAuB,KAAK,IAAI,GAAG,KAAK,MAA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A,UAAA,OAAA,GAAA,IAAA,YANc,MAAA,QAAR,SAAI;8DAMV,OAAA;MANsB,KAAK,KAAK;MAAW,4BAAyB;MAAI,sBAAoB,KAAK;MAAY,QAAA,GAAA,IAAA,gBAAO,UAAU,KAAK,UAAS,CAAA;gEAK1I,IAAA,UAAA,OAAA,GAAA,IAAA,YAJwB,KAAK,SAAtB,OAAO,UAAK;+DAInB,OAAA;OAJsC,KAAK;OAAO,OAAM;iEAGR,IAAA,UAAA,OAAA,GAAA,IAAA,YAFf,QAAhB,MAAM,UAAK;yDAEoB,oBAAA,SAAA;QAFP,KAAK,KAAK;QAAW;QAAO,MAAM;QAC5E,oBAAkB,QAAA;QAAkB,mBAAiB,QAAA;QAAiB,QAAQ,QAAA;QAAS,MAAM,QAAA;QAC7F,WAAS,MAAA,MAAM;QAAU,UAAQ,MAAA,MAAM"}
|
package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.mjs
CHANGED
|
@@ -28,8 +28,8 @@ var LiquidToaster_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
28
28
|
props: {
|
|
29
29
|
placement: { default: "top-center" },
|
|
30
30
|
max: { default: 1 },
|
|
31
|
-
defaultDuration: { default:
|
|
32
|
-
defaultVariant: { default: "
|
|
31
|
+
defaultDuration: { default: 4e3 },
|
|
32
|
+
defaultVariant: { default: "liquid" },
|
|
33
33
|
offset: { default: 16 },
|
|
34
34
|
radius: {},
|
|
35
35
|
size: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidToaster.vue_vue_type_script_setup_true_lang.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.vue_vue_type_script_setup_true_lang.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA,MAAM,QAAQ;EAGd,MAAM,MAAM,eAAc;EAC1B,MAAM,QAAQ,eAAe,MAAM,cAAc,YAAW;EAC5D,MAAM,QAAQ,eAAe,KAAK,IAAI,GAAG,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,CAAA;EACpE,MAAM,aAAqC;GAAC;GAAc;GAAY;GAAa;GAAiB;GAAe;GAAc;EAGjI,MAAM,QAAQ,eAAe,WAAW,KAAI,cAAa;GACvD,MAAM,QAAQ,MAAM,MAAM,MAAM,MAAM,QAAO,UAAS,KAAK,aAAa,MAAM,eAAe,UAAS;GACtG,MAAM,UAAU,MAAM,MAAM,GAAG,MAAM,MAAK;GAE1C,OAAO;IAAE;IAAW,QADgB,QAAQ,KAAK,MAAM,UAAU,UAAU,QAAQ,SAAS,IAAI,CAAC,MAAM,GAAG,MAAM,MAAM,MAAM,OAAO,MAAM,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CACzI;IAAO;IAC3B,CAAC,QAAO,SAAQ,KAAK,OAAO,OAAO,CAAA;EACrC,MAAM,aAAa,cAAoC;GACrD,MAAM,IAAI,GAAG,MAAM,OAAO;GAC1B,OAAO;KACJ,UAAU,WAAW,MAAM,GAAG,QAAQ,WAAW,UAAU,WAAW,MAAM,GAAG,OAAO,EAAE,+BAA+B,OA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F,mBAKM,OALN,YAKM,CAJJ,mBAGO,QAAA,MAAA,CAFL,mBAAoO,UAAA;KAA3N,IAAI;KAAO,+BAA4B;sCAAO,mBAAoE,kBAAA;KAApD,IAAG;KAAgB,cAAa;KAAI,QAAO;kBAAS,mBAAgG,iBAAA;KAAjF,IAAG;KAAO,MAAK;KAAS,QAAO;sBACzK,mBAAsO,UAAA;KAA7N,IAAI;KAAS,+BAA4B;sCAAO,mBAAoE,kBAAA;KAApD,IAAG;KAAgB,cAAa;KAAI,QAAO;kBAAS,mBAAgG,iBAAA;KAAjF,IAAG;KAAO,MAAK;KAAS,QAAO;;sBAG/K,mBAMM,UAAA,MAAA,WANc,MAAA,QAAR,SAAI;yBAAhB,mBAMM,OAAA;MANsB,KAAK,KAAK;MAAW,4BAAyB;MAAI,sBAAoB,KAAK;MAAY,OAAK,eAAE,UAAU,KAAK,UAAS,CAAA;2BAChJ,mBAIM,UAAA,MAAA,WAJwB,KAAK,SAAtB,OAAO,UAAK;0BAAzB,mBAIM,OAAA;OAJsC,KAAK;OAAO,OAAM;4BAC5D,mBAEoD,UAAA,MAAA,WAFf,QAAhB,MAAM,UAAK;2BAAhC,YAEoD,qBAAA;QAFP,KAAK,KAAK;QAAW;QAAO,MAAM;QAC5E,oBAAkB,QAAA;QAAkB,mBAAiB,QAAA;QAAiB,QAAQ,QAAA;QAAS,MAAM,QAAA;QAC7F,WAAS,MAAA,MAAM;QAAU,UAAQ,MAAA,MAAM"}
|
|
@@ -20,7 +20,7 @@ function createLiquidToast() {
|
|
|
20
20
|
let nextId = 0;
|
|
21
21
|
function push(options) {
|
|
22
22
|
const { id: wanted, ...data } = normalize(options);
|
|
23
|
-
const color = data.color ?? "
|
|
23
|
+
const color = data.color ?? "neutral";
|
|
24
24
|
const same = wanted !== void 0 ? items.value.find((item) => item.id === wanted && !item.leaving) : void 0;
|
|
25
25
|
const twin = same ?? (wanted === void 0 ? items.value.find((item) => !item.leaving && typeof item.title === "string" && item.title === data.title && item.description === data.description && item.color === color) : void 0);
|
|
26
26
|
if (twin) {
|
|
@@ -58,7 +58,7 @@ function createLiquidToast() {
|
|
|
58
58
|
}
|
|
59
59
|
/** Plays the exit morph, then removes. No-op for unknown ids. */
|
|
60
60
|
function dismiss(id) {
|
|
61
|
-
items.value = items.value.map((item) => item.id === id ? {
|
|
61
|
+
items.value = items.value.map((item) => id === void 0 || item.id === id ? {
|
|
62
62
|
...item,
|
|
63
63
|
leaving: true
|
|
64
64
|
} : item);
|
|
@@ -79,7 +79,7 @@ function createLiquidToast() {
|
|
|
79
79
|
...resolve(messages.success, result)
|
|
80
80
|
}), (error) => update(id, {
|
|
81
81
|
color: "danger",
|
|
82
|
-
duration:
|
|
82
|
+
duration: 5e3,
|
|
83
83
|
...resolve(messages.error, error)
|
|
84
84
|
})).catch(() => dismiss(id));
|
|
85
85
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquidToast2.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/liquidToast.ts"],"sourcesContent":["import { shallowReadonly, shallowRef } from 'vue'\nimport type { LiquidToastColor, LiquidToastItem, LiquidToastOptions } from '../../../interfaces/feedback/LiquidToast.interface'\n\ntype Input = string | LiquidToastOptions\ntype Message<T> = Input | ((value: T) => Input)\nconst normalize = (value: Input): LiquidToastOptions => typeof value === 'string' ? { title: value } : value\nconst resolve = <T>(message: Message<T>, value: T) => normalize(typeof message === 'function' ? message(value) : message)\nconst withColor = (input: Omit<LiquidToastOptions, 'color'> | string, color: LiquidToastColor): LiquidToastOptions =>\n typeof input === 'string' ? { title: input, color } : { ...input, color }\n\n/**\n * Create per-app/per-request state. Mirrors `useToast()` (`push`, `info`,\n * `success`, `warning`, `danger`, `dismiss`, `dismissAll`, id replace) plus\n * `update` and `promise`. The default singleton only accepts browser calls.\n */\nexport function createLiquidToast() {\n const items = shallowRef<LiquidToastItem[]>([])\n let nextId = 0\n function push(options: Input): string | number {\n const { id: wanted, ...data } = normalize(options)\n const color = data.color ?? '
|
|
1
|
+
{"version":3,"file":"liquidToast2.cjs","names":[],"sources":["../../../../src/components/feedback/liquid-toast/liquidToast.ts"],"sourcesContent":["import { shallowReadonly, shallowRef } from 'vue'\nimport type { LiquidToastColor, LiquidToastItem, LiquidToastOptions } from '../../../interfaces/feedback/LiquidToast.interface'\n\ntype Input = string | LiquidToastOptions\ntype Message<T> = Input | ((value: T) => Input)\nconst normalize = (value: Input): LiquidToastOptions => typeof value === 'string' ? { title: value } : value\nconst resolve = <T>(message: Message<T>, value: T) => normalize(typeof message === 'function' ? message(value) : message)\nconst withColor = (input: Omit<LiquidToastOptions, 'color'> | string, color: LiquidToastColor): LiquidToastOptions =>\n typeof input === 'string' ? { title: input, color } : { ...input, color }\n\n/**\n * Create per-app/per-request state. Mirrors `useToast()` (`push`, `info`,\n * `success`, `warning`, `danger`, `dismiss`, `dismissAll`, id replace) plus\n * `update` and `promise`. The default singleton only accepts browser calls.\n */\nexport function createLiquidToast() {\n const items = shallowRef<LiquidToastItem[]>([])\n let nextId = 0\n function push(options: Input): string | number {\n const { id: wanted, ...data } = normalize(options)\n const color = data.color ?? 'neutral'\n // Same id → replace in place (keeps its stage slot, replays the update morph).\n const same = wanted !== undefined ? items.value.find(item => item.id === wanted && !item.leaving) : undefined\n // Same plain-text message fired again → coalesce into the visible one.\n const twin = same ?? (wanted === undefined\n ? items.value.find(item => !item.leaving && typeof item.title === 'string' && item.title === data.title && item.description === data.description && item.color === color)\n : undefined)\n if (twin) {\n items.value = items.value.map(item => item.id === twin.id\n ? { ...(same ? data : item), id: item.id, color: same ? color : item.color, revision: item.revision + 1, leaving: false }\n : item)\n return twin.id\n }\n const id = wanted ?? ++nextId\n items.value = [...items.value.filter(item => item.id !== id), { ...data, id, color, revision: 0, leaving: false }]\n return id\n }\n function update(id: string | number, patch: Partial<LiquidToastOptions>) {\n const { id: _ignored, ...rest } = patch\n items.value = items.value.map(item => item.id === id && !item.leaving ? { ...item, ...rest, loading: rest.loading ?? false, revision: item.revision + 1 } : item)\n }\n /** Removes immediately (after the exit morph has played). */\n function remove(id: string | number) { items.value = items.value.filter(item => item.id !== id) }\n /** Plays the exit morph, then removes. No-op for unknown ids. */\n function dismiss(id?: string | number) {\n items.value = items.value.map(item => id === undefined || item.id === id ? { ...item, leaving: true } : item)\n }\n /** Clears the stage and the queue at once. */\n function dismissAll() { items.value = [] }\n function promise<T>(value: Promise<T>, messages: { loading: Input; success: Message<T>; error: Message<unknown> }): Promise<T> {\n const id = push({ ...normalize(messages.loading), loading: true, duration: 0 })\n void value.then(\n result => update(id, { color: 'success', duration: undefined, ...resolve(messages.success, result) }),\n error => update(id, { color: 'danger', duration: 5000, ...resolve(messages.error, error) }),\n ).catch(() => dismiss(id))\n return value\n }\n return Object.assign(push, {\n items: shallowReadonly(items), push, update, dismiss, dismissAll, remove, promise,\n info: (input: Omit<LiquidToastOptions, 'color'> | string) => push(withColor(input, 'info')),\n success: (input: Omit<LiquidToastOptions, 'color'> | string) => push(withColor(input, 'success')),\n warning: (input: Omit<LiquidToastOptions, 'color'> | string) => push(withColor(input, 'warning')),\n danger: (input: Omit<LiquidToastOptions, 'color'> | string) => push(withColor(input, 'danger')),\n })\n}\nexport type LiquidToastController = ReturnType<typeof createLiquidToast>\nconst browserStore = createLiquidToast()\nconst isServer = () => typeof window === 'undefined'\n/** Call from event handlers/onMounted. Server calls intentionally do not enqueue shared state. */\nexport const liquidToast: LiquidToastController = Object.assign(\n (options: Input) => isServer() ? -1 : browserStore(options),\n {\n ...browserStore,\n push: (options: Input) => isServer() ? -1 : browserStore.push(options),\n info: (input: Omit<LiquidToastOptions, 'color'> | string) => isServer() ? -1 : browserStore.info(input),\n success: (input: Omit<LiquidToastOptions, 'color'> | string) => isServer() ? -1 : browserStore.success(input),\n warning: (input: Omit<LiquidToastOptions, 'color'> | string) => isServer() ? -1 : browserStore.warning(input),\n danger: (input: Omit<LiquidToastOptions, 'color'> | string) => isServer() ? -1 : browserStore.danger(input),\n promise: <T>(value: Prom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