@plexui/vue 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,8 +3,11 @@ import { TooltipContent as RekaTooltipContent, TooltipPortal as RekaTooltipPorta
|
|
|
3
3
|
import { useEscCloseStack } from "../../composables/useEscCloseStack.js";
|
|
4
4
|
import { preventDefaultHandler } from "../../lib/helpers.js";
|
|
5
5
|
import { composeEventHandlers, concatAriaDescribedby, firstElementChild, flattenSlot, mergeSlotProps } from "./slot.js";
|
|
6
|
-
import { isHoverPointer } from "../../lib/inputMode.js";
|
|
6
|
+
import { isFocusVisible, isHoverPointer, notePointerInput, trackInputModality } from "../../lib/inputMode.js";
|
|
7
7
|
import s from "@plexui/styles/components/Tooltip/Tooltip.module.css";
|
|
8
|
+
// A tooltip opens on a focus that shows its ring only (isFocusVisible): it follows the last input of the page
|
|
9
|
+
if (typeof document !== "undefined")
|
|
10
|
+
trackInputModality(document);
|
|
8
11
|
const TOOLTIP_OPEN = "tooltip.open";
|
|
9
12
|
// Radix's VisuallyHidden styles (Reka's add clip-path, top and left)
|
|
10
13
|
const VISUALLY_HIDDEN_STYLE = {
|
|
@@ -140,6 +143,7 @@ export const TooltipTrigger = defineComponent({
|
|
|
140
143
|
// Radix's TooltipTrigger handlers
|
|
141
144
|
const handlers = {
|
|
142
145
|
onPointermove: (event) => {
|
|
146
|
+
trackInputModality(event.currentTarget.ownerDocument);
|
|
143
147
|
if (!isHoverPointer(event))
|
|
144
148
|
return;
|
|
145
149
|
if (!hasPointerMoveOpened && !providerContext.isPointerInTransitRef.value) {
|
|
@@ -160,11 +164,17 @@ export const TooltipTrigger = defineComponent({
|
|
|
160
164
|
}
|
|
161
165
|
isPointerDown = true;
|
|
162
166
|
pointerDocument = event.currentTarget.ownerDocument;
|
|
167
|
+
// A trigger in another document (an iframe) tracks that document's input
|
|
168
|
+
notePointerInput(pointerDocument);
|
|
163
169
|
pointerDocument.addEventListener("pointerup", handlePointerEnd, { once: true });
|
|
164
170
|
pointerDocument.addEventListener("pointercancel", handlePointerEnd, { once: true });
|
|
165
171
|
},
|
|
166
172
|
onFocus: (event) => {
|
|
167
|
-
|
|
173
|
+
const trigger = event.currentTarget;
|
|
174
|
+
trackInputModality(trigger.ownerDocument);
|
|
175
|
+
// A focus after a mouse press that a script moved here (a dialog closed with the mouse returns focus to its
|
|
176
|
+
// trigger) shows no ring, so no tooltip: it stayed open until the focus left
|
|
177
|
+
if (!isPointerDown && !trigger.hasAttribute("data-menu-pointer-focus") && isFocusVisible(trigger)) {
|
|
168
178
|
rootContext.onOpen();
|
|
169
179
|
}
|
|
170
180
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,OAAO,EACP,cAAc,EACd,eAAe,EACf,OAAO,EACP,GAAG,EACH,KAAK,GAMN,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,cAAc,IAAI,kBAAkB,EACpC,aAAa,IAAI,iBAAiB,EAClC,eAAe,IAAI,mBAAmB,EACtC,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,EACpC,4BAA4B,EAC5B,wBAAwB,EACxB,KAAK,GACN,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACvH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,CAAC,MAAM,sDAAsD,CAAA;AA8BpE,MAAM,YAAY,GAAG,cAAc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":["import {\n Text,\n computed,\n defineComponent,\n h,\n inject,\n markRaw,\n normalizeStyle,\n onBeforeUnmount,\n provide,\n ref,\n watch,\n type InjectionKey,\n type PropType,\n type Ref,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport {\n TooltipContent as RekaTooltipContent,\n TooltipPortal as RekaTooltipPortal,\n TooltipProvider as RekaTooltipProvider,\n TooltipRoot as RekaTooltipRoot,\n TooltipTrigger as RekaTooltipTrigger,\n injectTooltipProviderContext,\n injectTooltipRootContext,\n useId,\n} from \"reka-ui\"\nimport { useEscCloseStack } from \"../../composables/useEscCloseStack.js\"\nimport { preventDefaultHandler } from \"../../lib/helpers.js\"\nimport { composeEventHandlers, concatAriaDescribedby, firstElementChild, flattenSlot, mergeSlotProps } from \"./slot.js\"\nimport { isHoverPointer } from \"../../lib/inputMode.js\"\nimport s from \"@plexui/styles/components/Tooltip/Tooltip.module.css\"\n\n// Vue port of packages/ui/src/components/Tooltip/Tooltip.tsx on Reka UI.\n// Exports are flat (`TooltipRoot`, `TooltipTrigger`, ...) because\n// runtime-compiled templates cannot resolve `Tooltip.Root`; the static\n// properties are kept for render functions and SFCs.\n//\n// Reka keeps the open/close timers, the provider's skip delay, positioning,\n// the dismissable layer and the hover grace area. Where Radix and Reka\n// differ, the port follows Radix so the DOM and behaviour match React:\n// - Triggers run their handlers after the child's and skip them when one\n// called preventDefault() (Radix's composeEventHandlers). Reka's trigger\n// listeners are switched off (`disabled`) and re-implemented here.\n// - Radix tells the provider about open changes (skip delay, the\n// \"tooltip.open\" event that closes other tooltips) only when the tooltip\n// asks for one; Reka also does it for any change of the `open` prop, which\n// Plex uses to close on Escape and after a copy.\n// - The state attribute is computed when `open` changes, as Radix memoizes it.\n// - The content element is rendered here (Reka's `as`) the radix-ui 1.8 way:\n// it is the `role=\"tooltip\"` element itself, without the visually hidden\n// copy of the text Reka adds; an `id` on the content becomes the id the\n// trigger points at, and only an `aria-label` gets a visually hidden\n// element. Radix's custom property names, no `dir` and no\n// `data-grace-area-trigger`.\n\nexport type TooltipSide = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type TooltipAlign = \"start\" | \"center\" | \"end\"\nexport type TooltipGutterSize = \"sm\" | \"md\" | \"lg\"\ntype StateAttribute = \"closed\" | \"delayed-open\" | \"instant-open\"\n\nconst TOOLTIP_OPEN = \"tooltip.open\"\n\n// Radix's VisuallyHidden styles (Reka's add clip-path, top and left)\nconst VISUALLY_HIDDEN_STYLE = {\n position: \"absolute\",\n border: \"0\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n wordWrap: \"normal\",\n}\n\n/** React adds `px` to unitless numbers in style objects; Vue does not. */\nconst toCssLength = (value: number | string | undefined) => (typeof value === \"number\" ? `${value}px` : value)\n\n/**\n * The content custom properties under Radix's names (`--radix-tooltip-*`,\n * `--radix-popover-*`), which the shared CSS reads. They still point at the\n * `--reka-popper-*` values Reka sets on its positioning wrapper.\n */\nexport const withRadixVariableNames = (style: unknown, part: string) => {\n const from = `--reka-${part}-`\n const result: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(normalizeStyle([style]) as Record<string, unknown>)) {\n result[key.startsWith(from) ? `--radix-${part}-${key.slice(from.length)}` : key] = value\n }\n return result\n}\n\ntype ProviderHooks = { onOpen: () => void; onClose: () => void }\n\n// The content's own `id`, which Radix uses as the content id (Reka's\n// `contentId` is a plain string the trigger reads once)\nconst ContentIdKey: InjectionKey<Ref<string | undefined>> = Symbol(\"PlexUITooltipContentId\")\n\nconst REKA_PROVIDER_HOOKS = Symbol(\"rekaProviderHooks\")\nconst REKA_STATE = Symbol(\"rekaStateAttribute\")\n\n// Rendered inside Reka's root: adjusts the provider and root contexts the\n// Radix way (see the notes at the top).\nconst TooltipContextBridge = defineComponent({\n name: \"TooltipContextBridge\",\n props: {\n hooks: { type: Object as PropType<ProviderHooks>, required: true },\n },\n setup(props, { slots }) {\n // Reka's originals are kept on the contexts, so a second setup against\n // the same provider and root (a remount, HMR) still finds them\n const providerContext = injectTooltipProviderContext() as ReturnType<typeof injectTooltipProviderContext> & {\n [REKA_PROVIDER_HOOKS]?: ProviderHooks\n }\n const rekaHooks = (providerContext[REKA_PROVIDER_HOOKS] ??= {\n onOpen: providerContext.onOpen,\n onClose: providerContext.onClose,\n })\n props.hooks.onOpen = rekaHooks.onOpen\n props.hooks.onClose = rekaHooks.onClose\n // Reka's root skips its own provider calls when there is no `onClose`\n ;(providerContext as { onClose?: () => void }).onClose = undefined\n\n const rootContext = injectTooltipRootContext() as ReturnType<typeof injectTooltipRootContext> & {\n [REKA_STATE]?: Ref<StateAttribute>\n }\n const rekaState = (rootContext[REKA_STATE] ??= rootContext.stateAttribute)\n const state = ref<StateAttribute>(rekaState.value)\n watch(\n () => rootContext.open.value,\n () => {\n state.value = rekaState.value\n },\n { flush: \"sync\" },\n )\n rootContext.stateAttribute = computed(() => state.value) as unknown as Ref<StateAttribute>\n\n return () => slots.default?.()\n },\n})\n\n/** Low-level tooltip root (`Tooltip.Root` in React). Always controlled: bind `v-model:open`. */\nexport const TooltipRoot = defineComponent({\n name: \"TooltipRoot\",\n props: {\n open: { type: Boolean, required: true },\n /** Delay before the tooltip opens on hover, in milliseconds. @default 700 */\n delayDuration: Number,\n /** Closes the tooltip as soon as the pointer leaves the trigger. @default false */\n disableHoverableContent: { type: Boolean, default: undefined },\n },\n emits: {\n \"update:open\": (open: boolean) => typeof open === \"boolean\",\n },\n setup(props, { slots, emit }) {\n const hooks: ProviderHooks = { onOpen: () => {}, onClose: () => {} }\n const onOpenChange = (nextState: boolean) => emit(\"update:open\", nextState)\n provide(ContentIdKey, ref<string>())\n\n useEscCloseStack(\n () => props.open,\n () => onOpenChange(false),\n )\n\n // Radix's controlled state: only real changes are reported\n const handleOpenChange = (nextState: boolean) => {\n if (nextState === props.open) return\n if (nextState) {\n hooks.onOpen()\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))\n } else {\n hooks.onClose()\n }\n onOpenChange(nextState)\n }\n\n return () =>\n h(RekaTooltipProvider, null, {\n default: () =>\n h(\n RekaTooltipRoot,\n {\n \"open\": props.open,\n \"delayDuration\": props.delayDuration,\n \"disableHoverableContent\": props.disableHoverableContent,\n // The trigger listeners are this port's (TooltipTrigger)\n \"disabled\": true,\n \"onUpdate:open\": handleOpenChange,\n },\n { default: () => h(TooltipContextBridge, { hooks }, { default: () => slots.default?.() }) },\n ),\n })\n },\n})\n\n/**\n * Low-level trigger (`Tooltip.Trigger` in React). Renders its child with the\n * tooltip wiring merged in; `as-child=\"false\"` renders a `<button>` instead.\n */\nexport const TooltipTrigger = defineComponent({\n name: \"TooltipTrigger\",\n inheritAttrs: false,\n props: {\n /** Merges into the child instead of rendering a `<button>`. @default true */\n asChild: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n const rootContext = injectTooltipRootContext()\n const providerContext = injectTooltipProviderContext()\n // Set before the first render, which describes the trigger by it\n rootContext.contentId ||= useId(undefined, \"reka-tooltip-content\")\n const contentIdProp = inject(ContentIdKey, undefined)\n let isPointerDown = false\n let hasPointerMoveOpened = false\n\n let pointerDocument: Document | undefined\n const handlePointerEnd = () => {\n isPointerDown = false\n pointerDocument?.removeEventListener(\"pointerup\", handlePointerEnd)\n pointerDocument?.removeEventListener(\"pointercancel\", handlePointerEnd)\n pointerDocument = undefined\n }\n onBeforeUnmount(handlePointerEnd)\n\n // Radix's TooltipTrigger handlers\n const handlers: Record<string, (event: Event) => void> = {\n onPointermove: (event) => {\n if (!isHoverPointer(event as PointerEvent)) return\n if (!hasPointerMoveOpened && !providerContext.isPointerInTransitRef.value) {\n rootContext.onTriggerEnter()\n hasPointerMoveOpened = true\n }\n },\n onPointerleave: (event) => {\n if (!isHoverPointer(event as PointerEvent)) return\n rootContext.onTriggerLeave()\n hasPointerMoveOpened = false\n },\n onPointerdown: (event) => {\n handlePointerEnd()\n if (rootContext.open.value) {\n rootContext.onClose()\n }\n isPointerDown = true\n pointerDocument = (event.currentTarget as HTMLElement).ownerDocument\n pointerDocument.addEventListener(\"pointerup\", handlePointerEnd, { once: true })\n pointerDocument.addEventListener(\"pointercancel\", handlePointerEnd, { once: true })\n },\n onFocus: (event) => {\n if (!isPointerDown && !(event.currentTarget as HTMLElement).hasAttribute(\"data-menu-pointer-focus\")) {\n rootContext.onOpen()\n }\n },\n onBlur: (event) => {\n // Clipboard fallback borrows focus synchronously, then restores it.\n const nextTarget = (event as FocusEvent).relatedTarget\n if (nextTarget instanceof Element && nextTarget.hasAttribute(\"data-plex-clipboard-fallback\")) return\n rootContext.onClose()\n },\n onClick: () => rootContext.onClose(),\n }\n\n return () => {\n const child = props.asChild ? firstElementChild(slots.default?.()) : h(\"button\", null, slots.default?.())\n if (!child) return null\n\n const contentId = contentIdProp?.value ?? rootContext.contentId\n const triggerProps: Record<string, unknown> = {\n ...attrs,\n // Radix adds the content id to the trigger's own while open (the\n // child's own ids come first, as in Radix's Slot)\n \"aria-describedby\": rootContext.open.value\n ? concatAriaDescribedby(attrs[\"aria-describedby\"], contentId)\n : attrs[\"aria-describedby\"],\n \"data-grace-area-trigger\": undefined,\n }\n for (const [key, handler] of Object.entries(handlers)) {\n triggerProps[key] = composeEventHandlers(attrs[key], handler)\n }\n\n return h(RekaTooltipTrigger, { asChild: true }, { default: () => mergeSlotProps(child, triggerProps) })\n }\n },\n})\n\ntype ContentChildren = {\n render: () => VNodeArrayChildren | undefined\n ariaLabel: () => unknown\n}\n\nconst ContentChildrenKey: InjectionKey<ContentChildren> = Symbol(\"PlexUITooltipContent\")\n\n// The element Reka's content renders (`as`), in place of Reka's visually\n// hidden copy of the text. Raw, as Reka may pass `as` through reactive props.\nconst TooltipContentElement = markRaw(defineComponent({\n name: \"TooltipContentElement\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const rootContext = injectTooltipRootContext()\n const content = inject(ContentChildrenKey)!\n const contentIdProp = inject(ContentIdKey, undefined)\n\n return () => {\n const { style, ...rest } = attrs\n delete rest.dir\n delete rest.id\n const ariaLabel = content.ariaLabel() as string | undefined\n const contentId = contentIdProp?.value ?? (rootContext.contentId || undefined)\n return h(\n \"div\",\n {\n role: ariaLabel ? undefined : \"tooltip\",\n id: ariaLabel ? undefined : contentId,\n ...rest,\n style: withRadixVariableNames(style, \"tooltip\"),\n },\n [\n content.render(),\n ariaLabel ? h(\"span\", { id: contentId, role: \"tooltip\", style: VISUALLY_HIDDEN_STYLE }, ariaLabel) : null,\n ],\n )\n }\n },\n}))\n\nconst sideProp = String as PropType<TooltipSide>\nconst alignProp = String as PropType<TooltipAlign>\nconst gutterSizeProp = { type: String as PropType<TooltipGutterSize>, default: \"md\" }\nconst maxWidthProp = { type: [Number, String] as PropType<number | \"none\">, default: 300 }\n\n/** Low-level content (`Tooltip.Content` in React). `class` lands on the tooltip. */\nexport const TooltipContent = defineComponent({\n name: \"TooltipContent\",\n inheritAttrs: false,\n props: {\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Whether the tooltip content responds to clicks */\n clickable: { type: Boolean, default: undefined },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n },\n setup(props, { slots, attrs }) {\n provide(ContentChildrenKey, {\n render: () => slots.default?.(),\n ariaLabel: () => attrs[\"aria-label\"],\n })\n\n // Radix's content `id` replaces the generated content id while mounted\n const contentIdProp = inject(ContentIdKey, undefined)\n if (contentIdProp) {\n watch(\n () => attrs.id as string | undefined,\n (id) => {\n contentIdProp.value = id || undefined\n },\n { immediate: true },\n )\n onBeforeUnmount(() => {\n contentIdProp.value = undefined\n })\n }\n\n return () => {\n const { class: className, style, ...restProps } = attrs\n delete restProps[\"aria-label\"]\n delete restProps.id\n\n return h(RekaTooltipPortal, null, {\n default: () =>\n h(\n RekaTooltipContent,\n {\n ...restProps,\n \"as\": TooltipContentElement,\n \"side\": props.side,\n \"align\": props.align,\n \"class\": [s.Tooltip, className],\n \"data-compact\": String(props.compact),\n \"data-clickable\": props.clickable === undefined ? undefined : String(props.clickable),\n \"data-gutter-size\": props.gutterSize,\n \"alignOffset\": props.alignOffset,\n \"sideOffset\": props.sideOffset,\n \"collisionPadding\": 15,\n \"hideWhenDetached\": true,\n \"style\": [style, { maxWidth: toCssLength(props.maxWidth) }],\n // Escape is handled by the Escape stack in TooltipRoot\n \"onEscapeKeyDown\": preventDefaultHandler,\n },\n // Rendered by TooltipContentElement from the injected slot\n { default: () => [] },\n ),\n })\n }\n },\n})\n\nconst isPlainText = (nodes: VNode[]) => nodes.length === 1 && nodes[0]!.type === Text\n\n/**\n * Optional trigger wrapper (`Tooltip.TriggerDecorator` in React) for content\n * that is not accessible or visibly interactive on its own. Plain text is\n * wrapped in a focusable `<span>`; an element child gets the props merged in.\n */\nexport const TooltipTriggerDecorator = defineComponent({\n name: \"TooltipTriggerDecorator\",\n inheritAttrs: false,\n props: {\n /** Applies `tabindex=\"0\"` to the trigger. @default true */\n focusable: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n return () => {\n const { class: className, ...restProps } = attrs\n const slotProps = {\n ...restProps,\n class: [s.TriggerDecorator, className],\n tabindex: props.focusable ? 0 : undefined,\n }\n const children = flattenSlot(slots.default?.())\n\n if (isPlainText(children)) {\n return h(\"span\", slotProps, String(children[0]!.children ?? \"\"))\n }\n\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n }\n },\n})\n\nconst TooltipComponent = defineComponent({\n name: \"Tooltip\",\n inheritAttrs: false,\n props: {\n /**\n * The content of the tooltip (or the `#content` slot). `null` renders no\n * tooltip.\n */\n content: { type: [String, Number, Object] as PropType<string | number | VNode | null>, default: undefined },\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Forces the tooltip to remain open or closed */\n forceOpen: { type: Boolean, default: undefined },\n /** Delay before the tooltip opens from the first interaction, in milliseconds. @default 150 */\n openDelay: { type: Number, default: 150 },\n /** The tooltip has interactive content and stays open while hovered. @default false */\n interactive: { type: Boolean, default: false },\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Keeps the tooltip open when the trigger is clicked right after it opened. @default false */\n preventUnintentionalClickToClose: { type: Boolean, default: undefined },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n /** Class applied to the tooltip content */\n contentClassName: String,\n },\n emits: {\n pointerdown: (event: PointerEvent) => typeof event.type === \"string\",\n click: (event: MouseEvent) => typeof event.type === \"string\",\n },\n setup(props, { slots, attrs, emit }) {\n const visible = ref(false)\n const temporarilyPreventClickToClose = ref(false)\n\n watch(temporarilyPreventClickToClose, (prevent, _, onCleanup) => {\n if (!prevent) return\n const id = setTimeout(() => {\n temporarilyPreventClickToClose.value = false\n }, 400)\n onCleanup(() => clearTimeout(id))\n })\n\n const hasContent = () => !(props.content === null && !slots.content)\n const forceOpen = () => props.forceOpen ?? (hasContent() ? undefined : false)\n\n const handleOpenChange = (nextState: boolean) => {\n // When forceOpen is passed, don't manage internal state\n if (typeof forceOpen() === \"boolean\") return\n\n visible.value = nextState\n\n if (props.preventUnintentionalClickToClose) {\n temporarilyPreventClickToClose.value = nextState\n }\n }\n\n const maybePreventClickClose = (evt: Event) => {\n if (props.preventUnintentionalClickToClose && temporarilyPreventClickToClose.value) {\n // Prevents tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n }\n }\n\n const onPointerdown = (evt: PointerEvent) => {\n maybePreventClickClose(evt)\n emit(\"pointerdown\", evt)\n }\n\n const onClick = (evt: MouseEvent) => {\n maybePreventClickClose(evt)\n emit(\"click\", evt)\n }\n\n return () => {\n const child = firstElementChild(slots.default?.())\n\n return h(\n TooltipRoot,\n {\n \"open\": forceOpen() ?? visible.value,\n \"delayDuration\": props.openDelay,\n \"onUpdate:open\": handleOpenChange,\n \"disableHoverableContent\": !props.interactive,\n },\n {\n default: () => [\n h(TooltipTrigger, null, {\n default: () => (child ? mergeSlotProps(child, { ...attrs, onPointerdown, onClick }) : null),\n }),\n h(\n TooltipContent,\n {\n maxWidth: props.maxWidth,\n compact: props.compact,\n align: props.align,\n alignOffset: props.alignOffset,\n side: props.side,\n sideOffset: props.sideOffset,\n gutterSize: props.gutterSize,\n class: props.contentClassName,\n },\n { default: () => (slots.content ? slots.content() : props.content) },\n ),\n ],\n },\n )\n }\n },\n})\n\n/**\n * Tooltip for any trigger element (the default slot). Content comes from the\n * `content` prop or the `#content` slot; `null` disables the tooltip.\n */\n// Typed explicitly so the published declaration refers to the parts instead of\n// expanding them (an expanded component type fails consumers' type checks)\nexport const Tooltip: typeof TooltipComponent & {\n Root: typeof TooltipRoot\n Content: typeof TooltipContent\n Trigger: typeof TooltipTrigger\n TriggerDecorator: typeof TooltipTriggerDecorator\n} = Object.assign(TooltipComponent, {\n Root: TooltipRoot,\n Content: TooltipContent,\n Trigger: TooltipTrigger,\n TriggerDecorator: TooltipTriggerDecorator,\n})\n\nexport type TooltipProps = InstanceType<typeof TooltipComponent>[\"$props\"]\n"]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.ts"],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C,KAAK,CAAC,WAAW;aAC9C,EACD;gBACE,OAAO,EAAE,GAAG,EAAE,CAAC;oBACb,CAAC,CAAC,cAAc,EAAE,IAAI,EAAE;wBACtB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;qBAC5F,CAAC;oBACF,CAAC,CACC,cAAc,EACd;wBACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,OAAO,EAAE,KAAK,CAAC,OAAO;wBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;wBAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,KAAK,EAAE,KAAK,CAAC,gBAAgB;qBAC9B,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CACrE;iBACF;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF;;;GAGG;AACH,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,OAAO,GAKhB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAClC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,gBAAgB,EAAE,uBAAuB;CAC1C,CAAC,CAAA","sourcesContent":["import {\n Text,\n computed,\n defineComponent,\n h,\n inject,\n markRaw,\n normalizeStyle,\n onBeforeUnmount,\n provide,\n ref,\n watch,\n type InjectionKey,\n type PropType,\n type Ref,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport {\n TooltipContent as RekaTooltipContent,\n TooltipPortal as RekaTooltipPortal,\n TooltipProvider as RekaTooltipProvider,\n TooltipRoot as RekaTooltipRoot,\n TooltipTrigger as RekaTooltipTrigger,\n injectTooltipProviderContext,\n injectTooltipRootContext,\n useId,\n} from \"reka-ui\"\nimport { useEscCloseStack } from \"../../composables/useEscCloseStack.js\"\nimport { preventDefaultHandler } from \"../../lib/helpers.js\"\nimport { composeEventHandlers, concatAriaDescribedby, firstElementChild, flattenSlot, mergeSlotProps } from \"./slot.js\"\nimport { isFocusVisible, isHoverPointer, notePointerInput, trackInputModality } from \"../../lib/inputMode.js\"\nimport s from \"@plexui/styles/components/Tooltip/Tooltip.module.css\"\n\n// A tooltip opens on a focus that shows its ring only (isFocusVisible): it follows the last input of the page\nif (typeof document !== \"undefined\") trackInputModality(document)\n\n// Vue port of packages/ui/src/components/Tooltip/Tooltip.tsx on Reka UI.\n// Exports are flat (`TooltipRoot`, `TooltipTrigger`, ...) because\n// runtime-compiled templates cannot resolve `Tooltip.Root`; the static\n// properties are kept for render functions and SFCs.\n//\n// Reka keeps the open/close timers, the provider's skip delay, positioning,\n// the dismissable layer and the hover grace area. Where Radix and Reka\n// differ, the port follows Radix so the DOM and behaviour match React:\n// - Triggers run their handlers after the child's and skip them when one\n// called preventDefault() (Radix's composeEventHandlers). Reka's trigger\n// listeners are switched off (`disabled`) and re-implemented here.\n// - Radix tells the provider about open changes (skip delay, the\n// \"tooltip.open\" event that closes other tooltips) only when the tooltip\n// asks for one; Reka also does it for any change of the `open` prop, which\n// Plex uses to close on Escape and after a copy.\n// - The state attribute is computed when `open` changes, as Radix memoizes it.\n// - The content element is rendered here (Reka's `as`) the radix-ui 1.8 way:\n// it is the `role=\"tooltip\"` element itself, without the visually hidden\n// copy of the text Reka adds; an `id` on the content becomes the id the\n// trigger points at, and only an `aria-label` gets a visually hidden\n// element. Radix's custom property names, no `dir` and no\n// `data-grace-area-trigger`.\n\nexport type TooltipSide = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type TooltipAlign = \"start\" | \"center\" | \"end\"\nexport type TooltipGutterSize = \"sm\" | \"md\" | \"lg\"\ntype StateAttribute = \"closed\" | \"delayed-open\" | \"instant-open\"\n\nconst TOOLTIP_OPEN = \"tooltip.open\"\n\n// Radix's VisuallyHidden styles (Reka's add clip-path, top and left)\nconst VISUALLY_HIDDEN_STYLE = {\n position: \"absolute\",\n border: \"0\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n wordWrap: \"normal\",\n}\n\n/** React adds `px` to unitless numbers in style objects; Vue does not. */\nconst toCssLength = (value: number | string | undefined) => (typeof value === \"number\" ? `${value}px` : value)\n\n/**\n * The content custom properties under Radix's names (`--radix-tooltip-*`,\n * `--radix-popover-*`), which the shared CSS reads. They still point at the\n * `--reka-popper-*` values Reka sets on its positioning wrapper.\n */\nexport const withRadixVariableNames = (style: unknown, part: string) => {\n const from = `--reka-${part}-`\n const result: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(normalizeStyle([style]) as Record<string, unknown>)) {\n result[key.startsWith(from) ? `--radix-${part}-${key.slice(from.length)}` : key] = value\n }\n return result\n}\n\ntype ProviderHooks = { onOpen: () => void; onClose: () => void }\n\n// The content's own `id`, which Radix uses as the content id (Reka's\n// `contentId` is a plain string the trigger reads once)\nconst ContentIdKey: InjectionKey<Ref<string | undefined>> = Symbol(\"PlexUITooltipContentId\")\n\nconst REKA_PROVIDER_HOOKS = Symbol(\"rekaProviderHooks\")\nconst REKA_STATE = Symbol(\"rekaStateAttribute\")\n\n// Rendered inside Reka's root: adjusts the provider and root contexts the\n// Radix way (see the notes at the top).\nconst TooltipContextBridge = defineComponent({\n name: \"TooltipContextBridge\",\n props: {\n hooks: { type: Object as PropType<ProviderHooks>, required: true },\n },\n setup(props, { slots }) {\n // Reka's originals are kept on the contexts, so a second setup against\n // the same provider and root (a remount, HMR) still finds them\n const providerContext = injectTooltipProviderContext() as ReturnType<typeof injectTooltipProviderContext> & {\n [REKA_PROVIDER_HOOKS]?: ProviderHooks\n }\n const rekaHooks = (providerContext[REKA_PROVIDER_HOOKS] ??= {\n onOpen: providerContext.onOpen,\n onClose: providerContext.onClose,\n })\n props.hooks.onOpen = rekaHooks.onOpen\n props.hooks.onClose = rekaHooks.onClose\n // Reka's root skips its own provider calls when there is no `onClose`\n ;(providerContext as { onClose?: () => void }).onClose = undefined\n\n const rootContext = injectTooltipRootContext() as ReturnType<typeof injectTooltipRootContext> & {\n [REKA_STATE]?: Ref<StateAttribute>\n }\n const rekaState = (rootContext[REKA_STATE] ??= rootContext.stateAttribute)\n const state = ref<StateAttribute>(rekaState.value)\n watch(\n () => rootContext.open.value,\n () => {\n state.value = rekaState.value\n },\n { flush: \"sync\" },\n )\n rootContext.stateAttribute = computed(() => state.value) as unknown as Ref<StateAttribute>\n\n return () => slots.default?.()\n },\n})\n\n/** Low-level tooltip root (`Tooltip.Root` in React). Always controlled: bind `v-model:open`. */\nexport const TooltipRoot = defineComponent({\n name: \"TooltipRoot\",\n props: {\n open: { type: Boolean, required: true },\n /** Delay before the tooltip opens on hover, in milliseconds. @default 700 */\n delayDuration: Number,\n /** Closes the tooltip as soon as the pointer leaves the trigger. @default false */\n disableHoverableContent: { type: Boolean, default: undefined },\n },\n emits: {\n \"update:open\": (open: boolean) => typeof open === \"boolean\",\n },\n setup(props, { slots, emit }) {\n const hooks: ProviderHooks = { onOpen: () => {}, onClose: () => {} }\n const onOpenChange = (nextState: boolean) => emit(\"update:open\", nextState)\n provide(ContentIdKey, ref<string>())\n\n useEscCloseStack(\n () => props.open,\n () => onOpenChange(false),\n )\n\n // Radix's controlled state: only real changes are reported\n const handleOpenChange = (nextState: boolean) => {\n if (nextState === props.open) return\n if (nextState) {\n hooks.onOpen()\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))\n } else {\n hooks.onClose()\n }\n onOpenChange(nextState)\n }\n\n return () =>\n h(RekaTooltipProvider, null, {\n default: () =>\n h(\n RekaTooltipRoot,\n {\n \"open\": props.open,\n \"delayDuration\": props.delayDuration,\n \"disableHoverableContent\": props.disableHoverableContent,\n // The trigger listeners are this port's (TooltipTrigger)\n \"disabled\": true,\n \"onUpdate:open\": handleOpenChange,\n },\n { default: () => h(TooltipContextBridge, { hooks }, { default: () => slots.default?.() }) },\n ),\n })\n },\n})\n\n/**\n * Low-level trigger (`Tooltip.Trigger` in React). Renders its child with the\n * tooltip wiring merged in; `as-child=\"false\"` renders a `<button>` instead.\n */\nexport const TooltipTrigger = defineComponent({\n name: \"TooltipTrigger\",\n inheritAttrs: false,\n props: {\n /** Merges into the child instead of rendering a `<button>`. @default true */\n asChild: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n const rootContext = injectTooltipRootContext()\n const providerContext = injectTooltipProviderContext()\n // Set before the first render, which describes the trigger by it\n rootContext.contentId ||= useId(undefined, \"reka-tooltip-content\")\n const contentIdProp = inject(ContentIdKey, undefined)\n let isPointerDown = false\n let hasPointerMoveOpened = false\n\n let pointerDocument: Document | undefined\n const handlePointerEnd = () => {\n isPointerDown = false\n pointerDocument?.removeEventListener(\"pointerup\", handlePointerEnd)\n pointerDocument?.removeEventListener(\"pointercancel\", handlePointerEnd)\n pointerDocument = undefined\n }\n onBeforeUnmount(handlePointerEnd)\n\n // Radix's TooltipTrigger handlers\n const handlers: Record<string, (event: Event) => void> = {\n onPointermove: (event) => {\n trackInputModality((event.currentTarget as HTMLElement).ownerDocument)\n if (!isHoverPointer(event as PointerEvent)) return\n if (!hasPointerMoveOpened && !providerContext.isPointerInTransitRef.value) {\n rootContext.onTriggerEnter()\n hasPointerMoveOpened = true\n }\n },\n onPointerleave: (event) => {\n if (!isHoverPointer(event as PointerEvent)) return\n rootContext.onTriggerLeave()\n hasPointerMoveOpened = false\n },\n onPointerdown: (event) => {\n handlePointerEnd()\n if (rootContext.open.value) {\n rootContext.onClose()\n }\n isPointerDown = true\n pointerDocument = (event.currentTarget as HTMLElement).ownerDocument\n // A trigger in another document (an iframe) tracks that document's input\n notePointerInput(pointerDocument)\n pointerDocument.addEventListener(\"pointerup\", handlePointerEnd, { once: true })\n pointerDocument.addEventListener(\"pointercancel\", handlePointerEnd, { once: true })\n },\n onFocus: (event) => {\n const trigger = event.currentTarget as HTMLElement\n trackInputModality(trigger.ownerDocument)\n // A focus after a mouse press that a script moved here (a dialog closed with the mouse returns focus to its\n // trigger) shows no ring, so no tooltip: it stayed open until the focus left\n if (!isPointerDown && !trigger.hasAttribute(\"data-menu-pointer-focus\") && isFocusVisible(trigger)) {\n rootContext.onOpen()\n }\n },\n onBlur: (event) => {\n // Clipboard fallback borrows focus synchronously, then restores it.\n const nextTarget = (event as FocusEvent).relatedTarget\n if (nextTarget instanceof Element && nextTarget.hasAttribute(\"data-plex-clipboard-fallback\")) return\n rootContext.onClose()\n },\n onClick: () => rootContext.onClose(),\n }\n\n return () => {\n const child = props.asChild ? firstElementChild(slots.default?.()) : h(\"button\", null, slots.default?.())\n if (!child) return null\n\n const contentId = contentIdProp?.value ?? rootContext.contentId\n const triggerProps: Record<string, unknown> = {\n ...attrs,\n // Radix adds the content id to the trigger's own while open (the\n // child's own ids come first, as in Radix's Slot)\n \"aria-describedby\": rootContext.open.value\n ? concatAriaDescribedby(attrs[\"aria-describedby\"], contentId)\n : attrs[\"aria-describedby\"],\n \"data-grace-area-trigger\": undefined,\n }\n for (const [key, handler] of Object.entries(handlers)) {\n triggerProps[key] = composeEventHandlers(attrs[key], handler)\n }\n\n return h(RekaTooltipTrigger, { asChild: true }, { default: () => mergeSlotProps(child, triggerProps) })\n }\n },\n})\n\ntype ContentChildren = {\n render: () => VNodeArrayChildren | undefined\n ariaLabel: () => unknown\n}\n\nconst ContentChildrenKey: InjectionKey<ContentChildren> = Symbol(\"PlexUITooltipContent\")\n\n// The element Reka's content renders (`as`), in place of Reka's visually\n// hidden copy of the text. Raw, as Reka may pass `as` through reactive props.\nconst TooltipContentElement = markRaw(defineComponent({\n name: \"TooltipContentElement\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const rootContext = injectTooltipRootContext()\n const content = inject(ContentChildrenKey)!\n const contentIdProp = inject(ContentIdKey, undefined)\n\n return () => {\n const { style, ...rest } = attrs\n delete rest.dir\n delete rest.id\n const ariaLabel = content.ariaLabel() as string | undefined\n const contentId = contentIdProp?.value ?? (rootContext.contentId || undefined)\n return h(\n \"div\",\n {\n role: ariaLabel ? undefined : \"tooltip\",\n id: ariaLabel ? undefined : contentId,\n ...rest,\n style: withRadixVariableNames(style, \"tooltip\"),\n },\n [\n content.render(),\n ariaLabel ? h(\"span\", { id: contentId, role: \"tooltip\", style: VISUALLY_HIDDEN_STYLE }, ariaLabel) : null,\n ],\n )\n }\n },\n}))\n\nconst sideProp = String as PropType<TooltipSide>\nconst alignProp = String as PropType<TooltipAlign>\nconst gutterSizeProp = { type: String as PropType<TooltipGutterSize>, default: \"md\" }\nconst maxWidthProp = { type: [Number, String] as PropType<number | \"none\">, default: 300 }\n\n/** Low-level content (`Tooltip.Content` in React). `class` lands on the tooltip. */\nexport const TooltipContent = defineComponent({\n name: \"TooltipContent\",\n inheritAttrs: false,\n props: {\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Whether the tooltip content responds to clicks */\n clickable: { type: Boolean, default: undefined },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n },\n setup(props, { slots, attrs }) {\n provide(ContentChildrenKey, {\n render: () => slots.default?.(),\n ariaLabel: () => attrs[\"aria-label\"],\n })\n\n // Radix's content `id` replaces the generated content id while mounted\n const contentIdProp = inject(ContentIdKey, undefined)\n if (contentIdProp) {\n watch(\n () => attrs.id as string | undefined,\n (id) => {\n contentIdProp.value = id || undefined\n },\n { immediate: true },\n )\n onBeforeUnmount(() => {\n contentIdProp.value = undefined\n })\n }\n\n return () => {\n const { class: className, style, ...restProps } = attrs\n delete restProps[\"aria-label\"]\n delete restProps.id\n\n return h(RekaTooltipPortal, null, {\n default: () =>\n h(\n RekaTooltipContent,\n {\n ...restProps,\n \"as\": TooltipContentElement,\n \"side\": props.side,\n \"align\": props.align,\n \"class\": [s.Tooltip, className],\n \"data-compact\": String(props.compact),\n \"data-clickable\": props.clickable === undefined ? undefined : String(props.clickable),\n \"data-gutter-size\": props.gutterSize,\n \"alignOffset\": props.alignOffset,\n \"sideOffset\": props.sideOffset,\n \"collisionPadding\": 15,\n \"hideWhenDetached\": true,\n \"style\": [style, { maxWidth: toCssLength(props.maxWidth) }],\n // Escape is handled by the Escape stack in TooltipRoot\n \"onEscapeKeyDown\": preventDefaultHandler,\n },\n // Rendered by TooltipContentElement from the injected slot\n { default: () => [] },\n ),\n })\n }\n },\n})\n\nconst isPlainText = (nodes: VNode[]) => nodes.length === 1 && nodes[0]!.type === Text\n\n/**\n * Optional trigger wrapper (`Tooltip.TriggerDecorator` in React) for content\n * that is not accessible or visibly interactive on its own. Plain text is\n * wrapped in a focusable `<span>`; an element child gets the props merged in.\n */\nexport const TooltipTriggerDecorator = defineComponent({\n name: \"TooltipTriggerDecorator\",\n inheritAttrs: false,\n props: {\n /** Applies `tabindex=\"0\"` to the trigger. @default true */\n focusable: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n return () => {\n const { class: className, ...restProps } = attrs\n const slotProps = {\n ...restProps,\n class: [s.TriggerDecorator, className],\n tabindex: props.focusable ? 0 : undefined,\n }\n const children = flattenSlot(slots.default?.())\n\n if (isPlainText(children)) {\n return h(\"span\", slotProps, String(children[0]!.children ?? \"\"))\n }\n\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n }\n },\n})\n\nconst TooltipComponent = defineComponent({\n name: \"Tooltip\",\n inheritAttrs: false,\n props: {\n /**\n * The content of the tooltip (or the `#content` slot). `null` renders no\n * tooltip.\n */\n content: { type: [String, Number, Object] as PropType<string | number | VNode | null>, default: undefined },\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Forces the tooltip to remain open or closed */\n forceOpen: { type: Boolean, default: undefined },\n /** Delay before the tooltip opens from the first interaction, in milliseconds. @default 150 */\n openDelay: { type: Number, default: 150 },\n /** The tooltip has interactive content and stays open while hovered. @default false */\n interactive: { type: Boolean, default: false },\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Keeps the tooltip open when the trigger is clicked right after it opened. @default false */\n preventUnintentionalClickToClose: { type: Boolean, default: undefined },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n /** Class applied to the tooltip content */\n contentClassName: String,\n },\n emits: {\n pointerdown: (event: PointerEvent) => typeof event.type === \"string\",\n click: (event: MouseEvent) => typeof event.type === \"string\",\n },\n setup(props, { slots, attrs, emit }) {\n const visible = ref(false)\n const temporarilyPreventClickToClose = ref(false)\n\n watch(temporarilyPreventClickToClose, (prevent, _, onCleanup) => {\n if (!prevent) return\n const id = setTimeout(() => {\n temporarilyPreventClickToClose.value = false\n }, 400)\n onCleanup(() => clearTimeout(id))\n })\n\n const hasContent = () => !(props.content === null && !slots.content)\n const forceOpen = () => props.forceOpen ?? (hasContent() ? undefined : false)\n\n const handleOpenChange = (nextState: boolean) => {\n // When forceOpen is passed, don't manage internal state\n if (typeof forceOpen() === \"boolean\") return\n\n visible.value = nextState\n\n if (props.preventUnintentionalClickToClose) {\n temporarilyPreventClickToClose.value = nextState\n }\n }\n\n const maybePreventClickClose = (evt: Event) => {\n if (props.preventUnintentionalClickToClose && temporarilyPreventClickToClose.value) {\n // Prevents tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n }\n }\n\n const onPointerdown = (evt: PointerEvent) => {\n maybePreventClickClose(evt)\n emit(\"pointerdown\", evt)\n }\n\n const onClick = (evt: MouseEvent) => {\n maybePreventClickClose(evt)\n emit(\"click\", evt)\n }\n\n return () => {\n const child = firstElementChild(slots.default?.())\n\n return h(\n TooltipRoot,\n {\n \"open\": forceOpen() ?? visible.value,\n \"delayDuration\": props.openDelay,\n \"onUpdate:open\": handleOpenChange,\n \"disableHoverableContent\": !props.interactive,\n },\n {\n default: () => [\n h(TooltipTrigger, null, {\n default: () => (child ? mergeSlotProps(child, { ...attrs, onPointerdown, onClick }) : null),\n }),\n h(\n TooltipContent,\n {\n maxWidth: props.maxWidth,\n compact: props.compact,\n align: props.align,\n alignOffset: props.alignOffset,\n side: props.side,\n sideOffset: props.sideOffset,\n gutterSize: props.gutterSize,\n class: props.contentClassName,\n },\n { default: () => (slots.content ? slots.content() : props.content) },\n ),\n ],\n },\n )\n }\n },\n})\n\n/**\n * Tooltip for any trigger element (the default slot). Content comes from the\n * `content` prop or the `#content` slot; `null` disables the tooltip.\n */\n// Typed explicitly so the published declaration refers to the parts instead of\n// expanding them (an expanded component type fails consumers' type checks)\nexport const Tooltip: typeof TooltipComponent & {\n Root: typeof TooltipRoot\n Content: typeof TooltipContent\n Trigger: typeof TooltipTrigger\n TriggerDecorator: typeof TooltipTriggerDecorator\n} = Object.assign(TooltipComponent, {\n Root: TooltipRoot,\n Content: TooltipContent,\n Trigger: TooltipTrigger,\n TriggerDecorator: TooltipTriggerDecorator,\n})\n\nexport type TooltipProps = InstanceType<typeof TooltipComponent>[\"$props\"]\n"]}
|
package/dist/es/lib/inputMode.js
CHANGED
|
@@ -6,4 +6,44 @@ export const isHoverPointer = (event) => {
|
|
|
6
6
|
const doc = target instanceof Document ? target : target instanceof Node ? target.ownerDocument : null;
|
|
7
7
|
return doc?.documentElement.dataset.input !== "touch";
|
|
8
8
|
};
|
|
9
|
+
// The last input of each document: a pointer press or a key. A focus that follows a pointer press is one the press
|
|
10
|
+
// gave or a script moved after it (a dialog closed with the mouse returns focus to its trigger), and no focus ring
|
|
11
|
+
// shows for it; a key, Tab or an arrow, shows one.
|
|
12
|
+
const lastInput = new WeakMap();
|
|
13
|
+
const tracked = new WeakSet();
|
|
14
|
+
/** Starts tracking the last input of a document (once per document). */
|
|
15
|
+
export const trackInputModality = (doc) => {
|
|
16
|
+
if (!doc || tracked.has(doc))
|
|
17
|
+
return;
|
|
18
|
+
tracked.add(doc);
|
|
19
|
+
doc.addEventListener("pointerdown", () => lastInput.set(doc, "pointer"), { capture: true, passive: true });
|
|
20
|
+
doc.addEventListener("mousedown", () => lastInput.set(doc, "pointer"), { capture: true, passive: true });
|
|
21
|
+
// Any key counts, with a modifier too: a screen reader moves focus with its own keys (Control-Option-arrows), and
|
|
22
|
+
// a tooltip it misses is worse than one more after a shortcut
|
|
23
|
+
doc.addEventListener("keydown", () => lastInput.set(doc, "keyboard"), { capture: true, passive: true });
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Notes a pointer press from the element's own handler: a document that starts being tracked during that press (the
|
|
27
|
+
* first touch on a trigger in an iframe) has already let it pass its capture phase.
|
|
28
|
+
*/
|
|
29
|
+
export const notePointerInput = (doc) => {
|
|
30
|
+
if (!doc)
|
|
31
|
+
return;
|
|
32
|
+
trackInputModality(doc);
|
|
33
|
+
lastInput.set(doc, "pointer");
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Whether a focus shows its ring, as the browser's :focus-visible: a focus after a key or with no input yet does, one
|
|
37
|
+
* a pointer press gave or a script moved after it does not. A tooltip opens on the first only.
|
|
38
|
+
*/
|
|
39
|
+
export const isFocusVisible = (element) => {
|
|
40
|
+
try {
|
|
41
|
+
if (element.matches(":focus-visible"))
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// A browser without the selector leaves it to the last input
|
|
46
|
+
}
|
|
47
|
+
return lastInput.get(element.ownerDocument) !== "pointer";
|
|
48
|
+
};
|
|
9
49
|
//# sourceMappingURL=inputMode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputMode.js","sourceRoot":"","sources":["../../../src/lib/inputMode.ts"],"names":[],"mappings":"AAKA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAwB,EAAW,EAAE;IAClE,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO;QAAE,OAAO,KAAK,CAAA;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAA;IAClC,MAAM,GAAG,GAAG,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAA;IACtG,OAAO,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,KAAK,OAAO,CAAA;AACvD,CAAC,CAAA","sourcesContent":["type HoverPointerEvent = {\n pointerType: string\n currentTarget: EventTarget | null\n}\n\n/** Pointer hover is unavailable to touch input and explicitly touch-rendered surfaces. */\nexport const isHoverPointer = (event: HoverPointerEvent): boolean => {\n if (event.pointerType === \"touch\") return false\n const target = event.currentTarget\n const doc = target instanceof Document ? target : target instanceof Node ? target.ownerDocument : null\n return doc?.documentElement.dataset.input !== \"touch\"\n}\n"]}
|
|
1
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AC,CAAA;IACxG,kHAAkH;IAClH,8DAA8D;IAC9D,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;AACzG,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAgC,EAAQ,EAAE;IACzE,IAAI,CAAC,GAAG;QAAE,OAAM;IAChB,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACvB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAW,EAAE;IAC1D,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAAE,OAAO,IAAI,CAAA;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;IAC/D,CAAC;IACD,OAAO,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,SAAS,CAAA;AAC3D,CAAC,CAAA","sourcesContent":["type HoverPointerEvent = {\n pointerType: string\n currentTarget: EventTarget | null\n}\n\n/** Pointer hover is unavailable to touch input and explicitly touch-rendered surfaces. */\nexport const isHoverPointer = (event: HoverPointerEvent): boolean => {\n if (event.pointerType === \"touch\") return false\n const target = event.currentTarget\n const doc = target instanceof Document ? target : target instanceof Node ? target.ownerDocument : null\n return doc?.documentElement.dataset.input !== \"touch\"\n}\n\n// The last input of each document: a pointer press or a key. A focus that follows a pointer press is one the press\n// gave or a script moved after it (a dialog closed with the mouse returns focus to its trigger), and no focus ring\n// shows for it; a key, Tab or an arrow, shows one.\nconst lastInput = new WeakMap<Document, \"pointer\" | \"keyboard\">()\nconst tracked = new WeakSet<Document>()\n\n/** Starts tracking the last input of a document (once per document). */\nexport const trackInputModality = (doc: Document | null | undefined): void => {\n if (!doc || tracked.has(doc)) return\n tracked.add(doc)\n doc.addEventListener(\"pointerdown\", () => lastInput.set(doc, \"pointer\"), { capture: true, passive: true })\n doc.addEventListener(\"mousedown\", () => lastInput.set(doc, \"pointer\"), { capture: true, passive: true })\n // Any key counts, with a modifier too: a screen reader moves focus with its own keys (Control-Option-arrows), and\n // a tooltip it misses is worse than one more after a shortcut\n doc.addEventListener(\"keydown\", () => lastInput.set(doc, \"keyboard\"), { capture: true, passive: true })\n}\n\n/**\n * Notes a pointer press from the element's own handler: a document that starts being tracked during that press (the\n * first touch on a trigger in an iframe) has already let it pass its capture phase.\n */\nexport const notePointerInput = (doc: Document | null | undefined): void => {\n if (!doc) return\n trackInputModality(doc)\n lastInput.set(doc, \"pointer\")\n}\n\n/**\n * Whether a focus shows its ring, as the browser's :focus-visible: a focus after a key or with no input yet does, one\n * a pointer press gave or a script moved after it does not. A tooltip opens on the first only.\n */\nexport const isFocusVisible = (element: Element): boolean => {\n try {\n if (element.matches(\":focus-visible\")) return true\n } catch {\n // A browser without the selector leaves it to the last input\n }\n return lastInput.get(element.ownerDocument) !== \"pointer\"\n}\n"]}
|
|
@@ -4,4 +4,16 @@ type HoverPointerEvent = {
|
|
|
4
4
|
};
|
|
5
5
|
/** Pointer hover is unavailable to touch input and explicitly touch-rendered surfaces. */
|
|
6
6
|
export declare const isHoverPointer: (event: HoverPointerEvent) => boolean;
|
|
7
|
+
/** Starts tracking the last input of a document (once per document). */
|
|
8
|
+
export declare const trackInputModality: (doc: Document | null | undefined) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Notes a pointer press from the element's own handler: a document that starts being tracked during that press (the
|
|
11
|
+
* first touch on a trigger in an iframe) has already let it pass its capture phase.
|
|
12
|
+
*/
|
|
13
|
+
export declare const notePointerInput: (doc: Document | null | undefined) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a focus shows its ring, as the browser's :focus-visible: a focus after a key or with no input yet does, one
|
|
16
|
+
* a pointer press gave or a script moved after it does not. A tooltip opens on the first only.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isFocusVisible: (element: Element) => boolean;
|
|
7
19
|
export {};
|