@plexui/vue 0.38.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.
@@ -1,7 +1,7 @@
1
1
  import { computed, defineComponent, h, nextTick, onMounted, onBeforeUnmount, ref, useId, watch, withDirectives, } from "vue";
2
2
  import { vServerText } from "../../lib/defaultValue.js";
3
3
  import { toCssVariables } from "../../lib/helpers.js";
4
- import { observeTextareaWidth } from "../../lib/observeTextareaWidth.js";
4
+ import { observeTextareaWidth, sizesByContent } from "../../lib/observeTextareaWidth.js";
5
5
  import s from "@plexui/styles/components/Textarea/Textarea.module.css";
6
6
  const invoke = (handler, event) => {
7
7
  for (const fn of [].concat(handler ?? [])) {
@@ -68,7 +68,7 @@ const TextareaComponent = defineComponent({
68
68
  };
69
69
  const autosizeTextarea = () => {
70
70
  const textarea = textAreaRef.value;
71
- if (!props.autoResize || !textarea || computedMaxRows.value === undefined)
71
+ if (!props.autoResize || !textarea || computedMaxRows.value === undefined || sizesByContent())
72
72
  return;
73
73
  textarea.style.height = "0px";
74
74
  const scrollHeight = textarea.scrollHeight;
@@ -77,7 +77,7 @@ const TextareaComponent = defineComponent({
77
77
  let stopObservingWidth;
78
78
  const observeWidth = () => {
79
79
  stopObservingWidth?.();
80
- stopObservingWidth = props.autoResize && textAreaRef.value
80
+ stopObservingWidth = props.autoResize && textAreaRef.value && !sizesByContent()
81
81
  ? observeTextareaWidth(textAreaRef.value, autosizeTextarea)
82
82
  : undefined;
83
83
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../../src/components/Textarea/Textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,QAAQ,EACR,SAAS,EACT,eAAe,EACf,GAAG,EACH,KAAK,EACL,KAAK,EACL,cAAc,GAGf,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CA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E,EAAE;wBACvB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;wBACrB,MAAM,CAAC,MAAuB,EAAE,GAAG,CAAC,CAAA;oBACtC,CAAC;oBACD,kBAAkB,EAAE,CAAC,GAAmB,EAAE,EAAE;wBAC1C,MAAM,CAAC,gBAAiC,EAAE,GAAG,CAAC,CAAA;wBAC9C,IAAI,GAAG,CAAC,aAAa,KAAK,oBAAoB,EAAE,CAAC;4BAC/C,IAAI,CAAC,UAAU,CAAC,CAAA;wBAClB,CAAC;oBACH,CAAC;oBACD,gDAAgD;oBAChD,eAAe,EAAE,uBAAuB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;oBAC3D,gBAAgB,EAAE,uBAAuB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;oBAC5D,aAAa,EAAE,WAAW;iBAC3B,CAAC,EACF,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAC7B;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAqF,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n nextTick,\n onMounted,\n onBeforeUnmount,\n ref,\n useId,\n watch,\n withDirectives,\n type PropType,\n type TextareaHTMLAttributes,\n} from \"vue\"\nimport type { ControlSize, Sizes, Variants } from \"@plexui/styles/types\"\nimport { vServerText } from \"../../lib/defaultValue.js\"\nimport { toCssVariables } from \"../../lib/helpers.js\"\nimport { observeTextareaWidth } from \"../../lib/observeTextareaWidth.js\"\nimport s from \"@plexui/styles/components/Textarea/Textarea.module.css\"\n\n// Vue port of packages/ui/src/components/Textarea/Textarea.tsx. Props,\n// defaults and rendered DOM match React 1:1 (checked by the parity tests).\n//\n// - `class` goes to the container; every other attribute and listener\n// (`style`, `placeholder`, `@input`, `@change`, ...) goes to the <textarea>,\n// like React's `className` and `...restProps`.\n// - Value: `value` + `update:value` mirror React's `value` prop\n// (`v-model:value`) and fire on every input. Uncontrolled use takes\n// `default-value`. Like a React controlled textarea, a `value` the parent\n// does not update after input is put back.\n// - As in React, the textarea's text content (its `defaultValue`) follows\n// the controlled value, or `default-value` when uncontrolled. It is set\n// through the `textContent` property, which Vue's server renderer prints\n// as the element's content, so `vServerText` can adjust it at SSR.\n\ntype ListenerValue = ((event: Event) => void) | Array<(event: Event) => void> | undefined\n\nconst invoke = (handler: unknown, event: Event) => {\n for (const fn of ([] as unknown[]).concat(handler ?? [])) {\n if (typeof fn === \"function\") fn(event)\n }\n}\n\nconst TextareaComponent = defineComponent({\n name: \"Textarea\",\n inheritAttrs: false,\n props: {\n /** Visual style of the textarea. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\" | \"ghost\">>, default: \"outline\" },\n /** Controls the size of the textarea. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Applies a negative margin using the current gutter to optically align the text with surrounding content. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n /** Controls gutter on the edges of the textarea, defaults to value from `size`. */\n gutterSize: String as PropType<Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">>,\n /** Disables the textarea visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Makes the textarea read-only. @default false */\n readOnly: { type: Boolean, default: false },\n /** Native spelling of `readOnly` (`<Textarea readonly />`). @default false */\n readonly: { type: Boolean, default: false },\n /** Mark the textarea as invalid. @default false */\n invalid: { type: Boolean, default: false },\n /** Allow autofill extensions to appear in the textarea. @default `true` when `name` is set, else `false` */\n allowAutofillExtensions: { type: Boolean, default: undefined },\n /** Select all contents of the textarea when mounted (and whenever it turns `true`). @default false */\n autoSelect: { type: Boolean, default: undefined },\n /** Default number of rows to display. @default 3 */\n rows: { type: Number, default: 3 },\n /** Automatically adjust the height of the textarea based on its contents. @default false */\n autoResize: { type: Boolean, default: undefined },\n /** Maximum number of rows that can be displayed when autoResize is enabled. @default Math.max(rows, 10) */\n maxRows: Number,\n id: String,\n name: String,\n /** Controlled value (`v-model:value`) */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value when uncontrolled */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** The textarea's `autocomplete` attribute */\n autoComplete: String,\n },\n emits: {\n \"update:value\": (value: string) => typeof value === \"string\",\n /** Fired when the browser autofills the textarea */\n \"autofill\": () => true,\n },\n setup(props, { attrs, emit, expose }) {\n const textAreaRef = ref<HTMLTextAreaElement | null>(null)\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${useId()}`\n const focused = ref(false)\n\n const computedMaxRows = computed(() =>\n props.autoResize ? Math.max(props.maxRows ?? 10, props.rows) : props.rows,\n )\n const controlledValue = () => props.value\n\n const runAutoSelect = () => {\n if (props.autoSelect) {\n textAreaRef.value?.select()\n }\n }\n\n const autosizeTextarea = () => {\n const textarea = textAreaRef.value\n if (!props.autoResize || !textarea || computedMaxRows.value === undefined) return\n textarea.style.height = \"0px\"\n const scrollHeight = textarea.scrollHeight\n textarea.style.height = scrollHeight + \"px\"\n }\n\n let stopObservingWidth: (() => void) | undefined\n const observeWidth = () => {\n stopObservingWidth?.()\n stopObservingWidth = props.autoResize && textAreaRef.value\n ? observeTextareaWidth(textAreaRef.value, autosizeTextarea)\n : undefined\n }\n watch(() => props.autoResize, observeWidth, { flush: \"post\" })\n onBeforeUnmount(() => stopObservingWidth?.())\n\n // The textarea's value is set imperatively, like React DOM does: a `value`\n // prop would make Vue mirror it into a `value` attribute, which React\n // never renders. Puts the controlled value back when it differs.\n const syncValue = () => {\n const textarea = textAreaRef.value\n const value = controlledValue()\n if (!textarea || value == null) return\n const nextValue = String(value)\n if (textarea.value !== nextValue) textarea.value = nextValue\n }\n\n // React runs these effects after mount and when their dependencies change\n onMounted(() => {\n const textarea = textAreaRef.value\n // React's initTextarea: the initial text becomes the (dirty) value\n const initialValue = textarea?.textContent ?? \"\"\n if (textarea && initialValue !== \"\") textarea.value = initialValue\n runAutoSelect()\n autosizeTextarea()\n observeWidth()\n })\n // React DOM writes a new value while committing, before any effect runs,\n // so the selection covers the value that arrives with `autoSelect`\n watch(\n () => props.autoSelect,\n () => {\n syncValue()\n runAutoSelect()\n },\n { flush: \"post\" },\n )\n // Resize if value changes outside of user input - e.g. form reset\n watch(\n () => [controlledValue(), props.rows, props.autoResize, computedMaxRows.value],\n () => {\n syncValue()\n autosizeTextarea()\n },\n { flush: \"post\" },\n )\n\n const handleInput = (evt: Event) => {\n const next = (evt.target as HTMLTextAreaElement).value\n emit(\"update:value\", next)\n autosizeTextarea()\n // A controlled value the parent did not update wins over the typed text,\n // as in React\n void nextTick(syncValue)\n }\n\n expose({\n /** The rendered <textarea> element */\n textarea: textAreaRef,\n focus: () => textAreaRef.value?.focus(),\n })\n\n return () => {\n const {\n class: className,\n onInput,\n onFocus,\n onBlur,\n onAnimationstart,\n ...restAttrs\n } = attrs as Record<string, unknown>\n\n const { variant, size, gutterSize, disabled, invalid, rows } = props\n const readOnly = props.readOnly || props.readonly\n // Default to `true` when presence of `name`\n const allowAutofillExtensions = props.allowAutofillExtensions ?? !!props.name\n const value = controlledValue()\n // React keeps the textarea's defaultValue (its text content) in sync with\n // the controlled value, else with `defaultValue`\n const textContent = String(value ?? props.defaultValue ?? \"\")\n\n return h(\n \"div\",\n {\n \"class\": [s.Container, className],\n \"data-slot\": \"textarea\",\n \"data-variant\": variant,\n \"data-size\": size,\n \"data-gutter-size\": gutterSize,\n \"data-optically-align\": props.opticallyAlign,\n \"data-focused\": String(focused.value),\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-readonly\": readOnly ? \"\" : undefined,\n \"data-invalid\": invalid ? \"\" : undefined,\n \"data-auto-resize\": props.autoResize ? \"\" : undefined,\n \"style\": toCssVariables({\n \"textarea-min-rows\": `${rows}`,\n \"textarea-max-rows\": `${computedMaxRows.value}`,\n }),\n },\n [\n withDirectives(\n h(\"textarea\", {\n ...restAttrs,\n \"onInput\": (evt: Event) => {\n invoke(onInput as ListenerValue, evt)\n handleInput(evt)\n },\n \"ref\": textAreaRef,\n \"id\": props.id || (allowAutofillExtensions ? undefined : onePasswordPreventionId),\n \"class\": s.Textarea,\n \"name\": props.name,\n \"autocomplete\": props.autoComplete ?? restAttrs.autocomplete,\n // Expose the visual invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": restAttrs[\"aria-invalid\"] ?? (invalid || undefined),\n \"readonly\": readOnly,\n \"disabled\": disabled,\n \"rows\": rows,\n \"onFocus\": (evt: Event) => {\n focused.value = true\n invoke(onFocus as ListenerValue, evt)\n },\n \"onBlur\": (evt: Event) => {\n focused.value = false\n invoke(onBlur as ListenerValue, evt)\n },\n \"onAnimationstart\": (evt: AnimationEvent) => {\n invoke(onAnimationstart as ListenerValue, evt)\n if (evt.animationName === \"native-autofill-in\") {\n emit(\"autofill\")\n }\n },\n // Prevent LastPass and 1Password from appearing\n \"data-lpignore\": allowAutofillExtensions ? undefined : true,\n \"data-1p-ignore\": allowAutofillExtensions ? undefined : true,\n \"textContent\": textContent,\n }),\n [[vServerText, textContent]],\n ),\n ],\n )\n }\n },\n})\n\ntype TextareaOwnProps = InstanceType<typeof TextareaComponent>[\"$props\"]\n\n/** Textarea props plus the native <textarea> attributes that fall through to it, as in React. */\nexport type TextareaProps = TextareaOwnProps & Omit<TextareaHTMLAttributes, keyof TextareaOwnProps | \"readonly\">\n\nexport const Textarea = TextareaComponent as typeof TextareaComponent & { new (): { $props: TextareaProps } }\n"]}
1
+ {"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../../src/components/Textarea/Textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,QAAQ,EACR,SAAS,EACT,eAAe,EACf,GAAG,EACH,KAAK,EACL,KAAK,EACL,cAAc,GAGf,MAAM,KAAK,CAAA;AAEZ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wBACpB,MAAM,CAAC,OAAwB,EAAE,GAAG,CAAC,CAAA;oBACvC,CAAC;oBACD,QAAQ,EAAE,CAAC,GAAU,EAAE,EAAE;wBACvB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;wBACrB,MAAM,CAAC,MAAuB,EAAE,GAAG,CAAC,CAAA;oBACtC,CAAC;oBACD,kBAAkB,EAAE,CAAC,GAAmB,EAAE,EAAE;wBAC1C,MAAM,CAAC,gBAAiC,EAAE,GAAG,CAAC,CAAA;wBAC9C,IAAI,GAAG,CAAC,aAAa,KAAK,oBAAoB,EAAE,CAAC;4BAC/C,IAAI,CAAC,UAAU,CAAC,CAAA;wBAClB,CAAC;oBACH,CAAC;oBACD,gDAAgD;oBAChD,eAAe,EAAE,uBAAuB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;oBAC3D,gBAAgB,EAAE,uBAAuB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;oBAC5D,aAAa,EAAE,WAAW;iBAC3B,CAAC,EACF,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAC7B;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAqF,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n nextTick,\n onMounted,\n onBeforeUnmount,\n ref,\n useId,\n watch,\n withDirectives,\n type PropType,\n type TextareaHTMLAttributes,\n} from \"vue\"\nimport type { ControlSize, Sizes, Variants } from \"@plexui/styles/types\"\nimport { vServerText } from \"../../lib/defaultValue.js\"\nimport { toCssVariables } from \"../../lib/helpers.js\"\nimport { observeTextareaWidth, sizesByContent } from \"../../lib/observeTextareaWidth.js\"\nimport s from \"@plexui/styles/components/Textarea/Textarea.module.css\"\n\n// Vue port of packages/ui/src/components/Textarea/Textarea.tsx. Props,\n// defaults and rendered DOM match React 1:1 (checked by the parity tests).\n//\n// - `class` goes to the container; every other attribute and listener\n// (`style`, `placeholder`, `@input`, `@change`, ...) goes to the <textarea>,\n// like React's `className` and `...restProps`.\n// - Value: `value` + `update:value` mirror React's `value` prop\n// (`v-model:value`) and fire on every input. Uncontrolled use takes\n// `default-value`. Like a React controlled textarea, a `value` the parent\n// does not update after input is put back.\n// - As in React, the textarea's text content (its `defaultValue`) follows\n// the controlled value, or `default-value` when uncontrolled. It is set\n// through the `textContent` property, which Vue's server renderer prints\n// as the element's content, so `vServerText` can adjust it at SSR.\n\ntype ListenerValue = ((event: Event) => void) | Array<(event: Event) => void> | undefined\n\nconst invoke = (handler: unknown, event: Event) => {\n for (const fn of ([] as unknown[]).concat(handler ?? [])) {\n if (typeof fn === \"function\") fn(event)\n }\n}\n\nconst TextareaComponent = defineComponent({\n name: \"Textarea\",\n inheritAttrs: false,\n props: {\n /** Visual style of the textarea. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\" | \"ghost\">>, default: \"outline\" },\n /** Controls the size of the textarea. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Applies a negative margin using the current gutter to optically align the text with surrounding content. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n /** Controls gutter on the edges of the textarea, defaults to value from `size`. */\n gutterSize: String as PropType<Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">>,\n /** Disables the textarea visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Makes the textarea read-only. @default false */\n readOnly: { type: Boolean, default: false },\n /** Native spelling of `readOnly` (`<Textarea readonly />`). @default false */\n readonly: { type: Boolean, default: false },\n /** Mark the textarea as invalid. @default false */\n invalid: { type: Boolean, default: false },\n /** Allow autofill extensions to appear in the textarea. @default `true` when `name` is set, else `false` */\n allowAutofillExtensions: { type: Boolean, default: undefined },\n /** Select all contents of the textarea when mounted (and whenever it turns `true`). @default false */\n autoSelect: { type: Boolean, default: undefined },\n /** Default number of rows to display. @default 3 */\n rows: { type: Number, default: 3 },\n /** Automatically adjust the height of the textarea based on its contents. @default false */\n autoResize: { type: Boolean, default: undefined },\n /** Maximum number of rows that can be displayed when autoResize is enabled. @default Math.max(rows, 10) */\n maxRows: Number,\n id: String,\n name: String,\n /** Controlled value (`v-model:value`) */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value when uncontrolled */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** The textarea's `autocomplete` attribute */\n autoComplete: String,\n },\n emits: {\n \"update:value\": (value: string) => typeof value === \"string\",\n /** Fired when the browser autofills the textarea */\n \"autofill\": () => true,\n },\n setup(props, { attrs, emit, expose }) {\n const textAreaRef = ref<HTMLTextAreaElement | null>(null)\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${useId()}`\n const focused = ref(false)\n\n const computedMaxRows = computed(() =>\n props.autoResize ? Math.max(props.maxRows ?? 10, props.rows) : props.rows,\n )\n const controlledValue = () => props.value\n\n const runAutoSelect = () => {\n if (props.autoSelect) {\n textAreaRef.value?.select()\n }\n }\n\n const autosizeTextarea = () => {\n const textarea = textAreaRef.value\n if (!props.autoResize || !textarea || computedMaxRows.value === undefined || sizesByContent()) return\n textarea.style.height = \"0px\"\n const scrollHeight = textarea.scrollHeight\n textarea.style.height = scrollHeight + \"px\"\n }\n\n let stopObservingWidth: (() => void) | undefined\n const observeWidth = () => {\n stopObservingWidth?.()\n stopObservingWidth = props.autoResize && textAreaRef.value && !sizesByContent()\n ? observeTextareaWidth(textAreaRef.value, autosizeTextarea)\n : undefined\n }\n watch(() => props.autoResize, observeWidth, { flush: \"post\" })\n onBeforeUnmount(() => stopObservingWidth?.())\n\n // The textarea's value is set imperatively, like React DOM does: a `value`\n // prop would make Vue mirror it into a `value` attribute, which React\n // never renders. Puts the controlled value back when it differs.\n const syncValue = () => {\n const textarea = textAreaRef.value\n const value = controlledValue()\n if (!textarea || value == null) return\n const nextValue = String(value)\n if (textarea.value !== nextValue) textarea.value = nextValue\n }\n\n // React runs these effects after mount and when their dependencies change\n onMounted(() => {\n const textarea = textAreaRef.value\n // React's initTextarea: the initial text becomes the (dirty) value\n const initialValue = textarea?.textContent ?? \"\"\n if (textarea && initialValue !== \"\") textarea.value = initialValue\n runAutoSelect()\n autosizeTextarea()\n observeWidth()\n })\n // React DOM writes a new value while committing, before any effect runs,\n // so the selection covers the value that arrives with `autoSelect`\n watch(\n () => props.autoSelect,\n () => {\n syncValue()\n runAutoSelect()\n },\n { flush: \"post\" },\n )\n // Resize if value changes outside of user input - e.g. form reset\n watch(\n () => [controlledValue(), props.rows, props.autoResize, computedMaxRows.value],\n () => {\n syncValue()\n autosizeTextarea()\n },\n { flush: \"post\" },\n )\n\n const handleInput = (evt: Event) => {\n const next = (evt.target as HTMLTextAreaElement).value\n emit(\"update:value\", next)\n autosizeTextarea()\n // A controlled value the parent did not update wins over the typed text,\n // as in React\n void nextTick(syncValue)\n }\n\n expose({\n /** The rendered <textarea> element */\n textarea: textAreaRef,\n focus: () => textAreaRef.value?.focus(),\n })\n\n return () => {\n const {\n class: className,\n onInput,\n onFocus,\n onBlur,\n onAnimationstart,\n ...restAttrs\n } = attrs as Record<string, unknown>\n\n const { variant, size, gutterSize, disabled, invalid, rows } = props\n const readOnly = props.readOnly || props.readonly\n // Default to `true` when presence of `name`\n const allowAutofillExtensions = props.allowAutofillExtensions ?? !!props.name\n const value = controlledValue()\n // React keeps the textarea's defaultValue (its text content) in sync with\n // the controlled value, else with `defaultValue`\n const textContent = String(value ?? props.defaultValue ?? \"\")\n\n return h(\n \"div\",\n {\n \"class\": [s.Container, className],\n \"data-slot\": \"textarea\",\n \"data-variant\": variant,\n \"data-size\": size,\n \"data-gutter-size\": gutterSize,\n \"data-optically-align\": props.opticallyAlign,\n \"data-focused\": String(focused.value),\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-readonly\": readOnly ? \"\" : undefined,\n \"data-invalid\": invalid ? \"\" : undefined,\n \"data-auto-resize\": props.autoResize ? \"\" : undefined,\n \"style\": toCssVariables({\n \"textarea-min-rows\": `${rows}`,\n \"textarea-max-rows\": `${computedMaxRows.value}`,\n }),\n },\n [\n withDirectives(\n h(\"textarea\", {\n ...restAttrs,\n \"onInput\": (evt: Event) => {\n invoke(onInput as ListenerValue, evt)\n handleInput(evt)\n },\n \"ref\": textAreaRef,\n \"id\": props.id || (allowAutofillExtensions ? undefined : onePasswordPreventionId),\n \"class\": s.Textarea,\n \"name\": props.name,\n \"autocomplete\": props.autoComplete ?? restAttrs.autocomplete,\n // Expose the visual invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": restAttrs[\"aria-invalid\"] ?? (invalid || undefined),\n \"readonly\": readOnly,\n \"disabled\": disabled,\n \"rows\": rows,\n \"onFocus\": (evt: Event) => {\n focused.value = true\n invoke(onFocus as ListenerValue, evt)\n },\n \"onBlur\": (evt: Event) => {\n focused.value = false\n invoke(onBlur as ListenerValue, evt)\n },\n \"onAnimationstart\": (evt: AnimationEvent) => {\n invoke(onAnimationstart as ListenerValue, evt)\n if (evt.animationName === \"native-autofill-in\") {\n emit(\"autofill\")\n }\n },\n // Prevent LastPass and 1Password from appearing\n \"data-lpignore\": allowAutofillExtensions ? undefined : true,\n \"data-1p-ignore\": allowAutofillExtensions ? undefined : true,\n \"textContent\": textContent,\n }),\n [[vServerText, textContent]],\n ),\n ],\n )\n }\n },\n})\n\ntype TextareaOwnProps = InstanceType<typeof TextareaComponent>[\"$props\"]\n\n/** Textarea props plus the native <textarea> attributes that fall through to it, as in React. */\nexport type TextareaProps = TextareaOwnProps & Omit<TextareaHTMLAttributes, keyof TextareaOwnProps | \"readonly\">\n\nexport const Textarea = TextareaComponent as typeof TextareaComponent & { new (): { $props: TextareaProps } }\n"]}
@@ -87,15 +87,24 @@ const ToolbarComponent = defineComponent({
87
87
  if (!bar || !setHeight)
88
88
  return;
89
89
  // A desktop layout hides the bar; its height then leaves the host's own header in charge.
90
- const update = () => {
90
+ const update = (height) => {
91
91
  if (reported && reported !== props.placement)
92
92
  setHeight(reported, undefined);
93
93
  reported = props.placement;
94
- setHeight(props.placement, bar.offsetHeight || undefined);
94
+ setHeight(props.placement, height || undefined);
95
95
  };
96
- update();
97
- observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : undefined;
98
- observer?.observe(bar, { box: "border-box" });
96
+ if (typeof ResizeObserver === "undefined") {
97
+ update(bar.offsetHeight);
98
+ return;
99
+ }
100
+ // The observer reports the first height too, after the layout of the frame and before its paint: a read of
101
+ // offsetHeight on mount forced a layout while a sheet that holds the bar was being built
102
+ observer = new ResizeObserver((entries) => {
103
+ const entry = entries?.[entries.length - 1];
104
+ const box = entry?.borderBoxSize?.[0];
105
+ update(box ? box.blockSize : bar.offsetHeight);
106
+ });
107
+ observer.observe(bar, { box: "border-box" });
99
108
  });
100
109
  onBeforeUnmount(() => {
101
110
  observer?.disconnect();
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,QAAQ,EACR,KAAK,GAMN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,sDAAsD,CAAA;AA8BpE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAyC,EAA6B,EAAE,CACpG,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAA8B,MAAM,CAAC,aAAa,CAAC,CAAA;AAE5E,2GAA2G;AAC3G,MAAM,mBAAmB,GAA6D,MAAM,CAAC,mBAAmB,C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C,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;QACjJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n Teleport,\n watch,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\n// Vue port of packages/ui/src/components/Toolbar/Toolbar.tsx. Exports are flat\n// (`ToolbarLeading` for `Toolbar.Leading`, ...).\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, once content is under the bar, a blur that grows toward the top under a\n * thin veil of the canvas color, with no line, which lets go past the bar; at the bottom of a page the content stays clear\n * under and around the controls, as on native iOS 26, and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a hairline once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"blur\"`: no fill and no line, once content is under the bar: the content blurred a little over the bar and past it,\n * and heavily toward the screen's edge\n *\n * iOS 27.2 has two scroll edges, soft and hard; glass is the bar of earlier iOS and blur an app's own.\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"blur\"\n/**\n * `\"solid\"` is the earlier name of `\"hard\"`: iOS has no opaque bar without a line, and it draws the line of a hard edge\n * only once content is under the bar, so at rest the two look the same.\n */\nexport type BarBackgroundAlias = \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`, `\"solid\"` of `\"hard\"`. */\nexport type ToolbarBackground = BarBackground | BarBackgroundAlias | \"edge\"\n\n/** The background a bar draws, from its current name or an earlier one. */\nexport const barBackground = (background: ToolbarBackground | undefined): BarBackground | undefined =>\n background === \"edge\" ? \"soft\" : background === \"solid\" ? \"hard\" : background\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: Ref<boolean>\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: Ref<boolean>\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n /** A large title asks for a place in the content; returns the release. */\n requestLargeTitleSlot?: () => () => void\n /** The place at the top of the content where a large title scrolls with it, once the content has made one. */\n largeTitleSlot?: Ref<HTMLElement | null>\n /** The place under a large title where the bar's rows stand, pinned under the bar once scrolled up to it. */\n largeTitleRowSlot?: Ref<HTMLElement | null>\n /** The rows under a large title are pinned under the bar, so its background reaches under them. */\n rowsPinned?: Ref<boolean>\n /**\n * `false` while the host has no content to keep a large title in (a Dialog without DialogBody): the title and its\n * rows stay in the bar. Otherwise the rows wait for their place, so they mount once, there.\n */\n holdsLargeTitle?: Ref<boolean>\n}\n\nexport const TOOLBAR_HOST: InjectionKey<ToolbarHost> = Symbol(\"ToolbarHost\")\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst TOOLBAR_TITLE_STYLE: InjectionKey<ComputedRef<ToolbarTitleStyle | undefined>> = Symbol(\"ToolbarTitleStyle\")\n// The bar itself, which a large title in the content marks once it has gone under the bar.\nconst TOOLBAR_ELEMENT: InjectionKey<Ref<HTMLElement | null>> = Symbol(\"ToolbarElement\")\n\n// The tokens of a large title a bar can set for itself, which the title in the content no longer inherits from it.\nconst LARGE_TITLE_TOKENS = [\n \"--toolbar-padding-bottom\",\n \"--toolbar-large-title-gap\",\n \"--toolbar-large-title-font-size\",\n \"--toolbar-large-title-line-height\",\n \"--toolbar-large-title-descent\",\n \"--toolbar-large-subtitle-font-size\",\n \"--toolbar-large-subtitle-line-height\",\n \"--toolbar-large-subtitle-descent\",\n]\n\n/**\n * Follows a large title in the content: it takes the large title tokens the bar sets for itself, and once its last line\n * is at the bar's bottom the bar shows it inline. Scrolling moves it; a change of layout (a wide window turning into a\n * phone's, which shows the bar and the title) or of a class or style on the bar, the content or around them measures it\n * again. A token the bar shares with the content stays inherited, so it follows the page's changes. A hidden title has\n * not gone under anything.\n */\nfunction followLargeTitle(bar: HTMLElement, heading: HTMLElement, subscribeScroll: (listener: () => void) => () => void) {\n const collapse = () => {\n const box = heading.getBoundingClientRect()\n bar.toggleAttribute(\"data-title-collapsed\", box.height > 0 && box.bottom <= bar.getBoundingClientRect().bottom)\n }\n const layout = () => {\n const own = getComputedStyle(bar)\n const place = heading.parentElement ? getComputedStyle(heading.parentElement) : undefined\n for (const token of LARGE_TITLE_TOKENS) {\n const value = own.getPropertyValue(token).trim()\n if (value && value !== place?.getPropertyValue(token).trim()) heading.style.setProperty(token, value)\n else heading.style.removeProperty(token)\n }\n collapse()\n }\n layout()\n const unsubscribe = subscribeScroll(collapse)\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(layout) : undefined\n observer?.observe(bar)\n observer?.observe(heading)\n const mutations = typeof MutationObserver !== \"undefined\" ? new MutationObserver(layout) : undefined\n // A token reaches the bar or the content from the class or style of either or of anything around them.\n for (const start of [bar, heading.parentElement]) {\n for (let node = start; node; node = node.parentElement) mutations?.observe(node, { attributes: true, attributeFilter: [\"class\", \"style\"] })\n }\n return () => {\n unsubscribe()\n observer?.disconnect()\n mutations?.disconnect()\n bar.removeAttribute(\"data-title-collapsed\")\n for (const token of LARGE_TITLE_TOKENS) heading.style.removeProperty(token)\n }\n}\n\nconst ToolbarComponent = defineComponent({\n name: \"Toolbar\",\n props: {\n /** @default \"top\" */\n placement: { type: String as PropType<ToolbarPlacement>, default: \"top\" },\n /** Layout of `ToolbarTitle` in a top bar. @default \"inline\" */\n titleStyle: { type: String as PropType<ToolbarTitleStyle>, default: \"inline\" },\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign: { type: String as PropType<ToolbarTitleAlign>, default: \"center\" },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background: { type: String as PropType<ToolbarBackground>, default: undefined },\n },\n setup(props, { slots }) {\n const host = inject(TOOLBAR_HOST, null)\n provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === \"top\" ? props.titleStyle : undefined)))\n const element = ref<HTMLElement | null>(null)\n provide(TOOLBAR_ELEMENT, element)\n let observer: ResizeObserver | undefined\n let reported: ToolbarPlacement | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n if (reported && reported !== props.placement) setHeight(reported, undefined)\n reported = props.placement\n setHeight(props.placement, bar.offsetHeight || undefined)\n }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n if (reported) host?.setHeight?.(reported, undefined)\n })\n return () => h(\"div\", {\n \"ref\": element,\n \"class\": s.Toolbar,\n \"data-toolbar\": \"\",\n \"data-placement\": props.placement,\n \"data-title-style\": props.placement === \"top\" ? props.titleStyle : undefined,\n \"data-title-align\": props.placement === \"top\" ? props.titleAlign : undefined,\n \"data-background\": barBackground(props.background) ?? (props.placement === \"bottom\" ? \"soft\" : \"glass\"),\n \"data-host\": host?.kind,\n \"data-scrolled\": props.placement === \"top\" && host?.scrolled?.value ? \"\" : undefined,\n \"data-content-below\": props.placement === \"bottom\" && host?.contentBelow?.value ? \"\" : undefined,\n \"data-rows-pinned\": props.placement === \"top\" && host?.rowsPinned?.value ? \"\" : undefined,\n }, slots.default?.())\n },\n})\n\n/** Props of `Toolbar`. */\nexport type ToolbarProps = {\n placement?: ToolbarPlacement\n titleStyle?: ToolbarTitleStyle\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n} & HTMLAttributes\n\n/** A phone toolbar, top or bottom. It never renders at the desktop breakpoint. */\nexport const Toolbar = ToolbarComponent as typeof ToolbarComponent & { new (): { $props: ToolbarProps } }\n\nfunction part(name: string, className: string, role?: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(\"div\", { class: className, role }, slots.default?.())\n },\n })\n}\n\n/** Items at the leading edge (React `Toolbar.Leading`). */\nexport const ToolbarLeading = part(\"ToolbarLeading\", s.Leading)\n/** Items at the trailing edge (React `Toolbar.Trailing`). */\nexport const ToolbarTrailing = part(\"ToolbarTrailing\", s.Trailing)\n/** Buttons that share one capsule (React `Toolbar.Group`). */\nexport const ToolbarGroup = part(\"ToolbarGroup\", s.Group, \"group\")\nconst rowOfAnchor = new WeakMap<Element, HTMLElement>()\n\n/**\n * Under a large title each row is portaled into the rows' place as it mounts, so a row that comes later (a search field\n * shown over a segmented control already there) would stand last. An empty anchor in the bar keeps the row's place among\n * the bar's rows, and the rows are moved into that order in the content, so the keyboard and a screen reader meet them\n * as they stand (Codex #7); a row added or removed in the bar orders them again.\n * (React's twin)\n */\nfunction followRowOrder(anchor: HTMLElement, row: HTMLElement) {\n const bar = anchor.closest(\"[data-toolbar]\") ?? anchor.parentElement\n if (!bar) return () => {}\n rowOfAnchor.set(anchor, row)\n const place = () => {\n const slot = row.parentElement\n if (!slot) return\n const rows = Array.from(bar.querySelectorAll(\"[data-toolbar-row-anchor]\"), (mark) => rowOfAnchor.get(mark))\n .filter((each): each is HTMLElement => each?.parentElement === slot)\n // From the last row back, a row that does not stand before the next one goes right before it: only a row out of\n // place moves (the one that came later), so a field focused in another row keeps its focus (Codex #8); moveBefore,\n // where the browser has it, keeps it even in the row that moves.\n const move = (slot as HTMLElement & { moveBefore?: (node: Node, child: Node | null) => void }).moveBefore\n for (let index = rows.length - 2; index >= 0; index--) {\n const each = rows[index]\n const next = rows[index + 1]\n if (each.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING) continue\n try {\n if (move) {\n move.call(slot, each, next)\n continue\n }\n } catch {\n // falls back to a plain move\n }\n slot.insertBefore(each, next)\n }\n }\n place()\n const observer = typeof MutationObserver !== \"undefined\" ? new MutationObserver(place) : undefined\n observer?.observe(bar, { childList: true, subtree: true })\n return () => {\n observer?.disconnect()\n rowOfAnchor.delete(anchor)\n }\n}\n\n/**\n * A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's\n * folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in\n * their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,\n * at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a\n * safeAreaBar under a large title's bar (React `Toolbar.Row`).\n */\nexport const ToolbarRow = defineComponent({\n name: \"ToolbarRow\",\n inheritAttrs: false,\n setup(_, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n // The rows go with the title: under it at the top of a page's content or a Sheet's body\n const large = computed(() => titleStyle?.value === \"large\" && !!host?.requestLargeTitleSlot)\n const slot = computed(() => (large.value ? host?.largeTitleRowSlot?.value ?? null : null))\n let release: (() => void) | undefined\n watch(large, (value) => {\n release?.()\n release = value ? host?.requestLargeTitleSlot?.() : undefined\n })\n // A watch that ran first has asked already (Codex #68)\n onMounted(() => { if (large.value && !release) release = host?.requestLargeTitleSlot?.() })\n onBeforeUnmount(() => release?.())\n const element = ref<HTMLElement | null>(null)\n const anchor = ref<HTMLElement | null>(null)\n let stopOrder: (() => void) | undefined\n watch([slot, element, anchor], ([place, row, mark]) => {\n stopOrder?.()\n stopOrder = place && row && mark ? followRowOrder(mark, row) : undefined\n }, { flush: \"post\" })\n onBeforeUnmount(() => { stopOrder?.(); stopOrder = undefined })\n return () => {\n const place = slot.value\n const row = h(\"div\", { ...attrs, \"ref\": element, \"class\": [s.Row, attrs.class], \"data-toolbar-row\": \"\", \"data-in-content\": place ? \"\" : undefined }, slots.default?.())\n // Under a large title the row waits for its place in the content, as React's does; a host with no content to\n // keep the title in (a Sheet without a body) keeps it in the bar.\n if (large.value && place) return [h(Teleport, { to: place }, [row]), h(\"span\", { \"ref\": anchor, \"data-toolbar-row-anchor\": \"\", \"hidden\": true })]\n if (large.value && host?.holdsLargeTitle?.value !== false) return null\n return row\n }\n },\n})\n\n/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */\nexport const ToolbarContent = defineComponent({\n name: \"ToolbarContent\",\n props: {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n return () => h(\"div\", { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined }, slots.default?.())\n },\n})\n\n/** The bar title, with an optional second line (React `Toolbar.Title`). */\nexport const ToolbarTitle = defineComponent({\n name: \"ToolbarTitle\",\n inheritAttrs: false,\n props: {\n /** A second, smaller line below the title. The `subtitle` slot takes precedence. */\n subtitle: { type: String, default: undefined },\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden\n * from assistive technology there.\n * @default \"h1\"\n */\n as: { type: String as PropType<\"h1\" | \"h2\" | \"h3\">, default: \"h1\" },\n },\n setup(props, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n const bar = inject(TOOLBAR_ELEMENT, null)\n const heading = ref<HTMLElement | null>(null)\n // A page, and a Dialog with its body, keep the title at the top of their content\n const large = computed(() => titleStyle?.value === \"large\" && !!host?.requestLargeTitleSlot)\n const slot = computed(() => (large.value ? host?.largeTitleSlot?.value ?? null : null))\n let release: (() => void) | undefined\n // A watch that ran first has asked already (Codex #68)\n onMounted(() => { if (large.value && !release) release = host?.requestLargeTitleSlot?.() })\n watch(large, (value) => {\n release?.()\n release = value ? host?.requestLargeTitleSlot?.() : undefined\n })\n // In the content the title scrolls with it, on the compositor and through the overscroll, as on iOS 26. Once it has\n // gone under the bar (its last line at the bar's bottom), the bar shows it inline and a hard or glass bar its line.\n // It starts once mounted too: a bar replaced under a page that keeps its content finds the place already there.\n let stopFollowing: (() => void) | undefined\n const follow = () => {\n stopFollowing?.()\n stopFollowing = undefined\n const element = bar?.value\n const title = heading.value\n if (!slot.value || !element || !title || !host?.subscribeScroll) return\n stopFollowing = followLargeTitle(element, title, host.subscribeScroll)\n }\n onMounted(follow)\n watch([slot, () => bar?.value], follow, { flush: \"post\" })\n onBeforeUnmount(() => { stopFollowing?.(); release?.() })\n return () => {\n // An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.\n const present = (value: unknown) => (Array.isArray(value) ? value.length > 0 : value != null && value !== \"\")\n const subtitle = slots.subtitle?.() ?? props.subtitle\n const place = slot.value\n const title = h(\"div\", { \"ref\": heading, \"class\": s.Heading, \"aria-hidden\": host?.kind === \"dialog\" ? \"true\" : undefined, \"data-in-content\": place ? \"\" : undefined }, [\n h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),\n present(subtitle) ? h(\"p\", { class: s.Subtitle }, subtitle) : null,\n ])\n if (!large.value) return title\n // Until the content has made its place (a server-rendered page before it hydrates), the title stands in the bar\n // where it will stand in the content. The inline copy the row of controls shows once the large title has gone\n // under it keeps a subtitle as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n const copySubtitle = slots.subtitle?.() ?? props.subtitle\n const copy = present(copySubtitle)\n ? [h(\"span\", { class: s.CollapsedLine }, slots.default?.()), h(\"span\", { class: s.CollapsedSubtitle }, copySubtitle)]\n : slots.default?.()\n return [h(Teleport, { to: place ?? \"body\", disabled: !place }, [title]), h(\"span\", { \"class\": s.CollapsedTitle, \"aria-hidden\": \"true\" }, copy)]\n }\n },\n})\n"]}
1
+ {"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,QAAQ,EACR,KAAK,GAMN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,sDAAsD,CAAA;AA8BpE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAyC,EAA6B,EAAE,CACpG,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAA8B,MAAM,CAAC,aAAa,CAAC,CAAA;AAE5E,2GAA2G;AAC3G,MAAM,mBAAmB,GAA6D,MAAM,CAAC,mBAAmB,CAAC,CAAA;AACjH,2FAA2F;AAC3F,MAAM,eAAe,GAA0C,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAEvF,mHAAmH;AACnH,MAAM,kBAAkB,GAAG;IACzB,0BAA0B;IAC1B,2BAA2B;IAC3B,iCAAiC;IACjC,mCAAmC;IACnC,+BAA+B;IAC/B,oCAAoC;IACpC,sCAAsC;IACtC,kCAAkC;CACnC,CAAA;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,GAAgB,EAAE,OAAoB,EAAE,eAAqD;IACrH,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,MAAM,GAAG,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;QAC3C,GAAG,CAAC,eAAe,CAAC,sBAAsB,EAAE,GAAG,CAAC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ourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n Teleport,\n watch,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\n// Vue port of packages/ui/src/components/Toolbar/Toolbar.tsx. Exports are flat\n// (`ToolbarLeading` for `Toolbar.Leading`, ...).\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, once content is under the bar, a blur that grows toward the top under a\n * thin veil of the canvas color, with no line, which lets go past the bar; at the bottom of a page the content stays clear\n * under and around the controls, as on native iOS 26, and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a hairline once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"blur\"`: no fill and no line, once content is under the bar: the content blurred a little over the bar and past it,\n * and heavily toward the screen's edge\n *\n * iOS 27.2 has two scroll edges, soft and hard; glass is the bar of earlier iOS and blur an app's own.\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"blur\"\n/**\n * `\"solid\"` is the earlier name of `\"hard\"`: iOS has no opaque bar without a line, and it draws the line of a hard edge\n * only once content is under the bar, so at rest the two look the same.\n */\nexport type BarBackgroundAlias = \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`, `\"solid\"` of `\"hard\"`. */\nexport type ToolbarBackground = BarBackground | BarBackgroundAlias | \"edge\"\n\n/** The background a bar draws, from its current name or an earlier one. */\nexport const barBackground = (background: ToolbarBackground | undefined): BarBackground | undefined =>\n background === \"edge\" ? \"soft\" : background === \"solid\" ? \"hard\" : background\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: Ref<boolean>\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: Ref<boolean>\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n /** A large title asks for a place in the content; returns the release. */\n requestLargeTitleSlot?: () => () => void\n /** The place at the top of the content where a large title scrolls with it, once the content has made one. */\n largeTitleSlot?: Ref<HTMLElement | null>\n /** The place under a large title where the bar's rows stand, pinned under the bar once scrolled up to it. */\n largeTitleRowSlot?: Ref<HTMLElement | null>\n /** The rows under a large title are pinned under the bar, so its background reaches under them. */\n rowsPinned?: Ref<boolean>\n /**\n * `false` while the host has no content to keep a large title in (a Dialog without DialogBody): the title and its\n * rows stay in the bar. Otherwise the rows wait for their place, so they mount once, there.\n */\n holdsLargeTitle?: Ref<boolean>\n}\n\nexport const TOOLBAR_HOST: InjectionKey<ToolbarHost> = Symbol(\"ToolbarHost\")\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst TOOLBAR_TITLE_STYLE: InjectionKey<ComputedRef<ToolbarTitleStyle | undefined>> = Symbol(\"ToolbarTitleStyle\")\n// The bar itself, which a large title in the content marks once it has gone under the bar.\nconst TOOLBAR_ELEMENT: InjectionKey<Ref<HTMLElement | null>> = Symbol(\"ToolbarElement\")\n\n// The tokens of a large title a bar can set for itself, which the title in the content no longer inherits from it.\nconst LARGE_TITLE_TOKENS = [\n \"--toolbar-padding-bottom\",\n \"--toolbar-large-title-gap\",\n \"--toolbar-large-title-font-size\",\n \"--toolbar-large-title-line-height\",\n \"--toolbar-large-title-descent\",\n \"--toolbar-large-subtitle-font-size\",\n \"--toolbar-large-subtitle-line-height\",\n \"--toolbar-large-subtitle-descent\",\n]\n\n/**\n * Follows a large title in the content: it takes the large title tokens the bar sets for itself, and once its last line\n * is at the bar's bottom the bar shows it inline. Scrolling moves it; a change of layout (a wide window turning into a\n * phone's, which shows the bar and the title) or of a class or style on the bar, the content or around them measures it\n * again. A token the bar shares with the content stays inherited, so it follows the page's changes. A hidden title has\n * not gone under anything.\n */\nfunction followLargeTitle(bar: HTMLElement, heading: HTMLElement, subscribeScroll: (listener: () => void) => () => void) {\n const collapse = () => {\n const box = heading.getBoundingClientRect()\n bar.toggleAttribute(\"data-title-collapsed\", box.height > 0 && box.bottom <= bar.getBoundingClientRect().bottom)\n }\n const layout = () => {\n const own = getComputedStyle(bar)\n const place = heading.parentElement ? getComputedStyle(heading.parentElement) : undefined\n for (const token of LARGE_TITLE_TOKENS) {\n const value = own.getPropertyValue(token).trim()\n if (value && value !== place?.getPropertyValue(token).trim()) heading.style.setProperty(token, value)\n else heading.style.removeProperty(token)\n }\n collapse()\n }\n layout()\n const unsubscribe = subscribeScroll(collapse)\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(layout) : undefined\n observer?.observe(bar)\n observer?.observe(heading)\n const mutations = typeof MutationObserver !== \"undefined\" ? new MutationObserver(layout) : undefined\n // A token reaches the bar or the content from the class or style of either or of anything around them.\n for (const start of [bar, heading.parentElement]) {\n for (let node = start; node; node = node.parentElement) mutations?.observe(node, { attributes: true, attributeFilter: [\"class\", \"style\"] })\n }\n return () => {\n unsubscribe()\n observer?.disconnect()\n mutations?.disconnect()\n bar.removeAttribute(\"data-title-collapsed\")\n for (const token of LARGE_TITLE_TOKENS) heading.style.removeProperty(token)\n }\n}\n\nconst ToolbarComponent = defineComponent({\n name: \"Toolbar\",\n props: {\n /** @default \"top\" */\n placement: { type: String as PropType<ToolbarPlacement>, default: \"top\" },\n /** Layout of `ToolbarTitle` in a top bar. @default \"inline\" */\n titleStyle: { type: String as PropType<ToolbarTitleStyle>, default: \"inline\" },\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign: { type: String as PropType<ToolbarTitleAlign>, default: \"center\" },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background: { type: String as PropType<ToolbarBackground>, default: undefined },\n },\n setup(props, { slots }) {\n const host = inject(TOOLBAR_HOST, null)\n provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === \"top\" ? props.titleStyle : undefined)))\n const element = ref<HTMLElement | null>(null)\n provide(TOOLBAR_ELEMENT, element)\n let observer: ResizeObserver | undefined\n let reported: ToolbarPlacement | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = (height: number) => {\n if (reported && reported !== props.placement) setHeight(reported, undefined)\n reported = props.placement\n setHeight(props.placement, height || undefined)\n }\n if (typeof ResizeObserver === \"undefined\") {\n update(bar.offsetHeight)\n return\n }\n // The observer reports the first height too, after the layout of the frame and before its paint: a read of\n // offsetHeight on mount forced a layout while a sheet that holds the bar was being built\n observer = new ResizeObserver((entries?: ResizeObserverEntry[]) => {\n const entry = entries?.[entries.length - 1]\n const box = entry?.borderBoxSize?.[0]\n update(box ? box.blockSize : bar.offsetHeight)\n })\n observer.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n if (reported) host?.setHeight?.(reported, undefined)\n })\n return () => h(\"div\", {\n \"ref\": element,\n \"class\": s.Toolbar,\n \"data-toolbar\": \"\",\n \"data-placement\": props.placement,\n \"data-title-style\": props.placement === \"top\" ? props.titleStyle : undefined,\n \"data-title-align\": props.placement === \"top\" ? props.titleAlign : undefined,\n \"data-background\": barBackground(props.background) ?? (props.placement === \"bottom\" ? \"soft\" : \"glass\"),\n \"data-host\": host?.kind,\n \"data-scrolled\": props.placement === \"top\" && host?.scrolled?.value ? \"\" : undefined,\n \"data-content-below\": props.placement === \"bottom\" && host?.contentBelow?.value ? \"\" : undefined,\n \"data-rows-pinned\": props.placement === \"top\" && host?.rowsPinned?.value ? \"\" : undefined,\n }, slots.default?.())\n },\n})\n\n/** Props of `Toolbar`. */\nexport type ToolbarProps = {\n placement?: ToolbarPlacement\n titleStyle?: ToolbarTitleStyle\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n} & HTMLAttributes\n\n/** A phone toolbar, top or bottom. It never renders at the desktop breakpoint. */\nexport const Toolbar = ToolbarComponent as typeof ToolbarComponent & { new (): { $props: ToolbarProps } }\n\nfunction part(name: string, className: string, role?: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(\"div\", { class: className, role }, slots.default?.())\n },\n })\n}\n\n/** Items at the leading edge (React `Toolbar.Leading`). */\nexport const ToolbarLeading = part(\"ToolbarLeading\", s.Leading)\n/** Items at the trailing edge (React `Toolbar.Trailing`). */\nexport const ToolbarTrailing = part(\"ToolbarTrailing\", s.Trailing)\n/** Buttons that share one capsule (React `Toolbar.Group`). */\nexport const ToolbarGroup = part(\"ToolbarGroup\", s.Group, \"group\")\nconst rowOfAnchor = new WeakMap<Element, HTMLElement>()\n\n/**\n * Under a large title each row is portaled into the rows' place as it mounts, so a row that comes later (a search field\n * shown over a segmented control already there) would stand last. An empty anchor in the bar keeps the row's place among\n * the bar's rows, and the rows are moved into that order in the content, so the keyboard and a screen reader meet them\n * as they stand (Codex #7); a row added or removed in the bar orders them again.\n * (React's twin)\n */\nfunction followRowOrder(anchor: HTMLElement, row: HTMLElement) {\n const bar = anchor.closest(\"[data-toolbar]\") ?? anchor.parentElement\n if (!bar) return () => {}\n rowOfAnchor.set(anchor, row)\n const place = () => {\n const slot = row.parentElement\n if (!slot) return\n const rows = Array.from(bar.querySelectorAll(\"[data-toolbar-row-anchor]\"), (mark) => rowOfAnchor.get(mark))\n .filter((each): each is HTMLElement => each?.parentElement === slot)\n // From the last row back, a row that does not stand before the next one goes right before it: only a row out of\n // place moves (the one that came later), so a field focused in another row keeps its focus (Codex #8); moveBefore,\n // where the browser has it, keeps it even in the row that moves.\n const move = (slot as HTMLElement & { moveBefore?: (node: Node, child: Node | null) => void }).moveBefore\n for (let index = rows.length - 2; index >= 0; index--) {\n const each = rows[index]\n const next = rows[index + 1]\n if (each.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING) continue\n try {\n if (move) {\n move.call(slot, each, next)\n continue\n }\n } catch {\n // falls back to a plain move\n }\n slot.insertBefore(each, next)\n }\n }\n place()\n const observer = typeof MutationObserver !== \"undefined\" ? new MutationObserver(place) : undefined\n observer?.observe(bar, { childList: true, subtree: true })\n return () => {\n observer?.disconnect()\n rowOfAnchor.delete(anchor)\n }\n}\n\n/**\n * A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's\n * folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in\n * their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,\n * at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a\n * safeAreaBar under a large title's bar (React `Toolbar.Row`).\n */\nexport const ToolbarRow = defineComponent({\n name: \"ToolbarRow\",\n inheritAttrs: false,\n setup(_, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n // The rows go with the title: under it at the top of a page's content or a Sheet's body\n const large = computed(() => titleStyle?.value === \"large\" && !!host?.requestLargeTitleSlot)\n const slot = computed(() => (large.value ? host?.largeTitleRowSlot?.value ?? null : null))\n let release: (() => void) | undefined\n watch(large, (value) => {\n release?.()\n release = value ? host?.requestLargeTitleSlot?.() : undefined\n })\n // A watch that ran first has asked already (Codex #68)\n onMounted(() => { if (large.value && !release) release = host?.requestLargeTitleSlot?.() })\n onBeforeUnmount(() => release?.())\n const element = ref<HTMLElement | null>(null)\n const anchor = ref<HTMLElement | null>(null)\n let stopOrder: (() => void) | undefined\n watch([slot, element, anchor], ([place, row, mark]) => {\n stopOrder?.()\n stopOrder = place && row && mark ? followRowOrder(mark, row) : undefined\n }, { flush: \"post\" })\n onBeforeUnmount(() => { stopOrder?.(); stopOrder = undefined })\n return () => {\n const place = slot.value\n const row = h(\"div\", { ...attrs, \"ref\": element, \"class\": [s.Row, attrs.class], \"data-toolbar-row\": \"\", \"data-in-content\": place ? \"\" : undefined }, slots.default?.())\n // Under a large title the row waits for its place in the content, as React's does; a host with no content to\n // keep the title in (a Sheet without a body) keeps it in the bar.\n if (large.value && place) return [h(Teleport, { to: place }, [row]), h(\"span\", { \"ref\": anchor, \"data-toolbar-row-anchor\": \"\", \"hidden\": true })]\n if (large.value && host?.holdsLargeTitle?.value !== false) return null\n return row\n }\n },\n})\n\n/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */\nexport const ToolbarContent = defineComponent({\n name: \"ToolbarContent\",\n props: {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n return () => h(\"div\", { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined }, slots.default?.())\n },\n})\n\n/** The bar title, with an optional second line (React `Toolbar.Title`). */\nexport const ToolbarTitle = defineComponent({\n name: \"ToolbarTitle\",\n inheritAttrs: false,\n props: {\n /** A second, smaller line below the title. The `subtitle` slot takes precedence. */\n subtitle: { type: String, default: undefined },\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden\n * from assistive technology there.\n * @default \"h1\"\n */\n as: { type: String as PropType<\"h1\" | \"h2\" | \"h3\">, default: \"h1\" },\n },\n setup(props, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n const bar = inject(TOOLBAR_ELEMENT, null)\n const heading = ref<HTMLElement | null>(null)\n // A page, and a Dialog with its body, keep the title at the top of their content\n const large = computed(() => titleStyle?.value === \"large\" && !!host?.requestLargeTitleSlot)\n const slot = computed(() => (large.value ? host?.largeTitleSlot?.value ?? null : null))\n let release: (() => void) | undefined\n // A watch that ran first has asked already (Codex #68)\n onMounted(() => { if (large.value && !release) release = host?.requestLargeTitleSlot?.() })\n watch(large, (value) => {\n release?.()\n release = value ? host?.requestLargeTitleSlot?.() : undefined\n })\n // In the content the title scrolls with it, on the compositor and through the overscroll, as on iOS 26. Once it has\n // gone under the bar (its last line at the bar's bottom), the bar shows it inline and a hard or glass bar its line.\n // It starts once mounted too: a bar replaced under a page that keeps its content finds the place already there.\n let stopFollowing: (() => void) | undefined\n const follow = () => {\n stopFollowing?.()\n stopFollowing = undefined\n const element = bar?.value\n const title = heading.value\n if (!slot.value || !element || !title || !host?.subscribeScroll) return\n stopFollowing = followLargeTitle(element, title, host.subscribeScroll)\n }\n onMounted(follow)\n watch([slot, () => bar?.value], follow, { flush: \"post\" })\n onBeforeUnmount(() => { stopFollowing?.(); release?.() })\n return () => {\n // An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.\n const present = (value: unknown) => (Array.isArray(value) ? value.length > 0 : value != null && value !== \"\")\n const subtitle = slots.subtitle?.() ?? props.subtitle\n const place = slot.value\n const title = h(\"div\", { \"ref\": heading, \"class\": s.Heading, \"aria-hidden\": host?.kind === \"dialog\" ? \"true\" : undefined, \"data-in-content\": place ? \"\" : undefined }, [\n h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),\n present(subtitle) ? h(\"p\", { class: s.Subtitle }, subtitle) : null,\n ])\n if (!large.value) return title\n // Until the content has made its place (a server-rendered page before it hydrates), the title stands in the bar\n // where it will stand in the content. The inline copy the row of controls shows once the large title has gone\n // under it keeps a subtitle as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n const copySubtitle = slots.subtitle?.() ?? props.subtitle\n const copy = present(copySubtitle)\n ? [h(\"span\", { class: s.CollapsedLine }, slots.default?.()), h(\"span\", { class: s.CollapsedSubtitle }, copySubtitle)]\n : slots.default?.()\n return [h(Teleport, { to: place ?? \"body\", disabled: !place }, [title]), h(\"span\", { \"class\": s.CollapsedTitle, \"aria-hidden\": \"true\" }, copy)]\n }\n },\n})\n"]}
@@ -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
- if (!isPointerDown && !event.currentTarget.hasAttribute("data-menu-pointer-focus")) {
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,CAAA;AAEnC,qEAAqE;AACrE,MAAM,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb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E,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 { 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"],"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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K,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"]}
@@ -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