@wow-two-beta/fe 0.0.22 → 0.0.24
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/auth/AuthBridge.d.ts +15 -0
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +47 -8
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/providers/AuthProvider.vue.d.ts +1 -1
- package/dist/chunks/{SidebarMenuSection.vue_vue_type_script_setup_true_lang-CIEgYHl_.js → AppSwitcherMenu.vue_vue_type_script_setup_true_lang-DVqdOOst.js} +641 -226
- package/dist/chunks/AppSwitcherMenu.vue_vue_type_script_setup_true_lang-DVqdOOst.js.map +1 -0
- package/dist/chunks/Breakpoints-CltjxN0E.js +32 -0
- package/dist/chunks/Breakpoints-CltjxN0E.js.map +1 -0
- package/dist/chunks/{DrawerContent.vue_vue_type_script_setup_true_lang-C17R6SMV.js → DrawerContent.vue_vue_type_script_setup_true_lang-CZQnfNGk.js} +4 -12
- package/dist/chunks/DrawerContent.vue_vue_type_script_setup_true_lang-CZQnfNGk.js.map +1 -0
- package/dist/chunks/{ErrorBoundary.vue_vue_type_script_setup_true_lang-DBPGTzwk.js → ErrorBoundary.vue_vue_type_script_setup_true_lang-LRQbVAiW.js} +2 -2
- package/dist/chunks/{ErrorBoundary.vue_vue_type_script_setup_true_lang-DBPGTzwk.js.map → ErrorBoundary.vue_vue_type_script_setup_true_lang-LRQbVAiW.js.map} +1 -1
- package/dist/chunks/{KanbanCard.vue_vue_type_script_setup_true_lang-BolubhiV.js → KanbanCard.vue_vue_type_script_setup_true_lang-B_NmyVkE.js} +2 -2
- package/dist/chunks/{KanbanCard.vue_vue_type_script_setup_true_lang-BolubhiV.js.map → KanbanCard.vue_vue_type_script_setup_true_lang-B_NmyVkE.js.map} +1 -1
- package/dist/chunks/{LightboxModal.vue_vue_type_script_setup_true_lang-HSUZqn0g.js → LightboxModal.vue_vue_type_script_setup_true_lang-Dm79L1eK.js} +71 -477
- package/dist/chunks/LightboxModal.vue_vue_type_script_setup_true_lang-Dm79L1eK.js.map +1 -0
- package/dist/chunks/ListboxPicker.variants-hiMcl66_.js +44 -0
- package/dist/chunks/ListboxPicker.variants-hiMcl66_.js.map +1 -0
- package/dist/chunks/{MasonryLayout.vue_vue_type_script_setup_true_lang-CKhBN2SC.js → MasonryLayout.vue_vue_type_script_setup_true_lang-TuNWahLw.js} +2 -2
- package/dist/chunks/{MasonryLayout.vue_vue_type_script_setup_true_lang-CKhBN2SC.js.map → MasonryLayout.vue_vue_type_script_setup_true_lang-TuNWahLw.js.map} +1 -1
- package/dist/chunks/{MentionInput.vue_vue_type_script_setup_true_lang-C7X9NYpR.js → MentionInput.vue_vue_type_script_setup_true_lang-DdT24dkW.js} +12 -5
- package/dist/chunks/MentionInput.vue_vue_type_script_setup_true_lang-DdT24dkW.js.map +1 -0
- package/dist/chunks/OverlayChrome-BqRpuYX5.js +13 -0
- package/dist/chunks/OverlayChrome-BqRpuYX5.js.map +1 -0
- package/dist/chunks/OverlayCloseButton.vue_vue_type_script_setup_true_lang-D01KYAAn.js +429 -0
- package/dist/chunks/OverlayCloseButton.vue_vue_type_script_setup_true_lang-D01KYAAn.js.map +1 -0
- package/dist/chunks/{PopoverContent.vue_vue_type_script_setup_true_lang-hfb8AAVv.js → PopoverContent.vue_vue_type_script_setup_true_lang-BIHYpwzT.js} +2 -43
- package/dist/chunks/PopoverContent.vue_vue_type_script_setup_true_lang-BIHYpwzT.js.map +1 -0
- package/dist/chunks/{ToastHost.vue_vue_type_script_setup_true_lang-Xr-kmwgK.js → ToastHost.vue_vue_type_script_setup_true_lang-p0bfXJ9l.js} +2 -1
- package/dist/chunks/{ToastHost.vue_vue_type_script_setup_true_lang-Xr-kmwgK.js.map → ToastHost.vue_vue_type_script_setup_true_lang-p0bfXJ9l.js.map} +1 -1
- package/dist/chunks/{Tooltip.vue_vue_type_script_setup_true_lang-AzuqiFWY.js → Tooltip.vue_vue_type_script_setup_true_lang-vsFDijcV.js} +3 -2
- package/dist/chunks/{Tooltip.vue_vue_type_script_setup_true_lang-AzuqiFWY.js.map → Tooltip.vue_vue_type_script_setup_true_lang-vsFDijcV.js.map} +1 -1
- package/dist/feedback/FeedbackQueryErrors.d.ts +4 -3
- package/dist/feedback/FeedbackSessionExpiry.d.ts +5 -0
- package/dist/feedback/index.d.ts +1 -0
- package/dist/feedback/index.js +13 -1
- package/dist/feedback/index.js.map +1 -1
- package/dist/foundation/device/index.js +3 -27
- package/dist/foundation/device/index.js.map +1 -1
- package/dist/foundation/http/CreateApiClient.d.ts +1 -0
- package/dist/foundation/http/index.js +5 -1
- package/dist/foundation/http/index.js.map +1 -1
- package/dist/index.js +221 -217
- package/dist/index.js.map +1 -1
- package/dist/presentation/display/index.js +1 -1
- package/dist/presentation/feedback/index.js +2 -2
- package/dist/presentation/feedback/toastHost/index.js +1 -1
- package/dist/presentation/forms/index.js +2 -2
- package/dist/presentation/forms/passwordInput/PasswordInput.vue.d.ts +4 -0
- package/dist/presentation/layout/index.js +1 -1
- package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.d.ts +81 -0
- package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenuExtensions.d.ts +8 -0
- package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenuPanel.vue.d.ts +25 -0
- package/dist/presentation/nav/appSwitcherMenu/index.d.ts +1 -0
- package/dist/presentation/nav/index.d.ts +1 -0
- package/dist/presentation/nav/index.js +72 -70
- package/dist/presentation/overlays/index.js +55 -54
- package/dist/presentation/overlays/index.js.map +1 -1
- package/dist/router/adapters/vueRouter/Guards.d.ts +6 -1
- package/dist/router/adapters/vueRouter/index.d.ts +1 -1
- package/dist/router/index.js +8 -0
- package/dist/router/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/DrawerContent.vue_vue_type_script_setup_true_lang-C17R6SMV.js.map +0 -1
- package/dist/chunks/LightboxModal.vue_vue_type_script_setup_true_lang-HSUZqn0g.js.map +0 -1
- package/dist/chunks/MentionInput.vue_vue_type_script_setup_true_lang-C7X9NYpR.js.map +0 -1
- package/dist/chunks/PopoverContent.vue_vue_type_script_setup_true_lang-hfb8AAVv.js.map +0 -1
- package/dist/chunks/SidebarMenuSection.vue_vue_type_script_setup_true_lang-CIEgYHl_.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastHost.vue_vue_type_script_setup_true_lang-Xr-kmwgK.js","sources":["../../src/presentation/feedback/toastSimple/ToastSimple.vue","../../src/presentation/feedback/toast/Toast.vue","../../src/presentation/feedback/toastHost/ToastHost.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Severity } from '../../../foundation/styles';\n\n/** Represents the prop surface of `ToastSimple`. */\nexport interface ToastSimpleProps {\n /** The semantic severity palette. */\n readonly severity?: Severity;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, useTemplateRef } from 'vue';\nimport { cn, surfaceVariants } from '../../../foundation/styles';\nimport type { Tone } from '../../../foundation/styles';\nimport type { ToastSimpleVariants } from './ToastSimple.variants';\n\n/** Maps the toast `severity` keyword to a SurfaceStyles `tone`. */\nconst SeverityToTone: Record<NonNullable<ToastSimpleVariants['severity']>, Tone> = {\n info: 'info',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n neutral: 'neutral',\n};\n\n/**\n * Renders the atomic toast card — a single tone-driven notification around free-form children.\n *\n * `role=\"status\"` + `aria-live=\"polite\"` are the live-region contract; `role` is\n * bound before `v-bind=\"rest\"` so a caller-supplied `role` still wins.\n */\ndefineOptions({ name: 'ToastSimple', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastSimpleProps>(), { severity: 'neutral' });\n\ndefineSlots<{\n /** The toast content. */\n default?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\nconst classes = computed(() =>\n cn(\n 'pointer-events-auto text-sm',\n surfaceVariants({\n variant: 'surface',\n tone: SeverityToTone[props.severity],\n radius: 'md',\n padding: 'md',\n elevation: 3,\n }),\n attrs.class as string | undefined,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <div ref=\"el\" role=\"status\" aria-live=\"polite\" v-bind=\"rest\" :class=\"classes\"><slot /></div>\n</template>\n","<script lang=\"ts\">\nimport type { Severity } from '../../../foundation/styles';\n\nexport interface ToastProps {\n /** The semantic severity palette. */\n readonly severity?: Severity;\n /** The optional leading icon. Rich content → the `icon` slot. */\n readonly icon?: string;\n /** The bold heading line. Rich content → the `title` slot. */\n readonly title?: string;\n /** The body text below the title. Rich content → the `description` slot. */\n readonly description?: string;\n /** The action area below the body. Rich content → the `actions` slot. */\n readonly actions?: string;\n /** The accessible label for the close button. Default `\"Dismiss\"`. */\n readonly closeLabel?: string;\n /** The accessible label for removing a retained notice. Default \"Delete notification\". */\n readonly deleteLabel?: string;\n /**\n * Shows the severity's own glyph when no `icon` is given — a distinct shape per severity, so the meaning\n * never rests on colour alone. `neutral` has none. Default `true`.\n */\n readonly showSeverityIcon?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { computed, getCurrentInstance, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { Trash2, X } from 'lucide-vue-next';\nimport { cn, Severity as SeverityToken } from '../../../foundation/styles';\nimport { Icon, SeverityIconClasses, SeverityIcons } from '../../../foundation/icons';\nimport ToastSimple from '../toastSimple/ToastSimple.vue';\n\nconst CloseIcon = X;\n\n/**\n * Renders a toast card — icon, title, description, actions, and a close button.\n * Visual only (queue / portal / lifecycle land with `ToastHost` at L5); the atom is `ToastSimple`.\n *\n * Each of React's four `ReactNode` props keeps its string form and gains a\n * same-named slot for rich content; the slot wins when both are supplied.\n */\ndefineOptions({ name: 'Toast', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<ToastProps>(), { showSeverityIcon: true });\nconst props = useLocaleDefaults(componentProps, 'Toast', { closeLabel: 'Dismiss', deleteLabel: 'Delete notification' });\n\n/** Replaces React's `onClose`; omitting `@close` omits the close button. */\nconst emit = defineEmits<{\n /** Fires when the close button is activated. */\n close: [];\n /** Fires when the delete icon is activated; only rendered when bound for retained notices. */\n delete: [];\n}>();\n\ndefineSlots<{\n /** The extra content below the description. */\n default?(): unknown;\n /** The leading icon. Falls back to the `icon` prop. */\n icon?(): unknown;\n /** The heading line. Falls back to the `title` prop. */\n title?(): unknown;\n /** The body text below the title. Falls back to the `description` prop. */\n description?(): unknown;\n /** The action row. Falls back to the `actions` prop. */\n actions?(): unknown;\n /** The adornment beside the close button — a countdown, a timestamp. */\n trailing?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst instance = getCurrentInstance();\nconst inner = useTemplateRef<InstanceType<typeof ToastSimple>>('inner');\n\n/**\n * Mirrors React's `onClose && <button/>` guard — the close button renders only\n * when the consumer bound `@close`. Read through a call, not a cached computed:\n * `instance.vnode` is replaced on every re-render.\n */\nconst hasClose = () => Boolean(instance?.vnode.props?.onClose);\nconst hasDelete = () => Boolean(instance?.vnode.props?.onDelete);\n\n/**\n * The glyph standing in for a missing `icon` — `null` when switched off, or for a neutral toast. An `icon`\n * slot replaces it as the slot's fallback content, so slot presence stays out of this cached value.\n */\nconst severityIcon = computed(() =>\n props.showSeverityIcon && !props.icon ? SeverityIcons[props.severity ?? SeverityToken.Neutral] : null,\n);\nconst severityIconClass = computed(() => SeverityIconClasses[props.severity ?? SeverityToken.Neutral]);\n\n/*\n * Slot presence is read through calls, not cached computeds: `slots` is not reactive, and a host that updates a\n * toast in place (a promise settling, a dedup refresh) adds or drops slots between renders.\n */\nconst hasIcon = () => Boolean(props.icon) || Boolean(slots.icon) || severityIcon.value !== null;\nconst hasTitle = () => Boolean(props.title) || Boolean(slots.title);\nconst hasDescription = () => Boolean(props.description) || Boolean(slots.description);\nconst hasActions = () => Boolean(props.actions) || Boolean(slots.actions);\n\nconst classes = computed(() => cn('flex items-start gap-3', attrs.class as string | undefined));\n\nconst descriptionClasses = () => cn('text-sm', hasTitle() && 'mt-0.5 text-muted-foreground');\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** Re-exposes the underlying `ToastSimple` root element, matching React's forwarded ref. */\nconst el = computed(() => inner.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <ToastSimple ref=\"inner\" :severity=\"props.severity\" v-bind=\"rest\" :class=\"classes\">\n <span v-if=\"hasIcon()\" data-toast-icon class=\"mt-0.5 shrink-0\">\n <slot name=\"icon\">\n <Icon v-if=\"severityIcon\" :icon=\"severityIcon\" :size=\"16\" :class=\"severityIconClass\" />\n <template v-else>{{ props.icon }}</template>\n </slot>\n </span>\n <div class=\"min-w-0 flex-1\">\n <div v-if=\"hasTitle()\" class=\"font-medium\">\n <slot name=\"title\">{{ props.title }}</slot>\n </div>\n <div v-if=\"hasDescription()\" :class=\"descriptionClasses()\">\n <slot name=\"description\">{{ props.description }}</slot>\n </div>\n <div v-if=\"hasActions()\" class=\"mt-2 flex flex-wrap items-center gap-2\">\n <slot name=\"actions\">{{ props.actions }}</slot>\n </div>\n <slot />\n </div>\n <span v-if=\"slots.trailing\" class=\"flex h-5 shrink-0 items-center\">\n <slot name=\"trailing\" />\n </span>\n <button\n v-if=\"hasDelete()\"\n type=\"button\"\n :aria-label=\"props.deleteLabel\"\n class=\"grid h-6 w-6 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring\"\n @click=\"emit('delete')\"\n >\n <Icon :icon=\"Trash2\" :size=\"14\" />\n </button>\n <button\n v-if=\"hasClose()\"\n type=\"button\"\n :aria-label=\"props.closeLabel\"\n class=\"-mr-1 grid h-6 w-6 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring\"\n @click=\"emit('close')\"\n >\n <Icon :icon=\"CloseIcon\" :size=\"14\" />\n </button>\n </ToastSimple>\n</template>\n","<script lang=\"ts\">\nimport type { VNode } from 'vue';\nimport type { OverlayPosition } from '../../../foundation/styles';\nimport type { ReportSend } from '../../../reporting';\nimport type { ToastSimpleVariants } from '../toastSimple/ToastSimple.variants';\n\nexport type ToastSeverity = NonNullable<ToastSimpleVariants['severity']>;\n\n/** Defines how a toast shows the time left before it dismisses itself. */\nexport const ToastTimer = {\n /** Refers to no countdown — the toast still expires on time. */\n None: 'none',\n /** Refers to a bar draining along the toast's bottom edge. */\n Bar: 'bar',\n /** Refers to a ring draining beside the close button. */\n Ring: 'ring',\n /** Refers to the whole seconds left, counted beside the close button. */\n Seconds: 'seconds',\n} as const;\n\nexport type ToastTimer = (typeof ToastTimer)[keyof typeof ToastTimer];\n\n/** Provides the per-severity expiry a `ToastHost` starts from — an error stays long enough to read and report. */\nexport const DefaultToastDurations: Readonly<Partial<Record<ToastSeverity, number>>> = Object.freeze({\n danger: 8000,\n});\n\n/**\n * A renderable slice of a toast. These travel through the imperative\n * `toastHost.toast()` payload, not through a slot, so a caller who wants\n * markup builds it with `h()`.\n */\nexport type ToastNode = string | VNode;\n\nexport interface ToastOptions {\n title?: ToastNode;\n description?: ToastNode;\n icon?: ToastNode;\n severity?: ToastSeverity;\n /**\n * ms before auto-dismiss. Default: the ToastHost's `durations` entry for the severity, then its\n * `defaultDuration`. `Infinity` = sticky.\n */\n duration?: number;\n action?: ToastNode;\n /**\n * Sends a one-click report of the failure this toast shows; the toast renders a Report action that walks\n * sending → reported (with the reference) → retry on failure. Pairs with `/reporting`'s `capture(error).send`.\n */\n report?: ReportSend;\n /** Shows the severity's own glyph when no `icon` is given. Default: the ToastHost's `showSeverityIcon`. */\n showSeverityIcon?: boolean;\n /**\n * Fully custom body — replaces the default `Toast` chrome (icon/title/description/close).\n * Still animates + auto-dismisses; the content owns its close via the returned id.\n */\n content?: ToastNode;\n /**\n * Fired when the toast is removed — auto-dismiss, close button, `dismiss(id)`, or `dismissAll()`.\n * Not fired on a dedup-update. For undo cleanup / analytics.\n */\n onDismiss?: () => void;\n /** Deletes an explicitly retained notification; omitted for transient toasts. */\n onDelete?: () => void;\n /**\n * Dedup key — a `toast` whose `key` is already showing updates that toast in place,\n * refreshing its timer instead of stacking a duplicate.\n */\n key?: string;\n /** How this toast shows its time left. Default: the ToastHost's `timer`. */\n timer?: ToastTimer;\n /**\n * Shows or hides this toast's countdown bar.\n * @deprecated Use `timer` — `ToastTimer.Bar` or `ToastTimer.None`.\n */\n progress?: boolean;\n}\n\n/** Content for a `toastHost.promise` phase — a title string, or a full partial options object. */\nexport type ToastContent = string | Partial<ToastOptions>;\n\n/**\n * Options for `toastHost.promise` — loading / success / error content\n * (success + error may be a fn of the settled value).\n */\nexport interface ToastPromiseOptions<T> {\n loading: ToastContent;\n success: ToastContent | ((value: T) => ToastContent);\n error: ToastContent | ((err: unknown) => ToastContent);\n /** Auto-dismiss (ms) for the settled toast; defaults to the ToastHost's `defaultDuration`. */\n duration?: number;\n}\n\nfunction normalizeContent(content: ToastContent): Partial<ToastOptions> {\n return typeof content === 'string' ? { title: content } : content;\n}\n\ninterface ToastEntry extends ToastOptions {\n id: string;\n /** Bumped on every `update` / dedup so the viewport can reset that toast's auto-dismiss timer. */\n nonce: number;\n}\n\ntype Listener = (toasts: ReadonlyArray<ToastEntry>) => void;\n\nclass ToastHostStore {\n private items: ReadonlyArray<ToastEntry> = [];\n private listeners = new Set<Listener>();\n private idSeq = 0;\n\n toast(opts: ToastOptions): string {\n if (opts.key !== undefined) {\n const existing = this.items.find((t) => t.key === opts.key);\n if (existing) {\n this.update(existing.id, opts);\n return existing.id;\n }\n }\n const id = `t_${++this.idSeq}`;\n this.items = [...this.items, { id, ...opts, nonce: 0 }];\n this.emit();\n return id;\n }\n\n /** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */\n update(id: string, patch: Partial<ToastOptions>): void {\n this.items = this.items.map((t) => (t.id === id ? { ...t, ...patch, nonce: t.nonce + 1 } : t));\n this.emit();\n }\n\n /** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */\n promise<T>(promise: Promise<T>, opts: ToastPromiseOptions<T>): Promise<T> {\n const id = this.toast({ ...normalizeContent(opts.loading), severity: 'info', duration: Infinity });\n const settle = (content: ToastContent, severity: ToastSeverity) =>\n this.update(id, { ...normalizeContent(content), severity, duration: opts.duration });\n return promise.then(\n (value) => {\n settle(typeof opts.success === 'function' ? opts.success(value) : opts.success, 'success');\n return value;\n },\n (err: unknown) => {\n settle(typeof opts.error === 'function' ? opts.error(err) : opts.error, 'danger');\n throw err;\n },\n );\n }\n\n dismiss(id: string): void {\n const entry = this.items.find((t) => t.id === id);\n this.items = this.items.filter((t) => t.id !== id);\n try {\n entry?.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n dismissAll(): void {\n const gone = this.items;\n this.items = [];\n try {\n for (const t of gone) t.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n subscribe(fn: Listener): () => void {\n this.listeners.add(fn);\n fn(this.items);\n return () => {\n this.listeners.delete(fn);\n };\n }\n\n private emit() {\n for (const fn of this.listeners) fn(this.items);\n }\n}\n\nexport const toastHost = new ToastHostStore();\n\n/**\n * The imperative toast API, bound to the app-wide store. A plain object — the\n * store is a module singleton, so there is nothing per-instance to memoize.\n */\nexport function useToastHost() {\n return {\n toast: (opts: ToastOptions) => toastHost.toast(opts),\n update: (id: string, patch: Partial<ToastOptions>) => toastHost.update(id, patch),\n promise: <T,>(promise: Promise<T>, opts: ToastPromiseOptions<T>) => toastHost.promise(promise, opts),\n dismiss: (id: string) => toastHost.dismiss(id),\n dismissAll: () => toastHost.dismissAll(),\n };\n}\n\nconst PositionClasses = 'top-4 right-4 items-end';\n\n/** Toasts enter from the right; reduced-motion users get an instant swap. */\nconst MotionClasses =\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-right) motion-safe:data-[state=closed]:animate-(--animate-slide-out-right) motion-reduce:animate-none';\n\nexport interface ToastHostProps {\n /** @deprecated Toasts always anchor top-right. Accepted for one release, without changing placement. */\n readonly position?: OverlayPosition;\n readonly max?: number;\n /**\n * The auto-dismiss delay in ms for a severity missing from `durations`; per-toast `duration` overrides.\n * Default 5000. `Infinity` to disable.\n */\n readonly defaultDuration?: number;\n /**\n * The auto-dismiss delay in ms per severity; per-toast `duration` overrides, and a severity left out falls\n * back to `defaultDuration`. Default `DefaultToastDurations` — errors stay 8 seconds. Replaces, never merges.\n */\n readonly durations?: Readonly<Partial<Record<ToastSeverity, number>>>;\n readonly canPauseOnHover?: boolean;\n readonly gap?: number;\n /**\n * How each auto-dismissing toast shows its time left; a toast's `timer` overrides. Every display pauses with\n * the expiry timer and restarts when the toast updates; sticky toasts show none, and reduced motion drops the\n * bar and the ring. Custom `content` has no close button to sit beside, so it takes the bar for a ring or\n * seconds. Default `ToastTimer.None`.\n */\n readonly timer?: ToastTimer;\n /**\n * Shows a countdown bar along the bottom of each auto-dismissing toast.\n * @deprecated Use `timer` — `ToastTimer.Bar`.\n */\n readonly showProgress?: boolean;\n /** Shows each severity's glyph on toasts given no `icon`; a toast's `showSeverityIcon` overrides. Default `true`. */\n readonly showSeverityIcon?: boolean;\n}\n\ninterface VisibleToast extends ToastEntry {\n resolvedDuration: number;\n}\n\n/** Countdown fill per severity; the neutral countdown uses the brand primary. */\nconst ProgressClasses: Record<ToastSeverity, string> = {\n neutral: 'bg-primary',\n info: 'bg-info',\n success: 'bg-success',\n warning: 'bg-warning',\n danger: 'bg-destructive',\n};\n\n/** Countdown-ring stroke per severity — the bar's tones, drawn as an arc. */\nconst RingClasses: Record<ToastSeverity, string> = {\n neutral: 'stroke-primary',\n info: 'stroke-info',\n success: 'stroke-success',\n warning: 'stroke-warning',\n danger: 'stroke-destructive',\n};\n\n/** The ring's radius in the 16×16 view box; the circumference is the dash the countdown drains. */\nconst RingRadius = 6;\nconst RingCircumference = 2 * Math.PI * RingRadius;\n\n/** How often the seconds display re-reads its clock — a quarter second keeps a whole-second flip on time. */\nconst SecondsTickMs = 250;\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport {\n computed,\n defineComponent,\n h,\n onMounted,\n onUnmounted,\n ref,\n shallowRef,\n useAttrs,\n watch,\n type PropType,\n} from 'vue';\nimport { cn, OverlayPosition as OverlayPositionToken } from '../../../foundation/styles';\nimport { Announce, Portal, Presence } from '../../../foundation/primitives';\nimport Toast from '../toast/Toast.vue';\nimport ReportAction from '../reportAction/ReportAction.vue';\n\nconst locale = useLocale();\n\n/** Renders a `ToastNode` — either a plain string or a caller-built VNode. */\nconst ToastNodeView = defineComponent({\n name: 'ToastNodeView',\n props: { node: { type: [String, Object] as PropType<ToastNode>, required: true } },\n setup: (nodeProps) => () => nodeProps.node,\n});\n\n/** The props every countdown display shares — it mirrors the host's expiry timer, never drives it. */\nconst CountdownProps = {\n duration: { type: Number, required: true },\n paused: { type: Boolean, default: false },\n severity: { type: String as PropType<ToastSeverity>, default: 'neutral' },\n} as const;\n\n/**\n * Runs one Web Animations API countdown on a template ref, paused and resumed in step with the host's expiry\n * timer; environments without `animate` leave the element static at full.\n */\nfunction useCountdownAnimation(\n element: () => Element | null,\n keyframes: Keyframe[],\n countdown: { readonly duration: number; readonly paused: boolean },\n): void {\n let animation: Animation | undefined;\n onMounted(() => {\n const target = element();\n if (!target || typeof target.animate !== 'function') return;\n animation = target.animate(keyframes, { duration: countdown.duration, easing: 'linear', fill: 'forwards' });\n if (countdown.paused) animation.pause();\n });\n watch(\n () => countdown.paused,\n (isPaused) => {\n if (isPaused) animation?.pause();\n else animation?.play();\n },\n );\n onUnmounted(() => animation?.cancel());\n}\n\n/** The countdown bar — a scale transform draining along the toast's bottom edge. */\nconst ToastProgress = defineComponent({\n name: 'ToastProgress',\n props: CountdownProps,\n setup(countdown) {\n const fill = ref<HTMLElement | null>(null);\n useCountdownAnimation(() => fill.value, [{ transform: 'scaleX(1)' }, { transform: 'scaleX(0)' }], countdown);\n return () =>\n h(\n 'div',\n {\n 'aria-hidden': 'true',\n 'data-toast-progress': '',\n class: 'absolute inset-x-0 bottom-0 h-1 motion-reduce:hidden',\n },\n [\n h('div', {\n ref: fill,\n class: cn('h-full w-full origin-left opacity-80', ProgressClasses[countdown.severity]),\n }),\n ],\n );\n },\n});\n\n/** The countdown ring — an arc draining clockwise from twelve o'clock, drawn beside the close button. */\nconst ToastRing = defineComponent({\n name: 'ToastRing',\n props: CountdownProps,\n setup(countdown) {\n const arc = ref<SVGCircleElement | null>(null);\n useCountdownAnimation(\n () => arc.value,\n [{ strokeDashoffset: '0' }, { strokeDashoffset: `${RingCircumference}` }],\n countdown,\n );\n return () =>\n h(\n 'svg',\n {\n 'aria-hidden': 'true',\n 'data-toast-timer': ToastTimer.Ring,\n viewBox: '0 0 16 16',\n class: 'size-4 -rotate-90 motion-reduce:hidden',\n },\n [\n h('circle', { cx: 8, cy: 8, r: RingRadius, fill: 'none', 'stroke-width': 2, class: 'stroke-border' }),\n h('circle', {\n ref: arc,\n cx: 8,\n cy: 8,\n r: RingRadius,\n fill: 'none',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'stroke-dasharray': `${RingCircumference}`,\n class: RingClasses[countdown.severity],\n }),\n ],\n );\n },\n});\n\n/**\n * The seconds display — the whole seconds left, rounded up so it reads `1s` until the toast goes. It keeps its\n * own clock, advancing only while unpaused; the announcement region already carries the toast, so it is hidden.\n */\nconst ToastSeconds = defineComponent({\n name: 'ToastSeconds',\n props: CountdownProps,\n setup(countdown) {\n const left = ref(countdown.duration);\n let lastTick = 0;\n let handle: number | undefined;\n const tick = () => {\n const now = Date.now();\n left.value = Math.max(0, left.value - (now - lastTick));\n lastTick = now;\n };\n const start = () => {\n if (handle !== undefined) return;\n lastTick = Date.now();\n handle = window.setInterval(tick, SecondsTickMs);\n };\n const stop = () => {\n if (handle === undefined) return;\n tick();\n window.clearInterval(handle);\n handle = undefined;\n };\n onMounted(() => {\n if (!countdown.paused) start();\n });\n watch(\n () => countdown.paused,\n (isPaused) => (isPaused ? stop() : start()),\n );\n onUnmounted(() => {\n if (handle !== undefined) window.clearInterval(handle);\n });\n return () =>\n h(\n 'span',\n {\n 'aria-hidden': 'true',\n 'data-toast-timer': ToastTimer.Seconds,\n class: 'text-xs tabular-nums text-muted-foreground',\n },\n `${Math.ceil(left.value / 1000)}s`,\n );\n },\n});\n\n/**\n * Renders the toast viewport — subscribes to the global `toastHost` store and stacks `Toast` cards.\n * Mount once, per app.\n *\n * A caller's `class` attr lands on the stack container.\n */\ndefineOptions({ name: 'ToastHost', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastHostProps>(), {\n position: OverlayPositionToken.TopRight,\n max: 5,\n defaultDuration: 5000,\n durations: () => DefaultToastDurations,\n canPauseOnHover: true,\n gap: 8,\n timer: undefined,\n showProgress: false,\n showSeverityIcon: true,\n});\n\nconst attrs = useAttrs();\n\nconst items = shallowRef<ReadonlyArray<ToastEntry>>([]);\nconst hovered = ref(false);\nconst focused = ref(false);\nconst paused = computed(() => props.canPauseOnHover && (hovered.value || focused.value));\n\n/* Non-reactive state — mutated across ticks, never rendered. */\nconst timers = new Map<string, number>();\nconst remaining = new Map<string, number>();\nconst startedAt = new Map<string, number>();\nconst nonces = new Map<string, number>();\n\nlet unsubscribe: (() => void) | undefined;\nonMounted(() => {\n unsubscribe = toastHost.subscribe((next) => {\n items.value = next;\n });\n});\n\n// Visible window (FIFO).\nconst visible = computed<ReadonlyArray<VisibleToast>>(() =>\n items.value.slice(0, props.max).map((t) => ({\n ...t,\n resolvedDuration: t.duration ?? props.durations[t.severity ?? 'neutral'] ?? props.defaultDuration,\n })),\n);\nconst visibleIds = computed(() => new Set(visible.value.map((v) => v.id)));\n\n// Toasts that just left `visible` (dismissed, or pushed out of the FIFO\n// window) but must still play their exit animation. Kept mounted with\n// `data-state=\"closed\"` until `Presence` unmounts the child — the `@vue:unmounted`\n// hook below then prunes the entry here.\nconst exiting = shallowRef<ReadonlyArray<VisibleToast>>([]);\nlet prevVisible: ReadonlyArray<VisibleToast> = [];\n\nwatch(\n visibleIds,\n (ids) => {\n const gone = prevVisible.filter((p) => !ids.has(p.id));\n prevVisible = visible.value;\n const current = exiting.value;\n const known = new Set(current.map((e) => e.id));\n // Add newly-gone toasts; drop any that re-entered `visible`.\n const merged = [...current, ...gone.filter((g) => !known.has(g.id))].filter((e) => !ids.has(e.id));\n if (merged.length !== current.length || !merged.every((e, i) => e.id === current[i]?.id)) {\n exiting.value = merged;\n }\n },\n { immediate: true, flush: 'post' },\n);\n\nconst removeExiting = (id: string) => {\n exiting.value = exiting.value.filter((e) => e.id !== id);\n};\n\n// Visible (present) first, then the ones animating out.\nconst rendered = computed<Array<VisibleToast & { present: boolean }>>(() => [\n ...visible.value.map((v) => ({ ...v, present: true })),\n ...exiting.value.map((e) => ({ ...e, present: false })),\n]);\n\nconst latestTitle = computed(() => {\n const last = visible.value[visible.value.length - 1];\n if (typeof last?.title === 'string') return last.title;\n if (typeof last?.description === 'string') return last.description;\n return '';\n});\n\n// Schedule auto-dismiss timers.\nwatch(\n [items, () => props.max, () => props.defaultDuration, () => props.durations, paused],\n () => {\n const ids = visibleIds.value;\n // Clear timers for items that are no longer visible.\n for (const [id, handle] of timers) {\n if (!ids.has(id)) {\n window.clearTimeout(handle);\n timers.delete(id);\n remaining.delete(id);\n startedAt.delete(id);\n }\n }\n for (const id of nonces.keys()) {\n if (!ids.has(id)) nonces.delete(id);\n }\n if (paused.value) return;\n // A content update / dedup bumps `nonce` — clear that toast's timer so it reschedules fresh.\n for (const v of visible.value) {\n const seen = nonces.get(v.id);\n if (seen !== undefined && seen !== v.nonce) {\n const handle = timers.get(v.id);\n if (handle !== undefined) window.clearTimeout(handle);\n timers.delete(v.id);\n remaining.delete(v.id);\n startedAt.delete(v.id);\n }\n nonces.set(v.id, v.nonce);\n }\n for (const v of visible.value) {\n if (v.resolvedDuration === Infinity) continue;\n if (timers.has(v.id)) continue;\n const left = remaining.get(v.id) ?? v.resolvedDuration;\n const handle = window.setTimeout(() => {\n toastHost.dismiss(v.id);\n }, left);\n timers.set(v.id, handle);\n startedAt.set(v.id, Date.now());\n remaining.set(v.id, left);\n }\n },\n { immediate: true, flush: 'post' },\n);\n\n// Cleanup on unmount.\nonUnmounted(() => {\n unsubscribe?.();\n for (const handle of timers.values()) window.clearTimeout(handle);\n timers.clear();\n});\n\nwatch(\n paused,\n (isPaused) => {\n if (!isPaused) return;\n for (const [id, handle] of timers) {\n window.clearTimeout(handle);\n const start = startedAt.get(id) ?? Date.now();\n remaining.set(id, Math.max(0, (remaining.get(id) ?? 0) - (Date.now() - start)));\n }\n timers.clear();\n },\n { flush: 'sync' },\n);\n\nwatch(\n () => rendered.value.length,\n (count) => {\n if (count === 0) {\n hovered.value = false;\n focused.value = false;\n }\n },\n);\n\nfunction onFocusout(event: FocusEvent): void {\n const stack = event.currentTarget as HTMLElement;\n if (!(event.relatedTarget instanceof Node) || !stack.contains(event.relatedTarget)) focused.value = false;\n}\n\nconst stackClasses = computed(() =>\n cn('pointer-events-none fixed z-toast flex flex-col', PositionClasses, attrs.class as string | undefined),\n);\n\nconst itemClasses = computed(() => cn('pointer-events-auto relative w-80 overflow-hidden rounded-md', MotionClasses));\n\n/** The display a toast asked for — its own `timer`, its deprecated `progress`, then the host's two. */\nfunction requestedTimer(t: VisibleToast): ToastTimer {\n if (t.timer !== undefined) return t.timer;\n if (t.progress !== undefined) return t.progress ? ToastTimer.Bar : ToastTimer.None;\n if (props.timer !== undefined) return props.timer;\n return props.showProgress ? ToastTimer.Bar : ToastTimer.None;\n}\n\n/**\n * The display a toast gets — none while exiting or sticky, and the bar for custom `content`, which has no close\n * button for a ring or seconds to sit beside.\n */\nfunction timerFor(t: VisibleToast & { present: boolean }): ToastTimer {\n if (!t.present || !Number.isFinite(t.resolvedDuration)) return ToastTimer.None;\n const requested = requestedTimer(t);\n return t.content && requested !== ToastTimer.None ? ToastTimer.Bar : requested;\n}\n\n/** Whether a toast's display sits beside the close button rather than along the bottom edge. */\nconst isTrailingTimer = (timer: ToastTimer): boolean => timer === ToastTimer.Ring || timer === ToastTimer.Seconds;\n\n/** Vue does not auto-suffix numeric style values with `px`. */\nconst stackStyle = computed(() => ({ gap: `${props.gap}px` }));\n</script>\n\n<template>\n <Portal>\n <div\n v-if=\"rendered.length > 0\"\n :aria-label=\"locale.t('ToastHost.notifications', undefined, 'Notifications')\"\n :style=\"stackStyle\"\n :class=\"stackClasses\"\n @mouseenter=\"hovered = true\"\n @mouseleave=\"hovered = false\"\n @focusin=\"focused = true\"\n @focusout=\"onFocusout\"\n >\n <Presence v-for=\"t in rendered\" :key=\"t.id\" :is-present=\"t.present\">\n <!--\n `Presence` clones `data-state` onto this node and keeps it mounted\n until the exit animation ends; the `@vue:unmounted` hook is that\n \"exit finished\" signal (the read-only `Presence` API exposes no\n callback).\n -->\n <div :class=\"itemClasses\" @vue:unmounted=\"t.present ? undefined : removeExiting(t.id)\">\n <ToastNodeView v-if=\"t.content\" :node=\"t.content\" />\n <Toast\n v-else\n :severity=\"t.severity\"\n :show-severity-icon=\"t.showSeverityIcon ?? props.showSeverityIcon\"\n v-on=\"t.onDelete ? { delete: t.onDelete } : {}\"\n @close=\"toastHost.dismiss(t.id)\"\n >\n <template v-if=\"t.icon\" #icon><ToastNodeView :node=\"t.icon\" /></template>\n <template v-if=\"t.title\" #title><ToastNodeView :node=\"t.title\" /></template>\n <template v-if=\"t.description\" #description>\n <ToastNodeView :node=\"t.description\" />\n </template>\n <template v-if=\"t.action || t.report\" #actions>\n <ToastNodeView v-if=\"t.action\" :node=\"t.action\" />\n <ReportAction v-if=\"t.report\" :send=\"t.report\" />\n </template>\n <template v-if=\"isTrailingTimer(timerFor(t))\" #trailing>\n <ToastRing\n v-if=\"timerFor(t) === ToastTimer.Ring\"\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n <ToastSeconds\n v-else\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n </template>\n </Toast>\n <ToastProgress\n v-if=\"timerFor(t) === ToastTimer.Bar\"\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n </div>\n </Presence>\n </div>\n <Announce politeness=\"polite\">{{ latestTitle }}</Announce>\n </Portal>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_renderSlot","SeverityToken","_createBlock","ToastSimple","_unref","_hoisted_1","Icon","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","_hoisted_2","_createVNode","Portal","_renderList","Toast","_toHandlers","ReportAction","Announce"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,UAAM,iBAA6E;AAAA,MACjF,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,IAAA;AAWX,UAAM,QAAQ;AAOd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA+B,IAAI;AAE9C,UAAM,UAAU;AAAA,MAAS,MACvB;AAAA,QACE;AAAA,QACA,gBAAgB;AAAA,UACd,SAAS;AAAA,UACT,MAAM,eAAe,MAAM,QAAQ;AAAA,UACnC,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,WAAW;AAAA,QAAA,CACZ;AAAA,QACD,MAAM;AAAA,MAAA;AAAA,IACR;AAIF,UAAM,OAAO,SAAS,MAAM;AAC1B,YAAM,EAAE,OAAO,QAAQ,GAAG,WAAW;AACrC,aAAO;AAAA,IACT,CAAC;AAED,aAAa,EAAE,IAAI;;AAIjB,aAAAA,UAAA,GAAAC,mBAA4F,OAA5FC,WAA4F;AAAA,iBA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CAAC,MAAM,WAAW,oBADnCF,YAMEE,MAAA,aAAA,GAAA;AAAA,sBAJC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK;AAAA,sBACvB,UAAU,EAAE;AAAA,sBACZ,QAAQ,OAAA;AAAA,sBACR,UAAU,EAAE,YAAQ;AAAA,oBAAA;;;;;;;UAK7BQ,YAA0DR,MAAAc,WAAA,GAAA,EAAhD,YAAW,YAAQ;AAAA,6BAAC,MAAiB;AAAA,8CAAd,YAAA,KAAW,GAAA,CAAA;AAAA,YAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ToastHost.vue_vue_type_script_setup_true_lang-p0bfXJ9l.js","sources":["../../src/presentation/feedback/toastSimple/ToastSimple.vue","../../src/presentation/feedback/toast/Toast.vue","../../src/presentation/feedback/toastHost/ToastHost.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Severity } from '../../../foundation/styles';\n\n/** Represents the prop surface of `ToastSimple`. */\nexport interface ToastSimpleProps {\n /** The semantic severity palette. */\n readonly severity?: Severity;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, useTemplateRef } from 'vue';\nimport { cn, surfaceVariants } from '../../../foundation/styles';\nimport type { Tone } from '../../../foundation/styles';\nimport type { ToastSimpleVariants } from './ToastSimple.variants';\n\n/** Maps the toast `severity` keyword to a SurfaceStyles `tone`. */\nconst SeverityToTone: Record<NonNullable<ToastSimpleVariants['severity']>, Tone> = {\n info: 'info',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n neutral: 'neutral',\n};\n\n/**\n * Renders the atomic toast card — a single tone-driven notification around free-form children.\n *\n * `role=\"status\"` + `aria-live=\"polite\"` are the live-region contract; `role` is\n * bound before `v-bind=\"rest\"` so a caller-supplied `role` still wins.\n */\ndefineOptions({ name: 'ToastSimple', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastSimpleProps>(), { severity: 'neutral' });\n\ndefineSlots<{\n /** The toast content. */\n default?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\nconst classes = computed(() =>\n cn(\n 'pointer-events-auto text-sm',\n surfaceVariants({\n variant: 'surface',\n tone: SeverityToTone[props.severity],\n radius: 'md',\n padding: 'md',\n elevation: 3,\n }),\n attrs.class as string | undefined,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <div ref=\"el\" role=\"status\" aria-live=\"polite\" v-bind=\"rest\" :class=\"classes\"><slot /></div>\n</template>\n","<script lang=\"ts\">\nimport type { Severity } from '../../../foundation/styles';\n\nexport interface ToastProps {\n /** The semantic severity palette. */\n readonly severity?: Severity;\n /** The optional leading icon. Rich content → the `icon` slot. */\n readonly icon?: string;\n /** The bold heading line. Rich content → the `title` slot. */\n readonly title?: string;\n /** The body text below the title. Rich content → the `description` slot. */\n readonly description?: string;\n /** The action area below the body. Rich content → the `actions` slot. */\n readonly actions?: string;\n /** The accessible label for the close button. Default `\"Dismiss\"`. */\n readonly closeLabel?: string;\n /** The accessible label for removing a retained notice. Default \"Delete notification\". */\n readonly deleteLabel?: string;\n /**\n * Shows the severity's own glyph when no `icon` is given — a distinct shape per severity, so the meaning\n * never rests on colour alone. `neutral` has none. Default `true`.\n */\n readonly showSeverityIcon?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { computed, getCurrentInstance, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { Trash2, X } from 'lucide-vue-next';\nimport { cn, Severity as SeverityToken } from '../../../foundation/styles';\nimport { Icon, SeverityIconClasses, SeverityIcons } from '../../../foundation/icons';\nimport ToastSimple from '../toastSimple/ToastSimple.vue';\n\nconst CloseIcon = X;\n\n/**\n * Renders a toast card — icon, title, description, actions, and a close button.\n * Visual only (queue / portal / lifecycle land with `ToastHost` at L5); the atom is `ToastSimple`.\n *\n * Each of React's four `ReactNode` props keeps its string form and gains a\n * same-named slot for rich content; the slot wins when both are supplied.\n */\ndefineOptions({ name: 'Toast', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<ToastProps>(), { showSeverityIcon: true });\nconst props = useLocaleDefaults(componentProps, 'Toast', { closeLabel: 'Dismiss', deleteLabel: 'Delete notification' });\n\n/** Replaces React's `onClose`; omitting `@close` omits the close button. */\nconst emit = defineEmits<{\n /** Fires when the close button is activated. */\n close: [];\n /** Fires when the delete icon is activated; only rendered when bound for retained notices. */\n delete: [];\n}>();\n\ndefineSlots<{\n /** The extra content below the description. */\n default?(): unknown;\n /** The leading icon. Falls back to the `icon` prop. */\n icon?(): unknown;\n /** The heading line. Falls back to the `title` prop. */\n title?(): unknown;\n /** The body text below the title. Falls back to the `description` prop. */\n description?(): unknown;\n /** The action row. Falls back to the `actions` prop. */\n actions?(): unknown;\n /** The adornment beside the close button — a countdown, a timestamp. */\n trailing?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst instance = getCurrentInstance();\nconst inner = useTemplateRef<InstanceType<typeof ToastSimple>>('inner');\n\n/**\n * Mirrors React's `onClose && <button/>` guard — the close button renders only\n * when the consumer bound `@close`. Read through a call, not a cached computed:\n * `instance.vnode` is replaced on every re-render.\n */\nconst hasClose = () => Boolean(instance?.vnode.props?.onClose);\nconst hasDelete = () => Boolean(instance?.vnode.props?.onDelete);\n\n/**\n * The glyph standing in for a missing `icon` — `null` when switched off, or for a neutral toast. An `icon`\n * slot replaces it as the slot's fallback content, so slot presence stays out of this cached value.\n */\nconst severityIcon = computed(() =>\n props.showSeverityIcon && !props.icon ? SeverityIcons[props.severity ?? SeverityToken.Neutral] : null,\n);\nconst severityIconClass = computed(() => SeverityIconClasses[props.severity ?? SeverityToken.Neutral]);\n\n/*\n * Slot presence is read through calls, not cached computeds: `slots` is not reactive, and a host that updates a\n * toast in place (a promise settling, a dedup refresh) adds or drops slots between renders.\n */\nconst hasIcon = () => Boolean(props.icon) || Boolean(slots.icon) || severityIcon.value !== null;\nconst hasTitle = () => Boolean(props.title) || Boolean(slots.title);\nconst hasDescription = () => Boolean(props.description) || Boolean(slots.description);\nconst hasActions = () => Boolean(props.actions) || Boolean(slots.actions);\n\nconst classes = computed(() => cn('flex items-start gap-3', attrs.class as string | undefined));\n\nconst descriptionClasses = () => cn('text-sm', hasTitle() && 'mt-0.5 text-muted-foreground');\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** Re-exposes the underlying `ToastSimple` root element, matching React's forwarded ref. */\nconst el = computed(() => inner.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <ToastSimple ref=\"inner\" :severity=\"props.severity\" v-bind=\"rest\" :class=\"classes\">\n <span v-if=\"hasIcon()\" data-toast-icon class=\"mt-0.5 shrink-0\">\n <slot name=\"icon\">\n <Icon v-if=\"severityIcon\" :icon=\"severityIcon\" :size=\"16\" :class=\"severityIconClass\" />\n <template v-else>{{ props.icon }}</template>\n </slot>\n </span>\n <div class=\"min-w-0 flex-1\">\n <div v-if=\"hasTitle()\" class=\"font-medium\">\n <slot name=\"title\">{{ props.title }}</slot>\n </div>\n <div v-if=\"hasDescription()\" :class=\"descriptionClasses()\">\n <slot name=\"description\">{{ props.description }}</slot>\n </div>\n <div v-if=\"hasActions()\" class=\"mt-2 flex flex-wrap items-center gap-2\">\n <slot name=\"actions\">{{ props.actions }}</slot>\n </div>\n <slot />\n </div>\n <span v-if=\"slots.trailing\" class=\"flex h-5 shrink-0 items-center\">\n <slot name=\"trailing\" />\n </span>\n <button\n v-if=\"hasDelete()\"\n type=\"button\"\n :aria-label=\"props.deleteLabel\"\n class=\"grid h-6 w-6 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring\"\n @click=\"emit('delete')\"\n >\n <Icon :icon=\"Trash2\" :size=\"14\" />\n </button>\n <button\n v-if=\"hasClose()\"\n type=\"button\"\n :aria-label=\"props.closeLabel\"\n class=\"-mr-1 grid h-6 w-6 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring\"\n @click=\"emit('close')\"\n >\n <Icon :icon=\"CloseIcon\" :size=\"14\" />\n </button>\n </ToastSimple>\n</template>\n","<script lang=\"ts\">\nimport type { VNode } from 'vue';\nimport type { OverlayPosition } from '../../../foundation/styles';\nimport type { ReportSend } from '../../../reporting';\nimport type { ToastSimpleVariants } from '../toastSimple/ToastSimple.variants';\n\nexport type ToastSeverity = NonNullable<ToastSimpleVariants['severity']>;\n\n/** Defines how a toast shows the time left before it dismisses itself. */\nexport const ToastTimer = {\n /** Refers to no countdown — the toast still expires on time. */\n None: 'none',\n /** Refers to a bar draining along the toast's bottom edge. */\n Bar: 'bar',\n /** Refers to a ring draining beside the close button. */\n Ring: 'ring',\n /** Refers to the whole seconds left, counted beside the close button. */\n Seconds: 'seconds',\n} as const;\n\nexport type ToastTimer = (typeof ToastTimer)[keyof typeof ToastTimer];\n\n/** Provides the per-severity expiry a `ToastHost` starts from — an error stays long enough to read and report. */\nexport const DefaultToastDurations: Readonly<Partial<Record<ToastSeverity, number>>> = Object.freeze({\n danger: 8000,\n});\n\n/**\n * A renderable slice of a toast. These travel through the imperative\n * `toastHost.toast()` payload, not through a slot, so a caller who wants\n * markup builds it with `h()`.\n */\nexport type ToastNode = string | VNode;\n\nexport interface ToastOptions {\n title?: ToastNode;\n description?: ToastNode;\n icon?: ToastNode;\n severity?: ToastSeverity;\n /**\n * ms before auto-dismiss. Default: the ToastHost's `durations` entry for the severity, then its\n * `defaultDuration`. `Infinity` = sticky.\n */\n duration?: number;\n action?: ToastNode;\n /**\n * Sends a one-click report of the failure this toast shows; the toast renders a Report action that walks\n * sending → reported (with the reference) → retry on failure. Pairs with `/reporting`'s `capture(error).send`.\n */\n report?: ReportSend;\n /** Shows the severity's own glyph when no `icon` is given. Default: the ToastHost's `showSeverityIcon`. */\n showSeverityIcon?: boolean;\n /**\n * Fully custom body — replaces the default `Toast` chrome (icon/title/description/close).\n * Still animates + auto-dismisses; the content owns its close via the returned id.\n */\n content?: ToastNode;\n /**\n * Fired when the toast is removed — auto-dismiss, close button, `dismiss(id)`, or `dismissAll()`.\n * Not fired on a dedup-update. For undo cleanup / analytics.\n */\n onDismiss?: () => void;\n /** Deletes an explicitly retained notification; omitted for transient toasts. */\n onDelete?: () => void;\n /**\n * Dedup key — a `toast` whose `key` is already showing updates that toast in place,\n * refreshing its timer instead of stacking a duplicate.\n */\n key?: string;\n /** How this toast shows its time left. Default: the ToastHost's `timer`. */\n timer?: ToastTimer;\n /**\n * Shows or hides this toast's countdown bar.\n * @deprecated Use `timer` — `ToastTimer.Bar` or `ToastTimer.None`.\n */\n progress?: boolean;\n}\n\n/** Content for a `toastHost.promise` phase — a title string, or a full partial options object. */\nexport type ToastContent = string | Partial<ToastOptions>;\n\n/**\n * Options for `toastHost.promise` — loading / success / error content\n * (success + error may be a fn of the settled value).\n */\nexport interface ToastPromiseOptions<T> {\n loading: ToastContent;\n success: ToastContent | ((value: T) => ToastContent);\n error: ToastContent | ((err: unknown) => ToastContent);\n /** Auto-dismiss (ms) for the settled toast; defaults to the ToastHost's `defaultDuration`. */\n duration?: number;\n}\n\nfunction normalizeContent(content: ToastContent): Partial<ToastOptions> {\n return typeof content === 'string' ? { title: content } : content;\n}\n\ninterface ToastEntry extends ToastOptions {\n id: string;\n /** Bumped on every `update` / dedup so the viewport can reset that toast's auto-dismiss timer. */\n nonce: number;\n}\n\ntype Listener = (toasts: ReadonlyArray<ToastEntry>) => void;\n\nclass ToastHostStore {\n private items: ReadonlyArray<ToastEntry> = [];\n private listeners = new Set<Listener>();\n private idSeq = 0;\n\n toast(opts: ToastOptions): string {\n if (opts.key !== undefined) {\n const existing = this.items.find((t) => t.key === opts.key);\n if (existing) {\n this.update(existing.id, opts);\n return existing.id;\n }\n }\n const id = `t_${++this.idSeq}`;\n this.items = [...this.items, { id, ...opts, nonce: 0 }];\n this.emit();\n return id;\n }\n\n /** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */\n update(id: string, patch: Partial<ToastOptions>): void {\n this.items = this.items.map((t) => (t.id === id ? { ...t, ...patch, nonce: t.nonce + 1 } : t));\n this.emit();\n }\n\n /** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */\n promise<T>(promise: Promise<T>, opts: ToastPromiseOptions<T>): Promise<T> {\n const id = this.toast({ ...normalizeContent(opts.loading), severity: 'info', duration: Infinity });\n const settle = (content: ToastContent, severity: ToastSeverity) =>\n this.update(id, { ...normalizeContent(content), severity, duration: opts.duration });\n return promise.then(\n (value) => {\n settle(typeof opts.success === 'function' ? opts.success(value) : opts.success, 'success');\n return value;\n },\n (err: unknown) => {\n settle(typeof opts.error === 'function' ? opts.error(err) : opts.error, 'danger');\n throw err;\n },\n );\n }\n\n dismiss(id: string): void {\n const entry = this.items.find((t) => t.id === id);\n this.items = this.items.filter((t) => t.id !== id);\n try {\n entry?.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n dismissAll(): void {\n const gone = this.items;\n this.items = [];\n try {\n for (const t of gone) t.onDismiss?.();\n } finally {\n this.emit();\n }\n }\n\n subscribe(fn: Listener): () => void {\n this.listeners.add(fn);\n fn(this.items);\n return () => {\n this.listeners.delete(fn);\n };\n }\n\n private emit() {\n for (const fn of this.listeners) fn(this.items);\n }\n}\n\nexport const toastHost = new ToastHostStore();\n\n/**\n * The imperative toast API, bound to the app-wide store. A plain object — the\n * store is a module singleton, so there is nothing per-instance to memoize.\n */\nexport function useToastHost() {\n return {\n toast: (opts: ToastOptions) => toastHost.toast(opts),\n update: (id: string, patch: Partial<ToastOptions>) => toastHost.update(id, patch),\n promise: <T,>(promise: Promise<T>, opts: ToastPromiseOptions<T>) => toastHost.promise(promise, opts),\n dismiss: (id: string) => toastHost.dismiss(id),\n dismissAll: () => toastHost.dismissAll(),\n };\n}\n\nconst PositionClasses = 'top-4 right-4 items-end';\n\n/** Toasts enter from the right; reduced-motion users get an instant swap. */\nconst MotionClasses =\n 'motion-safe:data-[state=open]:animate-(--animate-slide-in-right) motion-safe:data-[state=closed]:animate-(--animate-slide-out-right) motion-reduce:animate-none';\n\nexport interface ToastHostProps {\n /** @deprecated Toasts always anchor top-right. Accepted for one release, without changing placement. */\n readonly position?: OverlayPosition;\n readonly max?: number;\n /**\n * The auto-dismiss delay in ms for a severity missing from `durations`; per-toast `duration` overrides.\n * Default 5000. `Infinity` to disable.\n */\n readonly defaultDuration?: number;\n /**\n * The auto-dismiss delay in ms per severity; per-toast `duration` overrides, and a severity left out falls\n * back to `defaultDuration`. Default `DefaultToastDurations` — errors stay 8 seconds. Replaces, never merges.\n */\n readonly durations?: Readonly<Partial<Record<ToastSeverity, number>>>;\n readonly canPauseOnHover?: boolean;\n readonly gap?: number;\n /**\n * How each auto-dismissing toast shows its time left; a toast's `timer` overrides. Every display pauses with\n * the expiry timer and restarts when the toast updates; sticky toasts show none, and reduced motion drops the\n * bar and the ring. Custom `content` has no close button to sit beside, so it takes the bar for a ring or\n * seconds. Default `ToastTimer.None`.\n */\n readonly timer?: ToastTimer;\n /**\n * Shows a countdown bar along the bottom of each auto-dismissing toast.\n * @deprecated Use `timer` — `ToastTimer.Bar`.\n */\n readonly showProgress?: boolean;\n /** Shows each severity's glyph on toasts given no `icon`; a toast's `showSeverityIcon` overrides. Default `true`. */\n readonly showSeverityIcon?: boolean;\n}\n\ninterface VisibleToast extends ToastEntry {\n resolvedDuration: number;\n}\n\n/** Countdown fill per severity; the neutral countdown uses the brand primary. */\nconst ProgressClasses: Record<ToastSeverity, string> = {\n neutral: 'bg-primary',\n info: 'bg-info',\n success: 'bg-success',\n warning: 'bg-warning',\n danger: 'bg-destructive',\n};\n\n/** Countdown-ring stroke per severity — the bar's tones, drawn as an arc. */\nconst RingClasses: Record<ToastSeverity, string> = {\n neutral: 'stroke-primary',\n info: 'stroke-info',\n success: 'stroke-success',\n warning: 'stroke-warning',\n danger: 'stroke-destructive',\n};\n\n/** The ring's radius in the 16×16 view box; the circumference is the dash the countdown drains. */\nconst RingRadius = 6;\nconst RingCircumference = 2 * Math.PI * RingRadius;\n\n/** How often the seconds display re-reads its clock — a quarter second keeps a whole-second flip on time. */\nconst SecondsTickMs = 250;\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport {\n computed,\n defineComponent,\n h,\n onMounted,\n onUnmounted,\n ref,\n shallowRef,\n useAttrs,\n watch,\n type PropType,\n} from 'vue';\nimport { cn, OverlayPosition as OverlayPositionToken } from '../../../foundation/styles';\nimport { Announce, Portal, Presence } from '../../../foundation/primitives';\nimport Toast from '../toast/Toast.vue';\nimport ReportAction from '../reportAction/ReportAction.vue';\n\nconst locale = useLocale();\n\n/** Renders a `ToastNode` — either a plain string or a caller-built VNode. */\nconst ToastNodeView = defineComponent({\n name: 'ToastNodeView',\n props: { node: { type: [String, Object] as PropType<ToastNode>, required: true } },\n setup: (nodeProps) => () => nodeProps.node,\n});\n\n/** The props every countdown display shares — it mirrors the host's expiry timer, never drives it. */\nconst CountdownProps = {\n duration: { type: Number, required: true },\n paused: { type: Boolean, default: false },\n severity: { type: String as PropType<ToastSeverity>, default: 'neutral' },\n} as const;\n\n/**\n * Runs one Web Animations API countdown on a template ref, paused and resumed in step with the host's expiry\n * timer; environments without `animate` leave the element static at full.\n */\nfunction useCountdownAnimation(\n element: () => Element | null,\n keyframes: Keyframe[],\n countdown: { readonly duration: number; readonly paused: boolean },\n): void {\n let animation: Animation | undefined;\n onMounted(() => {\n const target = element();\n if (!target || typeof target.animate !== 'function') return;\n animation = target.animate(keyframes, { duration: countdown.duration, easing: 'linear', fill: 'forwards' });\n if (countdown.paused) animation.pause();\n });\n watch(\n () => countdown.paused,\n (isPaused) => {\n if (isPaused) animation?.pause();\n else animation?.play();\n },\n );\n onUnmounted(() => animation?.cancel());\n}\n\n/** The countdown bar — a scale transform draining along the toast's bottom edge. */\nconst ToastProgress = defineComponent({\n name: 'ToastProgress',\n props: CountdownProps,\n setup(countdown) {\n const fill = ref<HTMLElement | null>(null);\n useCountdownAnimation(() => fill.value, [{ transform: 'scaleX(1)' }, { transform: 'scaleX(0)' }], countdown);\n return () =>\n h(\n 'div',\n {\n 'aria-hidden': 'true',\n 'data-toast-progress': '',\n class: 'absolute inset-x-0 bottom-0 h-1 motion-reduce:hidden',\n },\n [\n h('div', {\n ref: fill,\n class: cn('h-full w-full origin-left opacity-80', ProgressClasses[countdown.severity]),\n }),\n ],\n );\n },\n});\n\n/** The countdown ring — an arc draining clockwise from twelve o'clock, drawn beside the close button. */\nconst ToastRing = defineComponent({\n name: 'ToastRing',\n props: CountdownProps,\n setup(countdown) {\n const arc = ref<SVGCircleElement | null>(null);\n useCountdownAnimation(\n () => arc.value,\n [{ strokeDashoffset: '0' }, { strokeDashoffset: `${RingCircumference}` }],\n countdown,\n );\n return () =>\n h(\n 'svg',\n {\n 'aria-hidden': 'true',\n 'data-toast-timer': ToastTimer.Ring,\n viewBox: '0 0 16 16',\n class: 'size-4 -rotate-90 motion-reduce:hidden',\n },\n [\n h('circle', { cx: 8, cy: 8, r: RingRadius, fill: 'none', 'stroke-width': 2, class: 'stroke-border' }),\n h('circle', {\n ref: arc,\n cx: 8,\n cy: 8,\n r: RingRadius,\n fill: 'none',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'stroke-dasharray': `${RingCircumference}`,\n class: RingClasses[countdown.severity],\n }),\n ],\n );\n },\n});\n\n/**\n * The seconds display — the whole seconds left, rounded up so it reads `1s` until the toast goes. It keeps its\n * own clock, advancing only while unpaused; the announcement region already carries the toast, so it is hidden.\n */\nconst ToastSeconds = defineComponent({\n name: 'ToastSeconds',\n props: CountdownProps,\n setup(countdown) {\n const left = ref(countdown.duration);\n let lastTick = 0;\n let handle: number | undefined;\n const tick = () => {\n const now = Date.now();\n left.value = Math.max(0, left.value - (now - lastTick));\n lastTick = now;\n };\n const start = () => {\n if (handle !== undefined) return;\n lastTick = Date.now();\n handle = window.setInterval(tick, SecondsTickMs);\n };\n const stop = () => {\n if (handle === undefined) return;\n tick();\n window.clearInterval(handle);\n handle = undefined;\n };\n onMounted(() => {\n if (!countdown.paused) start();\n });\n watch(\n () => countdown.paused,\n (isPaused) => (isPaused ? stop() : start()),\n );\n onUnmounted(() => {\n if (handle !== undefined) window.clearInterval(handle);\n });\n return () =>\n h(\n 'span',\n {\n 'aria-hidden': 'true',\n 'data-toast-timer': ToastTimer.Seconds,\n class: 'text-xs tabular-nums text-muted-foreground',\n },\n `${Math.ceil(left.value / 1000)}s`,\n );\n },\n});\n\n/**\n * Renders the toast viewport — subscribes to the global `toastHost` store and stacks `Toast` cards.\n * Mount once, per app.\n *\n * A caller's `class` attr lands on the stack container.\n */\ndefineOptions({ name: 'ToastHost', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastHostProps>(), {\n position: OverlayPositionToken.TopRight,\n max: 5,\n defaultDuration: 5000,\n durations: () => DefaultToastDurations,\n canPauseOnHover: true,\n gap: 8,\n timer: undefined,\n showProgress: false,\n showSeverityIcon: true,\n});\n\nconst attrs = useAttrs();\n\nconst items = shallowRef<ReadonlyArray<ToastEntry>>([]);\nconst hovered = ref(false);\nconst focused = ref(false);\nconst paused = computed(() => props.canPauseOnHover && (hovered.value || focused.value));\n\n/* Non-reactive state — mutated across ticks, never rendered. */\nconst timers = new Map<string, number>();\nconst remaining = new Map<string, number>();\nconst startedAt = new Map<string, number>();\nconst nonces = new Map<string, number>();\n\nlet unsubscribe: (() => void) | undefined;\nonMounted(() => {\n unsubscribe = toastHost.subscribe((next) => {\n items.value = next;\n });\n});\n\n// Visible window (FIFO).\nconst visible = computed<ReadonlyArray<VisibleToast>>(() =>\n items.value.slice(0, props.max).map((t) => ({\n ...t,\n resolvedDuration: t.duration ?? props.durations[t.severity ?? 'neutral'] ?? props.defaultDuration,\n })),\n);\nconst visibleIds = computed(() => new Set(visible.value.map((v) => v.id)));\n\n// Toasts that just left `visible` (dismissed, or pushed out of the FIFO\n// window) but must still play their exit animation. Kept mounted with\n// `data-state=\"closed\"` until `Presence` unmounts the child — the `@vue:unmounted`\n// hook below then prunes the entry here.\nconst exiting = shallowRef<ReadonlyArray<VisibleToast>>([]);\nlet prevVisible: ReadonlyArray<VisibleToast> = [];\n\nwatch(\n visibleIds,\n (ids) => {\n const gone = prevVisible.filter((p) => !ids.has(p.id));\n prevVisible = visible.value;\n const current = exiting.value;\n const known = new Set(current.map((e) => e.id));\n // Add newly-gone toasts; drop any that re-entered `visible`.\n const merged = [...current, ...gone.filter((g) => !known.has(g.id))].filter((e) => !ids.has(e.id));\n if (merged.length !== current.length || !merged.every((e, i) => e.id === current[i]?.id)) {\n exiting.value = merged;\n }\n },\n { immediate: true, flush: 'post' },\n);\n\nconst removeExiting = (id: string) => {\n exiting.value = exiting.value.filter((e) => e.id !== id);\n};\n\n// Visible (present) first, then the ones animating out.\nconst rendered = computed<Array<VisibleToast & { present: boolean }>>(() => [\n ...visible.value.map((v) => ({ ...v, present: true })),\n ...exiting.value.map((e) => ({ ...e, present: false })),\n]);\n\nconst latestTitle = computed(() => {\n const last = visible.value[visible.value.length - 1];\n if (typeof last?.title === 'string') return last.title;\n if (typeof last?.description === 'string') return last.description;\n return '';\n});\n\n// Schedule auto-dismiss timers.\nwatch(\n [items, () => props.max, () => props.defaultDuration, () => props.durations, paused],\n () => {\n const ids = visibleIds.value;\n // Clear timers for items that are no longer visible.\n for (const [id, handle] of timers) {\n if (!ids.has(id)) {\n window.clearTimeout(handle);\n timers.delete(id);\n remaining.delete(id);\n startedAt.delete(id);\n }\n }\n for (const id of nonces.keys()) {\n if (!ids.has(id)) nonces.delete(id);\n }\n if (paused.value) return;\n // A content update / dedup bumps `nonce` — clear that toast's timer so it reschedules fresh.\n for (const v of visible.value) {\n const seen = nonces.get(v.id);\n if (seen !== undefined && seen !== v.nonce) {\n const handle = timers.get(v.id);\n if (handle !== undefined) window.clearTimeout(handle);\n timers.delete(v.id);\n remaining.delete(v.id);\n startedAt.delete(v.id);\n }\n nonces.set(v.id, v.nonce);\n }\n for (const v of visible.value) {\n if (v.resolvedDuration === Infinity) continue;\n if (timers.has(v.id)) continue;\n const left = remaining.get(v.id) ?? v.resolvedDuration;\n const handle = window.setTimeout(() => {\n toastHost.dismiss(v.id);\n }, left);\n timers.set(v.id, handle);\n startedAt.set(v.id, Date.now());\n remaining.set(v.id, left);\n }\n },\n { immediate: true, flush: 'post' },\n);\n\n// Cleanup on unmount.\nonUnmounted(() => {\n unsubscribe?.();\n for (const handle of timers.values()) window.clearTimeout(handle);\n timers.clear();\n});\n\nwatch(\n paused,\n (isPaused) => {\n if (!isPaused) return;\n for (const [id, handle] of timers) {\n window.clearTimeout(handle);\n const start = startedAt.get(id) ?? Date.now();\n remaining.set(id, Math.max(0, (remaining.get(id) ?? 0) - (Date.now() - start)));\n }\n timers.clear();\n },\n { flush: 'sync' },\n);\n\nwatch(\n () => rendered.value.length,\n (count) => {\n if (count === 0) {\n hovered.value = false;\n focused.value = false;\n }\n },\n);\n\nfunction onFocusout(event: FocusEvent): void {\n const stack = event.currentTarget as HTMLElement;\n if (!(event.relatedTarget instanceof Node) || !stack.contains(event.relatedTarget)) focused.value = false;\n}\n\nconst stackClasses = computed(() =>\n cn('pointer-events-none fixed z-toast flex flex-col', PositionClasses, attrs.class as string | undefined),\n);\n\nconst itemClasses = computed(() => cn('pointer-events-auto relative w-80 overflow-hidden rounded-md', MotionClasses));\n\n/** The display a toast asked for — its own `timer`, its deprecated `progress`, then the host's two. */\nfunction requestedTimer(t: VisibleToast): ToastTimer {\n if (t.timer !== undefined) return t.timer;\n if (t.progress !== undefined) return t.progress ? ToastTimer.Bar : ToastTimer.None;\n if (props.timer !== undefined) return props.timer;\n return props.showProgress ? ToastTimer.Bar : ToastTimer.None;\n}\n\n/**\n * The display a toast gets — none while exiting or sticky, and the bar for custom `content`, which has no close\n * button for a ring or seconds to sit beside.\n */\nfunction timerFor(t: VisibleToast & { present: boolean }): ToastTimer {\n if (!t.present || !Number.isFinite(t.resolvedDuration)) return ToastTimer.None;\n const requested = requestedTimer(t);\n return t.content && requested !== ToastTimer.None ? ToastTimer.Bar : requested;\n}\n\n/** Whether a toast's display sits beside the close button rather than along the bottom edge. */\nconst isTrailingTimer = (timer: ToastTimer): boolean => timer === ToastTimer.Ring || timer === ToastTimer.Seconds;\n\n/** Vue does not auto-suffix numeric style values with `px`. */\nconst stackStyle = computed(() => ({ gap: `${props.gap}px` }));\n</script>\n\n<template>\n <Portal>\n <div\n v-if=\"rendered.length > 0\"\n role=\"region\"\n :aria-label=\"locale.t('ToastHost.notifications', undefined, 'Notifications')\"\n :style=\"stackStyle\"\n :class=\"stackClasses\"\n @mouseenter=\"hovered = true\"\n @mouseleave=\"hovered = false\"\n @focusin=\"focused = true\"\n @focusout=\"onFocusout\"\n >\n <Presence v-for=\"t in rendered\" :key=\"t.id\" :is-present=\"t.present\">\n <!--\n `Presence` clones `data-state` onto this node and keeps it mounted\n until the exit animation ends; the `@vue:unmounted` hook is that\n \"exit finished\" signal (the read-only `Presence` API exposes no\n callback).\n -->\n <div :class=\"itemClasses\" @vue:unmounted=\"t.present ? undefined : removeExiting(t.id)\">\n <ToastNodeView v-if=\"t.content\" :node=\"t.content\" />\n <Toast\n v-else\n :severity=\"t.severity\"\n :show-severity-icon=\"t.showSeverityIcon ?? props.showSeverityIcon\"\n v-on=\"t.onDelete ? { delete: t.onDelete } : {}\"\n @close=\"toastHost.dismiss(t.id)\"\n >\n <template v-if=\"t.icon\" #icon><ToastNodeView :node=\"t.icon\" /></template>\n <template v-if=\"t.title\" #title><ToastNodeView :node=\"t.title\" /></template>\n <template v-if=\"t.description\" #description>\n <ToastNodeView :node=\"t.description\" />\n </template>\n <template v-if=\"t.action || t.report\" #actions>\n <ToastNodeView v-if=\"t.action\" :node=\"t.action\" />\n <ReportAction v-if=\"t.report\" :send=\"t.report\" />\n </template>\n <template v-if=\"isTrailingTimer(timerFor(t))\" #trailing>\n <ToastRing\n v-if=\"timerFor(t) === ToastTimer.Ring\"\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n <ToastSeconds\n v-else\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n </template>\n </Toast>\n <ToastProgress\n v-if=\"timerFor(t) === ToastTimer.Bar\"\n :key=\"`${t.id}:${t.nonce}`\"\n :duration=\"t.resolvedDuration\"\n :paused=\"paused\"\n :severity=\"t.severity ?? 'neutral'\"\n />\n </div>\n </Presence>\n </div>\n <Announce politeness=\"polite\">{{ latestTitle }}</Announce>\n </Portal>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_renderSlot","SeverityToken","_createBlock","ToastSimple","_unref","_hoisted_1","Icon","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","_hoisted_2","_createVNode","Portal","_renderList","Toast","_toHandlers","ReportAction","Announce"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,UAAM,iBAA6E;AAAA,MACjF,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,IAAA;AAWX,UAAM,QAAQ;AAOd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA+B,IAAI;AAE9C,UAAM,UAAU;AAAA,MAAS,MACvB;AAAA,QACE;AAAA,QACA,gBAAgB;AAAA,UACd,SAAS;AAAA,UACT,MAAM,eAAe,MAAM,QAAQ;AAAA,UACnC,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,WAAW;AAAA,QAAA,CACZ;AAAA,QACD,MAAM;AAAA,MAAA;AAAA,IACR;AAIF,UAAM,OAAO,SAAS,MAAM;AAC1B,YAAM,EAAE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4BAJC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK;AAAA,4BACvB,UAAU,EAAE;AAAA,4BACZ,QAAQ,OAAA;AAAA,4BACR,UAAU,EAAE,YAAQ;AAAA,0BAAA;;;;;oBAKnB,SAAS,CAAC,MAAM,WAAW,oBADnCF,YAMEE,MAAA,aAAA,GAAA;AAAA,sBAJC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK;AAAA,sBACvB,UAAU,EAAE;AAAA,sBACZ,QAAQ,OAAA;AAAA,sBACR,UAAU,EAAE,YAAQ;AAAA,oBAAA;;;;;;;UAK7BQ,YAA0DR,MAAAc,WAAA,GAAA,EAAhD,YAAW,YAAQ;AAAA,6BAAC,MAAiB;AAAA,8CAAd,YAAA,KAAW,GAAA,CAAA;AAAA,YAAA;;;;;;;;;"}
|
|
@@ -105,7 +105,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
const contentClasses = cn(
|
|
108
|
-
"
|
|
108
|
+
"rounded-md bg-inverse px-2.5 py-1.5 text-xs text-inverse-foreground shadow-md",
|
|
109
109
|
"motion-safe:data-[state=open]:animate-(--animate-pop-in)",
|
|
110
110
|
"motion-safe:data-[state=closed]:animate-(--animate-pop-out)"
|
|
111
111
|
);
|
|
@@ -118,6 +118,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
118
118
|
anchor: anchor.value,
|
|
119
119
|
placement: props.placement,
|
|
120
120
|
offset: 6,
|
|
121
|
+
class: "z-tooltip",
|
|
121
122
|
onAnimationend: onAnimationEnd
|
|
122
123
|
}, {
|
|
123
124
|
default: withCtx(() => [
|
|
@@ -148,4 +149,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
148
149
|
export {
|
|
149
150
|
_sfc_main as _
|
|
150
151
|
};
|
|
151
|
-
//# sourceMappingURL=Tooltip.vue_vue_type_script_setup_true_lang-
|
|
152
|
+
//# sourceMappingURL=Tooltip.vue_vue_type_script_setup_true_lang-vsFDijcV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.vue_vue_type_script_setup_true_lang-AzuqiFWY.js","sources":["../../src/presentation/overlays/tooltip/Tooltip.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Placement } from '@floating-ui/vue';\n\nexport interface TooltipProps {\n /** The tooltip body. Rich content goes through the `content` slot. */\n readonly content?: string | number;\n\n /** The Floating UI placement. Default `top`. */\n readonly placement?: Placement;\n\n /** The delay before opening on hover, in ms. Default 700. */\n readonly openDelay?: number;\n\n /** The delay before closing on leave, in ms. Default 0. */\n readonly closeDelay?: number;\n\n /** Controlled axes use their canonical Vue model names; each update event requests caller state. */\n readonly open?: boolean;\n\n /** The initial open state when uncontrolled. Default `false`. */\n readonly defaultOpen?: boolean;\n\n /** The disabled mode — suppresses rendering even on hover (e.g. when content is empty). */\n readonly isDisabled?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n cloneVNode,\n computed,\n createCommentVNode,\n onBeforeUnmount,\n ref,\n shallowRef,\n useSlots,\n watch,\n type VNode,\n} from 'vue';\nimport { AriaAttribute, resolveElement } from '../../../foundation/dom';\nimport { cn } from '../../../foundation/styles';\nimport { useControlled } from '../../../foundation/state';\nimport { useEscape } from '../../../foundation/shortcuts';\nimport { useId } from '../../../foundation/identifiers';\nimport { useReducedMotion } from '../../../foundation/device';\nimport { AnchoredPositioner, Portal, Presence, renderableChildren } from '../../../foundation/primitives';\n\n/**\n * Renders a hover- or focus-triggered tooltip into a Portal, positioned by Floating UI.\n *\n * Wraps a single default-slot child as the trigger. Default delays mirror the OS pattern (700ms in, 0 out). Escape\n * dismisses without moving focus (WCAG 1.4.13); the trigger is described by the tooltip via `aria-describedby` while\n * open.\n *\n * `inheritAttrs: false` because the component renders a fragment (trigger + portal) — there is no single root for\n * attrs to land on, exactly as in React.\n */\ndefineOptions({ name: 'Tooltip', inheritAttrs: false });\n\ndefineSlots<{\n /** The single child element — the trigger. Receives the handlers, the ref, and `aria-describedby`. */\n default(): unknown;\n /** The rich override for the `content` prop. */\n content?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<TooltipProps>(), {\n content: undefined,\n placement: 'top',\n openDelay: 700,\n closeDelay: 0,\n open: undefined,\n defaultOpen: false,\n isDisabled: undefined,\n});\n\nconst emit = defineEmits<{\n /** Fires when the tooltip shows or hides — the `v-model:open` half. */\n 'update:open': [open: boolean];\n}>();\n\nconst slots = useSlots();\n\n/* `useControlled` returns a handle, not React's tuple, and takes `controlled` as a getter so the\n controlled branch tracks the prop. */\nconst { value: open, setValue: setOpen } = useControlled<boolean>({\n controlled: () => props.open,\n default: props.defaultOpen,\n onChange: (next) => {\n emit('update:open', next);\n },\n});\n\nconst anchor = shallowRef<HTMLElement | null>(null);\nconst tooltipId = useId('tooltip');\n\nlet openTimer: ReturnType<typeof setTimeout> | null = null;\nlet closeTimer: ReturnType<typeof setTimeout> | null = null;\n\nfunction clear(): void {\n if (openTimer) clearTimeout(openTimer);\n if (closeTimer) clearTimeout(closeTimer);\n openTimer = null;\n closeTimer = null;\n}\n\nfunction show(): void {\n clear();\n if (props.isDisabled) return;\n openTimer = setTimeout(() => {\n if (!props.isDisabled) setOpen(true);\n }, props.openDelay);\n}\n\nfunction hide(): void {\n clear();\n closeTimer = setTimeout(() => setOpen(false), props.closeDelay);\n}\n\nwatch(\n () => props.isDisabled,\n (disabled) => {\n if (!disabled) return;\n clear();\n setOpen(false);\n },\n);\n\n/* Clear pending timers on unmount. */\nonBeforeUnmount(clear);\n\n/* WCAG 1.4.13 — Escape dismisses immediately, without moving focus. */\nuseEscape(() => {\n clear();\n setOpen(false);\n}, open);\n\nconst reducedMotion = useReducedMotion();\n\n/**\n * React gated on `!!content`; a Vue consumer can supply the body through the `content` slot\n * instead, so either source counts. An empty tooltip still never opens.\n */\nconst hasContent = computed(() => !!props.content || !!slots.content);\n\nconst visible = computed(() => !props.isDisabled && open.value && hasContent.value);\n\n/* Keep the Portal + positioner mounted while the exit animation plays.\n Becomes true with `visible`; cleared on the body's pop-out `animationend`\n (see `onAnimationEnd` below). With reduced motion no exit animation runs,\n so tear the shell down immediately on close. */\nconst mounted = ref(false);\nwatch(\n [visible, reducedMotion],\n ([isVisible, isReduced]) => {\n if (isVisible) mounted.value = true;\n else if (isReduced) mounted.value = false;\n },\n { immediate: true },\n);\n\nfunction onAnimationEnd(): void {\n if (!visible.value) mounted.value = false;\n}\n\n/** A function ref may receive a component's public instance; the positioner needs the DOM node. */\nfunction setAnchor(value: unknown): void {\n anchor.value = resolveElement(value);\n}\n\n/**\n * React cloned the child element to attach the ref, the handlers and `aria-describedby`.\n * `cloneVNode` is the Vue counterpart and merges through `mergeProps`, so a handler the\n * consumer already put on the trigger is chained rather than replaced — the job React's\n * explicit `trigger.props.onPointerEnter?.(e)` forwarding did.\n *\n * Called from the template, never from a `computed`: a vnode `ref` records the instance rendering\n * at creation as its owner. The scheduler refreshes a dirty computed before the render runs, while\n * no instance renders, and production Vue then throws reading the missing owner's `refs`.\n *\n * The listener keys are all-lowercase after `on` (`onPointerenter`, not `onPointerEnter`):\n * Vue hyphenates the remainder to derive the DOM event name, so the React casing would\n * register `pointer-enter` and never fire.\n */\nfunction renderTrigger(): VNode {\n const child = renderableChildren(slots.default?.())[0];\n if (!child) return createCommentVNode('');\n const own = child.props?.[AriaAttribute.DescribedBy] as string | undefined;\n return cloneVNode(\n child,\n {\n ref: setAnchor,\n [AriaAttribute.DescribedBy]: visible.value ? [own, tooltipId].filter(Boolean).join(' ') : own,\n onPointerenter: show,\n onPointerleave: hide,\n onFocus: show,\n onBlur: hide,\n },\n true,\n );\n}\n\nconst contentClasses = cn(\n 'z-tooltip rounded-md bg-inverse px-2.5 py-1.5 text-xs text-inverse-foreground shadow-md',\n 'motion-safe:data-[state=open]:animate-(--animate-pop-in)',\n 'motion-safe:data-[state=closed]:animate-(--animate-pop-out)',\n);\n</script>\n\n<template>\n <component :is=\"renderTrigger()\" />\n <Portal v-if=\"mounted\">\n <!-- Exit animation bubbles up from the body; once the closed-state pop-out ends, tear down\n the Portal shell. Also covers the reduced-motion path, where no animation runs and\n `Presence` has already unmounted the body. -->\n <AnchoredPositioner :anchor=\"anchor\" :placement=\"props.placement\" :offset=\"6\" @animationend=\"onAnimationEnd\">\n <!-- `Presence` clones `data-state` (\"open\" | \"closed\") + its tracking ref onto the body,\n which is what gates the pop-in / pop-out keyframes. Motion sits behind `motion-safe:`\n so reduced-motion users get an instant show/hide. -->\n <Presence :is-present=\"visible\">\n <div :id=\"tooltipId\" role=\"tooltip\" :class=\"contentClasses\">\n <slot name=\"content\">{{ props.content }}</slot>\n </div>\n </Presence>\n </AnchoredPositioner>\n </Portal>\n</template>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_unref","Portal","_createVNode","AnchoredPositioner","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,UAAM,QAAQ;AAUd,UAAM,OAAO;AAKb,UAAM,QAAQ,SAAA;AAId,UAAM,EAAE,OAAO,MAAM,UAAU,QAAA,IAAY,cAAuB;AAAA,MAChE,YAAY,MAAM,MAAM;AAAA,MACxB,SAAS,MAAM;AAAA,MACf,UAAU,CAAC,SAAS;AAClB,aAAK,eAAe,IAAI;AAAA,MAC1B;AAAA,IAAA,CACD;AAED,UAAM,SAAS,WAA+B,IAAI;AAClD,UAAM,YAAY,MAAM,SAAS;AAEjC,QAAI,YAAkD;AACtD,QAAI,aAAmD;AAEvD,aAAS,QAAc;AACrB,UAAI,wBAAwB,SAAS;AACrC,UAAI,yBAAyB,UAAU;AACvC,kBAAY;AACZ,mBAAa;AAAA,IACf;AAEA,aAAS,OAAa;AACpB,YAAA;AACA,UAAI,MAAM,WAAY;AACtB,kBAAY,WAAW,MAAM;AAC3B,YAAI,CAAC,MAAM,WAAY,SAAQ,IAAI;AAAA,MACrC,GAAG,MAAM,SAAS;AAAA,IACpB;A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AgB;AAAA,UAChB,SAAS;AAAA,UACT,QAAQ;AAAA,QAAA;AAAA,QAEV;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,IAAA;;;SAKAA,aAAAC,YAAmCC,wBAAnB,cAAA,CAAa,CAAA;AAAA,QACf,QAAA,sBAAdD,YAcSE,MAAAC,WAAA,GAAA,EAAA,KAAA,KAAA;AAAA,2BAVP,MASqB;AAAA,YATrBC,YASqBF,MAAAG,WAAA,GAAA;AAAA,cATA,QAAQ,OAAA;AAAA,cAAS,WAAW,MAAM;AAAA,cAAY,QAAQ;AAAA,cAAI,gBAAc;AAAA,YAAA;+BAI3F,MAIW;AAAA,gBAJXD,YAIWF,MAAA,QAAA,GAAA,EAJA,cAAY,QAAA,SAAO;AAAA,mCAC5B,MAEM;AAAA,oBAFNI,mBAEM,OAAA;AAAA,sBAFA,IAAIJ,MAAA,SAAA;AAAA,sBAAW,MAAK;AAAA,sBAAW,sBAAOA,MAAA,cAAA,CAAc;AAAA,oBAAA;sBACxDK,WAA+C,4BAA/C,MAA+C;AAAA,wBAAvBC,gBAAAC,gBAAA,MAAM,OAAO,GAAA,CAAA;AAAA,sBAAA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Tooltip.vue_vue_type_script_setup_true_lang-vsFDijcV.js","sources":["../../src/presentation/overlays/tooltip/Tooltip.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Placement } from '@floating-ui/vue';\n\nexport interface TooltipProps {\n /** The tooltip body. Rich content goes through the `content` slot. */\n readonly content?: string | number;\n\n /** The Floating UI placement. Default `top`. */\n readonly placement?: Placement;\n\n /** The delay before opening on hover, in ms. Default 700. */\n readonly openDelay?: number;\n\n /** The delay before closing on leave, in ms. Default 0. */\n readonly closeDelay?: number;\n\n /** Controlled axes use their canonical Vue model names; each update event requests caller state. */\n readonly open?: boolean;\n\n /** The initial open state when uncontrolled. Default `false`. */\n readonly defaultOpen?: boolean;\n\n /** The disabled mode — suppresses rendering even on hover (e.g. when content is empty). */\n readonly isDisabled?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n cloneVNode,\n computed,\n createCommentVNode,\n onBeforeUnmount,\n ref,\n shallowRef,\n useSlots,\n watch,\n type VNode,\n} from 'vue';\nimport { AriaAttribute, resolveElement } from '../../../foundation/dom';\nimport { cn } from '../../../foundation/styles';\nimport { useControlled } from '../../../foundation/state';\nimport { useEscape } from '../../../foundation/shortcuts';\nimport { useId } from '../../../foundation/identifiers';\nimport { useReducedMotion } from '../../../foundation/device';\nimport { AnchoredPositioner, Portal, Presence, renderableChildren } from '../../../foundation/primitives';\n\n/**\n * Renders a hover- or focus-triggered tooltip into a Portal, positioned by Floating UI.\n *\n * Wraps a single default-slot child as the trigger. Default delays mirror the OS pattern (700ms in, 0 out). Escape\n * dismisses without moving focus (WCAG 1.4.13); the trigger is described by the tooltip via `aria-describedby` while\n * open.\n *\n * `inheritAttrs: false` because the component renders a fragment (trigger + portal) — there is no single root for\n * attrs to land on, exactly as in React.\n */\ndefineOptions({ name: 'Tooltip', inheritAttrs: false });\n\ndefineSlots<{\n /** The single child element — the trigger. Receives the handlers, the ref, and `aria-describedby`. */\n default(): unknown;\n /** The rich override for the `content` prop. */\n content?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<TooltipProps>(), {\n content: undefined,\n placement: 'top',\n openDelay: 700,\n closeDelay: 0,\n open: undefined,\n defaultOpen: false,\n isDisabled: undefined,\n});\n\nconst emit = defineEmits<{\n /** Fires when the tooltip shows or hides — the `v-model:open` half. */\n 'update:open': [open: boolean];\n}>();\n\nconst slots = useSlots();\n\n/* `useControlled` returns a handle, not React's tuple, and takes `controlled` as a getter so the\n controlled branch tracks the prop. */\nconst { value: open, setValue: setOpen } = useControlled<boolean>({\n controlled: () => props.open,\n default: props.defaultOpen,\n onChange: (next) => {\n emit('update:open', next);\n },\n});\n\nconst anchor = shallowRef<HTMLElement | null>(null);\nconst tooltipId = useId('tooltip');\n\nlet openTimer: ReturnType<typeof setTimeout> | null = null;\nlet closeTimer: ReturnType<typeof setTimeout> | null = null;\n\nfunction clear(): void {\n if (openTimer) clearTimeout(openTimer);\n if (closeTimer) clearTimeout(closeTimer);\n openTimer = null;\n closeTimer = null;\n}\n\nfunction show(): void {\n clear();\n if (props.isDisabled) return;\n openTimer = setTimeout(() => {\n if (!props.isDisabled) setOpen(true);\n }, props.openDelay);\n}\n\nfunction hide(): void {\n clear();\n closeTimer = setTimeout(() => setOpen(false), props.closeDelay);\n}\n\nwatch(\n () => props.isDisabled,\n (disabled) => {\n if (!disabled) return;\n clear();\n setOpen(false);\n },\n);\n\n/* Clear pending timers on unmount. */\nonBeforeUnmount(clear);\n\n/* WCAG 1.4.13 — Escape dismisses immediately, without moving focus. */\nuseEscape(() => {\n clear();\n setOpen(false);\n}, open);\n\nconst reducedMotion = useReducedMotion();\n\n/**\n * React gated on `!!content`; a Vue consumer can supply the body through the `content` slot\n * instead, so either source counts. An empty tooltip still never opens.\n */\nconst hasContent = computed(() => !!props.content || !!slots.content);\n\nconst visible = computed(() => !props.isDisabled && open.value && hasContent.value);\n\n/* Keep the Portal + positioner mounted while the exit animation plays.\n Becomes true with `visible`; cleared on the body's pop-out `animationend`\n (see `onAnimationEnd` below). With reduced motion no exit animation runs,\n so tear the shell down immediately on close. */\nconst mounted = ref(false);\nwatch(\n [visible, reducedMotion],\n ([isVisible, isReduced]) => {\n if (isVisible) mounted.value = true;\n else if (isReduced) mounted.value = false;\n },\n { immediate: true },\n);\n\nfunction onAnimationEnd(): void {\n if (!visible.value) mounted.value = false;\n}\n\n/** A function ref may receive a component's public instance; the positioner needs the DOM node. */\nfunction setAnchor(value: unknown): void {\n anchor.value = resolveElement(value);\n}\n\n/**\n * React cloned the child element to attach the ref, the handlers and `aria-describedby`.\n * `cloneVNode` is the Vue counterpart and merges through `mergeProps`, so a handler the\n * consumer already put on the trigger is chained rather than replaced — the job React's\n * explicit `trigger.props.onPointerEnter?.(e)` forwarding did.\n *\n * Called from the template, never from a `computed`: a vnode `ref` records the instance rendering\n * at creation as its owner. The scheduler refreshes a dirty computed before the render runs, while\n * no instance renders, and production Vue then throws reading the missing owner's `refs`.\n *\n * The listener keys are all-lowercase after `on` (`onPointerenter`, not `onPointerEnter`):\n * Vue hyphenates the remainder to derive the DOM event name, so the React casing would\n * register `pointer-enter` and never fire.\n */\nfunction renderTrigger(): VNode {\n const child = renderableChildren(slots.default?.())[0];\n if (!child) return createCommentVNode('');\n const own = child.props?.[AriaAttribute.DescribedBy] as string | undefined;\n return cloneVNode(\n child,\n {\n ref: setAnchor,\n [AriaAttribute.DescribedBy]: visible.value ? [own, tooltipId].filter(Boolean).join(' ') : own,\n onPointerenter: show,\n onPointerleave: hide,\n onFocus: show,\n onBlur: hide,\n },\n true,\n );\n}\n\nconst contentClasses = cn(\n 'rounded-md bg-inverse px-2.5 py-1.5 text-xs text-inverse-foreground shadow-md',\n 'motion-safe:data-[state=open]:animate-(--animate-pop-in)',\n 'motion-safe:data-[state=closed]:animate-(--animate-pop-out)',\n);\n</script>\n\n<template>\n <component :is=\"renderTrigger()\" />\n <Portal v-if=\"mounted\">\n <!-- Exit animation bubbles up from the body; once the closed-state pop-out ends, tear down\n the Portal shell. Also covers the reduced-motion path, where no animation runs and\n `Presence` has already unmounted the body.\n z-tooltip (100) sits on this positioned root, as Popover and Menu put their layer on theirs: its\n transform makes the stacking context, so a z-index on the body inside never lifts it above a sticky\n bar (z-sticky, 30) or a modal (z-modal, 70). -->\n <AnchoredPositioner\n :anchor=\"anchor\"\n :placement=\"props.placement\"\n :offset=\"6\"\n class=\"z-tooltip\"\n @animationend=\"onAnimationEnd\"\n >\n <!-- `Presence` clones `data-state` (\"open\" | \"closed\") + its tracking ref onto the body,\n which is what gates the pop-in / pop-out keyframes. Motion sits behind `motion-safe:`\n so reduced-motion users get an instant show/hide. -->\n <Presence :is-present=\"visible\">\n <div :id=\"tooltipId\" role=\"tooltip\" :class=\"contentClasses\">\n <slot name=\"content\">{{ props.content }}</slot>\n </div>\n </Presence>\n </AnchoredPositioner>\n </Portal>\n</template>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_unref","Portal","_createVNode","AnchoredPositioner","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,UAAM,QAAQ;AAUd,UAAM,OAAO;AAKb,UAAM,QAAQ,SAAA;AAId,UAAM,EAAE,OAAO,MAAM,UAAU,QAAA,IAAY,cAAuB;AAAA,MAChE,YAAY,MAAM,MAAM;AAAA,MACxB,SAAS,MAAM;AAAA,MACf,UAAU,CAAC,SAAS;AAClB,aAAK,eAAe,IAAI;AAAA,MAC1B;AAAA,IAAA,CACD;AAED,UAAM,SAAS,WAA+B,IAAI;AAClD,UAAM,YAAY,MAAM,SAAS;AAEjC,QAAI,YAAkD;AACtD,QAAI,aAAmD;AAEvD,aAAS,QAAc;AACrB,UAAI,wBAAwB,SAAS;AACrC,UAAI,yBAAyB,UAAU;AACvC,kBAAY;AACZ,mBAAa;AAAA,IACf;AAEA,aAAS,OAAa;AACpB,YAAA;AACA,UAAI,MAAM,WAAY;AACtB,kBAAY,WAAW,MAAM;AAC3B,YAAI,CAAC,MAAM,WAAY,SAAQ,IAAI;AAAA,MACrC,GAAG,MAAM,SAAS;AAAA,IACpB;AAEA,aAAS,OAAa;AACpB,YAAA;AACA,mBAAa,WAAW,MAAM,QAAQ,KAAK,GAAG,MAAM,UAAU;AAAA,IAChE;AAEA;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,aAAa;AACZ,YAAI,CAAC,SAAU;AACf,cAAA;AACA,gBAAQ,KAAK;AAAA,MACf;AAAA,IAAA;AAIF,oBAAgB,KAAK;AAGrB,cAAU,MAAM;AACd,YAAA;AACA,cAAQ,KAAK;AAAA,IACf,GAAG,IAAI;AAEP,UAAM,gBAAgB,iBAAA;AAMtB,UAAM,aAAa,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AAA;AAAA,cACR,WAAW,MAAM;AAAA,cACjB,QAAQ;AAAA,cACT,OAAM;AAAA,cACL,gBAAc;AAAA,YAAA;+BAKf,MAIW;AAAA,gBAJXD,YAIWF,MAAA,QAAA,GAAA,EAJA,cAAY,QAAA,SAAO;AAAA,mCAC5B,MAEM;AAAA,oBAFNI,mBAEM,OAAA;AAAA,sBAFA,IAAIJ,MAAA,SAAA;AAAA,sBAAW,MAAK;AAAA,sBAAW,sBAAOA,MAAA,cAAA,CAAc;AAAA,oBAAA;sBACxDK,WAA+C,4BAA/C,MAA+C;AAAA,wBAAvBC,gBAAAC,gBAAA,MAAM,OAAO,GAAA,CAAA;AAAA,sBAAA;;;;;;;;;;;;;;;"}
|
|
@@ -19,8 +19,9 @@ export interface FeedbackQueryErrorsOptions {
|
|
|
19
19
|
/** Maps the catalog's display-safe message without exposing raw exception or server diagnostics. */
|
|
20
20
|
export declare function toErrorNotice(error: AppError): FeedbackNotice;
|
|
21
21
|
/**
|
|
22
|
-
* Creates the explicit query failure-to-notice adapter
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Creates the explicit query failure-to-notice adapter. Cancellation and 401 stay quiet: an unauthorized
|
|
23
|
+
* request belongs to the session-expiry path (`bridge.subscribeExpired`), never an error toast. With a
|
|
24
|
+
* `reporter`, a reportable failure is captured the moment it happens — freezing the trail and the request
|
|
25
|
+
* behind it — and the notice carries the incident's send, so the user reports it with one click.
|
|
25
26
|
*/
|
|
26
27
|
export declare function feedbackQueryErrors(bus?: FeedbackBus, options?: FeedbackQueryErrorsOptions): (error: AppError) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FeedbackBus, FeedbackNotice } from './FeedbackBus';
|
|
2
|
+
/** The single neutral notice an expired session publishes; its fixed id replaces a repeat instead of stacking. */
|
|
3
|
+
export declare const SessionExpiredNotice: FeedbackNotice;
|
|
4
|
+
/** Creates the `bridge.subscribeExpired` listener that publishes one neutral notice per expiry. */
|
|
5
|
+
export declare function feedbackSessionExpiry(bus?: FeedbackBus, notice?: FeedbackNotice): () => void;
|
package/dist/feedback/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { NoticeTone, NoticeCategory, createFeedbackBus, feedbackBus, notify, type NoticeNode, type FeedbackNotice, type PublishedNotice, type NoticeListener, type RetainedNoticeListener, type NoticeDismissListener, type FeedbackBus, type FeedbackBusOptions, type FeedbackErrorContext, type FeedbackErrorHandler, } from './FeedbackBus';
|
|
2
2
|
export { feedbackQueryErrors, toErrorNotice, DefaultReportableErrorTypes, type FeedbackQueryErrorsOptions, } from './FeedbackQueryErrors';
|
|
3
|
+
export { feedbackSessionExpiry, SessionExpiredNotice } from './FeedbackSessionExpiry';
|
package/dist/feedback/index.js
CHANGED
|
@@ -13,18 +13,30 @@ function feedbackQueryErrors(bus = feedbackBus, options = {}) {
|
|
|
13
13
|
const { reporter } = options;
|
|
14
14
|
const isReportable = options.isReportable ?? ((error) => DefaultReportableErrorTypes.includes(error.type));
|
|
15
15
|
return (error) => {
|
|
16
|
-
if (error.type === AppErrorType.Cancelled) return;
|
|
16
|
+
if (error.type === AppErrorType.Cancelled || error.type === AppErrorType.Unauthorized) return;
|
|
17
17
|
const notice = toErrorNotice(error);
|
|
18
18
|
bus.notify(reporter && isReportable(error) ? { ...notice, report: reporter.capture(error).send } : notice);
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
const SessionExpiredNotice = Object.freeze({
|
|
22
|
+
id: "session-expired",
|
|
23
|
+
tone: NoticeTone.Info,
|
|
24
|
+
title: "Signed out — sign in again"
|
|
25
|
+
});
|
|
26
|
+
function feedbackSessionExpiry(bus = feedbackBus, notice = SessionExpiredNotice) {
|
|
27
|
+
return () => {
|
|
28
|
+
bus.notify(notice);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
21
31
|
export {
|
|
22
32
|
DefaultReportableErrorTypes,
|
|
23
33
|
a as NoticeCategory,
|
|
24
34
|
NoticeTone,
|
|
35
|
+
SessionExpiredNotice,
|
|
25
36
|
c as createFeedbackBus,
|
|
26
37
|
feedbackBus,
|
|
27
38
|
feedbackQueryErrors,
|
|
39
|
+
feedbackSessionExpiry,
|
|
28
40
|
n as notify,
|
|
29
41
|
toErrorNotice
|
|
30
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/feedback/FeedbackQueryErrors.ts"],"sourcesContent":["import { AppErrorType, type AppError } from '../foundation/results';\nimport type { Reporter } from '../reporting';\nimport { feedbackBus, NoticeTone, type FeedbackBus, type FeedbackNotice } from './FeedbackBus';\n\n/**\n * Provides the failure types that offer a one-click report by default — the ones that point at a defect or an\n * outage. Validation, auth, not-found and conflict failures are the user's to fix, so a report would be noise.\n */\nexport const DefaultReportableErrorTypes: ReadonlyArray<AppErrorType> = Object.freeze([\n AppErrorType.Unexpected,\n AppErrorType.Unavailable,\n AppErrorType.Timeout,\n]);\n\n/** Defines the options for {@link feedbackQueryErrors}. */\nexport interface FeedbackQueryErrorsOptions {\n /**\n * Captures each reportable failure as an incident and offers its one-click send on the notice. Omitted,\n * notices carry no Report action.\n */\n readonly reporter?: Pick<Reporter, 'capture'>;\n /** Decides which failures offer a report. Default: the type is in {@link DefaultReportableErrorTypes}. */\n readonly isReportable?: (error: AppError) => boolean;\n}\n\n/** Maps the catalog's display-safe message without exposing raw exception or server diagnostics. */\nexport function toErrorNotice(error: AppError): FeedbackNotice {\n return { tone: NoticeTone.Danger, title: error.message };\n}\n\n/**\n * Creates the explicit query failure-to-notice adapter
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/feedback/FeedbackQueryErrors.ts","../../src/feedback/FeedbackSessionExpiry.ts"],"sourcesContent":["import { AppErrorType, type AppError } from '../foundation/results';\nimport type { Reporter } from '../reporting';\nimport { feedbackBus, NoticeTone, type FeedbackBus, type FeedbackNotice } from './FeedbackBus';\n\n/**\n * Provides the failure types that offer a one-click report by default — the ones that point at a defect or an\n * outage. Validation, auth, not-found and conflict failures are the user's to fix, so a report would be noise.\n */\nexport const DefaultReportableErrorTypes: ReadonlyArray<AppErrorType> = Object.freeze([\n AppErrorType.Unexpected,\n AppErrorType.Unavailable,\n AppErrorType.Timeout,\n]);\n\n/** Defines the options for {@link feedbackQueryErrors}. */\nexport interface FeedbackQueryErrorsOptions {\n /**\n * Captures each reportable failure as an incident and offers its one-click send on the notice. Omitted,\n * notices carry no Report action.\n */\n readonly reporter?: Pick<Reporter, 'capture'>;\n /** Decides which failures offer a report. Default: the type is in {@link DefaultReportableErrorTypes}. */\n readonly isReportable?: (error: AppError) => boolean;\n}\n\n/** Maps the catalog's display-safe message without exposing raw exception or server diagnostics. */\nexport function toErrorNotice(error: AppError): FeedbackNotice {\n return { tone: NoticeTone.Danger, title: error.message };\n}\n\n/**\n * Creates the explicit query failure-to-notice adapter. Cancellation and 401 stay quiet: an unauthorized\n * request belongs to the session-expiry path (`bridge.subscribeExpired`), never an error toast. With a\n * `reporter`, a reportable failure is captured the moment it happens — freezing the trail and the request\n * behind it — and the notice carries the incident's send, so the user reports it with one click.\n */\nexport function feedbackQueryErrors(\n bus: FeedbackBus = feedbackBus,\n options: FeedbackQueryErrorsOptions = {},\n): (error: AppError) => void {\n const { reporter } = options;\n const isReportable = options.isReportable ?? ((error: AppError) => DefaultReportableErrorTypes.includes(error.type));\n return (error) => {\n if (error.type === AppErrorType.Cancelled || error.type === AppErrorType.Unauthorized) return;\n const notice = toErrorNotice(error);\n bus.notify(reporter && isReportable(error) ? { ...notice, report: reporter.capture(error).send } : notice);\n };\n}\n","import { feedbackBus, NoticeTone, type FeedbackBus, type FeedbackNotice } from './FeedbackBus';\n\n/** The single neutral notice an expired session publishes; its fixed id replaces a repeat instead of stacking. */\nexport const SessionExpiredNotice: FeedbackNotice = Object.freeze({\n id: 'session-expired',\n tone: NoticeTone.Info,\n title: 'Signed out — sign in again',\n});\n\n/** Creates the `bridge.subscribeExpired` listener that publishes one neutral notice per expiry. */\nexport function feedbackSessionExpiry(\n bus: FeedbackBus = feedbackBus,\n notice: FeedbackNotice = SessionExpiredNotice,\n): () => void {\n return () => {\n bus.notify(notice);\n };\n}\n"],"names":[],"mappings":";;;AAQO,MAAM,8BAA2D,OAAO,OAAO;AAAA,EACpF,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AACf,CAAC;AAcM,SAAS,cAAc,OAAiC;AAC7D,SAAO,EAAE,MAAM,WAAW,QAAQ,OAAO,MAAM,QAAA;AACjD;AAQO,SAAS,oBACd,MAAmB,aACnB,UAAsC,CAAA,GACX;AAC3B,QAAM,EAAE,aAAa;AACrB,QAAM,eAAe,QAAQ,iBAAiB,CAAC,UAAoB,4BAA4B,SAAS,MAAM,IAAI;AAClH,SAAO,CAAC,UAAU;AAChB,QAAI,MAAM,SAAS,aAAa,aAAa,MAAM,SAAS,aAAa,aAAc;AACvF,UAAM,SAAS,cAAc,KAAK;AAClC,QAAI,OAAO,YAAY,aAAa,KAAK,IAAI,EAAE,GAAG,QAAQ,QAAQ,SAAS,QAAQ,KAAK,EAAE,KAAA,IAAS,MAAM;AAAA,EAC3G;AACF;AC5CO,MAAM,uBAAuC,OAAO,OAAO;AAAA,EAChE,IAAI;AAAA,EACJ,MAAM,WAAW;AAAA,EACjB,OAAO;AACT,CAAC;AAGM,SAAS,sBACd,MAAmB,aACnB,SAAyB,sBACb;AACZ,SAAO,MAAM;AACX,QAAI,OAAO,MAAM;AAAA,EACnB;AACF;"}
|
|
@@ -3,6 +3,8 @@ import { a as useMediaQuery, s as subscribeMediaQuery } from "../../chunks/UseRe
|
|
|
3
3
|
import { u } from "../../chunks/UseReducedMotion-NZ5fg-Xb.js";
|
|
4
4
|
import { u as useEventListener } from "../../chunks/UseEventListener-C1WgWGoT.js";
|
|
5
5
|
import { i as isApplePlatform } from "../../chunks/Chord-C3OKRsgk.js";
|
|
6
|
+
import { t as toBreakpointQueries, r as resolveBreakpoint } from "../../chunks/Breakpoints-CltjxN0E.js";
|
|
7
|
+
import { T } from "../../chunks/Breakpoints-CltjxN0E.js";
|
|
6
8
|
const PointerType = {
|
|
7
9
|
/** Low-precision primary pointer — a finger on a touchscreen, a TV remote. Size hit targets generously. */
|
|
8
10
|
Coarse: "coarse",
|
|
@@ -114,32 +116,6 @@ function getPlatform(hint) {
|
|
|
114
116
|
if (/linux|x11|cros|chrome ?os/i.test(source)) return Platform.Linux;
|
|
115
117
|
return Platform.Unknown;
|
|
116
118
|
}
|
|
117
|
-
const TailwindBreakpoints = {
|
|
118
|
-
/** ≥ 640px. */
|
|
119
|
-
sm: 640,
|
|
120
|
-
/** ≥ 768px. */
|
|
121
|
-
md: 768,
|
|
122
|
-
/** ≥ 1024px. */
|
|
123
|
-
lg: 1024,
|
|
124
|
-
/** ≥ 1280px. */
|
|
125
|
-
xl: 1280,
|
|
126
|
-
/** ≥ 1536px. */
|
|
127
|
-
"2xl": 1536
|
|
128
|
-
};
|
|
129
|
-
function toBreakpointQueries(scale) {
|
|
130
|
-
return Object.entries(scale).filter(([, minWidth]) => Number.isFinite(minWidth) && minWidth >= 0).sort(([, left], [, right]) => right - left).map(([key, minWidth]) => ({
|
|
131
|
-
// `Object.entries` widens the key to `string`; by construction it is a key of `scale`.
|
|
132
|
-
key,
|
|
133
|
-
minWidth,
|
|
134
|
-
query: `(min-width: ${minWidth}px)`
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
function resolveBreakpoint(queries, matches) {
|
|
138
|
-
for (const [index, entry] of queries.entries()) {
|
|
139
|
-
if (matches[index] === true) return entry.key;
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
119
|
function useBreakpoint(scale) {
|
|
144
120
|
const queries = computed(() => toBreakpointQueries(toValue(scale)));
|
|
145
121
|
const active = shallowRef(null);
|
|
@@ -177,7 +153,7 @@ export {
|
|
|
177
153
|
DisplayMode,
|
|
178
154
|
Platform,
|
|
179
155
|
PointerType,
|
|
180
|
-
TailwindBreakpoints,
|
|
156
|
+
T as TailwindBreakpoints,
|
|
181
157
|
getPlatform,
|
|
182
158
|
resolveBreakpoint,
|
|
183
159
|
toBreakpointQueries,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/foundation/device/enums/PointerType.ts","../../../src/foundation/device/hooks/UsePointer.ts","../../../src/foundation/device/hooks/UseOnlineStatus.ts","../../../src/foundation/device/enums/DisplayMode.ts","../../../src/foundation/device/hooks/UseDisplayMode.ts","../../../src/foundation/device/Platform.ts","../../../src/foundation/device/Breakpoints.ts","../../../src/foundation/device/hooks/UseBreakpoint.ts"],"sourcesContent":["// The pointer vocabulary, kept in its own file rather than inlined into the composable so a consumer can switch\n// on `PointerType.Coarse` without pulling Vue into a pure module — the same value/composable split\n// `foundation/shortcuts` uses for `Modifier` vs `UseHotkeys`.\n\n/** How precise the primary pointing device is, per the CSS `pointer` media feature. */\nexport const PointerType = {\n /** Low-precision primary pointer — a finger on a touchscreen, a TV remote. Size hit targets generously. */\n Coarse: 'coarse',\n /** High-precision primary pointer — a mouse, trackpad, or stylus. Hover affordances are meaningful here. */\n Fine: 'fine',\n /** No pointing device at all — keyboard- or voice-driven. Also the SSR answer, where nothing is knowable yet. */\n None: 'none',\n} as const;\n\n/** One of the {@link PointerType} values. */\nexport type PointerType = (typeof PointerType)[keyof typeof PointerType];\n","// Pointer precision and hover capability, read from the CSS `pointer` / `hover` media features through the shared\n// `useMediaQuery`.\n//\n// WHY NOT A USER-AGENT SNIFF: \"is this a touch device\" is not a device question, it is an INPUT question, and the\n// two diverge constantly. A Windows laptop with a touchscreen has both a fine mouse and a coarse finger; an iPad\n// with a Magic Keyboard reports a FINE pointer; a phone in desktop-site mode still has only a finger. A UA string\n// describes none of that, is trivially spoofed, and is frozen or deprecated on every Chromium browser. The media\n// features track the pointer the user is ACTUALLY holding and re-evaluate when it changes.\n//\n// WHY NOT `'ontouchstart' in window` AS THE PRIMARY SIGNAL: it proves the touch EVENT API is implemented, not that\n// a touchscreen is attached — every desktop Chromium build ships the API, so the check reads true on a mouse-only\n// machine and the UI grows finger-sized hit targets nobody needs. It is also a one-shot boolean with no change\n// event, so it can never react to a tablet being docked to a keyboard mid-session. `(pointer: coarse)` answers the\n// question that was actually being asked, and answers it reactively.\n\nimport { computed, type ComputedRef } from 'vue';\n\nimport { useMediaQuery } from './UseMediaQuery';\n\nimport { PointerType } from '../enums/PointerType';\n\n// `pointer` / `hover` describe the PRIMARY pointing device. The `any-pointer` / `any-hover` variants report every\n// attached device instead, which is the wrong question for layout: a touchscreen laptop matches `any-pointer:\n// coarse` while the user drives it entirely by mouse, and sizing every target for the finger they are not using\n// wastes the screen. Primary is what layout should follow.\nconst FinePointerQuery = '(pointer: fine)';\nconst CoarsePointerQuery = '(pointer: coarse)';\nconst HoverQuery = '(hover: hover)';\n\n/**\n * Reports the precision of the primary pointing device — `'fine'` (mouse, trackpad, stylus), `'coarse'` (finger),\n * or `'none'`.\n *\n * Reactive: a tablet gaining a mouse flips `'coarse'` → `'fine'` without a reload.\n *\n * Under SSR this reads `'none'` (there are no media features to read) and corrects on hydration. Treat `'none'`\n * as \"no pointer known\", not as a fact — never hide an essential affordance behind it.\n *\n * @returns The active {@link PointerType}.\n */\nexport function usePointerType(): ComputedRef<PointerType> {\n const fine = useMediaQuery(FinePointerQuery);\n const coarse = useMediaQuery(CoarsePointerQuery);\n\n // `pointer` names one primary device, so at most one of these matches in practice. `fine` is tested first so\n // that a browser reporting both resolves to the more capable pointer rather than to a coincidence of ordering.\n return computed(() => {\n if (fine.value) return PointerType.Fine;\n if (coarse.value) return PointerType.Coarse;\n return PointerType.None;\n });\n}\n\n/**\n * Whether the primary pointing device can hover — the `(hover: hover)` media feature.\n *\n * Gate hover-only affordances on this: a tooltip that opens on mouseover, a table row's hover-revealed actions. On\n * a touchscreen a hover-only control is simply unreachable and needs a tap target or an always-visible equivalent.\n *\n * Reads `false` under SSR, so hover-revealed content must never be the only path to an action.\n *\n * @returns `true` when the primary pointer can hover.\n */\nexport function useHoverCapability(): ComputedRef<boolean> {\n const hover = useMediaQuery(HoverQuery);\n return computed(() => hover.value);\n}\n","// Network reachability — or as much of it as the browser is willing to admit to.\n//\n// WHAT `navigator.onLine` ACTUALLY MEANS: it is `false` only when the browser is certain there is NO network link\n// — airplane mode, Wi-Fi off, cable unplugged. It is `true` the moment a link exists and says NOTHING beyond that.\n// A captive portal nobody has logged into, hotel Wi-Fi that has not been paid for, a dropped VPN, a DNS failure,\n// or an API that is simply down all report `true`. So `false` is trustworthy and `true` is a hint.\n//\n// USE ACCORDINGLY: explain a failure that already happened (\"you appear to be offline\"), defer a retry, pause a\n// poll. Never treat `true` as a precondition — \"we are online, so this request will succeed\" is exactly the\n// inference this value cannot support. Proving the server that matters is reachable takes a request to it, which\n// is `foundation/http`'s job and not this slice's.\n//\n// The `online` / `offline` events bind through `foundation/dom`' `useEventListener` rather than a hand-rolled\n// `addEventListener`, so handler identity, attach options, and teardown follow the same rules as every other\n// listener in the library. The target is a GETTER, not a module constant: resolving `window` at module scope\n// would evaluate during a server render, and the lazy getter is the same shape `useEventListener` uses for its\n// own default.\n\nimport { onMounted, shallowRef, type ShallowRef } from 'vue';\n\nimport { useEventListener } from '../../dom';\n\n/** Resolved lazily so importing this module in an SSR pass never touches `window`. */\nconst globalTarget = (): Window | null => (typeof window === 'undefined' ? null : window);\n\n/**\n * Reads `navigator.onLine`, defaulting to online when there is no `navigator` (SSR), when the property is missing\n * (a partial polyfill), or when the read throws. Optimistic by design — see the note on the composable.\n */\nfunction readOnlineStatus(): boolean {\n try {\n if (typeof navigator === 'undefined') return true;\n return navigator.onLine !== false;\n } catch {\n return true;\n }\n}\n\n/**\n * Tracks whether the browser believes it has a network link — seeded optimistically, synced from\n * `navigator.onLine` on mount, then kept current by the window `online` / `offline` events.\n *\n * Reads `true` under SSR and whenever the status cannot be read: an offline banner rendered by a server that has\n * never met the client is worse than a missing one, and the value corrects on mount either way. Read this file's\n * header before acting on it — `false` is reliable, `true` only means a link exists.\n *\n * @returns `true` while the browser reports a network link.\n */\nexport function useOnlineStatus(): Readonly<ShallowRef<boolean>> {\n // Seeded `true` rather than read at setup: `readOnlineStatus` answers `true` under SSR anyway, and seeding a\n // constant keeps `navigator` out of the setup pass entirely.\n const online = shallowRef(true);\n\n // Re-read once on mount. Two gaps the events alone can never close: the seed was unconditional, and the link\n // can flip between setup and the listeners attaching.\n onMounted(() => {\n online.value = readOnlineStatus();\n });\n\n useEventListener(\n 'online',\n () => {\n online.value = true;\n },\n globalTarget,\n );\n useEventListener(\n 'offline',\n () => {\n online.value = false;\n },\n globalTarget,\n );\n\n return online;\n}\n","// The display-mode vocabulary. Split from its composable for the same reason as `PointerType` — a consumer\n// comparing against `DisplayMode.Standalone` should not have to import Vue to do it.\n\n/** How the document is being presented — the values of the CSS `display-mode` media feature. */\nexport const DisplayMode = {\n /** Installed and running in its own window with no browser chrome. The usual \"is this a PWA\" answer. */\n Standalone: 'standalone',\n /** Filling the screen with no OS chrome either — kiosk displays, the Fullscreen API. */\n Fullscreen: 'fullscreen',\n /** Own window with a minimal navigation strip (back / reload). Installed, but not chrome-free. */\n MinimalUi: 'minimal-ui',\n /** An ordinary browser tab. Also the SSR answer. */\n Browser: 'browser',\n} as const;\n\n/** One of the {@link DisplayMode} values. */\nexport type DisplayMode = (typeof DisplayMode)[keyof typeof DisplayMode];\n","// Display mode — how the document is presented, and by extension whether the app was installed.\n//\n// Read entirely through `display-mode` media queries on the shared `useMediaQuery`, which makes the answer\n// reactive: a window entering or leaving fullscreen updates live, where the one-shot check at startup that most\n// codebases write would be stale for the rest of the session.\n//\n// QUERY ORDER IS LOAD-BEARING, and is not alphabetical. Browsers do not reliably report exactly one match — a\n// standalone window driven into fullscreen can satisfy both `(display-mode: fullscreen)` and\n// `(display-mode: standalone)` — so the most specific presentation is tested first and wins.\n//\n// KNOWN GAP — iOS Safari only supports `display-mode` from 16.4. On older iOS an installed home-screen app reports\n// `'browser'` here. Its legacy signal is the non-standard `navigator.standalone`, deliberately NOT read: this\n// slice keeps a single detection mechanism, and adding a second, non-reactive sniffer for one stale OS version\n// buys a narrow tail at the cost of two code paths that can disagree. A consumer that needs that tail can read\n// `navigator.standalone` itself and OR it in.\n\nimport { computed, type ComputedRef } from 'vue';\n\nimport { useMediaQuery } from './UseMediaQuery';\n\nimport { DisplayMode } from '../enums/DisplayMode';\n\nconst FullscreenQuery = '(display-mode: fullscreen)';\nconst StandaloneQuery = '(display-mode: standalone)';\nconst MinimalUiQuery = '(display-mode: minimal-ui)';\n\n/**\n * Reports how the document is being presented — its {@link DisplayMode}.\n *\n * Falls back to `'browser'` when no mode query matches, which is also what SSR and any browser without\n * `display-mode` support produce. `'browser'` therefore means \"an ordinary tab, as far as can be told\", not a\n * proof that the app is uninstalled.\n *\n * @returns The active {@link DisplayMode}.\n */\nexport function useDisplayMode(): ComputedRef<DisplayMode> {\n const fullscreen = useMediaQuery(FullscreenQuery);\n const standalone = useMediaQuery(StandaloneQuery);\n const minimalUi = useMediaQuery(MinimalUiQuery);\n\n return computed(() => {\n if (fullscreen.value) return DisplayMode.Fullscreen;\n if (standalone.value) return DisplayMode.Standalone;\n if (minimalUi.value) return DisplayMode.MinimalUi;\n return DisplayMode.Browser;\n });\n}\n\n/**\n * Whether the app is running as an installed app rather than in a browser tab — any display mode other than\n * `'browser'`.\n *\n * Reads `false` under SSR and on iOS < 16.4 (see this file's header). Use it to ADD an installed-only affordance\n * — suppressing an \"Install app\" prompt, showing a custom title bar — never to withhold functionality, because a\n * `false` here can mean \"installed, but undetectable\".\n *\n * @returns `true` when the app is presented outside an ordinary browser tab.\n */\nexport function useIsInstalled(): ComputedRef<boolean> {\n const mode = useDisplayMode();\n return computed(() => mode.value !== DisplayMode.Browser);\n}\n","// Platform identification — the LAST-RESORT signal in this slice, and the only one here that asks what the\n// environment IS rather than what it can DO.\n//\n// USE IT ONLY FOR COSMETICS: rendering `⌘K` vs `Ctrl+K` in a shortcut hint, naming a modifier in help text,\n// labelling a button \"Show in Finder\" vs \"Show in Explorer\". NEVER gate a feature on it. A user agent is freely\n// spoofed, `navigator.platform` is deprecated, Chromium freezes its UA, and every question worth gating on\n// (pointer precision, hover, display mode, viewport) has a real capability query in this slice that answers it\n// truthfully. Platform sniffing gates on a guess; a media feature gates on the fact.\n//\n// The Apple branch delegates to `foundation/shortcuts`' `isApplePlatform` rather than re-sniffing: that predicate\n// already backs `mod` → ⌘ resolution, and two sniffers that drift apart would render a ⌘ hint on a Ctrl machine.\n// This file adds the other three families around it and reuses its exact source-precedence rules.\n//\n// Ordering is load-bearing. Android is tested before Linux because Android's UA names the Linux kernel; the\n// Windows pattern is anchored on real tokens (`Windows` / `Win32` / `Win64` / `WOW64`) rather than a bare `win`,\n// which would misread `Darwin` — a substring collision that silently turns a Mac into a PC.\n\nimport { isApplePlatform } from '../shortcuts';\n\n/** The coarse OS families this slice distinguishes. */\nexport const Platform = {\n /** macOS, iOS, or iPadOS. */\n Apple: 'apple',\n /** Any Windows desktop. */\n Windows: 'windows',\n /** Android phones and tablets. */\n Android: 'android',\n /** Desktop Linux, X11, and ChromeOS — all Ctrl-keyed, all Linux-idiomatic in their affordances. */\n Linux: 'linux',\n /** Nothing recognisable — SSR, a stripped user agent, or a platform outside the four above. */\n Unknown: 'unknown',\n} as const;\n\n/** One of the {@link Platform} families. */\nexport type Platform = (typeof Platform)[keyof typeof Platform];\n\n/**\n * Reads the best available platform string, preferring the modern `userAgentData.platform` over the deprecated\n * `navigator.platform` and falling back to the full user agent. Mirrors `isApplePlatform`'s precedence exactly so\n * both predicates always judge the same text. Returns `''` under SSR or if any read throws.\n */\nfunction readPlatformSource(): string {\n try {\n if (typeof navigator === 'undefined') return '';\n const nav = navigator as Navigator & { userAgentData?: { platform?: string } };\n return nav.userAgentData?.platform || nav.platform || nav.userAgent || '';\n } catch {\n // A throwing `navigator` getter (polyfill, hardened environment) reads as \"no information\", never as a crash.\n return '';\n }\n}\n\n/**\n * Identifies the OS family. Read this file's header before using it: the answer is for cosmetic, platform-idiomatic\n * decisions only, never for feature gating.\n *\n * Never throws. Returns `'unknown'` under SSR, for an unrecognised platform, and for an empty hint.\n *\n * @param hint Forces the string that is matched, instead of reading the environment — makes tests deterministic and\n * lets a server render for a client whose platform it already knows. Accepts a full user agent, a\n * `userAgentData.platform` value, or a bare token such as `'Windows'`.\n * @returns The detected {@link Platform}.\n */\nexport function getPlatform(hint?: string): Platform {\n const source = hint ?? readPlatformSource();\n\n if (isApplePlatform(source)) return Platform.Apple;\n if (/android/i.test(source)) return Platform.Android;\n if (/windows|win32|win64|wow64/i.test(source)) return Platform.Windows;\n if (/linux|x11|cros|chrome ?os/i.test(source)) return Platform.Linux;\n return Platform.Unknown;\n}\n","// The breakpoint model — pure, DOM-free, and deliberately WITHOUT a built-in scale.\n//\n// WHY NO DEFAULT SCALE: this library is Tailwind-v4 token-driven, so the app owns its breakpoints in its `@theme`\n// block. A scale hardcoded here would be a second source of truth that silently disagrees with the CSS the same\n// app ships — a layout that switches at 768px in JS and 720px in CSS is a bug no test in this repo could see.\n// `TailwindBreakpoints` is offered as a constant the caller may opt into, never a fallback a composable reaches for.\n//\n// Queries are plain `(min-width: …)` sorted WIDEST FIRST, so \"the first query that matches\" is the active\n// breakpoint. Mutually-exclusive bands (`min` and `max` together) are the alternative and were rejected: bands\n// need a sentinel max for the widest entry and a sub-pixel gap between neighbours (`max-width: 767.98px`), and\n// both are places for an off-by-one to hide. Independent min-width queries have neither, and match how the\n// mobile-first CSS beside them already cascades.\n\n/** A breakpoint scale — each key (`sm`, `md`, …) mapped to its minimum viewport width in CSS pixels. */\nexport type BreakpointScale = Readonly<Record<string, number>>;\n\n/**\n * Tailwind v4's default breakpoint scale, in CSS pixels. Opt-in: pass it to `useBreakpoint` explicitly. An app\n * that customised its `@theme` breakpoints must pass its own map instead, or JS and CSS will disagree.\n */\nexport const TailwindBreakpoints = {\n /** ≥ 640px. */\n sm: 640,\n /** ≥ 768px. */\n md: 768,\n /** ≥ 1024px. */\n lg: 1024,\n /** ≥ 1280px. */\n xl: 1280,\n /** ≥ 1536px. */\n '2xl': 1536,\n} as const;\n\n/** One breakpoint compiled to the media query that detects it. */\nexport interface BreakpointQuery<TKey extends string = string> {\n /** The scale key this query stands for. */\n readonly key: TKey;\n /** The minimum viewport width, in CSS pixels. */\n readonly minWidth: number;\n /** The `(min-width: …px)` string to hand to `matchMedia`. */\n readonly query: string;\n}\n\n/**\n * Compiles a scale into widest-first `(min-width: …)` queries.\n *\n * Entries whose width is not a finite number `>= 0` are dropped: a malformed scale must not emit\n * `(min-width: NaNpx)`, which `matchMedia` accepts and then never matches, quietly skewing the resolved\n * breakpoint instead of failing.\n *\n * @param scale The caller's breakpoint map.\n * @returns The scale's valid entries as queries, widest first.\n */\nexport function toBreakpointQueries<TScale extends BreakpointScale>(\n scale: TScale,\n): ReadonlyArray<BreakpointQuery<Extract<keyof TScale, string>>> {\n return Object.entries(scale)\n .filter(([, minWidth]) => Number.isFinite(minWidth) && minWidth >= 0)\n .sort(([, left], [, right]) => right - left)\n .map(([key, minWidth]) => ({\n // `Object.entries` widens the key to `string`; by construction it is a key of `scale`.\n key: key as Extract<keyof TScale, string>,\n minWidth,\n query: `(min-width: ${minWidth}px)`,\n }));\n}\n\n/**\n * Picks the active breakpoint from a widest-first query list and the match results for it.\n *\n * @param queries Compiled queries, widest first, as returned by {@link toBreakpointQueries}.\n * @param matches Match results positionally aligned with `queries`. A shorter array reads as \"did not match\" for\n * the missing tail.\n * @returns The key of the widest matching breakpoint, or `null` when the viewport is narrower than every entry —\n * the implicit mobile-first base band, which by definition has no key of its own.\n */\nexport function resolveBreakpoint<TKey extends string>(\n queries: ReadonlyArray<BreakpointQuery<TKey>>,\n matches: ReadonlyArray<boolean>,\n): TKey | null {\n for (const [index, entry] of queries.entries()) {\n if (matches[index] === true) return entry.key;\n }\n return null;\n}\n","import {\n computed,\n onMounted,\n onScopeDispose,\n shallowRef,\n toValue,\n watch,\n type ComputedRef,\n type MaybeRefOrGetter,\n} from 'vue';\nimport { subscribeMediaQuery } from './UseMediaQuery';\nimport { resolveBreakpoint, toBreakpointQueries, type BreakpointScale } from '../Breakpoints';\n\n/** Tracks every valid breakpoint in the caller's scale and releases replaced subscriptions. */\nexport function useBreakpoint<TScale extends BreakpointScale>(\n scale: MaybeRefOrGetter<TScale>,\n): ComputedRef<Extract<keyof TScale, string> | null> {\n const queries = computed(() => toBreakpointQueries(toValue(scale)));\n const active = shallowRef<Extract<keyof TScale, string> | null>(null);\n let mounted = false;\n let dispose: (() => void) | undefined;\n function subscribe(): void {\n dispose?.();\n dispose = undefined;\n if (!mounted) return;\n const current = queries.value;\n const matches: boolean[] = current.map(() => false);\n active.value = null;\n const disposers = current.map((entry, index) =>\n subscribeMediaQuery(entry.query, (value) => {\n matches[index] = value;\n active.value = resolveBreakpoint(current, matches);\n }),\n );\n dispose = () => {\n for (const unsubscribe of disposers) unsubscribe();\n };\n }\n onMounted(() => {\n mounted = true;\n subscribe();\n });\n watch(queries, subscribe);\n onScopeDispose(() => {\n mounted = false;\n dispose?.();\n });\n return computed(() => active.value);\n}\n"],"names":[],"mappings":";;;;;AAKO,MAAM,cAAc;AAAA;AAAA,EAEzB,QAAQ;AAAA;AAAA,EAER,MAAM;AAAA;AAAA,EAEN,MAAM;AACR;ACaA,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,aAAa;AAaZ,SAAS,iBAA2C;AACzD,QAAM,OAAO,cAAc,gBAAgB;AAC3C,QAAM,SAAS,cAAc,kBAAkB;AAI/C,SAAO,SAAS,MAAM;AACpB,QAAI,KAAK,MAAO,QAAO,YAAY;AACnC,QAAI,OAAO,MAAO,QAAO,YAAY;AACrC,WAAO,YAAY;AAAA,EACrB,CAAC;AACH;AAYO,SAAS,qBAA2C;AACzD,QAAM,QAAQ,cAAc,UAAU;AACtC,SAAO,SAAS,MAAM,MAAM,KAAK;AACnC;AC3CA,MAAM,eAAe,MAAsB,OAAO,WAAW,cAAc,OAAO;AAMlF,SAAS,mBAA4B;AACnC,MAAI;AACF,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,UAAqB,QAAQ,IAAI,MAAM,KAAK;AAClD,WAAO,QAAQ;AACf,UAAM,YAAY,QAAQ;AAAA,MAAI,CAAC,OAAO,UACpC,oBAAoB,MAAM,OAAO,CAAC,UAAU;AAC1C,gBAAQ,KAAK,IAAI;AACjB,eAAO,QAAQ,kBAAkB,SAAS,OAAO;AAAA,MACnD,CAAC;AAAA,IAAA;AAEH,cAAU,MAAM;AACd,iBAAW,eAAe,UAAW,aAAA;AAAA,IACvC;AAAA,EACF;AACA,YAAU,MAAM;AACd,cAAU;AACV,cAAA;AAAA,EACF,CAAC;AACD,QAAM,SAAS,SAAS;AACxB,iBAAe,MAAM;AACnB,cAAU;AACV,cAAA;AAAA,EACF,CAAC;AACD,SAAO,SAAS,MAAM,OAAO,KAAK;AACpC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/foundation/device/enums/PointerType.ts","../../../src/foundation/device/hooks/UsePointer.ts","../../../src/foundation/device/hooks/UseOnlineStatus.ts","../../../src/foundation/device/enums/DisplayMode.ts","../../../src/foundation/device/hooks/UseDisplayMode.ts","../../../src/foundation/device/Platform.ts","../../../src/foundation/device/hooks/UseBreakpoint.ts"],"sourcesContent":["// The pointer vocabulary, kept in its own file rather than inlined into the composable so a consumer can switch\n// on `PointerType.Coarse` without pulling Vue into a pure module — the same value/composable split\n// `foundation/shortcuts` uses for `Modifier` vs `UseHotkeys`.\n\n/** How precise the primary pointing device is, per the CSS `pointer` media feature. */\nexport const PointerType = {\n /** Low-precision primary pointer — a finger on a touchscreen, a TV remote. Size hit targets generously. */\n Coarse: 'coarse',\n /** High-precision primary pointer — a mouse, trackpad, or stylus. Hover affordances are meaningful here. */\n Fine: 'fine',\n /** No pointing device at all — keyboard- or voice-driven. Also the SSR answer, where nothing is knowable yet. */\n None: 'none',\n} as const;\n\n/** One of the {@link PointerType} values. */\nexport type PointerType = (typeof PointerType)[keyof typeof PointerType];\n","// Pointer precision and hover capability, read from the CSS `pointer` / `hover` media features through the shared\n// `useMediaQuery`.\n//\n// WHY NOT A USER-AGENT SNIFF: \"is this a touch device\" is not a device question, it is an INPUT question, and the\n// two diverge constantly. A Windows laptop with a touchscreen has both a fine mouse and a coarse finger; an iPad\n// with a Magic Keyboard reports a FINE pointer; a phone in desktop-site mode still has only a finger. A UA string\n// describes none of that, is trivially spoofed, and is frozen or deprecated on every Chromium browser. The media\n// features track the pointer the user is ACTUALLY holding and re-evaluate when it changes.\n//\n// WHY NOT `'ontouchstart' in window` AS THE PRIMARY SIGNAL: it proves the touch EVENT API is implemented, not that\n// a touchscreen is attached — every desktop Chromium build ships the API, so the check reads true on a mouse-only\n// machine and the UI grows finger-sized hit targets nobody needs. It is also a one-shot boolean with no change\n// event, so it can never react to a tablet being docked to a keyboard mid-session. `(pointer: coarse)` answers the\n// question that was actually being asked, and answers it reactively.\n\nimport { computed, type ComputedRef } from 'vue';\n\nimport { useMediaQuery } from './UseMediaQuery';\n\nimport { PointerType } from '../enums/PointerType';\n\n// `pointer` / `hover` describe the PRIMARY pointing device. The `any-pointer` / `any-hover` variants report every\n// attached device instead, which is the wrong question for layout: a touchscreen laptop matches `any-pointer:\n// coarse` while the user drives it entirely by mouse, and sizing every target for the finger they are not using\n// wastes the screen. Primary is what layout should follow.\nconst FinePointerQuery = '(pointer: fine)';\nconst CoarsePointerQuery = '(pointer: coarse)';\nconst HoverQuery = '(hover: hover)';\n\n/**\n * Reports the precision of the primary pointing device — `'fine'` (mouse, trackpad, stylus), `'coarse'` (finger),\n * or `'none'`.\n *\n * Reactive: a tablet gaining a mouse flips `'coarse'` → `'fine'` without a reload.\n *\n * Under SSR this reads `'none'` (there are no media features to read) and corrects on hydration. Treat `'none'`\n * as \"no pointer known\", not as a fact — never hide an essential affordance behind it.\n *\n * @returns The active {@link PointerType}.\n */\nexport function usePointerType(): ComputedRef<PointerType> {\n const fine = useMediaQuery(FinePointerQuery);\n const coarse = useMediaQuery(CoarsePointerQuery);\n\n // `pointer` names one primary device, so at most one of these matches in practice. `fine` is tested first so\n // that a browser reporting both resolves to the more capable pointer rather than to a coincidence of ordering.\n return computed(() => {\n if (fine.value) return PointerType.Fine;\n if (coarse.value) return PointerType.Coarse;\n return PointerType.None;\n });\n}\n\n/**\n * Whether the primary pointing device can hover — the `(hover: hover)` media feature.\n *\n * Gate hover-only affordances on this: a tooltip that opens on mouseover, a table row's hover-revealed actions. On\n * a touchscreen a hover-only control is simply unreachable and needs a tap target or an always-visible equivalent.\n *\n * Reads `false` under SSR, so hover-revealed content must never be the only path to an action.\n *\n * @returns `true` when the primary pointer can hover.\n */\nexport function useHoverCapability(): ComputedRef<boolean> {\n const hover = useMediaQuery(HoverQuery);\n return computed(() => hover.value);\n}\n","// Network reachability — or as much of it as the browser is willing to admit to.\n//\n// WHAT `navigator.onLine` ACTUALLY MEANS: it is `false` only when the browser is certain there is NO network link\n// — airplane mode, Wi-Fi off, cable unplugged. It is `true` the moment a link exists and says NOTHING beyond that.\n// A captive portal nobody has logged into, hotel Wi-Fi that has not been paid for, a dropped VPN, a DNS failure,\n// or an API that is simply down all report `true`. So `false` is trustworthy and `true` is a hint.\n//\n// USE ACCORDINGLY: explain a failure that already happened (\"you appear to be offline\"), defer a retry, pause a\n// poll. Never treat `true` as a precondition — \"we are online, so this request will succeed\" is exactly the\n// inference this value cannot support. Proving the server that matters is reachable takes a request to it, which\n// is `foundation/http`'s job and not this slice's.\n//\n// The `online` / `offline` events bind through `foundation/dom`' `useEventListener` rather than a hand-rolled\n// `addEventListener`, so handler identity, attach options, and teardown follow the same rules as every other\n// listener in the library. The target is a GETTER, not a module constant: resolving `window` at module scope\n// would evaluate during a server render, and the lazy getter is the same shape `useEventListener` uses for its\n// own default.\n\nimport { onMounted, shallowRef, type ShallowRef } from 'vue';\n\nimport { useEventListener } from '../../dom';\n\n/** Resolved lazily so importing this module in an SSR pass never touches `window`. */\nconst globalTarget = (): Window | null => (typeof window === 'undefined' ? null : window);\n\n/**\n * Reads `navigator.onLine`, defaulting to online when there is no `navigator` (SSR), when the property is missing\n * (a partial polyfill), or when the read throws. Optimistic by design — see the note on the composable.\n */\nfunction readOnlineStatus(): boolean {\n try {\n if (typeof navigator === 'undefined') return true;\n return navigator.onLine !== false;\n } catch {\n return true;\n }\n}\n\n/**\n * Tracks whether the browser believes it has a network link — seeded optimistically, synced from\n * `navigator.onLine` on mount, then kept current by the window `online` / `offline` events.\n *\n * Reads `true` under SSR and whenever the status cannot be read: an offline banner rendered by a server that has\n * never met the client is worse than a missing one, and the value corrects on mount either way. Read this file's\n * header before acting on it — `false` is reliable, `true` only means a link exists.\n *\n * @returns `true` while the browser reports a network link.\n */\nexport function useOnlineStatus(): Readonly<ShallowRef<boolean>> {\n // Seeded `true` rather than read at setup: `readOnlineStatus` answers `true` under SSR anyway, and seeding a\n // constant keeps `navigator` out of the setup pass entirely.\n const online = shallowRef(true);\n\n // Re-read once on mount. Two gaps the events alone can never close: the seed was unconditional, and the link\n // can flip between setup and the listeners attaching.\n onMounted(() => {\n online.value = readOnlineStatus();\n });\n\n useEventListener(\n 'online',\n () => {\n online.value = true;\n },\n globalTarget,\n );\n useEventListener(\n 'offline',\n () => {\n online.value = false;\n },\n globalTarget,\n );\n\n return online;\n}\n","// The display-mode vocabulary. Split from its composable for the same reason as `PointerType` — a consumer\n// comparing against `DisplayMode.Standalone` should not have to import Vue to do it.\n\n/** How the document is being presented — the values of the CSS `display-mode` media feature. */\nexport const DisplayMode = {\n /** Installed and running in its own window with no browser chrome. The usual \"is this a PWA\" answer. */\n Standalone: 'standalone',\n /** Filling the screen with no OS chrome either — kiosk displays, the Fullscreen API. */\n Fullscreen: 'fullscreen',\n /** Own window with a minimal navigation strip (back / reload). Installed, but not chrome-free. */\n MinimalUi: 'minimal-ui',\n /** An ordinary browser tab. Also the SSR answer. */\n Browser: 'browser',\n} as const;\n\n/** One of the {@link DisplayMode} values. */\nexport type DisplayMode = (typeof DisplayMode)[keyof typeof DisplayMode];\n","// Display mode — how the document is presented, and by extension whether the app was installed.\n//\n// Read entirely through `display-mode` media queries on the shared `useMediaQuery`, which makes the answer\n// reactive: a window entering or leaving fullscreen updates live, where the one-shot check at startup that most\n// codebases write would be stale for the rest of the session.\n//\n// QUERY ORDER IS LOAD-BEARING, and is not alphabetical. Browsers do not reliably report exactly one match — a\n// standalone window driven into fullscreen can satisfy both `(display-mode: fullscreen)` and\n// `(display-mode: standalone)` — so the most specific presentation is tested first and wins.\n//\n// KNOWN GAP — iOS Safari only supports `display-mode` from 16.4. On older iOS an installed home-screen app reports\n// `'browser'` here. Its legacy signal is the non-standard `navigator.standalone`, deliberately NOT read: this\n// slice keeps a single detection mechanism, and adding a second, non-reactive sniffer for one stale OS version\n// buys a narrow tail at the cost of two code paths that can disagree. A consumer that needs that tail can read\n// `navigator.standalone` itself and OR it in.\n\nimport { computed, type ComputedRef } from 'vue';\n\nimport { useMediaQuery } from './UseMediaQuery';\n\nimport { DisplayMode } from '../enums/DisplayMode';\n\nconst FullscreenQuery = '(display-mode: fullscreen)';\nconst StandaloneQuery = '(display-mode: standalone)';\nconst MinimalUiQuery = '(display-mode: minimal-ui)';\n\n/**\n * Reports how the document is being presented — its {@link DisplayMode}.\n *\n * Falls back to `'browser'` when no mode query matches, which is also what SSR and any browser without\n * `display-mode` support produce. `'browser'` therefore means \"an ordinary tab, as far as can be told\", not a\n * proof that the app is uninstalled.\n *\n * @returns The active {@link DisplayMode}.\n */\nexport function useDisplayMode(): ComputedRef<DisplayMode> {\n const fullscreen = useMediaQuery(FullscreenQuery);\n const standalone = useMediaQuery(StandaloneQuery);\n const minimalUi = useMediaQuery(MinimalUiQuery);\n\n return computed(() => {\n if (fullscreen.value) return DisplayMode.Fullscreen;\n if (standalone.value) return DisplayMode.Standalone;\n if (minimalUi.value) return DisplayMode.MinimalUi;\n return DisplayMode.Browser;\n });\n}\n\n/**\n * Whether the app is running as an installed app rather than in a browser tab — any display mode other than\n * `'browser'`.\n *\n * Reads `false` under SSR and on iOS < 16.4 (see this file's header). Use it to ADD an installed-only affordance\n * — suppressing an \"Install app\" prompt, showing a custom title bar — never to withhold functionality, because a\n * `false` here can mean \"installed, but undetectable\".\n *\n * @returns `true` when the app is presented outside an ordinary browser tab.\n */\nexport function useIsInstalled(): ComputedRef<boolean> {\n const mode = useDisplayMode();\n return computed(() => mode.value !== DisplayMode.Browser);\n}\n","// Platform identification — the LAST-RESORT signal in this slice, and the only one here that asks what the\n// environment IS rather than what it can DO.\n//\n// USE IT ONLY FOR COSMETICS: rendering `⌘K` vs `Ctrl+K` in a shortcut hint, naming a modifier in help text,\n// labelling a button \"Show in Finder\" vs \"Show in Explorer\". NEVER gate a feature on it. A user agent is freely\n// spoofed, `navigator.platform` is deprecated, Chromium freezes its UA, and every question worth gating on\n// (pointer precision, hover, display mode, viewport) has a real capability query in this slice that answers it\n// truthfully. Platform sniffing gates on a guess; a media feature gates on the fact.\n//\n// The Apple branch delegates to `foundation/shortcuts`' `isApplePlatform` rather than re-sniffing: that predicate\n// already backs `mod` → ⌘ resolution, and two sniffers that drift apart would render a ⌘ hint on a Ctrl machine.\n// This file adds the other three families around it and reuses its exact source-precedence rules.\n//\n// Ordering is load-bearing. Android is tested before Linux because Android's UA names the Linux kernel; the\n// Windows pattern is anchored on real tokens (`Windows` / `Win32` / `Win64` / `WOW64`) rather than a bare `win`,\n// which would misread `Darwin` — a substring collision that silently turns a Mac into a PC.\n\nimport { isApplePlatform } from '../shortcuts';\n\n/** The coarse OS families this slice distinguishes. */\nexport const Platform = {\n /** macOS, iOS, or iPadOS. */\n Apple: 'apple',\n /** Any Windows desktop. */\n Windows: 'windows',\n /** Android phones and tablets. */\n Android: 'android',\n /** Desktop Linux, X11, and ChromeOS — all Ctrl-keyed, all Linux-idiomatic in their affordances. */\n Linux: 'linux',\n /** Nothing recognisable — SSR, a stripped user agent, or a platform outside the four above. */\n Unknown: 'unknown',\n} as const;\n\n/** One of the {@link Platform} families. */\nexport type Platform = (typeof Platform)[keyof typeof Platform];\n\n/**\n * Reads the best available platform string, preferring the modern `userAgentData.platform` over the deprecated\n * `navigator.platform` and falling back to the full user agent. Mirrors `isApplePlatform`'s precedence exactly so\n * both predicates always judge the same text. Returns `''` under SSR or if any read throws.\n */\nfunction readPlatformSource(): string {\n try {\n if (typeof navigator === 'undefined') return '';\n const nav = navigator as Navigator & { userAgentData?: { platform?: string } };\n return nav.userAgentData?.platform || nav.platform || nav.userAgent || '';\n } catch {\n // A throwing `navigator` getter (polyfill, hardened environment) reads as \"no information\", never as a crash.\n return '';\n }\n}\n\n/**\n * Identifies the OS family. Read this file's header before using it: the answer is for cosmetic, platform-idiomatic\n * decisions only, never for feature gating.\n *\n * Never throws. Returns `'unknown'` under SSR, for an unrecognised platform, and for an empty hint.\n *\n * @param hint Forces the string that is matched, instead of reading the environment — makes tests deterministic and\n * lets a server render for a client whose platform it already knows. Accepts a full user agent, a\n * `userAgentData.platform` value, or a bare token such as `'Windows'`.\n * @returns The detected {@link Platform}.\n */\nexport function getPlatform(hint?: string): Platform {\n const source = hint ?? readPlatformSource();\n\n if (isApplePlatform(source)) return Platform.Apple;\n if (/android/i.test(source)) return Platform.Android;\n if (/windows|win32|win64|wow64/i.test(source)) return Platform.Windows;\n if (/linux|x11|cros|chrome ?os/i.test(source)) return Platform.Linux;\n return Platform.Unknown;\n}\n","import {\n computed,\n onMounted,\n onScopeDispose,\n shallowRef,\n toValue,\n watch,\n type ComputedRef,\n type MaybeRefOrGetter,\n} from 'vue';\nimport { subscribeMediaQuery } from './UseMediaQuery';\nimport { resolveBreakpoint, toBreakpointQueries, type BreakpointScale } from '../Breakpoints';\n\n/** Tracks every valid breakpoint in the caller's scale and releases replaced subscriptions. */\nexport function useBreakpoint<TScale extends BreakpointScale>(\n scale: MaybeRefOrGetter<TScale>,\n): ComputedRef<Extract<keyof TScale, string> | null> {\n const queries = computed(() => toBreakpointQueries(toValue(scale)));\n const active = shallowRef<Extract<keyof TScale, string> | null>(null);\n let mounted = false;\n let dispose: (() => void) | undefined;\n function subscribe(): void {\n dispose?.();\n dispose = undefined;\n if (!mounted) return;\n const current = queries.value;\n const matches: boolean[] = current.map(() => false);\n active.value = null;\n const disposers = current.map((entry, index) =>\n subscribeMediaQuery(entry.query, (value) => {\n matches[index] = value;\n active.value = resolveBreakpoint(current, matches);\n }),\n );\n dispose = () => {\n for (const unsubscribe of disposers) unsubscribe();\n };\n }\n onMounted(() => {\n mounted = true;\n subscribe();\n });\n watch(queries, subscribe);\n onScopeDispose(() => {\n mounted = false;\n dispose?.();\n });\n return computed(() => active.value);\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,cAAc;AAAA;AAAA,EAEzB,QAAQ;AAAA;AAAA,EAER,MAAM;AAAA;AAAA,EAEN,MAAM;AACR;ACaA,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,aAAa;AAaZ,SAAS,iBAA2C;AACzD,QAAM,OAAO,cAAc,gBAAgB;AAC3C,QAAM,SAAS,cAAc,kBAAkB;AAI/C,SAAO,SAAS,MAAM;AACpB,QAAI,KAAK,MAAO,QAAO,YAAY;AACnC,QAAI,OAAO,MAAO,QAAO,YAAY;AACrC,WAAO,YAAY;AAAA,EACrB,CAAC;AACH;AAYO,SAAS,qBAA2C;AACzD,QAAM,QAAQ,cAAc,UAAU;AACtC,SAAO,SAAS,MAAM,MAAM,KAAK;AACnC;AC3CA,MAAM,eAAe,MAAsB,OAAO,WAAW,cAAc,OAAO;AAMlF,SAAS,mBAA4B;AACnC,MAAI;AACF,QAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,WAAO,UAAU,WAAW;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAYO,SAAS,kBAAiD;AAG/D,QAAM,SAAS,WAAW,IAAI;AAI9B,YAAU,MAAM;AACd,WAAO,QAAQ,iBAAA;AAAA,EACjB,CAAC;AAED;AAAA,IACE;AAAA,IACA,MAAM;AACJ,aAAO,QAAQ;AAAA,IACjB;AAAA,IACA;AAAA,EAAA;AAEF;AAAA,IACE;AAAA,IACA,MAA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AAClB;ACzDO,SAAS,cACd,OACmD;AACnD,QAAM,UAAU,SAAS,MAAM,oBAAoB,QAAQ,KAAK,CAAC,CAAC;AAClE,QAAM,SAAS,WAAiD,IAAI;AACpE,MAAI,UAAU;AACd,MAAI;AACJ,WAAS,YAAkB;AACzB,cAAA;AACA,cAAU;AACV,QAAI,CAAC,QAAS;AACd,UAAM,UAAU,QAAQ;AACxB,UAAM,UAAqB,QAAQ,IAAI,MAAM,KAAK;AAClD,WAAO,QAAQ;AACf,UAAM,YAAY,QAAQ;AAAA,MAAI,CAAC,OAAO,UACpC,oBAAoB,MAAM,OAAO,CAAC,UAAU;AAC1C,gBAAQ,KAAK,IAAI;AACjB,eAAO,QAAQ,kBAAkB,SAAS,OAAO;AAAA,MACnD,CAAC;AAAA,IAAA;AAEH,cAAU,MAAM;AACd,iBAAW,eAAe,UAAW,aAAA;AAAA,IACvC;AAAA,EACF;AACA,YAAU,MAAM;AACd,cAAU;AACV,cAAA;AAAA,EACF,CAAC;AACD,QAAM,SAAS,SAAS;AACxB,iBAAe,MAAM;AACnB,cAAU;AACV,cAAA;AAAA,EACF,CAAC;AACD,SAAO,SAAS,MAAM,OAAO,KAAK;AACpC;"}
|
|
@@ -37,6 +37,7 @@ export interface ApiClientOptions {
|
|
|
37
37
|
readonly baseUrl?: string;
|
|
38
38
|
readonly getAuthToken?: () => string | null | Promise<string | null>;
|
|
39
39
|
readonly credentials?: RequestCredentials;
|
|
40
|
+
/** Receives a current-session 401; when it invalidates `scope`, this request resolves cancelled. */
|
|
40
41
|
readonly onUnauthorized?: (failure: ApiFailure, origin?: RequestSnapshot) => void;
|
|
41
42
|
/** Explicit session lifetime; captures once before credentials, retries and response decoding. */
|
|
42
43
|
readonly scope?: RequestScope;
|