@ai-matrx/design-system 0.86.332 → 0.86.334
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -2
- package/dist/auth-gate-dialog.js +4 -4
- package/dist/carousel.js +18 -18
- package/dist/{chunk-MVGMI6UZ.js → chunk-3MQMVPKO.js} +5 -5
- package/dist/{chunk-2WL2SGKL.js → chunk-677JS6TX.js} +24 -10
- package/dist/chunk-677JS6TX.js.map +1 -0
- package/dist/{chunk-TBDMTCRW.js → chunk-6YZMGSQY.js} +10 -10
- package/dist/{chunk-OFJ5LGBU.js → chunk-7NEVJKDZ.js} +8 -8
- package/dist/{chunk-XTNAKJSH.js → chunk-B3LDW3IQ.js} +2 -2
- package/dist/{chunk-VTJWQPYR.js → chunk-BM2YYBUO.js} +5 -5
- package/dist/{chunk-FTZCPGTH.js → chunk-CFCWQDGC.js} +4 -4
- package/dist/{chunk-CN7C4KQB.js → chunk-CH2NWSES.js} +2 -2
- package/dist/{chunk-CJCUD62M.js → chunk-CSSD6NS4.js} +5 -5
- package/dist/{chunk-W3QSRJ3O.js → chunk-E4GS5QH7.js} +7 -7
- package/dist/{chunk-O4KANICE.js → chunk-FRJ4PPA2.js} +5 -5
- package/dist/{chunk-4PCLJAW2.js → chunk-FXT7PZAF.js} +5 -14
- package/dist/chunk-FXT7PZAF.js.map +1 -0
- package/dist/{chunk-D45XDOJS.js → chunk-GHPUO3O7.js} +2 -2
- package/dist/{chunk-RPUC5MNH.js → chunk-GLZJ7WZK.js} +3 -3
- package/dist/{chunk-VKWQTSB6.js → chunk-HEFTQUJ5.js} +6 -6
- package/dist/{chunk-KWBYKUKP.js → chunk-J6637L6D.js} +4 -4
- package/dist/chunk-KGW373MK.js +21 -0
- package/dist/chunk-KGW373MK.js.map +1 -0
- package/dist/{chunk-5LT34PFX.js → chunk-MEJVHDYJ.js} +18 -18
- package/dist/{chunk-PPB52S7F.js → chunk-MFUNGDHO.js} +7 -7
- package/dist/{chunk-LCPHFONA.js → chunk-MIJMP4WI.js} +5 -5
- package/dist/{chunk-XREKZXAL.js → chunk-SMJGESH7.js} +6 -6
- package/dist/{chunk-SNHCBHBE.js → chunk-U24MOJWK.js} +4 -4
- package/dist/{chunk-DO6G4EKJ.js → chunk-UWTODOMD.js} +2 -2
- package/dist/{chunk-BQR4N24F.js → chunk-VLLUUOYJ.js} +4 -4
- package/dist/{chunk-FD6V6JBN.js → chunk-VV6WZTH5.js} +8 -8
- package/dist/{chunk-LVM7XZRJ.js → chunk-WQ2QCMMA.js} +4 -4
- package/dist/{chunk-57OD2WTY.js → chunk-X6ZRHJQP.js} +6 -6
- package/dist/{chunk-PLFWDUJW.js → chunk-XEXSZBXV.js} +3 -3
- package/dist/{chunk-JSXNITMG.js → chunk-YC5GAO35.js} +2 -2
- package/dist/{chunk-5TF2AFDM.js → chunk-ZCRPESQX.js} +4 -4
- package/dist/{chunk-5IKQ6RU4.js → chunk-ZOQ2XKXF.js} +9 -9
- package/dist/clipboard-fallback-dialog.js +10 -10
- package/dist/controls.js +15 -15
- package/dist/data-table/data-row-inspector.js +15 -14
- package/dist/data-table/data-row-window.js +20 -19
- package/dist/data-table/index.cjs +16 -12
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +37 -36
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/layered-filter-builder.js +4 -4
- package/dist/data-table/pagination.js +8 -8
- package/dist/data-table/uuid-cell.js +8 -8
- package/dist/desktop.js +22 -22
- package/dist/email-input-dialog.js +7 -7
- package/dist/index.cjs +590 -397
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -10
- package/dist/index.d.ts +120 -10
- package/dist/index.js +519 -348
- package/dist/index.js.map +1 -1
- package/dist/intro-stage.js +3 -3
- package/dist/item.cjs +33 -17
- package/dist/item.cjs.map +1 -1
- package/dist/item.d.cts +7 -1
- package/dist/item.d.ts +7 -1
- package/dist/item.js +32 -30
- package/dist/item.js.map +1 -1
- package/dist/lite-table.js +10 -10
- package/dist/menu-look.js +3 -3
- package/dist/record-list.cjs +16 -2
- package/dist/record-list.cjs.map +1 -1
- package/dist/record-list.d.cts +7 -1
- package/dist/record-list.d.ts +7 -1
- package/dist/record-list.js +13 -13
- package/dist/sandbox-gate-dialog.js +8 -8
- package/dist/scope-mismatch-dialog.js +7 -7
- package/dist/settings.cjs +16 -12
- package/dist/settings.cjs.map +1 -1
- package/dist/settings.js +20 -19
- package/dist/settings.js.map +1 -1
- package/dist/site-icon.js +2 -2
- package/dist/swipe-deck.js +1 -1
- package/dist/tap-shortcut.cjs +40 -0
- package/dist/tap-shortcut.cjs.map +1 -0
- package/dist/tap-shortcut.d.cts +13 -0
- package/dist/tap-shortcut.d.ts +13 -0
- package/dist/tap-shortcut.js +10 -0
- package/dist/tap-shortcut.js.map +1 -0
- package/dist/tap-target/ai-buttons.cjs +16 -12
- package/dist/tap-target/ai-buttons.cjs.map +1 -1
- package/dist/tap-target/ai-buttons.js +4 -3
- package/dist/tap-target/ai-buttons.js.map +1 -1
- package/dist/tap-target/buttons.cjs +16 -12
- package/dist/tap-target/buttons.cjs.map +1 -1
- package/dist/tap-target/buttons.d.cts +3 -5
- package/dist/tap-target/buttons.d.ts +3 -5
- package/dist/tap-target/buttons.js +4 -3
- package/dist/tap-target.cjs +16 -12
- package/dist/tap-target.cjs.map +1 -1
- package/dist/tap-target.d.cts +5 -7
- package/dist/tap-target.d.ts +5 -7
- package/dist/tap-target.js +6 -4
- package/dist/text-input-dialog.js +10 -10
- package/dist/thumbnail-grid.js +2 -2
- package/dist/transcript-scroll-nav.cjs +16 -12
- package/dist/transcript-scroll-nav.cjs.map +1 -1
- package/dist/transcript-scroll-nav.js +2 -1
- package/dist/transcript-scroll-nav.js.map +1 -1
- package/dist/value-prompts-dialog.js +5 -5
- package/dist/writing-field.cjs +16 -12
- package/dist/writing-field.cjs.map +1 -1
- package/dist/writing-field.js +21 -20
- package/dist/writing-field.js.map +1 -1
- package/package.json +12 -2
- package/dist/chunk-2WL2SGKL.js.map +0 -1
- package/dist/chunk-4PCLJAW2.js.map +0 -1
- /package/dist/{chunk-MVGMI6UZ.js.map → chunk-3MQMVPKO.js.map} +0 -0
- /package/dist/{chunk-TBDMTCRW.js.map → chunk-6YZMGSQY.js.map} +0 -0
- /package/dist/{chunk-OFJ5LGBU.js.map → chunk-7NEVJKDZ.js.map} +0 -0
- /package/dist/{chunk-XTNAKJSH.js.map → chunk-B3LDW3IQ.js.map} +0 -0
- /package/dist/{chunk-VTJWQPYR.js.map → chunk-BM2YYBUO.js.map} +0 -0
- /package/dist/{chunk-FTZCPGTH.js.map → chunk-CFCWQDGC.js.map} +0 -0
- /package/dist/{chunk-CN7C4KQB.js.map → chunk-CH2NWSES.js.map} +0 -0
- /package/dist/{chunk-CJCUD62M.js.map → chunk-CSSD6NS4.js.map} +0 -0
- /package/dist/{chunk-W3QSRJ3O.js.map → chunk-E4GS5QH7.js.map} +0 -0
- /package/dist/{chunk-O4KANICE.js.map → chunk-FRJ4PPA2.js.map} +0 -0
- /package/dist/{chunk-D45XDOJS.js.map → chunk-GHPUO3O7.js.map} +0 -0
- /package/dist/{chunk-RPUC5MNH.js.map → chunk-GLZJ7WZK.js.map} +0 -0
- /package/dist/{chunk-VKWQTSB6.js.map → chunk-HEFTQUJ5.js.map} +0 -0
- /package/dist/{chunk-KWBYKUKP.js.map → chunk-J6637L6D.js.map} +0 -0
- /package/dist/{chunk-5LT34PFX.js.map → chunk-MEJVHDYJ.js.map} +0 -0
- /package/dist/{chunk-PPB52S7F.js.map → chunk-MFUNGDHO.js.map} +0 -0
- /package/dist/{chunk-LCPHFONA.js.map → chunk-MIJMP4WI.js.map} +0 -0
- /package/dist/{chunk-XREKZXAL.js.map → chunk-SMJGESH7.js.map} +0 -0
- /package/dist/{chunk-SNHCBHBE.js.map → chunk-U24MOJWK.js.map} +0 -0
- /package/dist/{chunk-DO6G4EKJ.js.map → chunk-UWTODOMD.js.map} +0 -0
- /package/dist/{chunk-BQR4N24F.js.map → chunk-VLLUUOYJ.js.map} +0 -0
- /package/dist/{chunk-FD6V6JBN.js.map → chunk-VV6WZTH5.js.map} +0 -0
- /package/dist/{chunk-LVM7XZRJ.js.map → chunk-WQ2QCMMA.js.map} +0 -0
- /package/dist/{chunk-57OD2WTY.js.map → chunk-X6ZRHJQP.js.map} +0 -0
- /package/dist/{chunk-PLFWDUJW.js.map → chunk-XEXSZBXV.js.map} +0 -0
- /package/dist/{chunk-JSXNITMG.js.map → chunk-YC5GAO35.js.map} +0 -0
- /package/dist/{chunk-5TF2AFDM.js.map → chunk-ZCRPESQX.js.map} +0 -0
- /package/dist/{chunk-5IKQ6RU4.js.map → chunk-ZOQ2XKXF.js.map} +0 -0
package/dist/tap-target.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tap-target/index.ts","../src/tap-target/tap-target-button.tsx","../src/tooltip.tsx","../src/cn.ts","../src/motion.ts","../src/portal-container.tsx","../src/title-tooltips.ts","../src/tap-target/tap-target-guard.ts","../src/layout-scale.ts","../src/tap-target/tap-surface.tsx","../src/tap-target/tap-features.tsx","../src/tap-target/link.ts","../src/tap-target/tap-target-labeled.tsx","../src/tap-target/tap-target-copy.tsx","../src/tap-target/tap-default-variant.tsx","../src/tap-target/tap-target-search.tsx"],"sourcesContent":["\"use client\";\n\nexport {\n TapTargetButton,\n TapTargetButtonTransparent,\n TapTargetButtonOutline,\n TapTargetButtonSolid,\n TapTargetButtonDestructive,\n TapTargetButtonForGroup,\n TapTargetButtonGroup,\n type TapTargetButtonProps,\n type TapTargetButtonSolidProps,\n} from \"./tap-target-button\";\nexport { TapSurface, useTapSurface, type TapSurfaceKind } from \"./tap-surface\";\nexport { TapTargetLabeled } from \"./tap-target-labeled\";\nexport { TapTargetCopyButton, type TapTargetCopyButtonProps } from \"./tap-target-copy\";\nexport {\n formatTapShortcut,\n type TapFeatureProps,\n type TapShortcut,\n type TapSolidTone,\n type TapTone,\n} from \"./tap-features\";\nexport {\n TapTargetSearchGroup,\n type TapTargetSearchGroupProps,\n type TapTargetSearchShortcut,\n} from \"./tap-target-search\";\nexport { enableTapTargetGuard, findPillInsetWarning, findTapPlacementWarning, findTapViolation } from \"./tap-target-guard\";\nexport {\n setTapTargetLinkComponent,\n getTapTargetLinkComponent,\n type TapTargetLinkComponent,\n type TapTargetLinkProps,\n} from \"./link\";\nexport { TapDefaultVariant, useTapDefaultVariant, type TapDefaultVariantValue } from \"./tap-default-variant\";\n","\"use client\";\n\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useRef,\n type ButtonHTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { joinClassNames } from \"@ai-matrx/kit/dom\";\nimport { classNameMisuse, useTapGuardRef } from \"./tap-target-guard\";\nimport { useTapSurface } from \"./tap-surface\";\nimport {\n TAP_SOLID_TONE,\n TAP_TONE_CLASS,\n TapBadge,\n TapChevron,\n TapSpinner,\n formatTapShortcut,\n tooltipBody,\n useTapShortcut,\n type TapFeatureProps,\n type TapShortcut,\n type TapSolidTone,\n} from \"./tap-features\";\nimport {\n getTapTargetLinkComponent,\n type TapTargetLinkComponent,\n} from \"./link\";\n\nexport interface TapTargetButtonProps extends TapFeatureProps {\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n onClick?: (() => void) | undefined;\n className?: string | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n /**\n * When set, the tap button renders as a link instead of a button.\n * - Internal hrefs (e.g. \"/tasks\") render via the injected link component\n * (`setTapTargetLinkComponent` / the `linkComponent` prop), falling back\n * to a plain `<a>` when none is registered.\n * - External hrefs (http://, https://, mailto:, tel:) render as `<a>`\n * with `target=\"_blank\"` and `rel=\"noopener noreferrer\"` by default.\n * - When combined with `disabled`, the trigger renders as a non-navigable\n * `<span aria-disabled=\"true\">` with the same visual styling.\n */\n href?: string | undefined;\n /** Override target. Works on both internal links and external anchors. */\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n /** Override rel. Works on both internal links and external anchors. */\n rel?: string | undefined;\n /** Forwarded to the injected link component. Pass `false` to disable prefetching. */\n prefetch?: boolean | null | undefined;\n /**\n * Per-instance link component for internal hrefs — overrides the\n * module-level `setTapTargetLinkComponent` registration.\n */\n linkComponent?: TapTargetLinkComponent | undefined;\n /**\n * Tooltip text. Defaults to `ariaLabel` when omitted.\n * EVERY tap button shows a tooltip (owner ruling 2026-10-01). `false` no\n * longer hides it: it renders the tooltip through `title` (the provider's\n * title takeover draws the same surface) — for a button nested inside\n * another `asChild` trigger, where the Tooltip wrapper cannot sit.\n */\n tooltip?: string | false | undefined;\n /** Tooltip placement. Defaults to \"top\". */\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n /** Tooltip alignment along its side. Defaults to \"center\". */\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n /**\n * Visible caption rendered inline after the icon (`[icon Label]`).\n * Widens the pill automatically. Tooltip defaults to off when set — the\n * label is self-describing. Visible text becomes the accessible name.\n */\n label?: string | undefined;\n /**\n * Collapse an icon + caption pill to its icon-only 44px tap target below\n * the `sm` breakpoint. The caption and inline geometry return at `sm+`;\n * `ariaLabel` (falling back to `label`) remains the accessible name.\n */\n mobileIconOnly?: boolean | undefined;\n}\n\nexport interface TapTargetButtonSolidProps extends Omit<TapTargetButtonProps, \"tone\"> {\n /** The fill, from the system's list. Replaces bgColor / iconColor / hover / active. */\n tone?: TapSolidTone | undefined;\n bgColor?: string | undefined;\n iconColor?: string | undefined;\n hoverBgColor?: string | undefined;\n /**\n * Press-state background. Defaults to `group-active/tap:brightness-90` (the\n * BOX is what is pressed — its touch area included), which works on\n * any color. Override when using a custom `bgColor` that should darken to a\n * specific shade on press (e.g. `group-active/tap:bg-primary/60`).\n */\n activeBgColor?: string | undefined;\n}\n\n/** Native button attributes a tap button accepts — everything except `style`:\n * a tap button's geometry is the system's, never the caller's. */\nexport type TapTargetNativeProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"style\">;\n\nconst EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;\n\n// Geometry + press feedback + tap hygiene are the SINGLE SOURCE OF TRUTH in\n// the shipped stylesheet (the `.matrx-tap-*` family in styles.css — import\n// \"@ai-matrx/tap-target/styles.css\" once at app root). This component only\n// picks the right class and layers each variant's decoration on top.\nconst TAP_OUTER_CLASS = \"matrx-tap-target group group/tap\";\nconst TAP_GROUP_OUTER_CLASS = \"matrx-tap-target matrx-tap-target-sm group group/tap\";\n\nfunction IconContent({\n icon,\n children,\n strokeWidth = 2,\n className,\n}: Pick<\n TapTargetButtonProps,\n \"icon\" | \"children\" | \"strokeWidth\" | \"className\"\n>) {\n if (icon) {\n if (isValidElement<{ className?: string }>(icon)) {\n return cloneElement(icon, {\n className: joinClassNames(className, icon.props.className),\n });\n }\n return <span className={className}>{icon}</span>;\n }\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {children}\n </svg>\n );\n}\n\ntype TapTargetSize = \"default\" | \"sm\";\n\nfunction resolveTapGeometry(\n label: string | undefined,\n size: TapTargetSize,\n mobileIconOnly: boolean,\n) {\n const inline = Boolean(label);\n if (size === \"sm\") {\n return {\n outerClassName:\n inline && mobileIconOnly\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-mobile-icon-only-sm group group/tap\"\n : inline\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-inline-sm group group/tap\"\n : TAP_GROUP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only-sm\"\n : \"matrx-tap-pill-inline-sm\",\n };\n }\n return {\n outerClassName:\n inline && mobileIconOnly\n ? `${TAP_OUTER_CLASS} matrx-tap-target-mobile-icon-only`\n : inline\n ? `${TAP_OUTER_CLASS} matrx-tap-target-inline`\n : TAP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only\"\n : \"matrx-tap-pill-inline\",\n };\n}\n\nfunction buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName,\n inlineModifier,\n icon,\n children,\n strokeWidth = 2,\n loading,\n chevron,\n}: {\n label?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n inlineModifier: string;\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n loading?: boolean | undefined;\n chevron?: boolean | undefined;\n}) {\n const iconEl = loading ? (\n <TapSpinner className={iconClassName} />\n ) : (\n <IconContent\n icon={icon}\n strokeWidth={strokeWidth}\n className={iconClassName}\n >\n {children}\n </IconContent>\n );\n const pillClasses = label\n ? `${pillClassName} ${inlineModifier}`.trim()\n : pillClassName;\n\n if (!label) {\n return <div className={pillClasses}>{iconEl}</div>;\n }\n\n return (\n <div className={pillClasses}>\n {iconEl}\n <span className={labelClassName ?? \"matrx-tap-label\"}>{label}</span>\n {chevron ? <TapChevron /> : null}\n </div>\n );\n}\n\ninterface RenderTapTargetArgs extends Pick<\n TapTargetButtonProps,\n | \"icon\"\n | \"children\"\n | \"strokeWidth\"\n | \"label\"\n | \"mobileIconOnly\"\n | \"onClick\"\n | \"as\"\n | \"htmlFor\"\n | \"ariaLabel\"\n | \"disabled\"\n | \"href\"\n | \"target\"\n | \"rel\"\n | \"prefetch\"\n | \"linkComponent\"\n | \"tooltip\"\n | \"tooltipSide\"\n | \"tooltipAlign\"\n> {\n size?: TapTargetSize;\n /** The caller's raw `className` (the glyph color) — checked by the guard. */\n colorClassName?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n rest?: (TapTargetNativeProps & TapFeatureProps) | undefined;\n buttonRef?: Ref<HTMLButtonElement> | undefined;\n}\n\n// A hook (it carries the guard ref); every variant calls it exactly once.\nfunction useTapTarget({\n size = \"default\",\n colorClassName,\n pillClassName,\n iconClassName,\n labelClassName,\n icon,\n children,\n strokeWidth,\n label,\n mobileIconOnly = false,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n rest,\n buttonRef,\n}: RenderTapTargetArgs): ReactElement {\n const {\n tone,\n badge,\n pressed,\n loading,\n disabledReason,\n shortcut,\n chevron,\n ...nativeRest\n } = rest ?? {};\n const isDisabled = Boolean(disabled || disabledReason);\n // FORCED TOOLTIPS: the text is the reason, an explicit tooltip, the\n // accessible name, or the label — and a button with none is a defect.\n const tipText =\n disabledReason || (typeof tooltip === \"string\" && tooltip ? tooltip : undefined) || ariaLabel || label;\n const titleMode = tooltip === false;\n const propViolation =\n (tipText ? null : \"every tap button needs a tooltip — pass ariaLabel\") ??\n classNameMisuse(colorClassName ?? nativeRest.className) ??\n ((nativeRest as { style?: unknown }).style ? \"style is not supported on a tap button\" : null);\n const guardRef = useTapGuardRef<HTMLElement>(\n buttonRef as Ref<HTMLElement> | undefined,\n propViolation,\n );\n const nodeRef = useRef<HTMLElement | null>(null);\n const triggerRef = useCallback(\n (node: HTMLElement | null) => {\n nodeRef.current = node;\n guardRef(node);\n },\n [guardRef],\n );\n const getNode = useCallback(() => nodeRef.current, []);\n useTapShortcut(shortcut, getNode, !isDisabled && !loading);\n\n // Tone (or a pressed toggle) owns the glyph and label color.\n const toneColor = tone ? TAP_TONE_CLASS[tone] : pressed && !colorClassName ? TAP_TONE_CLASS.primary : null;\n if (toneColor) {\n iconClassName = `matrx-tap-icon ${toneColor}`;\n labelClassName = `matrx-tap-label ${toneColor}`;\n }\n if (pressed) pillClassName = `${pillClassName} matrx-tap-pressed`;\n const { outerClassName, inlineModifier } = resolveTapGeometry(\n label,\n size,\n mobileIconOnly,\n );\n const responsiveLabelClassName = mobileIconOnly\n ? `${labelClassName ?? \"matrx-tap-label\"} matrx-tap-label-mobile-icon-only`\n : labelClassName;\n const inner = buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName: responsiveLabelClassName,\n inlineModifier: label ? inlineModifier : \"\",\n icon,\n children,\n strokeWidth,\n loading,\n chevron,\n });\n const triggerAriaLabel =\n label && !mobileIconOnly ? undefined : (ariaLabel ?? label);\n const trigger = renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick: loading ? undefined : onClick,\n ariaLabel: triggerAriaLabel,\n disabled: isDisabled,\n outerClassName,\n title: titleMode && tipText ? (shortcut ? `${tipText} (${formatTapShortcut(shortcut)})` : tipText) : undefined,\n children: (\n <>\n {inner}\n {badge !== undefined ? <TapBadge badge={badge} /> : null}\n </>\n ),\n rest: {\n ...nativeRest,\n ...(pressed !== undefined ? { \"aria-pressed\": pressed } : {}),\n ...(loading ? { \"aria-busy\": true } : {}),\n ...(shortcut ? { \"aria-keyshortcuts\": shortcut.replace(/mod/i, \"Meta\") } : {}),\n },\n triggerRef,\n });\n if (titleMode || !tipText) return trigger;\n return withTooltip(trigger, {\n tooltip: tipText,\n ariaLabel: tipText,\n disabled: isDisabled,\n tooltipSide,\n tooltipAlign,\n shortcut,\n });\n}\n\ninterface RenderTriggerArgs {\n href?: string | undefined;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n prefetch?: boolean | null | undefined;\n linkComponent?: TapTargetLinkComponent | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n onClick?: (() => void) | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n outerClassName: string;\n children: ReactNode;\n rest?: ButtonHTMLAttributes<HTMLButtonElement> | undefined;\n triggerRef: Ref<HTMLElement>;\n /** Tooltip text drawn through `title` (tooltip={false}: a nested trigger). */\n title?: string | undefined;\n}\n\n/**\n * Resolves the correct trigger element based on the props passed.\n *\n * - `href` + `disabled` → unclickable `<span aria-disabled>`\n * - `href` matching `http(s):|mailto:|tel:` → `<a target=\"_blank\" rel=\"noopener noreferrer\">`\n * - `href` (internal) → the injected link component (per-instance\n * `linkComponent` prop, else `setTapTargetLinkComponent` registration),\n * falling back to a plain `<a>` when none is registered\n * - `as=\"label\"` → `<label htmlFor=...>`\n * - default → `<button>`\n */\nfunction renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick,\n ariaLabel,\n disabled,\n outerClassName,\n children,\n rest,\n triggerRef,\n title,\n}: RenderTriggerArgs): ReactElement {\n const { style: _style, ...restWithoutStyle } = rest ?? {};\n if (disabled && href) {\n return (\n <span\n ref={triggerRef}\n aria-disabled=\"true\"\n aria-label={ariaLabel}\n title={title}\n className={`${outerClassName} opacity-40`}\n >\n {children}\n </span>\n );\n }\n if (href) {\n const isExternal = EXTERNAL_RE.test(href);\n if (isExternal) {\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target ?? \"_blank\"}\n rel={rel ?? \"noopener noreferrer\"}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n const Link = linkComponent ?? getTapTargetLinkComponent();\n if (Link) {\n return (\n <Link\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n prefetch={prefetch}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </Link>\n );\n }\n // No link component registered — plain <a>. `prefetch` is a router hint,\n // not a DOM attribute, so it is deliberately dropped here.\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n if (as === \"label\") {\n return (\n <label\n ref={triggerRef as Ref<HTMLLabelElement>}\n htmlFor={htmlFor}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </label>\n );\n }\n return (\n <button\n ref={triggerRef as Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={onClick}\n aria-label={ariaLabel}\n title={title}\n disabled={disabled}\n {...restWithoutStyle}\n className={outerClassName}\n >\n {children}\n </button>\n );\n}\n\n/**\n * Wraps a trigger element in a Tooltip when a tooltip label is available.\n * Falls back to `ariaLabel` when `tooltip` is not explicitly set. If both\n * are absent (or `tooltip === false`), the trigger is returned unwrapped.\n */\nfunction withTooltip(\n trigger: ReactElement,\n {\n tooltip,\n ariaLabel,\n disabled,\n tooltipSide = \"top\",\n tooltipAlign = \"center\",\n shortcut,\n }: {\n tooltip?: string | false | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n shortcut?: TapShortcut | undefined;\n },\n): ReactElement {\n if (tooltip === false) return trigger;\n const label =\n typeof tooltip === \"string\" && tooltip.length > 0 ? tooltip : ariaLabel;\n if (!label) return trigger;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n {disabled ? (\n // Radix Tooltip triggers need a hoverable element; a disabled button\n // does not dispatch pointer events, so we wrap in a span for the\n // trigger target while keeping the disabled visual state.\n <span className=\"inline-flex\">{trigger}</span>\n ) : (\n trigger\n )}\n </TooltipTrigger>\n <TooltipContent side={tooltipSide} align={tooltipAlign}>\n {tooltipBody(label, shortcut)}\n </TooltipContent>\n </Tooltip>\n );\n}\n\n// To resize/retune every tap button, edit styles.css — not here.\n\nexport const TapTargetButton = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButton(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-glass-thin-border\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonTransparent = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonTransparent(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill group-hover/tap:bg-muted group-active/tap:bg-muted-foreground/15\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\n/** Outline pill — a plain 1px border, no fill, no blur, no shadow. Glass only\n * reads as glass over something you can see through; on an opaque card or\n * header use THIS. Same colors as the classic square \"+\": border-border,\n * muted glyph, primary border + foreground glyph on hover. */\nexport const TapTargetButtonOutline = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonOutline(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color =\n className ?? \"text-muted-foreground group-hover/tap:text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill border border-border bg-transparent transition-colors group-hover/tap:border-primary/60 group-active/tap:bg-muted\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonSolid = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonSolid(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tone,\n bgColor,\n iconColor,\n hoverBgColor,\n activeBgColor,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n return useTapTarget({\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...solidClasses(tone, bgColor, iconColor, hoverBgColor, activeBgColor),\n rest,\n buttonRef: ref,\n });\n});\n\n// `tone` is the system's fill; the four color strings are the pre-tone API,\n// accepted only until their last callers move to `tone`. `matrx-tap-solid` marks the\n// filled pill so the stylesheet can give a DISABLED solid the system's disabled token\n// (muted fill + --disabled-foreground glyph) instead of a 40%-opacity ghost of its fill.\nfunction solidClasses(\n tone: TapSolidTone | undefined,\n bgColor: string | undefined,\n iconColor: string | undefined,\n hoverBgColor: string | undefined,\n activeBgColor: string | undefined,\n) {\n const legacy = !tone && (bgColor || iconColor || hoverBgColor || activeBgColor);\n if (!legacy) {\n const t = TAP_SOLID_TONE[tone ?? \"primary\"];\n return {\n pillClassName: `matrx-tap-pill matrx-tap-solid ${t.fill} ${t.glyph} group-active/tap:brightness-90`,\n iconClassName: `matrx-tap-icon ${t.glyph}`,\n labelClassName: `matrx-tap-label ${t.glyph}`,\n };\n }\n const glyph = iconColor ?? \"text-primary-foreground\";\n return {\n pillClassName: `matrx-tap-pill matrx-tap-solid ${bgColor ?? \"bg-primary\"} ${glyph} ${hoverBgColor ?? \"group-hover/tap:bg-primary/80\"} ${activeBgColor ?? \"group-active/tap:brightness-90\"}`,\n iconClassName: `matrx-tap-icon ${glyph}`,\n labelClassName: `matrx-tap-label ${glyph}`,\n };\n}\n\n/** Solid destructive pill — delete/remove actions. White-on-red like the\n * primary solid is white-on-blue. Use THIS, never hand-pass bg-destructive\n * with the default (dark) icon color. */\nexport const TapTargetButtonDestructive = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonDestructive({ tone = \"destructive\", ...rest }, ref) {\n return <TapTargetButtonSolid ref={ref} tone={tone} {...rest} />;\n});\n\nexport const TapTargetButtonForGroup = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonForGroup(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n size: \"sm\",\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-tap-pill-sm matrx-glass-interactive\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport function TapTargetButtonGroup({\n children,\n className,\n surface: surfaceProp,\n}: {\n children: React.ReactNode;\n className?: string | undefined;\n /**\n * GLASS ONLY FLOATS (owner rule, 2026-10-02): glass belongs on a bar that\n * floats over scrolling content or a see-through plane. On a solid surface\n * (a page, a card, a toast, a table toolbar) use `\"solid\"`: a muted track,\n * no glass stroke, the same geometry.\n */\n surface?: \"glass\" | \"solid\" | undefined;\n}) {\n // Geometry (height, the half-gap outside the capsule, the capsule itself)\n // is `.matrx-tap-group*` in tap-target.css.\n const surface = useTapSurface(surfaceProp);\n return (\n <div\n className={className ? `matrx-tap-group ${className}` : \"matrx-tap-group\"}\n data-surface={surface}\n >\n <div\n className={\n surface === \"solid\"\n ? \"matrx-tap-group-capsule matrx-tap-group-capsule-solid\"\n : \"matrx-tap-group-capsule matrx-glass-thin-border\"\n }\n />\n <div className=\"matrx-tap-group-row\">{children}</div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Tooltip — the ONE tooltip in the fleet.\n *\n * THE COLLAPSE (0.6.0). Two implementations existed: matrx-frontend's\n * `components/ui/tooltip.tsx` (182 import sites) and `@ai-matrx/tap-target`'s\n * `src/tooltip.tsx` — the latter an explicit inlined PORT of the former,\n * carrying a header that said so. tap-target shipped it only because its ~60\n * tap buttons need a tooltip and no shared package owned one; four repos then\n * adopted `TooltipProvider` from tap-target. That made tap-target — a\n * button-geometry package — the accidental owner of a design-system primitive,\n * with a second copy living in the biggest host.\n *\n * A tooltip is a design-system surface, so it lives here. tap-target now takes\n * `@ai-matrx/design-system` as an ordinary sibling dependency and imports this\n * file; its own copy is deleted, and its re-export removed. The DAG already\n * ordered design-system before tap-target, so no cycle is introduced.\n *\n * BEHAVIOR is matrx-frontend's, verbatim, including the ruling both copies\n * carried in prose:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was false: Radix ids come from React's\n * SSR-stable `useId`. It was actively harmful — a Trigger wraps\n * ALWAYS-VISIBLE content, so `return null` deleted that subtree from SSR and\n * the first client paint.\n *\n * 2. THE SURFACE IS TOKEN-DRIVEN, NOT BRANDED. Popover tokens, not\n * `bg-primary`: rich tooltip content using `text-muted-foreground` was\n * illegible on a brand-colored background in one theme or the other.\n * Since 2026-09-28 the `.matrx-tooltip` class re-scopes those tokens to a dark,\n * high-contrast chip in both themes (styles.css, THE TOOLTIP SURFACE): the\n * neutral white surface it wore before was indistinguishable from the\n * browser's own `title` box.\n *\n * 3. EVERY `title` IS THIS TOOLTIP. The provider installs the title takeover\n * (`title-tooltips.ts`), so a hand-written `title=` anywhere in the\n * document shows this surface, never the browser's.\n *\n * SEAM INVERSION. The host resolved nested portal targets through\n * `useNestedPortalContainer` (an app hook wired to its dialog + window-panel\n * systems); tap-target's port dropped that seam entirely and always portalled\n * to `document.body` — which is why a tooltip inside a popped-out panel landed\n * in the wrong window. Here it is the package's `PortalContainerProvider`\n * seam: an explicit `container` prop wins, then the injected container, then\n * `document.body`. Both prior behaviors are reachable; neither is forked.\n */\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\nimport { acquireTitleTooltips, clipTooltipText, tooltipSide, TOOLTIP_EDGE_PX, TOOLTIP_LAYER_Z, TOOLTIP_TRIGGER_ATTR, type Side } from \"./title-tooltips\";\n\nexport interface TooltipProviderProps\n extends React.ComponentProps<typeof TooltipPrimitive.Provider> {\n /**\n * THE TITLE TAKEOVER (2026-09-28) — while any provider is mounted, every native\n * `title` attribute in the document shows as this tooltip instead of the\n * browser's (see `title-tooltips.ts`). On by default, because a rule every\n * author must remember is a rule that is broken; pass `false` only for a\n * surface that must keep the browser's own box. One provider opting out does\n * not turn it off while another one is mounted.\n */\n titleTooltips?: boolean;\n}\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing, and the root provider takes\n * over native `title` attributes (see `titleTooltips`). The fleet default keeps\n * tooltip content hoverable and selectable. A native mirrored Desktop shell may\n * explicitly opt in to `disableHoverableContent` so its overlay view yields the\n * pointer back to the host; ordinary application tooltips must leave it unset.\n */\nfunction TooltipProvider({ titleTooltips = true, disableHoverableContent = false, ...props }: TooltipProviderProps) {\n React.useEffect(() => {\n if (!titleTooltips) return;\n return acquireTitleTooltips();\n }, [titleTooltips]);\n return <TooltipPrimitive.Provider {...props} disableHoverableContent={disableHoverableContent} />;\n}\n\n/**\n * The tooltip root inherits its provider's hoverability policy: the ordinary\n * provider defaults to hoverable, selectable content (Arman, 2026-10-14), while\n * a native mirrored Desktop shell may opt in at its provider so the overlay view\n * yields pointer control to its host. An explicit root prop still wins.\n */\n/** The tooltip's trigger and whether it is open, so its content takes THE SMART SIDE\n * (title-tooltips.ts) from where the trigger stands at the moment it opens. */\ninterface TriggerState {\n ref: React.MutableRefObject<HTMLElement | null>;\n open: boolean;\n}\nconst TriggerContext = React.createContext<TriggerState | null>(null);\n\nconst Tooltip = ({ onOpenChange, ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) => {\n const ref = React.useRef<HTMLElement | null>(null);\n const [open, setOpen] = React.useState(Boolean(props.open ?? props.defaultOpen));\n const shown = props.open ?? open;\n const value = React.useMemo(() => ({ ref, open: shown }), [shown]);\n return (\n <TriggerContext.Provider value={value}>\n <TooltipPrimitive.Root\n {...props}\n onOpenChange={(next) => {\n setOpen(next);\n onOpenChange?.(next);\n }}\n />\n </TriggerContext.Provider>\n );\n};\nTooltip.displayName = \"Tooltip\";\n\n/**\n * Stamps `data-matrx-tooltip-trigger` so the title takeover never draws a\n * second tooltip over a control that already has this one — it still lifts a\n * `title` on the same control, so the browser's box never doubles it either.\n */\nconst TooltipTrigger = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>((props, ref) => {\n const trigger = React.useContext(TriggerContext);\n const setRef = React.useCallback(\n (node: HTMLButtonElement | null) => {\n if (trigger) trigger.ref.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [trigger, ref],\n );\n return <TooltipPrimitive.Trigger ref={setRef} {...{ [TOOLTIP_TRIGGER_ATTR]: \"\" }} {...props} />;\n});\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;\n\nexport interface TooltipContentProps\n extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {\n /**\n * Explicit portal target; wins over the injected `PortalContainerProvider`\n * value. Pass `null` to force `document.body`.\n */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honors `prefers-reduced-motion`.\n */\n animated?: boolean;\n /**\n * The side when the control is not in a vertical stack and no side is given (the host's default:\n * a macOS desktop host says \"bottom\"). Omit for the document's `data-title-side`, else \"top\".\n */\n fallbackSide?: Side;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, side, fallbackSide, sideOffset = 4, collisionPadding = TOOLTIP_EDGE_PX, container, animated = true, children, style, ...props }, ref) => {\n const resolved = usePortalContainer(container);\n const trigger = React.useContext(TriggerContext);\n // THE SMART SIDE: an explicit side wins; otherwise where the trigger's neighbours stand decides.\n const placed = side ?? (trigger?.open ? tooltipSide(trigger.ref.current, fallbackSide) : (fallbackSide ?? \"top\"));\n return (\n <TooltipPrimitive.Portal container={resolved ?? null}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n side={placed}\n sideOffset={sideOffset}\n // Flip and stay inside the window: Radix flips to the opposite side when the preferred one\n // does not fit, and shifts along the edge; the padding keeps it off the window's border.\n avoidCollisions\n collisionPadding={collisionPadding}\n className={cn(\n \"matrx-tooltip max-w-xs select-text overflow-hidden whitespace-normal break-words rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\",\n animated && MOTION_POPPER,\n className,\n )}\n // THE tooltip layer: above every menu, popover and modal (Radix copies it onto its wrapper).\n style={{ zIndex: TOOLTIP_LAYER_Z, ...style }}\n {...props}\n >\n {typeof children === \"string\" ? clipTooltipText(children) : children}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\nexport { acquireTitleTooltips, clipTooltipText, NATIVE_TITLE_OPT_OUT_ATTR, TOOLTIP_TEXT_BUDGET } from \"./title-tooltips\";\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * THE MOTION CONTRACT (0.10.0) — the class names every animated surface in\n * this package puts on the DOM, in ONE place.\n *\n * Why a module and not ten inline strings: the sweep that produced this file\n * found the same defect ten times over, and it was invisible each time\n * because each primitive spelled its animation out by hand. Ten hand-written\n * copies of `data-[state=open]:animate-in data-[state=closed]:animate-out\n * data-[state=closed]:fade-out-0 …` meant ten chances to reach for a utility\n * nothing in the package defines — which is exactly what happened. A single\n * exported constant per motion SHAPE means the next primitive cannot invent\n * an eleventh spelling, and `styles.test.ts` can prove every one of them\n * resolves to a rule in the shipped stylesheet.\n *\n * Every rule these name lives in `styles.css` under the package's own\n * keyframes. NONE of them is a Tailwind utility, and none requires a host\n * plugin — see that file's header for the measurement that made this\n * necessary.\n */\n\n/** Modal scrims: Dialog, AlertDialog, Sheet, CommandDialog. Fade only. */\nexport const MOTION_OVERLAY = \"matrx-motion-overlay\";\n\n/** The centered dialog card. Fades and scales; centering is not its business. */\nexport const MOTION_DIALOG = \"matrx-motion-dialog\";\n\n/**\n * THE CENTERING OF A CENTERED DIALOG CARD — package-owned, in the `translate`\n * property, and NEVER a Tailwind `translate-x-[-50%] translate-y-[-50%]` pair.\n *\n * Those utilities do not compile to the same thing in every host: Tailwind v3\n * writes them into `transform`, Tailwind v4 writes them into the independent\n * `translate` property, which COMPOSES with `transform` instead of being\n * replaced by it. 0.10.0's keyframes restated the centering inside `transform`,\n * which was harmless on v3 and doubled the centering on v4 — the card flew in\n * from off the top-left of the viewport for the animation's whole duration and\n * snapped into place at the end (fixed in 0.10.1).\n *\n * Owning it here means one spelling that reads the same on both, and it frees\n * `transform` so the keyframes carry ONLY the delta. Put this on every centered\n * surface UNCONDITIONALLY — it is geometry, so unlike {@link MOTION_DIALOG} it\n * must survive `animated={false}`. Its rule ships in `styles.css`.\n */\nexport const CENTERED_DIALOG = \"matrx-dialog-centered\";\n\n/**\n * The resting gap between a `popper`-positioned surface and its trigger, for\n * the primitives that want one (today: `Select`). Same law and same reason as\n * {@link CENTERED_DIALOG} — a position an animated surface holds AT REST is\n * the `translate` property's job, never a Tailwind translate utility, because\n * those land in `transform` on a v3 host and in `translate` on a v4 one while\n * the keyframes animate `transform` either way. Sizes from\n * `--matrx-popper-offset`; keys off Radix's `data-side`.\n */\nexport const POPPER_OFFSET = \"matrx-popper-offset\";\n\n/** The mobile Dialog / CommandDialog bottom sheet. Slides up and fades. */\nexport const MOTION_BOTTOM_SHEET = \"matrx-motion-bottom-sheet\";\n\n/**\n * Radix-popper surfaces: Popover, DropdownMenu, ContextMenu, HoverCard,\n * Select, Tooltip. Reads `--radix-popper-transform-origin` so the surface\n * grows out of its trigger, and `data-side` so it travels from it.\n */\nexport const MOTION_POPPER = \"matrx-motion-popper\";\n\n/** Edge sheets, one class per `sheetVariants` side. */\nexport const MOTION_SHEET = {\n top: \"matrx-motion-sheet-top\",\n bottom: \"matrx-motion-sheet-bottom\",\n left: \"matrx-motion-sheet-left\",\n right: \"matrx-motion-sheet-right\",\n center: \"matrx-motion-sheet-center\",\n} as const;\n\n/** Skeleton's breathing loop. */\nexport const MOTION_PULSE = \"matrx-pulse\";\n/** A waiting box's crossing band of light (Skeleton `motion=\"shimmer\"`). Reduced motion: a slow breathe, no travel. */\nexport const MOTION_SHIMMER = \"matrx-shimmer\";\n\n/** The spinner loop, for every inline busy indicator in the package. */\nexport const MOTION_SPIN = \"matrx-spin\";\n\n/**\n * FirstUseHint's beacon: a soft ring that pulses three times around the anchor, on\n * `box-shadow` only, so nothing moves. A still ring under reduced motion.\n */\nexport const MOTION_HINT_BEACON = \"matrx-motion-hint-beacon\";\n\n/**\n * Every motion class the package ships, for the guards. If a rule for one of\n * these is missing from `styles.css`, a component animates in no consumer and\n * says nothing about it — the C26 failure this list exists to make loud.\n */\nexport const ALL_MOTION_CLASSES = [\n MOTION_OVERLAY,\n MOTION_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_POPPER,\n ...Object.values(MOTION_SHEET),\n MOTION_PULSE,\n MOTION_SHIMMER,\n MOTION_SPIN,\n MOTION_HINT_BEACON,\n] as const;\n\n/**\n * The host-plugin utilities this package is forbidden to emit. They are\n * supplied by `tailwindcss-animate` / `tw-animate-css`, which is a HOST CSS\n * entry concern a package cannot declare a dependency on: three of the four\n * AI Matrx consumers never loaded it, so every surface wearing these appeared\n * with no animation and no error. `styles.test.ts` fails the build if one\n * comes back.\n */\nexport const FORBIDDEN_HOST_MOTION_UTILITIES = [\n \"animate-in\",\n \"animate-out\",\n \"fade-in\",\n \"fade-out\",\n \"zoom-in\",\n \"zoom-out\",\n \"slide-in-from\",\n \"slide-out-to\",\n \"animate-accordion\",\n \"animate-slide-down\",\n \"animate-slide-up\",\n \"animate-pulse\",\n \"animate-spin\",\n] as const;\n\n/**\n * THE PANEL MOTION as a Tailwind class string (moved from matrx-frontend\n * `lib/motion/panel-motion.ts`): every panel, sidebar, dock, drawer and sheet\n * slides its size/position on the host's `--matrx-motion-duration-panel` /\n * `--matrx-motion-ease-panel` (tokens.css ships the standard). Pair it with the\n * transition property you animate (`transition-transform`, …).\n */\nexport const PANEL_MOTION_CLASS =\n \"duration-(--matrx-motion-duration-panel) ease-(--matrx-motion-ease-panel) motion-reduce:transition-none\";\nexport const PANEL_MOTION_DURATION_VAR = \"var(--matrx-motion-duration-panel)\";\nexport const PANEL_MOTION_EASE_VAR = \"var(--matrx-motion-ease-panel)\";\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.portal-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null | undefined> };\nconst PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<HTMLElement | null | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n","/**\n * THE TITLE TAKEOVER — every native `title` attribute in the document shows\n * as THE fleet tooltip instead of the browser's.\n *\n * Why this exists. A `title=` is the one tooltip nobody has to import, so it\n * is what every hand-written control reaches for: ~50 of them on an ordinary\n * matrx-frontend page (2026-09-28), next to the Radix tooltips on the tap\n * buttons. The browser draws those as a slow, unstyled system box, and a page\n * that mixes the two reads as having \"lost all of its tooltips\" (Arman,\n * 2026-09-28). Asking every author — human or agent — to wrap every control in\n * `<Tooltip>` is a rule that is broken the day it is written. So the\n * `TooltipProvider` every host already mounts at its root installs this layer,\n * and a `title` is simply a tooltip from then on. Nothing to remember.\n *\n * How it works. On hover (mouse or pen) or keyboard focus (`:focus-visible`)\n * of an element that carries a `title`, the attribute is lifted onto\n * `data-matrx-title` for exactly as long as the pointer or focus stays — so\n * the browser has nothing to show — and one shared, script-placed element\n * wearing `.matrx-tooltip` shows the text instead. When the pointer or focus\n * leaves, the `title` is put back, so assistive technology and every\n * `[title]` selector read the element exactly as authored the rest of the\n * time. Touch never shows it (a `title` has no touch affordance either).\n *\n * What it does not draw: a tooltip that only repeats text already readable in\n * full inside the element (it still draws when that text is hidden or\n * truncated).\n *\n * What it leaves alone:\n * - an element that is already a Radix tooltip trigger\n * (`[data-matrx-tooltip-trigger]`, stamped by `TooltipTrigger`): its\n * `title` is still lifted — two tooltips on one control was the other\n * half of the mess — but only the Radix one shows;\n * - anything inside `[data-native-title]` (the explicit opt-out);\n * - SVG `<title>` children, which are elements, not attributes.\n *\n * Placement. `tooltipSide` (THE SMART SIDE, below): beside a control in a\n * vertical stack, else the host's side; flipped when there is no room,\n * clamped into the viewport. `data-title-side=\"right\" | \"left\" | \"bottom\" |\n * \"top\"` on the element or any ancestor states a preferred side — a vertical\n * rail sets `right` once on its container.\n *\n * Installed at most once per document, reference-counted across every\n * mounted provider, and removed when the last one unmounts.\n */\n\n/**\n * THE SMART SIDE (Arman, 2026-10-15: tooltips \"don't show up intelligently\"). A tooltip never\n * covers the control next to its own. Where the control's neighbours stand decides the side:\n * - an explicit side (a prop, or `data-title-side` on the control or an ancestor below <html>) wins;\n * - an icon-sized control in a vertical stack (an icon column, a tool palette) has its neighbours\n * above and below, so it opens beside the control: right, or left when the control is in the\n * window's right half (an inspector column). A wide row in a list keeps the host's side: its\n * tooltip is the row's own text in full, and beside it would sit over the page next to the list;\n * - anywhere else (a toolbar, a row of buttons, a lone control) it opens on the host's default\n * side (`data-title-side` on <html>: macOS desktop hosts say \"bottom\"; the web's is \"top\").\n * Either way it flips to the other side when there is no room, and stays inside the window.\n */\nexport function tooltipSide(el: Element | null, fallback?: Side): Side {\n if (!el) return fallback ?? \"top\";\n const doc = el.ownerDocument;\n const hinted = el.closest(\"[data-title-side]\");\n const hint = hinted?.getAttribute(\"data-title-side\");\n const isSide = (v: string | null | undefined): v is Side => v === \"top\" || v === \"bottom\" || v === \"left\" || v === \"right\";\n if (hinted && hinted !== doc.documentElement && isSide(hint)) return hint;\n const base: Side = fallback ?? (isSide(hint) ? hint : \"top\");\n const box = el.getBoundingClientRect();\n if (box.width <= ICON_CONTROL_MAX_PX && stackDirection(el) === \"vertical\") {\n const vw = doc.defaultView?.innerWidth ?? 0;\n return vw > 0 && box.left + box.width / 2 > vw / 2 ? \"left\" : \"right\";\n }\n return base;\n}\n\n/** The widest control that counts as an icon (a navigator item, a palette tool). */\nconst ICON_CONTROL_MAX_PX = 64;\n\n/** How the control's nearest group of siblings is laid out, from where they actually are on screen. */\nfunction stackDirection(el: Element): \"vertical\" | \"horizontal\" | null {\n let node: Element | null = el;\n for (let depth = 0; node && depth < 4; depth++, node = node.parentElement) {\n const parent: Element | null = node.parentElement;\n if (!parent) return null;\n const me = node.getBoundingClientRect();\n if (me.width === 0 && me.height === 0) return null;\n let vertical = 0;\n let horizontal = 0;\n for (const sib of Array.from(parent.children)) {\n if (sib === node) continue;\n const r = sib.getBoundingClientRect();\n if (r.width === 0 || r.height === 0) continue;\n const overlapX = Math.min(me.right, r.right) - Math.max(me.left, r.left);\n const overlapY = Math.min(me.bottom, r.bottom) - Math.max(me.top, r.top);\n if (overlapX > 0.5 * Math.min(me.width, r.width) && overlapY <= 0) vertical++;\n else if (overlapY > 0.5 * Math.min(me.height, r.height) && overlapX <= 0) horizontal++;\n }\n if (vertical > 0 && horizontal === 0) return \"vertical\";\n if (horizontal > 0) return \"horizontal\";\n }\n return null;\n}\n\nexport const TITLE_TOOLTIP_ATTR = \"data-matrx-title\";\nexport const TOOLTIP_TRIGGER_ATTR = \"data-matrx-tooltip-trigger\";\nexport const NATIVE_TITLE_OPT_OUT_ATTR = \"data-native-title\";\n\nexport type Side = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nconst OPEN_DELAY_MS = 350;\n/** Moving from one titled control to the next inside this window is instant. */\nconst SKIP_DELAY_MS = 500;\n/**\n * THE HOVER BRIDGE. Leaving the control does not close the tooltip at once: the pointer has this\n * long to reach the tooltip itself (Arman, 2026-10-14: a tooltip must stay long enough to put the\n * mouse on it and copy its text). Entering the tooltip holds it open.\n */\n/**\n * THE TOOLTIP LAYER — above every other layer, always (Arman, 2026-10-14: a tooltip \"coming up\n * behind the content\"). Menus and popovers share the modal tier (equal z, DOM order decides), so a\n * tooltip on that tier lost to any menu opened after it. A tooltip is transient and never takes a\n * press, so nothing ever needs to sit above it.\n */\nexport const TOOLTIP_LAYER_Z = 2_147_483_000;\n\nexport const TOOLTIP_CLOSE_DELAY_MS = 300;\nconst GAP_PX = 6;\nconst EDGE_PX = 8;\n/** How far every tooltip stays from the window's edge (both implementations). */\nexport const TOOLTIP_EDGE_PX = EDGE_PX;\n/**\n * A tooltip is a short hint, never a paragraph (Apple HIG: a tooltip is a few words): text past\n * this budget is cut at a word boundary with an ellipsis. Long detail belongs in a sheet or a\n * Copy details action, not on hover.\n */\nexport const TOOLTIP_TEXT_BUDGET = 140;\n\nexport function clipTooltipText(text: string, budget: number = TOOLTIP_TEXT_BUDGET): string {\n const flat = text.replace(/\\s+/g, \" \").trim();\n if (flat.length <= budget) return flat;\n const cut = flat.slice(0, budget - 1);\n const space = cut.lastIndexOf(\" \");\n return `${(space > budget * 0.6 ? cut.slice(0, space) : cut).replace(/[\\s,.;:–—-]+$/, \"\")}…`;\n}\n\nconst SURFACE_CLASS =\n \"matrx-tooltip matrx-title-tooltip matrx-motion-popper max-w-xs select-text rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\";\n\ninterface Installation {\n count: number;\n uninstall: () => void;\n}\n\n/**\n * Keyed on the document itself through a registered symbol, never a module\n * WeakMap: tsup bundles this module into more than one entry (`index`,\n * `tap-target`), and two module copies each holding their own map would\n * install twice — two listeners, two surfaces.\n */\nconst INSTALLATION_KEY = Symbol.for(\"@ai-matrx/design-system/title-tooltips\");\ntype DocumentWithInstallation = Document & { [INSTALLATION_KEY]?: Installation };\nconst installations = {\n get: (doc: Document) => (doc as DocumentWithInstallation)[INSTALLATION_KEY],\n set: (doc: Document, value: Installation) => {\n (doc as DocumentWithInstallation)[INSTALLATION_KEY] = value;\n },\n delete: (doc: Document) => {\n delete (doc as DocumentWithInstallation)[INSTALLATION_KEY];\n },\n};\n\n/** Install the takeover on `doc`. Returns the release function. */\nexport function acquireTitleTooltips(doc: Document | undefined = typeof document === \"undefined\" ? undefined : document): () => void {\n if (!doc) return () => {};\n const existing = installations.get(doc);\n if (existing) {\n existing.count += 1;\n } else {\n installations.set(doc, { count: 1, uninstall: install(doc) });\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const current = installations.get(doc);\n if (!current) return;\n current.count -= 1;\n if (current.count <= 0) {\n current.uninstall();\n installations.delete(doc);\n }\n };\n}\n\nfunction install(doc: Document): () => void {\n const win = doc.defaultView;\n let active: HTMLElement | null = null;\n let surface: HTMLDivElement | null = null;\n let openTimer: ReturnType<typeof setTimeout> | undefined;\n let closeTimer: ReturnType<typeof setTimeout> | undefined;\n let lastClosedAt = 0;\n /** A press began on the tooltip (selecting its text): it must not close until release. */\n let holding = false;\n\n const HTMLElementCtor = win?.HTMLElement;\n\n const titledAncestor = (node: EventTarget | null): HTMLElement | null => {\n if (!HTMLElementCtor || !(node instanceof win!.Node)) return null;\n const start = node instanceof HTMLElementCtor ? node : (node as Node).parentElement;\n if (!start) return null;\n const el = start.closest<HTMLElement>(`[title], [${TITLE_TOOLTIP_ATTR}]`);\n if (!el || !(el instanceof HTMLElementCtor)) return null;\n if (el.closest(`[${NATIVE_TITLE_OPT_OUT_ATTR}]`)) return null;\n return el;\n };\n\n const textOf = (el: HTMLElement) => clipTooltipText(el.getAttribute(TITLE_TOOLTIP_ATTR) ?? el.getAttribute(\"title\") ?? \"\");\n\n const lift = (el: HTMLElement) => {\n const title = el.getAttribute(\"title\");\n if (title === null) return;\n el.setAttribute(TITLE_TOOLTIP_ATTR, title);\n el.removeAttribute(\"title\");\n };\n\n const restore = (el: HTMLElement) => {\n const held = el.getAttribute(TITLE_TOOLTIP_ATTR);\n if (held === null) return;\n // An author who changed or removed the title while it was lifted wins:\n // only put ours back when nothing re-set it in the meantime.\n if (!el.hasAttribute(\"title\")) el.setAttribute(\"title\", held);\n el.removeAttribute(TITLE_TOOLTIP_ATTR);\n };\n\n const ensureSurface = () => {\n if (surface && surface.isConnected) return surface;\n surface = doc.createElement(\"div\");\n surface.setAttribute(\"role\", \"tooltip\");\n surface.setAttribute(\"data-slot\", \"title-tooltip\");\n surface.className = SURFACE_CLASS;\n surface.style.position = \"fixed\";\n surface.style.zIndex = String(TOOLTIP_LAYER_Z);\n surface.style.visibility = \"hidden\";\n doc.body.appendChild(surface);\n return surface;\n };\n\n /**\n * THE PART OF `el` A PERSON CAN SEE: its box clipped by every ancestor that clips (scrolls or hides\n * overflow) and by the window. A truncated cell in a sideways-scrolling table is far wider than its\n * visible part; anchored to the whole box the tooltip landed at the window's edge (2026-10-14).\n */\n const visibleRect = (el: HTMLElement, vw: number, vh: number) => {\n const box = el.getBoundingClientRect();\n let left = box.left;\n let top = box.top;\n let right = box.right;\n let bottom = box.bottom;\n for (let node = el.parentElement; node && node !== doc.body && node !== doc.documentElement; node = node.parentElement) {\n const cs = win?.getComputedStyle(node);\n if (!cs) break;\n const clipsX = cs.overflowX !== \"visible\" || cs.overflow === \"hidden\";\n const clipsY = cs.overflowY !== \"visible\" || cs.overflow === \"hidden\";\n if (!clipsX && !clipsY) continue;\n const clip = node.getBoundingClientRect();\n if (clipsX) { left = Math.max(left, clip.left); right = Math.min(right, clip.right); }\n if (clipsY) { top = Math.max(top, clip.top); bottom = Math.min(bottom, clip.bottom); }\n }\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n right = Math.min(right, vw || right);\n bottom = Math.min(bottom, vh || bottom);\n // Nothing of it is visible (scrolled away under the pointer is impossible, but a test DOM can say so): the box itself.\n if (right <= left || bottom <= top) return box;\n return { left, top, right, bottom, width: right - left, height: bottom - top };\n };\n\n const preferredSide = (el: HTMLElement): Side => tooltipSide(el);\n\n const place = (el: HTMLElement, node: HTMLDivElement) => {\n // The VISIBLE viewport, not the window: inside a clipped host (the kind\n // sandbox frame is window-wide but shown only at its column) the visual\n // viewport is what the reader sees, so a tooltip never lands past it.\n const vw = win?.visualViewport?.width ?? win?.innerWidth ?? 0;\n const vh = win?.visualViewport?.height ?? win?.innerHeight ?? 0;\n const anchor = visibleRect(el, vw, vh);\n const box = node.getBoundingClientRect();\n const fits: Record<Side, boolean> = {\n top: anchor.top - GAP_PX - box.height >= EDGE_PX,\n bottom: anchor.bottom + GAP_PX + box.height <= vh - EDGE_PX,\n left: anchor.left - GAP_PX - box.width >= EDGE_PX,\n right: anchor.right + GAP_PX + box.width <= vw - EDGE_PX,\n };\n const opposite: Record<Side, Side> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n const wanted = preferredSide(el);\n const side: Side = fits[wanted] ? wanted : fits[opposite[wanted]] ? opposite[wanted] : wanted;\n\n let x: number;\n let y: number;\n if (side === \"top\" || side === \"bottom\") {\n x = anchor.left + anchor.width / 2 - box.width / 2;\n y = side === \"top\" ? anchor.top - GAP_PX - box.height : anchor.bottom + GAP_PX;\n } else {\n y = anchor.top + anchor.height / 2 - box.height / 2;\n x = side === \"left\" ? anchor.left - GAP_PX - box.width : anchor.right + GAP_PX;\n }\n x = Math.min(Math.max(x, EDGE_PX), Math.max(EDGE_PX, vw - EDGE_PX - box.width));\n y = Math.min(Math.max(y, EDGE_PX), Math.max(EDGE_PX, vh - EDGE_PX - box.height));\n // Placed with `left`/`top`, NEVER `transform`: the open animation\n // (`.matrx-motion-popper`) animates `transform`, and a running animation\n // overrides an inline transform — the chip sat at the page's top-left\n // corner for the whole animation, then jumped to its control (2026-10-08).\n node.style.left = `${Math.round(x)}px`;\n node.style.top = `${Math.round(y)}px`;\n node.setAttribute(\"data-side\", side);\n };\n\n const isShown = (node: HTMLElement, root: HTMLElement) => {\n const rect = node.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) return false;\n for (let cur: HTMLElement | null = node; cur; cur = cur === root ? null : cur.parentElement) {\n const cs = win?.getComputedStyle(cur);\n if (!cs) return false;\n if (cs.display === \"none\" || cs.visibility === \"hidden\" || Number(cs.opacity) === 0) return false;\n }\n return true;\n };\n\n /**\n * A tooltip that repeats text the person can already read in full is noise\n * (an expanded sidebar row, a \"Save\" button titled \"Save\"). It still shows\n * when that text is hidden (a collapsed rail's label) or cut off\n * (truncated) — the two cases a title exists for.\n */\n const isClipped = (host: HTMLElement, root: HTMLElement) => {\n for (let node: HTMLElement | null = host; node; node = node.parentElement) {\n if (node.scrollWidth > node.clientWidth + 1 && node.clientWidth > 0) return true;\n if (node.scrollHeight > node.clientHeight + 1 && node.clientHeight > 0) return true;\n if (node === root) break;\n }\n return false;\n };\n\n const repeatsVisibleText = (el: HTMLElement, text: string) => {\n const norm = (t: string) => t.replace(/\\s+/g, \" \").trim().toLowerCase();\n const want = norm(text);\n if (!want || !win) return false;\n const walker = doc.createTreeWalker(el, win.NodeFilter.SHOW_TEXT);\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n if (norm(node.textContent ?? \"\") !== want) continue;\n const host = node.parentElement;\n if (!host || !isShown(host, el)) continue;\n // Cut off is measured on the BOX that clips: an inline host (a span inside a truncating\n // cell) has no box width of its own, so every ancestor up to the titled element is asked.\n if (isClipped(host, el)) continue;\n return true;\n }\n return false;\n };\n\n const show = (el: HTMLElement, instant: boolean) => {\n if (active !== el) return;\n // A Radix tooltip trigger shows its own tooltip — never a second one.\n if (el.closest(`[${TOOLTIP_TRIGGER_ATTR}]`)) return;\n const text = textOf(el);\n if (!text || !el.isConnected) return;\n if (repeatsVisibleText(el, text)) return;\n const node = ensureSurface();\n node.textContent = text;\n node.style.visibility = \"hidden\";\n // Measure and place BEFORE the open state starts the animation: measured\n // mid-animation the box reads at its 0.95 entry scale and lands off-centre.\n node.removeAttribute(\"data-state\");\n // The surface is ONE shared fixed element that keeps the `left` of its last\n // placement. Measured there, a longer text wraps against the room that is\n // left of the OLD spot, reads one line too tall, and lands a line too high\n // once it moves (the sandbox tooltip spec caught a 16px extra gap). Rewind\n // to the origin so the box is measured at its natural, unwrapped size.\n node.style.left = \"0px\";\n node.style.top = \"0px\";\n place(el, node);\n node.setAttribute(\"data-state\", instant ? \"instant-open\" : \"delayed-open\");\n node.style.visibility = \"visible\";\n if (el.id) node.id = `${el.id}-title-tooltip`;\n };\n\n const hide = () => {\n if (openTimer !== undefined) clearTimeout(openTimer);\n openTimer = undefined;\n cancelClose();\n holding = false;\n if (surface && surface.style.visibility === \"visible\") lastClosedAt = Date.now();\n if (surface) {\n surface.style.visibility = \"hidden\";\n surface.removeAttribute(\"data-state\");\n }\n };\n\n const cancelClose = () => {\n if (closeTimer !== undefined) clearTimeout(closeTimer);\n closeTimer = undefined;\n };\n\n const inSurface = (node: EventTarget | null) =>\n !!surface && !!win && node instanceof win.Node && surface.contains(node);\n\n const hasSelectionInSurface = () => {\n const sel = win?.getSelection();\n return !!sel && !sel.isCollapsed && !!surface && !!sel.anchorNode && surface.contains(sel.anchorNode);\n };\n\n /** Close after the bridge delay unless the pointer reached the tooltip or text in it is selected. */\n const scheduleClose = () => {\n cancelClose();\n // Nothing is showing yet (the open delay has not run, or the text was not worth drawing): there is\n // nothing to bridge to, so leaving simply cancels.\n if (!surface || surface.style.visibility !== \"visible\") {\n deactivate();\n return;\n }\n closeTimer = setTimeout(() => {\n closeTimer = undefined;\n if (holding || hasSelectionInSurface()) return;\n deactivate();\n }, TOOLTIP_CLOSE_DELAY_MS);\n };\n\n const activate = (el: HTMLElement) => {\n cancelClose();\n if (active === el) return;\n deactivate();\n active = el;\n lift(el);\n const instant = Date.now() - lastClosedAt < SKIP_DELAY_MS;\n if (instant) show(el, true);\n else openTimer = setTimeout(() => show(el, false), OPEN_DELAY_MS);\n };\n\n const deactivate = () => {\n hide();\n if (active) restore(active);\n active = null;\n };\n\n // A touch has no hover: the tap that focuses a button must not open its tooltip, and a tooltip\n // that is open when a finger lands closes. The compat mouse events and the focus a tap leaves\n // behind used to pin \"Copy chart source\" over the chart title on a phone (review 5, G13).\n let lastTouchAt = Number.NEGATIVE_INFINITY;\n const TOUCH_FOCUS_WINDOW_MS = 1000;\n const onPointerOver = (e: PointerEvent) => {\n if (e.pointerType === \"touch\") {\n lastTouchAt = Date.now();\n if (active) deactivate();\n return;\n }\n if (inSurface(e.target)) {\n cancelClose();\n return;\n }\n if (holding || hasSelectionInSurface()) {\n // Text is being selected in the tooltip: another control passing under the pointer must not replace it.\n return;\n }\n const el = titledAncestor(e.target);\n if (el) activate(el);\n else if (active && closeTimer === undefined) scheduleClose();\n };\n\n const onPointerOut = (e: PointerEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && (active.contains(next) || inSurface(next))) return;\n if (inSurface(e.target)) {\n if (holding) return;\n scheduleClose();\n return;\n }\n scheduleClose();\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if (e.pointerType === \"touch\") lastTouchAt = Date.now();\n if (inSurface(e.target)) {\n // Selecting the tooltip's text: keep it open until the press ends.\n holding = true;\n cancelClose();\n return;\n }\n deactivate();\n };\n\n const onPointerUp = () => {\n if (!holding) return;\n holding = false;\n if (!hasSelectionInSurface()) scheduleClose();\n };\n\n const onFocusIn = (e: FocusEvent) => {\n if (Date.now() - lastTouchAt < TOUCH_FOCUS_WINDOW_MS) return;\n const el = titledAncestor(e.target);\n if (!el) return;\n let visible = true;\n try {\n visible = (e.target as Element).matches(\":focus-visible\");\n } catch {\n visible = true;\n }\n if (visible) activate(el);\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && active.contains(next)) return;\n deactivate();\n };\n\n const onDismiss = (e?: Event) => {\n if (e && inSurface(e.target)) return;\n deactivate();\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") deactivate();\n };\n\n doc.addEventListener(\"pointerover\", onPointerOver, true);\n doc.addEventListener(\"pointerout\", onPointerOut, true);\n doc.addEventListener(\"focusin\", onFocusIn, true);\n doc.addEventListener(\"focusout\", onFocusOut, true);\n doc.addEventListener(\"pointerdown\", onPointerDown, true);\n doc.addEventListener(\"pointerup\", onPointerUp, true);\n doc.addEventListener(\"keydown\", onKeyDown, true);\n doc.addEventListener(\"scroll\", onDismiss, true);\n win?.addEventListener(\"blur\", onDismiss);\n\n return () => {\n deactivate();\n doc.removeEventListener(\"pointerover\", onPointerOver, true);\n doc.removeEventListener(\"pointerout\", onPointerOut, true);\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n doc.removeEventListener(\"focusout\", onFocusOut, true);\n doc.removeEventListener(\"pointerdown\", onPointerDown, true);\n doc.removeEventListener(\"pointerup\", onPointerUp, true);\n doc.removeEventListener(\"keydown\", onKeyDown, true);\n doc.removeEventListener(\"scroll\", onDismiss, true);\n win?.removeEventListener(\"blur\", onDismiss);\n surface?.remove();\n surface = null;\n };\n}\n","\"use client\";\n\n// THE TAP-TARGET GUARD — development builds only.\n//\n// The lock layer in tap-target.css makes a tap button's own box, pill and\n// glyph impossible to resize from outside. What CSS cannot stop is a caller\n// bending the system AROUND the button: a parent that adds `gap` between two\n// tap buttons, a wrapper with margin or padding, a local override of a\n// `--matrx-tap-*` token, a utility class smuggled in through `className`.\n// After a tap button mounts, this guard measures it in the real layout and,\n// on any of those, marks it `data-matrx-tap-violation`: the stylesheet then\n// paints it as a giant red box carrying the reason, and the console names\n// the element.\n//\n// OFF until the host turns it on with `enableTapTargetGuard()` — from code the\n// HOST compiles, e.g. matrx-frontend's dev-only client boot. Never gate it on\n// `process.env.NODE_ENV` in here: this package's own build inlines that\n// expression, so a \"dev only\" check written here would run in production too\n// (see @ai-matrx/associations' context.tsx for the outage that taught this).\n\nimport { useCallback, useRef, type MutableRefObject, type Ref } from \"react\";\nimport { layoutScale } from \"../layout-scale\";\n\n// A `Symbol.for` slot on globalThis, like the link seam: the `.` and\n// `./buttons` bundles each inline this module, and one switch must reach both.\nconst GUARD_SLOT = Symbol.for(\"@ai-matrx/tap-target:guard\");\ntype GlobalWithGuard = typeof globalThis & { [GUARD_SLOT]?: boolean };\n\n/** Turn the development guard on (or off). Call once at client boot, only in\n * development builds of the host. */\nexport function enableTapTargetGuard(on = true): void {\n (globalThis as GlobalWithGuard)[GUARD_SLOT] = on;\n if (on) startPillInsetScan();\n}\n\nfunction guardOn(): boolean {\n return (globalThis as GlobalWithGuard)[GUARD_SLOT] === true;\n}\n\nconst TOKENS = [\n \"--matrx-tap-box\",\n \"--matrx-tap-gap\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-icon-size\",\n \"--matrx-tap-touch-min\",\n \"--matrx-tap-target-size\",\n] as const;\n\n/** The only scopes that may move tap tokens, and which ones — each owned by\n * this package's own CSS: the table density scales (tap-target.css) and\n * Alchemy's 18px trigger glyph (content-transfer.css). */\nconst SANCTIONED: ReadonlyArray<{ scope: string; tokens: ReadonlySet<string> }> = [\n {\n scope: \"[data-matrx-table][data-matrx-table-density]\",\n tokens: new Set([\n \"--matrx-tap-target-size\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-icon-size\",\n ]),\n },\n { scope: \"[data-alchemy-trigger]\", tokens: new Set([\"--matrx-tap-icon-size\"]) },\n // THE ONE CONTROL scope (controls.css): tap buttons beside the 28px controls\n // take the controls' height — a 28px pill in a 34px box, the same 6px apart.\n {\n scope: \"[data-matrx-controls]\",\n tokens: new Set([\n \"--matrx-tap-target-size\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-pill-sm-size\",\n ]),\n },\n];\nconst TABLE_SCOPE = SANCTIONED[0]!.scope;\nconst CONTROL_SCOPE = SANCTIONED[2]!.scope;\nconst TAP_ITEM = \".matrx-tap-target, .matrx-tap-group\";\n\n/** `className` on a tap button is the GLYPH COLOR. Anything that sizes,\n * spaces, positions or fills is misuse. */\nconst NON_COLOR_CLASS =\n /^(?:[^\\s:]+:)*!?-?(?:\\[&|scale|translate|h|w|size|min-h|min-w|max-h|max-w|p|px|py|ps|pe|pt|pb|pl|pr|m|mx|my|ms|me|mt|mb|ml|mr|gap|space-x|space-y|bg|rounded|border|ring|shadow|absolute|relative|fixed|sticky|inset|top|left|right|bottom|flex|grid|block|inline|hidden|z|shrink|grow|basis|self|order)(?:-|$|\\[)/;\n\nexport function classNameMisuse(className: string | undefined): string | null {\n if (!guardOn() || !className) return null;\n const bad = className.split(/\\s+/).filter((t) => t && NON_COLOR_CLASS.test(t));\n return bad.length\n ? `className is the glyph color only — remove \"${bad.join(\" \")}\"`\n : null;\n}\n\n/**\n * The horizontal space a wrapper adds around what it holds. An `auto` margin (`ml-auto` pushing a\n * toolbar's actions to the end) only aligns — the browser resolves it to pixels in\n * `getComputedStyle`, so read the computed keyword from the typed OM and count it as zero.\n */\nexport function wrapperSpace(el: Element, view: Window): number {\n const pcs = view.getComputedStyle(el);\n const typed = (el as Element & { computedStyleMap?: () => { get(p: string): unknown } }).computedStyleMap?.();\n const margin = (prop: \"margin-left\" | \"margin-right\", resolved: string) =>\n typed && String(typed.get(prop)) === \"auto\" ? 0 : px(resolved);\n return margin(\"margin-left\", pcs.marginLeft) + margin(\"margin-right\", pcs.marginRight) + px(pcs.paddingLeft) + px(pcs.paddingRight);\n}\n\nfunction px(value: string): number {\n const n = Number.parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n}\n\nfunction describe(el: Element): string {\n const cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).slice(0, 4).join(\".\") : \"\";\n return `<${el.tagName.toLowerCase()}${cls ? `.${cls}` : \"\"}>`;\n}\n\n/** Elements that ride along with a tap button without taking space from it\n * (a badge, a capsule, a tooltip portal anchor). */\nfunction isDecor(el: Element, view: Window): boolean {\n const cs = view.getComputedStyle(el);\n return cs.position === \"absolute\" || cs.position === \"fixed\" || cs.display === \"none\";\n}\n\nfunction tapCount(el: Element): number {\n return el.matches(TAP_ITEM) ? 1 : el.querySelectorAll(TAP_ITEM).length;\n}\n\n/** Visible text in `container` outside `tap` and outside decor (a badge's\n * count is decor) — a wrapper with its own words is a chip, not a wrapper. */\nfunction ownText(container: Element, tap: Element, view: Window): string {\n let out = \"\";\n const walk = (node: Node) => {\n if (node === tap) return;\n if (node.nodeType === 3) out += node.textContent ?? \"\";\n else if (node.nodeType === 1 && !isDecor(node as Element, view)) node.childNodes.forEach(walk);\n };\n container.childNodes.forEach(walk);\n return out.trim();\n}\n\n/** True when `child` is a tap button, or a plain wrapper whose only content\n * is ONE tap button (plus decor) — never a search box that happens to hold\n * a clear button, never a chip with words. */\nfunction isTapSlot(child: Element, view: Window): boolean {\n if (child.matches(TAP_ITEM)) return true;\n if (tapCount(child) !== 1) return false;\n const tap = child.querySelector(TAP_ITEM)!;\n const controls = Array.from(child.querySelectorAll(\"input, select, textarea, button, a, [role='button']\"));\n if (controls.some((c) => c !== tap && !tap.contains(c))) return false;\n return ownText(child, tap, view) === \"\";\n}\n\nlet probe: { key: string; target: number; pill: number; sm: number; smPill: number; wide: number; icon: number } | null = null;\n\n/** What the package's own CSS produces with no surrounding context — the\n * canon every mounted button is measured against. Re-measured whenever the\n * root tokens change (the lab page switches the gap). */\nfunction canon(doc: Document) {\n const view = doc.defaultView!;\n const root = view.getComputedStyle(doc.documentElement);\n const key = TOKENS.map((t) => root.getPropertyValue(t)).join(\"|\");\n if (probe?.key === key) return probe;\n const host = doc.createElement(\"div\");\n host.setAttribute(\"aria-hidden\", \"true\");\n host.style.cssText = \"position:absolute;visibility:hidden;pointer-events:none;left:-9999px;top:0\";\n host.innerHTML =\n '<button class=\"matrx-tap-target\"><div class=\"matrx-tap-pill\"><svg class=\"matrx-tap-icon\"></svg></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-sm\"><div class=\"matrx-tap-pill matrx-tap-pill-sm\"></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-inline\"><div class=\"matrx-tap-pill matrx-tap-pill-inline\"></div></button>';\n doc.body.appendChild(host);\n const [a, b, w] = Array.from(host.children) as HTMLElement[];\n probe = {\n key,\n target: a!.offsetHeight,\n pill: (a!.firstElementChild as HTMLElement).offsetHeight,\n icon: px(view.getComputedStyle(a!.querySelector(\"svg\")!).height),\n sm: b!.offsetHeight,\n smPill: (b!.firstElementChild as HTMLElement).offsetHeight,\n wide: (w!.firstElementChild as HTMLElement).offsetHeight,\n };\n host.remove();\n return probe;\n}\n\n/** Returns the first rule this mounted tap button breaks, or null. */\nexport function findTapViolation(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n const cs = view.getComputedStyle(el);\n if (cs.display === \"none\") return null;\n\n // 1. Tokens are the package's alone. Only the table-density scope may move\n // the three it owns.\n const root = view.getComputedStyle(doc.documentElement);\n // Both scaled scopes size by their own tokens; the canon check below reads\n // the root canon, so it applies outside them only.\n const inTable = el.closest(TABLE_SCOPE) !== null || el.closest(CONTROL_SCOPE) !== null;\n const moved = new Set<string>();\n for (const token of TOKENS) {\n const mine = cs.getPropertyValue(token).trim();\n const base = root.getPropertyValue(token).trim();\n if (mine === base) continue;\n if (!SANCTIONED.some((s) => s.tokens.has(token) && el.closest(s.scope))) {\n return `${token} overridden to \"${mine}\" — tap geometry is not configurable`;\n }\n moved.add(token);\n }\n\n // 2. Measured geometry equals the canon (outside table density, which\n // sizes by its own tokens).\n const sm = el.classList.contains(\"matrx-tap-target-sm\");\n const inline = /matrx-tap-target-(?:inline|mobile-icon-only)/.test(el.className);\n const pill = el.querySelector<HTMLElement>(\":scope > .matrx-tap-pill\");\n const icon = pill?.querySelector(\".matrx-tap-icon\") ?? null;\n // A host touch floor (min-width / min-height) may enlarge a box; that is\n // the floor working, not a bend.\n const floored =\n px(cs.minHeight) >= el.offsetHeight - 0.5 || px(cs.minWidth) >= el.offsetWidth - 0.5;\n if (!inTable && pill && !floored) {\n const c = canon(doc);\n const box = sm ? c.sm : c.target;\n // A labeled pill is a WIDE shape (shorter than a round one); below the\n // `sm` breakpoint a mobile-icon-only pill is round again — either is canon.\n const pillSizes = sm ? [c.smPill] : inline ? [c.pill, c.wide] : [c.pill];\n if (Math.abs(el.offsetHeight - box) > 0.5) return `button is ${el.offsetHeight}px tall, canon is ${box}px`;\n if (!inline && Math.abs(el.offsetWidth - box) > 0.5) return `button is ${el.offsetWidth}px wide, canon is ${box}px`;\n if (!pillSizes.some((p) => Math.abs(pill.offsetHeight - p) <= 0.5)) {\n return `pill is ${pill.offsetHeight}px, canon is ${pillSizes.join(\" or \")}px`;\n }\n if (icon && !moved.has(\"--matrx-tap-icon-size\")) {\n const size = px(view.getComputedStyle(icon).height);\n if (Math.abs(size - c.icon) > 0.5) return `glyph is ${size}px, canon is ${c.icon}px`;\n }\n }\n\n // 3. Nothing adds space around it. Climb the wrappers that hold only this\n // button (plus decor such as a badge); none may carry inline margin or\n // padding. A tap button inside a group is represented by its group.\n let slot: Element = el;\n if (el.parentElement?.matches(\".matrx-tap-group-row, .matrx-tap-search-measure\")) {\n const group = el.closest(\".matrx-tap-group\");\n if (group && tapCount(el.parentElement) > 1) return null;\n slot = group ?? el;\n }\n for (let depth = 0; depth < 2; depth += 1) {\n const parent: HTMLElement | null = slot.parentElement;\n if (!parent || parent === doc.body) break;\n const others = Array.from(parent.children).filter((c) => c !== slot && !isDecor(c, view));\n if (others.length > 0) break; // `parent` is the row\n if (ownText(parent, slot, view) !== \"\") break; // a chip or a titled header\n const space = wrapperSpace(parent, view);\n if (space > 0.5) {\n return `${describe(parent)} adds ${space}px around a tap button — tap buttons space themselves`;\n }\n slot = parent;\n }\n\n // 4. The row adds no gap between tap buttons.\n const row = slot.parentElement;\n if (row) {\n const rcs = view.getComputedStyle(row);\n const flexOrGrid = /flex|grid/.test(rcs.display);\n const neighbours = Array.from(row.children).filter((c) => c !== slot && isTapSlot(c, view));\n if (flexOrGrid && neighbours.length > 0) {\n const horizontal = rcs.display.includes(\"grid\") || !rcs.flexDirection.startsWith(\"column\");\n const gap = px(horizontal ? rcs.columnGap : rcs.rowGap);\n if (gap > 0.5) {\n return `${describe(row)} adds a ${gap}px gap between tap buttons — remove it; tap buttons space themselves`;\n }\n }\n }\n return null;\n}\n\n/* ------------------------------------------------------------------ */\n/* PLACEMENT — the three rules a tap button's SURROUNDINGS must keep */\n/* (owner, 2026-10-02). Reported as a WARNING (a dashed outline and one */\n/* console error naming the fix), not the misuse box: they are about */\n/* the page around the button, and the whole app is being brought into */\n/* line with them. */\n/* 1. GLASS ONLY FLOATS — glass is see-through; it belongs on a bar */\n/* that floats over moving content (position fixed/sticky) or on a */\n/* plane marked `data-matrx-glass-plane`. On a page, card, toast or */\n/* table use `variant=\"transparent\"` / a solid group. */\n/* 2. ALL GLASS OR NONE — a glass item's row holds only glass items */\n/* (glass tap buttons, glass groups, or `data-matrx-glass` pieces). */\n/* 3. NEIGHBOURS KEEP THEIR HALF-GAP — a tap box carries 3px of unseen */\n/* space each side (box − pill = one gap, 6px). Anything beside it */\n/* adds its own 3px, so the visible distance is always one gap. */\n/* ------------------------------------------------------------------ */\n\nconst GLASS = \".matrx-glass-thin-border, .matrx-glass-interactive\";\n\nfunction isGlassItem(node: Element): boolean {\n if (node.hasAttribute(\"data-matrx-glass\")) return true;\n if (node.matches(\".matrx-tap-group\")) return node.querySelector(\":scope > .matrx-tap-group-capsule.matrx-glass-thin-border\") !== null;\n if (node.matches(\".matrx-tap-target\")) return node.querySelector(`:scope > .matrx-tap-pill:is(${GLASS})`) !== null;\n // A plain wrapper whose only content is ONE tap button (plus decor such as a\n // badge) is that button: a badge host around a glass button is glass.\n const view = node.ownerDocument.defaultView;\n if (view && isTapSlot(node, view)) return isGlassItem(node.querySelector(TAP_ITEM)!);\n return false;\n}\n\nconst SCROLLS = /^(auto|scroll|overlay)$/;\n\n/** True when `el` rides a bar over moving content: a fixed/sticky ancestor (or\n * a glass plane) reached BEFORE any scroll container. Inside a scroller the\n * button IS the moving content — an app root that is itself `position:\n * fixed` (the shell) must not make every page button \"float\". */\nfunction floats(el: Element, view: Window): boolean {\n for (let n: Element | null = el; n && n !== el.ownerDocument.body; n = n.parentElement) {\n if (n.hasAttribute(\"data-matrx-glass-plane\")) return true;\n const cs = view.getComputedStyle(n);\n if (cs.position === \"fixed\" || cs.position === \"sticky\") return true;\n if (n !== el && (SCROLLS.test(cs.overflowY) || SCROLLS.test(cs.overflowX))) return false;\n }\n return false;\n}\n\n/** True when the edge of `wrapper` that faces a neighbour (`side` is where the\n * wrapper sits relative to that neighbour) is itself a tap slot: that button\n * carries its own 3px half-gap, so the wrapper is spacing-correct however many\n * tap buttons it holds (the fading mic + More cluster beside Send). A wrapper\n * whose edge is text or a field is not — it still has to keep its distance. */\nfunction facesWithTapSlot(wrapper: Element, side: \"after\" | \"before\", view: Window): boolean {\n for (let node: Element | null = wrapper; node; ) {\n if (isTapSlot(node, view)) return true;\n const kids: Element[] = Array.from(node.children).filter((c) => !isDecor(c, view));\n node = (side === \"after\" ? kids[0] : kids[kids.length - 1]) ?? null;\n }\n return false;\n}\n\nfunction visible(el: Element, view: Window): boolean {\n if (el.getAttribute(\"aria-hidden\") === \"true\" || isDecor(el, view)) return false;\n const r = el.getBoundingClientRect();\n return r.width > 1 && r.height > 1;\n}\n\nconst INTERACTIVE = \"button, a[href], input, select, textarea, [role='button'], svg, img\";\n\n/** The box the eye sees on the side of `sib` that faces the tap button. An\n * unpainted layout wrapper (no fill, no border on that side, no words of its\n * own) is invisible, so the distance is judged at the first thing inside it —\n * the wrapper around ProTextarea's mic sits 3px from Expand while the mic\n * capsule, which keeps its own 3px margin, sits one gap away (2026-10-13). */\nfunction facingBox(sib: Element, side: \"after\" | \"before\", view: Window): Element {\n let node = sib;\n for (;;) {\n if (node.matches(INTERACTIVE)) return node;\n const cs = view.getComputedStyle(node);\n const fill = cs.backgroundColor;\n if ((fill && fill !== \"rgba(0, 0, 0, 0)\" && fill !== \"transparent\") || px(side === \"after\" ? cs.borderLeftWidth : cs.borderRightWidth) > 0) {\n return node;\n }\n if (Array.from(node.childNodes).some((c) => c.nodeType === 3 && c.textContent?.trim())) return node;\n const kids = Array.from(node.children).filter((c) => visible(c, view));\n const next = side === \"after\" ? kids[0] : kids[kids.length - 1];\n if (!next) return node;\n node = next;\n }\n}\n\n/** The first placement rule this tap button's surroundings break, or null. */\nexport function findTapPlacementWarning(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n // A button inside a group is judged as its group.\n const slot: Element = el.closest(\".matrx-tap-group\") ?? el;\n const glass = isGlassItem(slot);\n\n if (glass && !floats(slot, view)) {\n return 'glass on a solid surface — glass only floats over moving content; use variant=\"transparent\" (or a solid group)';\n }\n\n const row = slot.parentElement;\n if (!row) return null;\n if (glass) {\n const mixed = Array.from(row.children).find((c) => c !== slot && visible(c, view) && !isGlassItem(c));\n if (mixed) return `glass beside non-glass ${describe(mixed)} — make the row all glass or none`;\n }\n\n const pill = (el.querySelector(\":scope > .matrx-tap-pill\") as HTMLElement | null) ?? (slot.querySelector(\".matrx-tap-group-capsule\") as HTMLElement | null);\n if (!pill) return null;\n const gap = px(view.getComputedStyle(el).getPropertyValue(\"--matrx-tap-gap\")) || 6;\n const p = pill.getBoundingClientRect();\n if (p.width === 0) return null;\n // Distances are judged in LAYOUT pixels: inside a zoomed (transformed) tile a screen distance\n // is the layout distance times the scale.\n const scale = layoutScale(pill);\n for (const [side, sib] of [[\"after\", slot.nextElementSibling], [\"before\", slot.previousElementSibling]] as const) {\n if (!sib || !visible(sib, view) || isTapSlot(sib, view) || isGlassItem(sib) || facesWithTapSlot(sib, side, view)) continue;\n if (Math.abs(sib.getBoundingClientRect().top + sib.getBoundingClientRect().height / 2 - (p.top + p.height / 2)) > p.height) continue; // not on this row\n const box = facingBox(sib, side, view);\n const r = box.getBoundingClientRect();\n const cs = view.getComputedStyle(box);\n const distance =\n (side === \"after\" ? r.left - p.right : p.left - r.right) / scale + (side === \"after\" ? px(cs.paddingLeft) : px(cs.paddingRight));\n if (distance < gap - 0.5) {\n return `${describe(sib)} sits ${Math.round(distance)}px from the pill — anything beside a tap button adds its own ${gap / 2}px (the box only carries ${gap / 2}px)`;\n }\n }\n return null;\n}\n\nconst reported = new Set<string>();\n\nfunction report(el: HTMLElement, reason: string) {\n el.setAttribute(\"data-matrx-tap-violation\", reason);\n const key = `${reason}@${el.getAttribute(\"aria-label\") ?? el.textContent ?? \"\"}`;\n if (reported.has(key)) return;\n reported.add(key);\n console.error(`[tap-target] ${reason}`, el);\n}\n\nconst mounted = new Set<HTMLElement>();\nlet resizeTimer: ReturnType<typeof setTimeout> | null = null;\nlet listening = false;\n\nfunction check(node: HTMLElement) {\n const reason = findTapViolation(node);\n if (reason) {\n report(node, reason);\n return;\n }\n node.removeAttribute(\"data-matrx-tap-violation\");\n const warning = findTapPlacementWarning(node);\n if (warning) {\n node.setAttribute(\"data-matrx-tap-warning\", warning);\n const key = `w:${warning}@${node.getAttribute(\"aria-label\") ?? \"\"}`;\n if (!reported.has(key)) {\n reported.add(key);\n console.error(`[tap-target] ${warning}`, node);\n }\n } else node.removeAttribute(\"data-matrx-tap-warning\");\n}\n\nfunction listenForResize(view: Window) {\n if (listening) return;\n listening = true;\n view.addEventListener(\"resize\", () => {\n if (resizeTimer) clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => mounted.forEach((n) => (n.isConnected ? check(n) : mounted.delete(n))), 200);\n });\n // A button is judged once, at mount — but its neighbours keep changing (a\n // loading placeholder becomes the real control). Re-judge a button when the\n // row it sits in gains or loses children, so a mark never outlives the\n // neighbour it named (2026-10-13: \"New run\" kept a red outline for a\n // skeleton that had already left the header).\n const Observer = (view as Window & { MutationObserver?: typeof MutationObserver }).MutationObserver;\n if (!Observer || !view.document.body) return;\n const changedRows = new Set<Node>();\n let rowTimer: ReturnType<typeof setTimeout> | null = null;\n new Observer((records) => {\n for (const r of records) changedRows.add(r.target);\n if (rowTimer) clearTimeout(rowTimer);\n rowTimer = setTimeout(() => {\n mounted.forEach((n) => {\n if (!n.isConnected) return void mounted.delete(n);\n const row = (n.closest(\".matrx-tap-group\") ?? n).parentElement;\n if (row && changedRows.has(row)) check(n);\n });\n changedRows.clear();\n }, 200);\n }).observe(view.document.body, { childList: true, subtree: true });\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) (ref as MutableRefObject<T | null>).current = value;\n}\n\n/**\n * The callback ref every tap trigger carries. In production it only forwards\n * the caller's ref; in development it also measures the trigger once it is in\n * the layout and paints a violation.\n */\nexport function useTapGuardRef<T extends HTMLElement>(\n forwarded: Ref<T> | undefined,\n propViolation: string | null,\n): (node: T | null) => void {\n const current = useRef<T | null>(null);\n return useCallback(\n (node: T | null) => {\n assignRef(forwarded, node);\n if (current.current && current.current !== node) mounted.delete(current.current);\n current.current = node;\n if (!guardOn() || !node) return;\n if (propViolation) {\n report(node, propViolation);\n return;\n }\n const view = node.ownerDocument.defaultView;\n if (!view) return;\n mounted.add(node);\n listenForResize(view);\n view.requestAnimationFrame(() => check(node));\n },\n [forwarded, propViolation],\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* THE PILL-INSET GUARD (0.60.10). A pill is balanced when its INK sits */\n/* the same distance from both edges. On 2026-10-04 every icon+label */\n/* pill read off-centre (1.3–3.3px) because padding was shaved on the */\n/* glyph side by a guess at the glyph's air. The trim in tap-target.css */\n/* now removes each glyph's real air; this measures the result in the */\n/* real layout and marks any pill whose ink insets differ by more than */\n/* 2px — dashed red outline + one console error naming both numbers. */\n/* ------------------------------------------------------------------ */\n\nconst PILL_TOLERANCE_PX = 2;\nconst PILL_ITEMS = \"button, a[href], [role='button'], [role='tab'], [role='radio'], [role='menuitem']\";\nconst PILL_CANDIDATES = \"button, a[href], [role='button'], .rounded-full, .matrx-tap-pill-inline, .matrx-tap-pill-mobile-icon-only\";\n\n/** Horizontal ink extents inside `el`: glyph geometry for svgs, text runs for text. */\nfunction inkExtents(el: Element): { left: number; right: number } | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view) return null;\n let left = Infinity;\n let right = -Infinity;\n const walker = doc.createTreeWalker(el, 0x1 | 0x4 /* SHOW_ELEMENT | SHOW_TEXT */);\n let n: Node | null;\n while ((n = walker.nextNode())) {\n if (n.nodeType === 1) {\n const node = n as Element;\n const cs = view.getComputedStyle(node);\n if (cs.display === \"none\" || cs.visibility === \"hidden\" || cs.position === \"absolute\") continue;\n const tag = node.tagName.toLowerCase();\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\") {\n // A picture (a favicon, an avatar) is ink by its box — it draws its own pixels, and a logo\n // renders exactly as it is, never tinted to make a guard see it (2026-10-13: every\n // favicon-led link pill read \"29px left vs 10px right\" because the image was invisible here).\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.min(left, r.left);\n right = Math.max(right, r.right);\n }\n continue;\n }\n if (tag !== \"svg\" && (node.getAttribute(\"role\") === \"status\" || node.getAttribute(\"role\") === \"progressbar\")) {\n // A busy spinner drawn with borders (its rings are absolute, so nothing below sees them)\n // is ink by its box: a pill whose icon turned into a spinner read \"44px left vs 20px right\".\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.min(left, r.left);\n right = Math.max(right, r.right);\n }\n continue;\n }\n if (tag !== \"svg\") {\n // A painted chip inside the pill (a count badge) is ink by its box: its fill is what the eye sees.\n const paintedChip = (cs.backgroundColor !== \"rgba(0, 0, 0, 0)\" && cs.backgroundColor !== \"transparent\") || parseFloat(cs.borderLeftWidth) > 0;\n if (paintedChip) {\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.min(left, r.left);\n right = Math.max(right, r.right);\n }\n }\n continue;\n }\n const svg = node as SVGGraphicsElement;\n if (typeof svg.getBBox !== \"function\" || typeof svg.getScreenCTM !== \"function\") continue;\n const bb = svg.getBBox();\n const ctm = svg.getScreenCTM();\n if (!ctm || bb.width === 0) continue;\n if (Math.abs(ctm.b) > 0.001 || Math.abs(ctm.c) > 0.001) {\n // A turning glyph (a busy spinner) has no fixed ink: judge it by its layout box, centered\n // where the rotation centers it — never by a mid-turn snapshot of its paths.\n const r = node.getBoundingClientRect();\n const half = (parseFloat(cs.width) || r.width) / 2;\n const mid = r.left + r.width / 2;\n left = Math.min(left, mid - half);\n right = Math.max(right, mid + half);\n continue;\n }\n const half = ((parseFloat(cs.strokeWidth) || 0) * Math.abs(ctm.a)) / 2;\n const x1 = ctm.a * bb.x + ctm.e;\n const x2 = ctm.a * (bb.x + bb.width) + ctm.e;\n left = Math.min(left, Math.min(x1, x2) - half);\n right = Math.max(right, Math.max(x1, x2) + half);\n } else if (n.nodeValue && n.nodeValue.trim()) {\n const parent = n.parentElement;\n if (!parent || parent.closest(\"svg\")) continue;\n const pcs = view.getComputedStyle(parent);\n if (pcs.visibility === \"hidden\" || pcs.position === \"absolute\") continue;\n const range = doc.createRange();\n range.selectNodeContents(n);\n // A truncated label (`truncate max-w-*`) draws only what its clipping box shows: its text\n // run keeps going past the ellipsis, so the run is clipped to every overflow-hiding box\n // between it and the pill (2026-10-18: a scope chip \"matrx-frontend (LCP test)\" read\n // \"9.0px left vs 5.7px right\" while its ellipsis sat exactly 9px from the edge).\n const clip = textClip(parent, el, view);\n for (const r of Array.from(range.getClientRects())) {\n if (r.width <= 0) continue;\n const rl = Math.max(r.left, clip.left);\n const rr = Math.min(r.right, clip.right);\n if (rr <= rl) continue;\n left = Math.min(left, rl);\n right = Math.max(right, rr);\n }\n }\n }\n return Number.isFinite(left) && Number.isFinite(right) ? { left, right } : null;\n}\n\n/** The horizontal window a text run can paint in: its overflow-clipping ancestors up to (excluding) `pill`. */\nfunction textClip(from: Element, pill: Element, view: Window): { left: number; right: number } {\n let left = -Infinity;\n let right = Infinity;\n for (let node: Element | null = from; node && node !== pill; node = node.parentElement) {\n const cs = view.getComputedStyle(node);\n // overflow-x, or the shorthand's first (x) value where a runtime does not expand it (jsdom)\n const clipsX = (cs.overflowX && cs.overflowX !== \"visible\") || (cs.overflow && !cs.overflow.startsWith(\"visible\"));\n if (clipsX) {\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.max(left, r.left);\n right = Math.min(right, r.right);\n }\n }\n }\n return { left, right };\n}\n\nconst FIELDS = \"input, textarea, select, [contenteditable='true'], [role='textbox'], [role='searchbox'], [role='combobox']\";\n\n/**\n * Only a BUTTON can be a pill whose ink must balance: an interactive element,\n * or the painted pill inside one (a tap button's `.matrx-tap-pill-inline`).\n * A field — or a capsule that holds one, like a rounded search box — aligns its\n * text to an edge by design, and a non-interactive container (a status chip, a\n * wrapper painted `rounded-full`) is never a pill button (2026-10-09: the\n * messenger's search field and messaging's AI chips wore the red outline).\n */\nexport function isPillButton(el: Element): boolean {\n if (el.matches(FIELDS) || el.querySelector(FIELDS) !== null) return false;\n if (el.matches(PILL_ITEMS)) return true;\n if (el.parentElement?.closest(PILL_ITEMS)) return true;\n return el.querySelector(PILL_ITEMS) !== null;\n}\n\n/** Why this pill's ink is off-centre, or null. Only judges a pill — a capsule\n * (radius ≥ half its height) with its own fill or border, carrying ink. */\nexport function findPillInsetWarning(el: HTMLElement): string | null {\n const view = el.ownerDocument.defaultView;\n if (!view || !el.isConnected) return null;\n if (!isPillButton(el)) return null;\n const box = el.getBoundingClientRect();\n const scale = layoutScale(el);\n if (box.width / scale < 20 || box.height / scale < 16 || box.height / scale > 48) return null;\n const cs = view.getComputedStyle(el);\n if (parseFloat(cs.borderTopLeftRadius) < box.height / scale / 2 - 1) return null;\n const painted = cs.backgroundColor !== \"rgba(0, 0, 0, 0)\" && cs.backgroundColor !== \"transparent\";\n if (!painted && !(parseFloat(cs.borderLeftWidth) > 0)) return null;\n // A wide capsule (a stretched select or field) aligns content to an edge on purpose.\n if (box.width / scale > 320) return null;\n // Ink balance is a question only for CENTERED content. A select trigger (value left, chevron\n // right), a field, or a full-width action row that says justify-start aligns its content on\n // purpose — content alignment is placement, not an inset to balance.\n if (cs.display.includes(\"flex\") && ![\"center\", \"normal\"].includes(cs.justifyContent)) return null;\n if (el.matches(\"[data-matrx-control='select'], [data-matrx-control='field']\")) return null;\n // A switch, checkbox or slider carries STATE, not a label: its thumb sits at one end by design\n // (measured 2026-10-04: every connector switch read \"18px left vs 2px right\" in the chat composer).\n if (el.matches(\"[role='switch'], [role='checkbox'], [role='slider'], [role='radio']\")) return null;\n // A TRACK of several controls (a segmented nav, a tab strip) is a container, not a pill: its\n // items sit where the selection puts them, so the ink is lopsided by design — each item is\n // judged on its own (measured 2026-10-05: the shell route nav's icon track read 2px vs 12.5px\n // at 768 because the selected item's fill hugs one end and the last glyph carries its air).\n if (el.querySelectorAll(PILL_ITEMS).length > 1) return null;\n const ink = inkExtents(el);\n if (!ink) return null;\n const left = (ink.left - box.left) / scale;\n const right = (box.right - ink.right) / scale;\n if (left < 0 || right < 0) return null; // clipped / overflowing content: not this guard's question\n if (Math.abs(left - right) <= PILL_TOLERANCE_PX) return null;\n return `pill ink is off-centre: ${left.toFixed(1)}px left vs ${right.toFixed(1)}px right — pad both sides alike and let the glyph trim (tap-target.css, THE OPTICAL GLYPH TRIM) remove the glyph's air; never shave one side by hand`;\n}\n\nlet pillTimer: ReturnType<typeof setTimeout> | null = null;\nlet pillObserver: MutationObserver | null = null;\n\nfunction scanPills(doc: Document) {\n if (!guardOn()) return;\n for (const node of Array.from(doc.querySelectorAll<HTMLElement>(PILL_CANDIDATES))) {\n // A tap button's own pill is judged, not its invisible box.\n if (node.classList.contains(\"matrx-tap-target\")) continue;\n const warning = findPillInsetWarning(node);\n if (warning) {\n if (node.getAttribute(\"data-matrx-pill-inset-warning\") === warning) continue;\n node.setAttribute(\"data-matrx-pill-inset-warning\", warning);\n const key = `p:${warning}@${(node.textContent ?? \"\").trim().slice(0, 40)}`;\n if (!reported.has(key)) {\n reported.add(key);\n console.error(`[tap-target] ${warning}`, node);\n }\n } else if (node.hasAttribute(\"data-matrx-pill-inset-warning\")) {\n node.removeAttribute(\"data-matrx-pill-inset-warning\");\n }\n }\n}\n\nfunction startPillInsetScan() {\n if (pillObserver || typeof document === \"undefined\" || typeof MutationObserver === \"undefined\") return;\n const doc = document;\n const schedule = () => {\n if (pillTimer) clearTimeout(pillTimer);\n pillTimer = setTimeout(() => scanPills(doc), 600);\n };\n pillObserver = new MutationObserver((records) => {\n // Our own attribute writes must not re-trigger the scan.\n if (records.every((r) => r.type === \"attributes\" && r.attributeName === \"data-matrx-pill-inset-warning\")) return;\n schedule();\n });\n const begin = () => {\n pillObserver?.observe(doc.body, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: [\"class\", \"style\", \"data-matrx-pill-inset-warning\"] });\n schedule();\n };\n if (doc.body) begin();\n else doc.addEventListener(\"DOMContentLoaded\", begin, { once: true });\n}\n","// THE LAYOUT SCALE (0.62.4). The dev guards (pill guard, tap-target guard) judge spacing, ink\n// balance and width in LAYOUT pixels — the numbers a stylesheet writes. `getBoundingClientRect`\n// returns SCREEN pixels, so inside a CSS-transformed (zoomed) container — every Board tile at\n// overview zoom — a correct 11px gap read 5.3px at 0.48 and warned falsely. The effective scale\n// is the ratio of an element's drawn width to its layout width (`offsetWidth`, which ignores\n// transforms), taken from the nearest ancestor-or-self that has a box. 1 when no engine reports\n// layout (jsdom) or the ratio is within 2% of 1, so a real violation at scale 1 reads unchanged.\n\nexport function layoutScale(el: Element | null): number {\n for (let n: Element | null = el; n; n = n.parentElement) {\n const w = (n as HTMLElement).offsetWidth;\n if (!w) continue;\n const drawn = n.getBoundingClientRect().width;\n if (!(drawn > 0)) continue;\n const s = drawn / w;\n if (!Number.isFinite(s) || s <= 0) return 1;\n return Math.abs(s - 1) < 0.02 ? 1 : s;\n }\n return 1;\n}\n","\"use client\";\n\nimport { createContext, useContext, type ReactNode } from \"react\";\n\n/** The surface a tap group sits on. \"glass\" floats over moving content; \"solid\" is a page, card,\n * toast or a header row that is itself a solid band. */\nexport type TapSurfaceKind = \"glass\" | \"solid\";\n\n// Shared through a Symbol.for slot on globalThis (like the default-variant context): the `.` and\n// `./buttons` dist bundles each inline this module, and a provider rendered by one must reach\n// buttons rendered by the other.\nconst SLOT = Symbol.for(\"@ai-matrx/tap-target:surface\");\ntype GlobalWithSlot = typeof globalThis & { [SLOT]?: ReturnType<typeof createContext<TapSurfaceKind>> };\nconst TapSurfaceContext = ((globalThis as GlobalWithSlot)[SLOT] ??= createContext<TapSurfaceKind>(\"glass\"));\n\n/**\n * GLASS ONLY FLOATS, declared once by the surface. A host whose header (or any region) is a solid\n * row wraps it in `<TapSurface surface=\"solid\">`; every `TapTargetButtonGroup` /\n * `TapTargetSearchGroup` inside then renders solid by itself — no per-page `surface=\"solid\"`.\n * A group's own `surface` prop still wins.\n */\nexport function TapSurface({ surface, children }: { surface: TapSurfaceKind; children: ReactNode }) {\n return <TapSurfaceContext.Provider value={surface}>{children}</TapSurfaceContext.Provider>;\n}\n\n/** The group's surface: its explicit prop, else the nearest `<TapSurface>`, else glass. */\nexport function useTapSurface(explicit: TapSurfaceKind | undefined): TapSurfaceKind {\n const inherited = useContext(TapSurfaceContext);\n return explicit ?? inherited;\n}\n","\"use client\";\n\n// THE BUILT-IN CAPABILITIES of every tap button — each one an enum or a flag,\n// never a class a caller writes. Rendering and geometry live in tap-target.css\n// (`.matrx-tap-badge`, `.matrx-tap-pressed`, `.matrx-tap-chevron`, …).\n\nimport { useEffect, type ReactNode } from \"react\";\n\nimport { MOTION_SPIN } from \"../motion\";\n\n/** Glyph color. Replaces the free-form `className`. */\nexport type TapTone = \"default\" | \"muted\" | \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"info\";\n\n/** Fill of a solid button. Replaces `bgColor` / `iconColor` / hover / active. */\nexport type TapSolidTone = \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"neutral\";\n\nexport const TAP_TONE_CLASS: Record<TapTone, string> = {\n default: \"text-foreground\",\n muted: \"text-muted-foreground group-hover/tap:text-foreground\",\n primary: \"text-primary-ink\",\n destructive: \"text-destructive-ink\",\n success: \"text-success-ink\",\n warning: \"text-warning-ink\",\n info: \"text-info-ink\",\n};\n\nexport const TAP_SOLID_TONE: Record<TapSolidTone, { fill: string; glyph: string }> = {\n primary: { fill: \"bg-primary group-hover/tap:bg-primary/85\", glyph: \"text-primary-foreground\" },\n destructive: { fill: \"bg-danger-fill group-hover/tap:bg-danger-fill/85\", glyph: \"text-danger-fill-foreground\" },\n success: { fill: \"bg-success-fill group-hover/tap:bg-success-fill/85\", glyph: \"text-success-fill-foreground\" },\n warning: { fill: \"bg-warning group-hover/tap:bg-warning/85\", glyph: \"text-warning-foreground\" },\n neutral: { fill: \"bg-foreground group-hover/tap:bg-foreground/85\", glyph: \"text-background\" },\n};\n\n/**\n * A keyboard shortcut: modifiers joined by \"+\", then one key —\n * \"mod+k\" (⌘ on Apple, Ctrl elsewhere), \"shift+mod+p\", \"alt+n\", \"/\", \"?\".\n */\nexport type TapShortcut = string;\n\nexport interface TapFeatureProps {\n /** Glyph color, from the system's list. */\n tone?: TapTone | undefined;\n /** A count (99+ past 99) or a dot, drawn on the pill's corner by the system. */\n badge?: number | \"dot\" | undefined;\n /** A toggle that is on (sidebar open, filter on): tinted pill + aria-pressed. */\n pressed?: boolean | undefined;\n /** Work in flight: the glyph becomes a spinner and presses are ignored. */\n loading?: boolean | undefined;\n /** Why the button cannot be used — disables it and becomes its tooltip. */\n disabledReason?: string | undefined;\n /** Keyboard shortcut that presses the button; shown in its tooltip. */\n shortcut?: TapShortcut | undefined;\n /** A menu trigger: a small chevron after the label. */\n chevron?: boolean | undefined;\n}\n\nconst IS_APPLE =\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);\n\ninterface ParsedShortcut {\n mod: boolean;\n shift: boolean;\n alt: boolean;\n key: string;\n}\n\nexport function parseShortcut(shortcut: TapShortcut): ParsedShortcut {\n const parts = shortcut.toLowerCase().split(\"+\");\n const key = parts.pop() ?? \"\";\n return { mod: parts.includes(\"mod\"), shift: parts.includes(\"shift\"), alt: parts.includes(\"alt\"), key };\n}\n\n/** \"mod+k\" → \"⌘K\" on Apple, \"Ctrl+K\" elsewhere. */\nexport function formatTapShortcut(shortcut: TapShortcut): string {\n const p = parseShortcut(shortcut);\n const key = p.key.length === 1 ? p.key.toUpperCase() : p.key[0]!.toUpperCase() + p.key.slice(1);\n if (IS_APPLE) return `${p.alt ? \"⌥\" : \"\"}${p.shift ? \"⇧\" : \"\"}${p.mod ? \"⌘\" : \"\"}${key}`;\n return [p.mod && \"Ctrl\", p.alt && \"Alt\", p.shift && \"Shift\", key].filter(Boolean).join(\"+\");\n}\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n return !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));\n}\n\nexport function matchesTapShortcut(e: KeyboardEvent, shortcut: TapShortcut): boolean {\n const p = parseShortcut(shortcut);\n if ((e.metaKey || e.ctrlKey) !== p.mod || e.altKey !== p.alt) return false;\n // \"?\" and other shifted symbols arrive with shiftKey set — only compare\n // shift for letters and named keys.\n if (/^[a-z0-9]$|^[a-z]{2,}$/.test(p.key) && e.shiftKey !== p.shift) return false;\n if (!p.mod && isTyping(e.target)) return false;\n return e.key.toLowerCase() === p.key;\n}\n\n/** Presses `node` when its shortcut is typed anywhere on the page. */\nexport function useTapShortcut(shortcut: TapShortcut | undefined, getNode: () => HTMLElement | null, enabled: boolean) {\n useEffect(() => {\n if (!shortcut || !enabled) return;\n const onKey = (e: KeyboardEvent) => {\n if (!matchesTapShortcut(e, shortcut)) return;\n const node = getNode();\n if (!node || !node.isConnected) return;\n e.preventDefault();\n node.click();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, enabled, getNode]);\n}\n\nexport function TapBadge({ badge }: { badge: number | \"dot\" }) {\n if (badge === \"dot\") return <span aria-hidden=\"true\" className=\"matrx-tap-badge\" data-dot=\"\" />;\n if (badge <= 0) return null;\n return (\n <span aria-hidden=\"true\" className=\"matrx-tap-badge\">\n {badge > 99 ? \"99+\" : badge}\n </span>\n );\n}\n\nexport function TapSpinner({ className }: { className: string }) {\n return (\n <svg className={className} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2} aria-hidden=\"true\">\n <circle\n className={MOTION_SPIN}\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n strokeDasharray=\"28.27\"\n strokeDashoffset=\"9\"\n strokeLinecap=\"round\"\n style={{ transformOrigin: \"12px 12px\" }}\n />\n </svg>\n );\n}\n\nexport function TapChevron() {\n return (\n <svg\n className=\"matrx-tap-chevron\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** Tooltip body: the label, then the shortcut as a key cap. */\nexport function tooltipBody(label: string, shortcut: TapShortcut | undefined): ReactNode {\n if (!shortcut) return label;\n return (\n <span className=\"matrx-tap-tooltip\">\n {label}\n <kbd className=\"matrx-tap-kbd\">{formatTapShortcut(shortcut)}</kbd>\n </span>\n );\n}\n","import type { ComponentType, ReactNode, Ref } from \"react\";\n\n/**\n * The injectable link seam — the package's replacement for the original\n * hard `next/link` import.\n *\n * Internal hrefs (anything NOT matching `http(s):`, `mailto:`, `tel:`) render\n * through the link component resolved here; external hrefs always render a\n * plain `<a target=\"_blank\" rel=\"noopener noreferrer\">`, exactly like the\n * original. When nothing is registered and no per-instance `linkComponent`\n * prop is given, internal hrefs fall back to a plain `<a>` (no prefetch, no\n * client-side routing — still a working link).\n */\nexport interface TapTargetLinkProps {\n href: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n /** Router prefetch hint (next/link semantics). Plain `<a>` fallback ignores it. */\n prefetch?: boolean | null | undefined;\n \"aria-label\"?: string | undefined;\n /** Tooltip text drawn through `title` (the provider's title takeover). */\n title?: string | undefined;\n className?: string | undefined;\n children?: ReactNode;\n /** The trigger's ref (the development guard measures the rendered link).\n * next/link forwards it to its `<a>`. */\n ref?: Ref<HTMLAnchorElement> | undefined;\n}\n\nexport type TapTargetLinkComponent = ComponentType<TapTargetLinkProps>;\n\n/**\n * The registered component lives in a `Symbol.for` slot on `globalThis` — NOT\n * in module state — so it survives the module graph being instantiated more\n * than once: the `.` and `./buttons` dist bundles each inline the primitives\n * (tsup `splitting: false`), and a consumer may even mix `import` and\n * `require`. One registration must reach every copy.\n */\nconst LINK_SLOT = Symbol.for(\"@ai-matrx/tap-target:link-component\");\n\ntype GlobalWithLinkSlot = typeof globalThis & {\n [LINK_SLOT]?: TapTargetLinkComponent | null;\n};\n\n/**\n * Register the app's link component once at startup (e.g. `next/link`):\n *\n * ```tsx\n * import Link from \"next/link\";\n * import { setTapTargetLinkComponent } from \"@ai-matrx/tap-target\";\n * setTapTargetLinkComponent(Link);\n * ```\n *\n * Pass `null` to unregister (plain `<a>` fallback resumes).\n */\nexport function setTapTargetLinkComponent(\n component: TapTargetLinkComponent | null,\n): void {\n (globalThis as GlobalWithLinkSlot)[LINK_SLOT] = component;\n}\n\n/** The currently registered link component, or `null` when none is set. */\nexport function getTapTargetLinkComponent(): TapTargetLinkComponent | null {\n return (globalThis as GlobalWithLinkSlot)[LINK_SLOT] ?? null;\n}\n","\"use client\";\n\nimport { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from \"../tooltip\";\n\n/**\n * Wraps a TapTargetButton (or any tap control) like the button-demo page:\n * no extra padding on the control — only `gap-0.5` before the caption.\n * Tooltip shows the full `label`; the caption truncates at max-w-[52px].\n */\nexport function TapTargetLabeled({\n label,\n children,\n hideLabel = false,\n toolTipSide = \"bottom\",\n}: {\n label: string;\n children: React.ReactNode;\n hideLabel?: boolean | undefined;\n toolTipSide?: \"top\" | \"bottom\" | \"left\" | \"right\" | undefined;\n}) {\n return (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"flex flex-col items-center p-0 gap-0 space-y-0 space-x-0 shrink-0\">\n {children}\n {!hideLabel && (\n <span className=\"text-[10px] text-muted-foreground leading-tight max-w-[52px] text-center truncate\">\n {label}\n </span>\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side={toolTipSide}>\n <span className=\"font-mono text-xs max-w-[280px] break-all\">\n {label}\n </span>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n","\"use client\";\n\n// TapTargetCopyButton — one press copies, and the button itself says so: the\n// glyph becomes a check (success tone) and the tooltip reads \"Copied\" for\n// 1.6s; a failure shows a destructive \"Copy failed\" instead of nothing.\n// Replaces the copy-then-flash logic screens used to hand-build.\n\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport { useTapButtonVariant } from \"./tap-default-variant\";\n\nimport {\n TapTargetButton,\n TapTargetButtonForGroup,\n TapTargetButtonOutline,\n TapTargetButtonTransparent,\n type TapTargetButtonProps,\n} from \"./tap-target-button\";\n\nexport interface TapTargetCopyButtonProps\n extends Omit<TapTargetButtonProps, \"onClick\" | \"icon\" | \"children\" | \"tone\" | \"loading\" | \"className\"> {\n /** What to copy — a string, or a function (sync or async) that produces it on press. */\n value: string | (() => string | Promise<string>);\n variant?: \"glass\" | \"transparent\" | \"outline\" | \"group\" | undefined;\n onCopied?: ((text: string) => void) | undefined;\n}\n\nconst COPY = (\n <>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </>\n);\nconst CHECK = <path d=\"M20 6 9 17l-5-5\" />;\nconst FAIL = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nconst VARIANTS = {\n glass: TapTargetButton,\n transparent: TapTargetButtonTransparent,\n outline: TapTargetButtonOutline,\n group: TapTargetButtonForGroup,\n} as const;\n\nexport const TapTargetCopyButton = forwardRef<HTMLButtonElement, TapTargetCopyButtonProps>(\n function TapTargetCopyButton({ value, variant: variantProp, onCopied, ariaLabel = \"Copy\", tooltip, ...rest }, ref) {\n const variant = useTapButtonVariant(variantProp);\n const [state, setState] = useState<\"idle\" | \"copied\" | \"failed\">(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => () => {\n if (timer.current) clearTimeout(timer.current);\n }, []);\n\n const copy = async () => {\n try {\n const text = typeof value === \"function\" ? await value() : value;\n if (await copyText(text)) {\n setState(\"copied\");\n onCopied?.(text);\n } else setState(\"failed\");\n } catch {\n setState(\"failed\");\n }\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setState(\"idle\"), 1600);\n };\n\n const Button = VARIANTS[variant];\n return (\n <Button\n ref={ref}\n {...rest}\n ariaLabel={ariaLabel}\n tooltip={state === \"copied\" ? \"Copied\" : state === \"failed\" ? \"Copy failed\" : tooltip}\n tone={state === \"copied\" ? \"success\" : state === \"failed\" ? \"destructive\" : undefined}\n onClick={() => void copy()}\n >\n {state === \"copied\" ? CHECK : state === \"failed\" ? FAIL : COPY}\n </Button>\n );\n },\n);\n","\"use client\";\n\nimport { createContext, useContext, type ReactNode } from \"react\";\n\nimport { useTapSurface } from \"./tap-surface\";\n\n// THE PLACEMENT DEFAULT — which variant a tap button takes when its caller\n// names none. Outside a provider that is \"glass\" (the floating-bar look). A\n// host region that holds tap buttons BESIDE text (a route header's back +\n// title cell) wraps itself in <TapDefaultVariant value=\"transparent\"> so every\n// button in it matches its neighbours (rule 2, \"all glass or none\") without\n// each call site repeating variant=\"transparent\". An explicit `variant` prop\n// always wins, so a bar whose pieces are ALL glass stays glass.\n//\n// The context object lives in a `Symbol.for` slot on globalThis, like the link\n// seam: the `.` and `./buttons` dist bundles each inline this module, and a\n// provider rendered by one must reach buttons rendered by the other.\n\nexport type TapDefaultVariantValue = \"glass\" | \"transparent\";\n\nconst SLOT = Symbol.for(\"@ai-matrx/tap-target:default-variant\");\ntype GlobalWithSlot = typeof globalThis & {\n [SLOT]?: ReturnType<typeof createContext<TapDefaultVariantValue>>;\n};\n\nfunction ctx() {\n const g = globalThis as GlobalWithSlot;\n return (g[SLOT] ??= createContext<TapDefaultVariantValue>(\"glass\"));\n}\n\n/** The variant tap buttons below take when they name none. */\nexport function useTapDefaultVariant(): TapDefaultVariantValue {\n return useContext(ctx());\n}\n\n/** Set the default variant for every tap button below that names none. */\nexport function TapDefaultVariant({ value, children }: { value: TapDefaultVariantValue; children: ReactNode }) {\n const Context = ctx();\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\n/**\n * The variant a lone tap button draws: its explicit `variant`, else a region's\n * <TapDefaultVariant>, else — on a <TapSurface surface=\"solid\"> — \"transparent\"\n * (glass only floats), else glass. An explicit variant always wins.\n */\nexport function useTapButtonVariant<V extends string>(explicit: V | undefined): V | TapDefaultVariantValue {\n const placed = useTapDefaultVariant();\n const surface = useTapSurface(undefined);\n if (explicit !== undefined) return explicit;\n if (placed !== \"glass\") return placed;\n return surface === \"solid\" ? \"transparent\" : \"glass\";\n}\n","\"use client\";\n\n// TapTargetSearchGroup — search anywhere, in the space of one group.\n//\n// The macOS toolbar search: a tap-button group carries a search button; tap it\n// and the group's other buttons give way to a search field in the SAME glass\n// capsule, focused and ready; Escape (or the close button) brings the buttons\n// back. With no other children it is a lone search button that opens into a\n// field. Origin: matrx-frontend's CSS-only SearchGroup (2026-03), rebuilt on\n// the tap geometry with real focus, keyboard and screen-reader behavior.\n//\n// Behavior, fixed (the opinions ARE the component):\n// • open → the field takes the group's place and focuses.\n// • Escape → clears a non-empty query; on an empty field, closes and\n// returns focus to the search button.\n// • close (×) → clears and closes.\n// • focus leaves with an EMPTY query → closes. A non-empty query stays open,\n// because a filter in effect must stay visible.\n// • Enter → onSubmit(query).\n\nimport { useTapSurface } from \"./tap-surface\";\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { TapTargetButtonForGroup } from \"./tap-target-button\";\n\nexport type TapTargetSearchShortcut = \"mod+k\" | \"mod+f\" | \"/\" | false;\n\nexport interface TapTargetSearchGroupProps {\n /** The group's other buttons (`TapTargetButtonForGroup` / `variant=\"group\"`). */\n children?: ReactNode;\n value?: string | undefined;\n defaultValue?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n onSubmit?: ((value: string) => void) | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n /** Field placeholder and the search button's name. Default \"Search\". */\n placeholder?: string | undefined;\n /** Where the search button sits among the group's buttons. Default \"end\". */\n searchPosition?: \"start\" | \"end\" | undefined;\n /** Open width: \"fit\" (16rem, shrinking in a tight row) or \"fill\" (the row's free space). */\n width?: \"fit\" | \"fill\" | undefined;\n /** Keyboard shortcut that opens the field. Default none. */\n shortcut?: TapTargetSearchShortcut | undefined;\n /**\n * The group's surface, as `TapTargetButtonGroup`'s: \"glass\" (default) floats over moving content;\n * \"solid\" (a muted track, no glass stroke) sits on a page, a card or a table toolbar.\n */\n surface?: \"glass\" | \"solid\" | undefined;\n}\n\nconst SHORTCUT_LABEL: Record<Exclude<TapTargetSearchShortcut, false>, string> = {\n \"mod+k\": \"⌘K\",\n \"mod+f\": \"⌘F\",\n \"/\": \"/\",\n};\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el) return false;\n return el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);\n}\n\nconst SearchGlyph = (\n <>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.34-4.34\" />\n </>\n);\nconst CloseGlyph = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nexport function TapTargetSearchGroup({\n children,\n value: valueProp,\n defaultValue = \"\",\n onValueChange,\n onSubmit,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = \"Search\",\n searchPosition = \"end\",\n width = \"fit\",\n shortcut = false,\n surface: surfaceProp,\n}: TapTargetSearchGroupProps) {\n const surface = useTapSurface(surfaceProp);\n const [ownValue, setOwnValue] = useState(defaultValue);\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const value = valueProp ?? ownValue;\n const open = openProp ?? ownOpen;\n const fieldId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const [buttonsWidth, setButtonsWidth] = useState<number | null>(null);\n\n // The buttons' real width, so open/close animate between two measured\n // widths instead of a max-width guess (which stalls, then snaps).\n useLayoutEffect(() => {\n const el = measureRef.current;\n if (!el) return;\n const read = () => setButtonsWidth(el.offsetWidth);\n read();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(read);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const setValue = useCallback(\n (next: string) => {\n if (valueProp === undefined) setOwnValue(next);\n onValueChange?.(next);\n },\n [valueProp, onValueChange],\n );\n const setOpen = useCallback(\n (next: boolean, returnFocus = false) => {\n if (openProp === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n if (returnFocus) requestAnimationFrame(() => triggerRef.current?.focus());\n },\n [openProp, onOpenChange],\n );\n\n // Focus the field the moment it opens (click, shortcut or a controlled\n // prop) — in the layout phase, before the browser moves focus off the\n // now-inert search button, so that blur never reads as \"focus left\".\n useLayoutEffect(() => {\n if (open) inputRef.current?.focus();\n }, [open]);\n\n useEffect(() => {\n if (!shortcut) return;\n const onKey = (e: globalThis.KeyboardEvent) => {\n const mod = e.metaKey || e.ctrlKey;\n const hit =\n shortcut === \"/\"\n ? e.key === \"/\" && !mod && !isTyping(e.target)\n : mod && e.key.toLowerCase() === shortcut.slice(-1);\n if (!hit) return;\n e.preventDefault();\n setOpen(true);\n inputRef.current?.focus();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, setOpen]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n if (value) setValue(\"\");\n else setOpen(false, true);\n } else if (e.key === \"Enter\") {\n onSubmit?.(value);\n }\n };\n\n const label = shortcut ? `${placeholder} (${SHORTCUT_LABEL[shortcut]})` : placeholder;\n const trigger = (\n <TapTargetButtonForGroup\n ref={triggerRef}\n ariaLabel={label}\n aria-expanded={open}\n aria-controls={fieldId}\n onClick={() => setOpen(true)}\n >\n {SearchGlyph}\n </TapTargetButtonForGroup>\n );\n\n return (\n <div\n ref={rootRef}\n role=\"search\"\n className=\"matrx-tap-group matrx-tap-search\"\n data-open={open ? \"\" : undefined}\n data-width={width}\n data-surface={surface}\n onBlur={() => {\n // Decide after focus has settled: closing on an empty query only when\n // focus really left the group.\n setTimeout(() => {\n const root = rootRef.current;\n if (root && !root.contains(document.activeElement) && !inputRef.current?.value) setOpen(false);\n }, 0);\n }}\n >\n <div\n className={\n surface === \"solid\" ? \"matrx-tap-group-capsule matrx-tap-group-capsule-solid\" : \"matrx-tap-group-capsule matrx-glass-thin-border\"\n }\n />\n <div\n className=\"matrx-tap-group-row matrx-tap-search-buttons\"\n inert={open}\n style={\n buttonsWidth === null\n ? undefined\n : ({ \"--matrx-tap-search-buttons-w\": `${buttonsWidth}px` } as CSSProperties)\n }\n >\n <div ref={measureRef} className=\"matrx-tap-search-measure\">\n {searchPosition === \"start\" ? trigger : null}\n {children}\n {searchPosition === \"end\" ? trigger : null}\n </div>\n </div>\n <div className=\"matrx-tap-search-field\" id={fieldId} inert={!open}>\n <svg\n className=\"matrx-tap-search-glyph\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {SearchGlyph}\n </svg>\n <input\n ref={inputRef}\n type=\"search\"\n className=\"matrx-tap-search-input\"\n value={value}\n placeholder={placeholder}\n aria-label={placeholder}\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={onKeyDown}\n />\n <TapTargetButtonForGroup\n ariaLabel=\"Close search\"\n tooltip={false}\n onClick={() => {\n setValue(\"\");\n setOpen(false, true);\n }}\n >\n {CloseGlyph}\n </TapTargetButtonForGroup>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAAA,gBAU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AS,aAAa,KAAK,CAAC,SAAS,SAAS,MAAO,SAAQ,KAAK;AAAA,QAC/F,GAAG,CAAC;AAAA,MACN;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WACE,YAAY,UAAU,0DAA0D;AAAA;AAAA,QAEpF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,YACP,OACE,iBAAiB,OACb,SACC,EAAE,gCAAgC,GAAG,YAAY,KAAK;AAAA,YAG7D,wDAAC,SAAI,KAAK,YAAY,WAAU,4BAC7B;AAAA,iCAAmB,UAAU,UAAU;AAAA,cACvC;AAAA,cACA,mBAAmB,QAAQ,UAAU;AAAA,eACxC;AAAA;AAAA,QACF;AAAA,QACA,8CAAC,SAAI,WAAU,0BAAyB,IAAI,SAAS,OAAO,CAAC,MAC3D;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,eAAY;AAAA,cACZ,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,QAAO;AAAA,cACP,aAAa;AAAA,cACb,eAAc;AAAA,cACd,gBAAe;AAAA,cAEd;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL,MAAK;AAAA,cACL,WAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA,cAAY;AAAA,cACZ,cAAa;AAAA,cACb,cAAa;AAAA,cACb,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC;AAAA;AAAA,UACF;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS;AAAA,cACT,SAAS,MAAM;AACb,yBAAS,EAAE;AACX,wBAAQ,OAAO,IAAI;AAAA,cACrB;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","React","visible","import_jsx_runtime","half","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","tooltipSide","TapTargetButton","TapTargetButtonTransparent","TapTargetButtonOutline","TapTargetButtonSolid","TapTargetButtonDestructive","TapTargetButtonForGroup","import_jsx_runtime","import_react","import_react","import_jsx_runtime","SLOT","import_jsx_runtime","TapTargetCopyButton","import_react","import_jsx_runtime","isTyping"]}
|
|
1
|
+
{"version":3,"sources":["../src/tap-target/index.ts","../src/tap-target/tap-target-button.tsx","../src/tooltip.tsx","../src/cn.ts","../src/motion.ts","../src/portal-container.tsx","../src/title-tooltips.ts","../src/tap-target/tap-target-guard.ts","../src/layout-scale.ts","../src/tap-target/tap-surface.tsx","../src/tap-target/tap-features.tsx","../src/tap-shortcut.ts","../src/tap-target/link.ts","../src/tap-target/tap-target-labeled.tsx","../src/tap-target/tap-target-copy.tsx","../src/tap-target/tap-default-variant.tsx","../src/tap-target/tap-target-search.tsx"],"sourcesContent":["\"use client\";\n\nexport {\n TapTargetButton,\n TapTargetButtonTransparent,\n TapTargetButtonOutline,\n TapTargetButtonSolid,\n TapTargetButtonDestructive,\n TapTargetButtonForGroup,\n TapTargetButtonGroup,\n type TapTargetButtonProps,\n type TapTargetButtonSolidProps,\n} from \"./tap-target-button\";\nexport { TapSurface, useTapSurface, type TapSurfaceKind } from \"./tap-surface\";\nexport { TapTargetLabeled } from \"./tap-target-labeled\";\nexport { TapTargetCopyButton, type TapTargetCopyButtonProps } from \"./tap-target-copy\";\nexport {\n formatTapShortcut,\n type TapFeatureProps,\n type TapShortcut,\n type TapSolidTone,\n type TapTone,\n} from \"./tap-features\";\nexport {\n TapTargetSearchGroup,\n type TapTargetSearchGroupProps,\n type TapTargetSearchShortcut,\n} from \"./tap-target-search\";\nexport { enableTapTargetGuard, findPillInsetWarning, findTapPlacementWarning, findTapViolation } from \"./tap-target-guard\";\nexport {\n setTapTargetLinkComponent,\n getTapTargetLinkComponent,\n type TapTargetLinkComponent,\n type TapTargetLinkProps,\n} from \"./link\";\nexport { TapDefaultVariant, useTapDefaultVariant, type TapDefaultVariantValue } from \"./tap-default-variant\";\n","\"use client\";\n\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useRef,\n type ButtonHTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { joinClassNames } from \"@ai-matrx/kit/dom\";\nimport { classNameMisuse, useTapGuardRef } from \"./tap-target-guard\";\nimport { useTapSurface } from \"./tap-surface\";\nimport {\n TAP_SOLID_TONE,\n TAP_TONE_CLASS,\n TapBadge,\n TapChevron,\n TapSpinner,\n formatTapShortcut,\n tooltipBody,\n useTapShortcut,\n type TapFeatureProps,\n type TapShortcut,\n type TapSolidTone,\n} from \"./tap-features\";\nimport {\n getTapTargetLinkComponent,\n type TapTargetLinkComponent,\n} from \"./link\";\n\nexport interface TapTargetButtonProps extends TapFeatureProps {\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n onClick?: (() => void) | undefined;\n className?: string | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n /**\n * When set, the tap button renders as a link instead of a button.\n * - Internal hrefs (e.g. \"/tasks\") render via the injected link component\n * (`setTapTargetLinkComponent` / the `linkComponent` prop), falling back\n * to a plain `<a>` when none is registered.\n * - External hrefs (http://, https://, mailto:, tel:) render as `<a>`\n * with `target=\"_blank\"` and `rel=\"noopener noreferrer\"` by default.\n * - When combined with `disabled`, the trigger renders as a non-navigable\n * `<span aria-disabled=\"true\">` with the same visual styling.\n */\n href?: string | undefined;\n /** Override target. Works on both internal links and external anchors. */\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n /** Override rel. Works on both internal links and external anchors. */\n rel?: string | undefined;\n /** Forwarded to the injected link component. Pass `false` to disable prefetching. */\n prefetch?: boolean | null | undefined;\n /**\n * Per-instance link component for internal hrefs — overrides the\n * module-level `setTapTargetLinkComponent` registration.\n */\n linkComponent?: TapTargetLinkComponent | undefined;\n /**\n * Tooltip text. Defaults to `ariaLabel` when omitted.\n * EVERY tap button shows a tooltip (owner ruling 2026-10-01). `false` no\n * longer hides it: it renders the tooltip through `title` (the provider's\n * title takeover draws the same surface) — for a button nested inside\n * another `asChild` trigger, where the Tooltip wrapper cannot sit.\n */\n tooltip?: string | false | undefined;\n /** Tooltip placement. Defaults to \"top\". */\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n /** Tooltip alignment along its side. Defaults to \"center\". */\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n /**\n * Visible caption rendered inline after the icon (`[icon Label]`).\n * Widens the pill automatically. Tooltip defaults to off when set — the\n * label is self-describing. Visible text becomes the accessible name.\n */\n label?: string | undefined;\n /**\n * Collapse an icon + caption pill to its icon-only 44px tap target below\n * the `sm` breakpoint. The caption and inline geometry return at `sm+`;\n * `ariaLabel` (falling back to `label`) remains the accessible name.\n */\n mobileIconOnly?: boolean | undefined;\n}\n\nexport interface TapTargetButtonSolidProps extends Omit<TapTargetButtonProps, \"tone\"> {\n /** The fill, from the system's list. Replaces bgColor / iconColor / hover / active. */\n tone?: TapSolidTone | undefined;\n bgColor?: string | undefined;\n iconColor?: string | undefined;\n hoverBgColor?: string | undefined;\n /**\n * Press-state background. Defaults to `group-active/tap:brightness-90` (the\n * BOX is what is pressed — its touch area included), which works on\n * any color. Override when using a custom `bgColor` that should darken to a\n * specific shade on press (e.g. `group-active/tap:bg-primary/60`).\n */\n activeBgColor?: string | undefined;\n}\n\n/** Native button attributes a tap button accepts — everything except `style`:\n * a tap button's geometry is the system's, never the caller's. */\nexport type TapTargetNativeProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"style\">;\n\nconst EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;\n\n// Geometry + press feedback + tap hygiene are the SINGLE SOURCE OF TRUTH in\n// the shipped stylesheet (the `.matrx-tap-*` family in styles.css — import\n// \"@ai-matrx/tap-target/styles.css\" once at app root). This component only\n// picks the right class and layers each variant's decoration on top.\nconst TAP_OUTER_CLASS = \"matrx-tap-target group group/tap\";\nconst TAP_GROUP_OUTER_CLASS = \"matrx-tap-target matrx-tap-target-sm group group/tap\";\n\nfunction IconContent({\n icon,\n children,\n strokeWidth = 2,\n className,\n}: Pick<\n TapTargetButtonProps,\n \"icon\" | \"children\" | \"strokeWidth\" | \"className\"\n>) {\n if (icon) {\n if (isValidElement<{ className?: string }>(icon)) {\n return cloneElement(icon, {\n className: joinClassNames(className, icon.props.className),\n });\n }\n return <span className={className}>{icon}</span>;\n }\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {children}\n </svg>\n );\n}\n\ntype TapTargetSize = \"default\" | \"sm\";\n\nfunction resolveTapGeometry(\n label: string | undefined,\n size: TapTargetSize,\n mobileIconOnly: boolean,\n) {\n const inline = Boolean(label);\n if (size === \"sm\") {\n return {\n outerClassName:\n inline && mobileIconOnly\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-mobile-icon-only-sm group group/tap\"\n : inline\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-inline-sm group group/tap\"\n : TAP_GROUP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only-sm\"\n : \"matrx-tap-pill-inline-sm\",\n };\n }\n return {\n outerClassName:\n inline && mobileIconOnly\n ? `${TAP_OUTER_CLASS} matrx-tap-target-mobile-icon-only`\n : inline\n ? `${TAP_OUTER_CLASS} matrx-tap-target-inline`\n : TAP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only\"\n : \"matrx-tap-pill-inline\",\n };\n}\n\nfunction buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName,\n inlineModifier,\n icon,\n children,\n strokeWidth = 2,\n loading,\n chevron,\n}: {\n label?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n inlineModifier: string;\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n loading?: boolean | undefined;\n chevron?: boolean | undefined;\n}) {\n const iconEl = loading ? (\n <TapSpinner className={iconClassName} />\n ) : (\n <IconContent\n icon={icon}\n strokeWidth={strokeWidth}\n className={iconClassName}\n >\n {children}\n </IconContent>\n );\n const pillClasses = label\n ? `${pillClassName} ${inlineModifier}`.trim()\n : pillClassName;\n\n if (!label) {\n return <div className={pillClasses}>{iconEl}</div>;\n }\n\n return (\n <div className={pillClasses}>\n {iconEl}\n <span className={labelClassName ?? \"matrx-tap-label\"}>{label}</span>\n {chevron ? <TapChevron /> : null}\n </div>\n );\n}\n\ninterface RenderTapTargetArgs extends Pick<\n TapTargetButtonProps,\n | \"icon\"\n | \"children\"\n | \"strokeWidth\"\n | \"label\"\n | \"mobileIconOnly\"\n | \"onClick\"\n | \"as\"\n | \"htmlFor\"\n | \"ariaLabel\"\n | \"disabled\"\n | \"href\"\n | \"target\"\n | \"rel\"\n | \"prefetch\"\n | \"linkComponent\"\n | \"tooltip\"\n | \"tooltipSide\"\n | \"tooltipAlign\"\n> {\n size?: TapTargetSize;\n /** The caller's raw `className` (the glyph color) — checked by the guard. */\n colorClassName?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n rest?: (TapTargetNativeProps & TapFeatureProps) | undefined;\n buttonRef?: Ref<HTMLButtonElement> | undefined;\n}\n\n// A hook (it carries the guard ref); every variant calls it exactly once.\nfunction useTapTarget({\n size = \"default\",\n colorClassName,\n pillClassName,\n iconClassName,\n labelClassName,\n icon,\n children,\n strokeWidth,\n label,\n mobileIconOnly = false,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n rest,\n buttonRef,\n}: RenderTapTargetArgs): ReactElement {\n const {\n tone,\n badge,\n pressed,\n loading,\n disabledReason,\n shortcut,\n chevron,\n ...nativeRest\n } = rest ?? {};\n const isDisabled = Boolean(disabled || disabledReason);\n // FORCED TOOLTIPS: the text is the reason, an explicit tooltip, the\n // accessible name, or the label — and a button with none is a defect.\n const tipText =\n disabledReason || (typeof tooltip === \"string\" && tooltip ? tooltip : undefined) || ariaLabel || label;\n const titleMode = tooltip === false;\n const propViolation =\n (tipText ? null : \"every tap button needs a tooltip — pass ariaLabel\") ??\n classNameMisuse(colorClassName ?? nativeRest.className) ??\n ((nativeRest as { style?: unknown }).style ? \"style is not supported on a tap button\" : null);\n const guardRef = useTapGuardRef<HTMLElement>(\n buttonRef as Ref<HTMLElement> | undefined,\n propViolation,\n );\n const nodeRef = useRef<HTMLElement | null>(null);\n const triggerRef = useCallback(\n (node: HTMLElement | null) => {\n nodeRef.current = node;\n guardRef(node);\n },\n [guardRef],\n );\n const getNode = useCallback(() => nodeRef.current, []);\n useTapShortcut(shortcut, getNode, !isDisabled && !loading);\n\n // Tone (or a pressed toggle) owns the glyph and label color.\n const toneColor = tone ? TAP_TONE_CLASS[tone] : pressed && !colorClassName ? TAP_TONE_CLASS.primary : null;\n if (toneColor) {\n iconClassName = `matrx-tap-icon ${toneColor}`;\n labelClassName = `matrx-tap-label ${toneColor}`;\n }\n if (pressed) pillClassName = `${pillClassName} matrx-tap-pressed`;\n const { outerClassName, inlineModifier } = resolveTapGeometry(\n label,\n size,\n mobileIconOnly,\n );\n const responsiveLabelClassName = mobileIconOnly\n ? `${labelClassName ?? \"matrx-tap-label\"} matrx-tap-label-mobile-icon-only`\n : labelClassName;\n const inner = buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName: responsiveLabelClassName,\n inlineModifier: label ? inlineModifier : \"\",\n icon,\n children,\n strokeWidth,\n loading,\n chevron,\n });\n const triggerAriaLabel =\n label && !mobileIconOnly ? undefined : (ariaLabel ?? label);\n const trigger = renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick: loading ? undefined : onClick,\n ariaLabel: triggerAriaLabel,\n disabled: isDisabled,\n outerClassName,\n title: titleMode && tipText ? (shortcut ? `${tipText} (${formatTapShortcut(shortcut)})` : tipText) : undefined,\n children: (\n <>\n {inner}\n {badge !== undefined ? <TapBadge badge={badge} /> : null}\n </>\n ),\n rest: {\n ...nativeRest,\n ...(pressed !== undefined ? { \"aria-pressed\": pressed } : {}),\n ...(loading ? { \"aria-busy\": true } : {}),\n ...(shortcut ? { \"aria-keyshortcuts\": shortcut.replace(/mod/i, \"Meta\") } : {}),\n },\n triggerRef,\n });\n if (titleMode || !tipText) return trigger;\n return withTooltip(trigger, {\n tooltip: tipText,\n ariaLabel: tipText,\n disabled: isDisabled,\n tooltipSide,\n tooltipAlign,\n shortcut,\n });\n}\n\ninterface RenderTriggerArgs {\n href?: string | undefined;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n prefetch?: boolean | null | undefined;\n linkComponent?: TapTargetLinkComponent | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n onClick?: (() => void) | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n outerClassName: string;\n children: ReactNode;\n rest?: ButtonHTMLAttributes<HTMLButtonElement> | undefined;\n triggerRef: Ref<HTMLElement>;\n /** Tooltip text drawn through `title` (tooltip={false}: a nested trigger). */\n title?: string | undefined;\n}\n\n/**\n * Resolves the correct trigger element based on the props passed.\n *\n * - `href` + `disabled` → unclickable `<span aria-disabled>`\n * - `href` matching `http(s):|mailto:|tel:` → `<a target=\"_blank\" rel=\"noopener noreferrer\">`\n * - `href` (internal) → the injected link component (per-instance\n * `linkComponent` prop, else `setTapTargetLinkComponent` registration),\n * falling back to a plain `<a>` when none is registered\n * - `as=\"label\"` → `<label htmlFor=...>`\n * - default → `<button>`\n */\nfunction renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick,\n ariaLabel,\n disabled,\n outerClassName,\n children,\n rest,\n triggerRef,\n title,\n}: RenderTriggerArgs): ReactElement {\n const { style: _style, ...restWithoutStyle } = rest ?? {};\n if (disabled && href) {\n return (\n <span\n ref={triggerRef}\n aria-disabled=\"true\"\n aria-label={ariaLabel}\n title={title}\n className={`${outerClassName} opacity-40`}\n >\n {children}\n </span>\n );\n }\n if (href) {\n const isExternal = EXTERNAL_RE.test(href);\n if (isExternal) {\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target ?? \"_blank\"}\n rel={rel ?? \"noopener noreferrer\"}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n const Link = linkComponent ?? getTapTargetLinkComponent();\n if (Link) {\n return (\n <Link\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n prefetch={prefetch}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </Link>\n );\n }\n // No link component registered — plain <a>. `prefetch` is a router hint,\n // not a DOM attribute, so it is deliberately dropped here.\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n if (as === \"label\") {\n return (\n <label\n ref={triggerRef as Ref<HTMLLabelElement>}\n htmlFor={htmlFor}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </label>\n );\n }\n return (\n <button\n ref={triggerRef as Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={onClick}\n aria-label={ariaLabel}\n title={title}\n disabled={disabled}\n {...restWithoutStyle}\n className={outerClassName}\n >\n {children}\n </button>\n );\n}\n\n/**\n * Wraps a trigger element in a Tooltip when a tooltip label is available.\n * Falls back to `ariaLabel` when `tooltip` is not explicitly set. If both\n * are absent (or `tooltip === false`), the trigger is returned unwrapped.\n */\nfunction withTooltip(\n trigger: ReactElement,\n {\n tooltip,\n ariaLabel,\n disabled,\n tooltipSide = \"top\",\n tooltipAlign = \"center\",\n shortcut,\n }: {\n tooltip?: string | false | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n shortcut?: TapShortcut | undefined;\n },\n): ReactElement {\n if (tooltip === false) return trigger;\n const label =\n typeof tooltip === \"string\" && tooltip.length > 0 ? tooltip : ariaLabel;\n if (!label) return trigger;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n {disabled ? (\n // Radix Tooltip triggers need a hoverable element; a disabled button\n // does not dispatch pointer events, so we wrap in a span for the\n // trigger target while keeping the disabled visual state.\n <span className=\"inline-flex\">{trigger}</span>\n ) : (\n trigger\n )}\n </TooltipTrigger>\n <TooltipContent side={tooltipSide} align={tooltipAlign}>\n {tooltipBody(label, shortcut)}\n </TooltipContent>\n </Tooltip>\n );\n}\n\n// To resize/retune every tap button, edit styles.css — not here.\n\nexport const TapTargetButton = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButton(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-glass-thin-border\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonTransparent = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonTransparent(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill group-hover/tap:bg-muted group-active/tap:bg-muted-foreground/15\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\n/** Outline pill — a plain 1px border, no fill, no blur, no shadow. Glass only\n * reads as glass over something you can see through; on an opaque card or\n * header use THIS. Same colors as the classic square \"+\": border-border,\n * muted glyph, primary border + foreground glyph on hover. */\nexport const TapTargetButtonOutline = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonOutline(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color =\n className ?? \"text-muted-foreground group-hover/tap:text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill border border-border bg-transparent transition-colors group-hover/tap:border-primary/60 group-active/tap:bg-muted\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonSolid = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonSolid(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tone,\n bgColor,\n iconColor,\n hoverBgColor,\n activeBgColor,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n return useTapTarget({\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...solidClasses(tone, bgColor, iconColor, hoverBgColor, activeBgColor),\n rest,\n buttonRef: ref,\n });\n});\n\n// `tone` is the system's fill; the four color strings are the pre-tone API,\n// accepted only until their last callers move to `tone`. `matrx-tap-solid` marks the\n// filled pill so the stylesheet can give a DISABLED solid the system's disabled token\n// (muted fill + --disabled-foreground glyph) instead of a 40%-opacity ghost of its fill.\nfunction solidClasses(\n tone: TapSolidTone | undefined,\n bgColor: string | undefined,\n iconColor: string | undefined,\n hoverBgColor: string | undefined,\n activeBgColor: string | undefined,\n) {\n const legacy = !tone && (bgColor || iconColor || hoverBgColor || activeBgColor);\n if (!legacy) {\n const t = TAP_SOLID_TONE[tone ?? \"primary\"];\n return {\n pillClassName: `matrx-tap-pill matrx-tap-solid ${t.fill} ${t.glyph} group-active/tap:brightness-90`,\n iconClassName: `matrx-tap-icon ${t.glyph}`,\n labelClassName: `matrx-tap-label ${t.glyph}`,\n };\n }\n const glyph = iconColor ?? \"text-primary-foreground\";\n return {\n pillClassName: `matrx-tap-pill matrx-tap-solid ${bgColor ?? \"bg-primary\"} ${glyph} ${hoverBgColor ?? \"group-hover/tap:bg-primary/80\"} ${activeBgColor ?? \"group-active/tap:brightness-90\"}`,\n iconClassName: `matrx-tap-icon ${glyph}`,\n labelClassName: `matrx-tap-label ${glyph}`,\n };\n}\n\n/** Solid destructive pill — delete/remove actions. White-on-red like the\n * primary solid is white-on-blue. Use THIS, never hand-pass bg-destructive\n * with the default (dark) icon color. */\nexport const TapTargetButtonDestructive = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonDestructive({ tone = \"destructive\", ...rest }, ref) {\n return <TapTargetButtonSolid ref={ref} tone={tone} {...rest} />;\n});\n\nexport const TapTargetButtonForGroup = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonForGroup(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n size: \"sm\",\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-tap-pill-sm matrx-glass-interactive\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport function TapTargetButtonGroup({\n children,\n className,\n surface: surfaceProp,\n}: {\n children: React.ReactNode;\n className?: string | undefined;\n /**\n * GLASS ONLY FLOATS (owner rule, 2026-10-02): glass belongs on a bar that\n * floats over scrolling content or a see-through plane. On a solid surface\n * (a page, a card, a toast, a table toolbar) use `\"solid\"`: a muted track,\n * no glass stroke, the same geometry.\n */\n surface?: \"glass\" | \"solid\" | undefined;\n}) {\n // Geometry (height, the half-gap outside the capsule, the capsule itself)\n // is `.matrx-tap-group*` in tap-target.css.\n const surface = useTapSurface(surfaceProp);\n return (\n <div\n className={className ? `matrx-tap-group ${className}` : \"matrx-tap-group\"}\n data-surface={surface}\n >\n <div\n className={\n surface === \"solid\"\n ? \"matrx-tap-group-capsule matrx-tap-group-capsule-solid\"\n : \"matrx-tap-group-capsule matrx-glass-thin-border\"\n }\n />\n <div className=\"matrx-tap-group-row\">{children}</div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Tooltip — the ONE tooltip in the fleet.\n *\n * THE COLLAPSE (0.6.0). Two implementations existed: matrx-frontend's\n * `components/ui/tooltip.tsx` (182 import sites) and `@ai-matrx/tap-target`'s\n * `src/tooltip.tsx` — the latter an explicit inlined PORT of the former,\n * carrying a header that said so. tap-target shipped it only because its ~60\n * tap buttons need a tooltip and no shared package owned one; four repos then\n * adopted `TooltipProvider` from tap-target. That made tap-target — a\n * button-geometry package — the accidental owner of a design-system primitive,\n * with a second copy living in the biggest host.\n *\n * A tooltip is a design-system surface, so it lives here. tap-target now takes\n * `@ai-matrx/design-system` as an ordinary sibling dependency and imports this\n * file; its own copy is deleted, and its re-export removed. The DAG already\n * ordered design-system before tap-target, so no cycle is introduced.\n *\n * BEHAVIOR is matrx-frontend's, verbatim, including the ruling both copies\n * carried in prose:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was false: Radix ids come from React's\n * SSR-stable `useId`. It was actively harmful — a Trigger wraps\n * ALWAYS-VISIBLE content, so `return null` deleted that subtree from SSR and\n * the first client paint.\n *\n * 2. THE SURFACE IS TOKEN-DRIVEN, NOT BRANDED. Popover tokens, not\n * `bg-primary`: rich tooltip content using `text-muted-foreground` was\n * illegible on a brand-colored background in one theme or the other.\n * Since 2026-09-28 the `.matrx-tooltip` class re-scopes those tokens to a dark,\n * high-contrast chip in both themes (styles.css, THE TOOLTIP SURFACE): the\n * neutral white surface it wore before was indistinguishable from the\n * browser's own `title` box.\n *\n * 3. EVERY `title` IS THIS TOOLTIP. The provider installs the title takeover\n * (`title-tooltips.ts`), so a hand-written `title=` anywhere in the\n * document shows this surface, never the browser's.\n *\n * SEAM INVERSION. The host resolved nested portal targets through\n * `useNestedPortalContainer` (an app hook wired to its dialog + window-panel\n * systems); tap-target's port dropped that seam entirely and always portalled\n * to `document.body` — which is why a tooltip inside a popped-out panel landed\n * in the wrong window. Here it is the package's `PortalContainerProvider`\n * seam: an explicit `container` prop wins, then the injected container, then\n * `document.body`. Both prior behaviors are reachable; neither is forked.\n */\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\nimport { acquireTitleTooltips, clipTooltipText, tooltipSide, TOOLTIP_EDGE_PX, TOOLTIP_LAYER_Z, TOOLTIP_TRIGGER_ATTR, type Side } from \"./title-tooltips\";\n\nexport interface TooltipProviderProps\n extends React.ComponentProps<typeof TooltipPrimitive.Provider> {\n /**\n * THE TITLE TAKEOVER (2026-09-28) — while any provider is mounted, every native\n * `title` attribute in the document shows as this tooltip instead of the\n * browser's (see `title-tooltips.ts`). On by default, because a rule every\n * author must remember is a rule that is broken; pass `false` only for a\n * surface that must keep the browser's own box. One provider opting out does\n * not turn it off while another one is mounted.\n */\n titleTooltips?: boolean;\n}\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing, and the root provider takes\n * over native `title` attributes (see `titleTooltips`). The fleet default keeps\n * tooltip content hoverable and selectable. A native mirrored Desktop shell may\n * explicitly opt in to `disableHoverableContent` so its overlay view yields the\n * pointer back to the host; ordinary application tooltips must leave it unset.\n */\nfunction TooltipProvider({ titleTooltips = true, disableHoverableContent = false, ...props }: TooltipProviderProps) {\n React.useEffect(() => {\n if (!titleTooltips) return;\n return acquireTitleTooltips();\n }, [titleTooltips]);\n return <TooltipPrimitive.Provider {...props} disableHoverableContent={disableHoverableContent} />;\n}\n\n/**\n * The tooltip root inherits its provider's hoverability policy: the ordinary\n * provider defaults to hoverable, selectable content (Arman, 2026-10-14), while\n * a native mirrored Desktop shell may opt in at its provider so the overlay view\n * yields pointer control to its host. An explicit root prop still wins.\n */\n/** The tooltip's trigger and whether it is open, so its content takes THE SMART SIDE\n * (title-tooltips.ts) from where the trigger stands at the moment it opens. */\ninterface TriggerState {\n ref: React.MutableRefObject<HTMLElement | null>;\n open: boolean;\n}\nconst TriggerContext = React.createContext<TriggerState | null>(null);\n\nconst Tooltip = ({ onOpenChange, ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) => {\n const ref = React.useRef<HTMLElement | null>(null);\n const [open, setOpen] = React.useState(Boolean(props.open ?? props.defaultOpen));\n const shown = props.open ?? open;\n const value = React.useMemo(() => ({ ref, open: shown }), [shown]);\n return (\n <TriggerContext.Provider value={value}>\n <TooltipPrimitive.Root\n {...props}\n onOpenChange={(next) => {\n setOpen(next);\n onOpenChange?.(next);\n }}\n />\n </TriggerContext.Provider>\n );\n};\nTooltip.displayName = \"Tooltip\";\n\n/**\n * Stamps `data-matrx-tooltip-trigger` so the title takeover never draws a\n * second tooltip over a control that already has this one — it still lifts a\n * `title` on the same control, so the browser's box never doubles it either.\n */\nconst TooltipTrigger = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>((props, ref) => {\n const trigger = React.useContext(TriggerContext);\n const setRef = React.useCallback(\n (node: HTMLButtonElement | null) => {\n if (trigger) trigger.ref.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [trigger, ref],\n );\n return <TooltipPrimitive.Trigger ref={setRef} {...{ [TOOLTIP_TRIGGER_ATTR]: \"\" }} {...props} />;\n});\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;\n\nexport interface TooltipContentProps\n extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {\n /**\n * Explicit portal target; wins over the injected `PortalContainerProvider`\n * value. Pass `null` to force `document.body`.\n */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honors `prefers-reduced-motion`.\n */\n animated?: boolean;\n /**\n * The side when the control is not in a vertical stack and no side is given (the host's default:\n * a macOS desktop host says \"bottom\"). Omit for the document's `data-title-side`, else \"top\".\n */\n fallbackSide?: Side;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, side, fallbackSide, sideOffset = 4, collisionPadding = TOOLTIP_EDGE_PX, container, animated = true, children, style, ...props }, ref) => {\n const resolved = usePortalContainer(container);\n const trigger = React.useContext(TriggerContext);\n // THE SMART SIDE: an explicit side wins; otherwise where the trigger's neighbours stand decides.\n const placed = side ?? (trigger?.open ? tooltipSide(trigger.ref.current, fallbackSide) : (fallbackSide ?? \"top\"));\n return (\n <TooltipPrimitive.Portal container={resolved ?? null}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n side={placed}\n sideOffset={sideOffset}\n // Flip and stay inside the window: Radix flips to the opposite side when the preferred one\n // does not fit, and shifts along the edge; the padding keeps it off the window's border.\n avoidCollisions\n collisionPadding={collisionPadding}\n className={cn(\n \"matrx-tooltip max-w-xs select-text overflow-hidden whitespace-normal break-words rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\",\n animated && MOTION_POPPER,\n className,\n )}\n // THE tooltip layer: above every menu, popover and modal (Radix copies it onto its wrapper).\n style={{ zIndex: TOOLTIP_LAYER_Z, ...style }}\n {...props}\n >\n {typeof children === \"string\" ? clipTooltipText(children) : children}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\nexport { acquireTitleTooltips, clipTooltipText, NATIVE_TITLE_OPT_OUT_ATTR, TOOLTIP_TEXT_BUDGET } from \"./title-tooltips\";\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * THE MOTION CONTRACT (0.10.0) — the class names every animated surface in\n * this package puts on the DOM, in ONE place.\n *\n * Why a module and not ten inline strings: the sweep that produced this file\n * found the same defect ten times over, and it was invisible each time\n * because each primitive spelled its animation out by hand. Ten hand-written\n * copies of `data-[state=open]:animate-in data-[state=closed]:animate-out\n * data-[state=closed]:fade-out-0 …` meant ten chances to reach for a utility\n * nothing in the package defines — which is exactly what happened. A single\n * exported constant per motion SHAPE means the next primitive cannot invent\n * an eleventh spelling, and `styles.test.ts` can prove every one of them\n * resolves to a rule in the shipped stylesheet.\n *\n * Every rule these name lives in `styles.css` under the package's own\n * keyframes. NONE of them is a Tailwind utility, and none requires a host\n * plugin — see that file's header for the measurement that made this\n * necessary.\n */\n\n/** Modal scrims: Dialog, AlertDialog, Sheet, CommandDialog. Fade only. */\nexport const MOTION_OVERLAY = \"matrx-motion-overlay\";\n\n/** The centered dialog card. Fades and scales; centering is not its business. */\nexport const MOTION_DIALOG = \"matrx-motion-dialog\";\n\n/**\n * THE CENTERING OF A CENTERED DIALOG CARD — package-owned, in the `translate`\n * property, and NEVER a Tailwind `translate-x-[-50%] translate-y-[-50%]` pair.\n *\n * Those utilities do not compile to the same thing in every host: Tailwind v3\n * writes them into `transform`, Tailwind v4 writes them into the independent\n * `translate` property, which COMPOSES with `transform` instead of being\n * replaced by it. 0.10.0's keyframes restated the centering inside `transform`,\n * which was harmless on v3 and doubled the centering on v4 — the card flew in\n * from off the top-left of the viewport for the animation's whole duration and\n * snapped into place at the end (fixed in 0.10.1).\n *\n * Owning it here means one spelling that reads the same on both, and it frees\n * `transform` so the keyframes carry ONLY the delta. Put this on every centered\n * surface UNCONDITIONALLY — it is geometry, so unlike {@link MOTION_DIALOG} it\n * must survive `animated={false}`. Its rule ships in `styles.css`.\n */\nexport const CENTERED_DIALOG = \"matrx-dialog-centered\";\n\n/**\n * The resting gap between a `popper`-positioned surface and its trigger, for\n * the primitives that want one (today: `Select`). Same law and same reason as\n * {@link CENTERED_DIALOG} — a position an animated surface holds AT REST is\n * the `translate` property's job, never a Tailwind translate utility, because\n * those land in `transform` on a v3 host and in `translate` on a v4 one while\n * the keyframes animate `transform` either way. Sizes from\n * `--matrx-popper-offset`; keys off Radix's `data-side`.\n */\nexport const POPPER_OFFSET = \"matrx-popper-offset\";\n\n/** The mobile Dialog / CommandDialog bottom sheet. Slides up and fades. */\nexport const MOTION_BOTTOM_SHEET = \"matrx-motion-bottom-sheet\";\n\n/**\n * Radix-popper surfaces: Popover, DropdownMenu, ContextMenu, HoverCard,\n * Select, Tooltip. Reads `--radix-popper-transform-origin` so the surface\n * grows out of its trigger, and `data-side` so it travels from it.\n */\nexport const MOTION_POPPER = \"matrx-motion-popper\";\n\n/** Edge sheets, one class per `sheetVariants` side. */\nexport const MOTION_SHEET = {\n top: \"matrx-motion-sheet-top\",\n bottom: \"matrx-motion-sheet-bottom\",\n left: \"matrx-motion-sheet-left\",\n right: \"matrx-motion-sheet-right\",\n center: \"matrx-motion-sheet-center\",\n} as const;\n\n/** Skeleton's breathing loop. */\nexport const MOTION_PULSE = \"matrx-pulse\";\n/** A waiting box's crossing band of light (Skeleton `motion=\"shimmer\"`). Reduced motion: a slow breathe, no travel. */\nexport const MOTION_SHIMMER = \"matrx-shimmer\";\n\n/** The spinner loop, for every inline busy indicator in the package. */\nexport const MOTION_SPIN = \"matrx-spin\";\n\n/**\n * FirstUseHint's beacon: a soft ring that pulses three times around the anchor, on\n * `box-shadow` only, so nothing moves. A still ring under reduced motion.\n */\nexport const MOTION_HINT_BEACON = \"matrx-motion-hint-beacon\";\n\n/**\n * Every motion class the package ships, for the guards. If a rule for one of\n * these is missing from `styles.css`, a component animates in no consumer and\n * says nothing about it — the C26 failure this list exists to make loud.\n */\nexport const ALL_MOTION_CLASSES = [\n MOTION_OVERLAY,\n MOTION_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_POPPER,\n ...Object.values(MOTION_SHEET),\n MOTION_PULSE,\n MOTION_SHIMMER,\n MOTION_SPIN,\n MOTION_HINT_BEACON,\n] as const;\n\n/**\n * The host-plugin utilities this package is forbidden to emit. They are\n * supplied by `tailwindcss-animate` / `tw-animate-css`, which is a HOST CSS\n * entry concern a package cannot declare a dependency on: three of the four\n * AI Matrx consumers never loaded it, so every surface wearing these appeared\n * with no animation and no error. `styles.test.ts` fails the build if one\n * comes back.\n */\nexport const FORBIDDEN_HOST_MOTION_UTILITIES = [\n \"animate-in\",\n \"animate-out\",\n \"fade-in\",\n \"fade-out\",\n \"zoom-in\",\n \"zoom-out\",\n \"slide-in-from\",\n \"slide-out-to\",\n \"animate-accordion\",\n \"animate-slide-down\",\n \"animate-slide-up\",\n \"animate-pulse\",\n \"animate-spin\",\n] as const;\n\n/**\n * THE PANEL MOTION as a Tailwind class string (moved from matrx-frontend\n * `lib/motion/panel-motion.ts`): every panel, sidebar, dock, drawer and sheet\n * slides its size/position on the host's `--matrx-motion-duration-panel` /\n * `--matrx-motion-ease-panel` (tokens.css ships the standard). Pair it with the\n * transition property you animate (`transition-transform`, …).\n */\nexport const PANEL_MOTION_CLASS =\n \"duration-(--matrx-motion-duration-panel) ease-(--matrx-motion-ease-panel) motion-reduce:transition-none\";\nexport const PANEL_MOTION_DURATION_VAR = \"var(--matrx-motion-duration-panel)\";\nexport const PANEL_MOTION_EASE_VAR = \"var(--matrx-motion-ease-panel)\";\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.portal-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null | undefined> };\nconst PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<HTMLElement | null | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n","/**\n * THE TITLE TAKEOVER — every native `title` attribute in the document shows\n * as THE fleet tooltip instead of the browser's.\n *\n * Why this exists. A `title=` is the one tooltip nobody has to import, so it\n * is what every hand-written control reaches for: ~50 of them on an ordinary\n * matrx-frontend page (2026-09-28), next to the Radix tooltips on the tap\n * buttons. The browser draws those as a slow, unstyled system box, and a page\n * that mixes the two reads as having \"lost all of its tooltips\" (Arman,\n * 2026-09-28). Asking every author — human or agent — to wrap every control in\n * `<Tooltip>` is a rule that is broken the day it is written. So the\n * `TooltipProvider` every host already mounts at its root installs this layer,\n * and a `title` is simply a tooltip from then on. Nothing to remember.\n *\n * How it works. On hover (mouse or pen) or keyboard focus (`:focus-visible`)\n * of an element that carries a `title`, the attribute is lifted onto\n * `data-matrx-title` for exactly as long as the pointer or focus stays — so\n * the browser has nothing to show — and one shared, script-placed element\n * wearing `.matrx-tooltip` shows the text instead. When the pointer or focus\n * leaves, the `title` is put back, so assistive technology and every\n * `[title]` selector read the element exactly as authored the rest of the\n * time. Touch never shows it (a `title` has no touch affordance either).\n *\n * What it does not draw: a tooltip that only repeats text already readable in\n * full inside the element (it still draws when that text is hidden or\n * truncated).\n *\n * What it leaves alone:\n * - an element that is already a Radix tooltip trigger\n * (`[data-matrx-tooltip-trigger]`, stamped by `TooltipTrigger`): its\n * `title` is still lifted — two tooltips on one control was the other\n * half of the mess — but only the Radix one shows;\n * - anything inside `[data-native-title]` (the explicit opt-out);\n * - SVG `<title>` children, which are elements, not attributes.\n *\n * Placement. `tooltipSide` (THE SMART SIDE, below): beside a control in a\n * vertical stack, else the host's side; flipped when there is no room,\n * clamped into the viewport. `data-title-side=\"right\" | \"left\" | \"bottom\" |\n * \"top\"` on the element or any ancestor states a preferred side — a vertical\n * rail sets `right` once on its container.\n *\n * Installed at most once per document, reference-counted across every\n * mounted provider, and removed when the last one unmounts.\n */\n\n/**\n * THE SMART SIDE (Arman, 2026-10-15: tooltips \"don't show up intelligently\"). A tooltip never\n * covers the control next to its own. Where the control's neighbours stand decides the side:\n * - an explicit side (a prop, or `data-title-side` on the control or an ancestor below <html>) wins;\n * - an icon-sized control in a vertical stack (an icon column, a tool palette) has its neighbours\n * above and below, so it opens beside the control: right, or left when the control is in the\n * window's right half (an inspector column). A wide row in a list keeps the host's side: its\n * tooltip is the row's own text in full, and beside it would sit over the page next to the list;\n * - anywhere else (a toolbar, a row of buttons, a lone control) it opens on the host's default\n * side (`data-title-side` on <html>: macOS desktop hosts say \"bottom\"; the web's is \"top\").\n * Either way it flips to the other side when there is no room, and stays inside the window.\n */\nexport function tooltipSide(el: Element | null, fallback?: Side): Side {\n if (!el) return fallback ?? \"top\";\n const doc = el.ownerDocument;\n const hinted = el.closest(\"[data-title-side]\");\n const hint = hinted?.getAttribute(\"data-title-side\");\n const isSide = (v: string | null | undefined): v is Side => v === \"top\" || v === \"bottom\" || v === \"left\" || v === \"right\";\n if (hinted && hinted !== doc.documentElement && isSide(hint)) return hint;\n const base: Side = fallback ?? (isSide(hint) ? hint : \"top\");\n const box = el.getBoundingClientRect();\n if (box.width <= ICON_CONTROL_MAX_PX && stackDirection(el) === \"vertical\") {\n const vw = doc.defaultView?.innerWidth ?? 0;\n return vw > 0 && box.left + box.width / 2 > vw / 2 ? \"left\" : \"right\";\n }\n return base;\n}\n\n/** The widest control that counts as an icon (a navigator item, a palette tool). */\nconst ICON_CONTROL_MAX_PX = 64;\n\n/** How the control's nearest group of siblings is laid out, from where they actually are on screen. */\nfunction stackDirection(el: Element): \"vertical\" | \"horizontal\" | null {\n let node: Element | null = el;\n for (let depth = 0; node && depth < 4; depth++, node = node.parentElement) {\n const parent: Element | null = node.parentElement;\n if (!parent) return null;\n const me = node.getBoundingClientRect();\n if (me.width === 0 && me.height === 0) return null;\n let vertical = 0;\n let horizontal = 0;\n for (const sib of Array.from(parent.children)) {\n if (sib === node) continue;\n const r = sib.getBoundingClientRect();\n if (r.width === 0 || r.height === 0) continue;\n const overlapX = Math.min(me.right, r.right) - Math.max(me.left, r.left);\n const overlapY = Math.min(me.bottom, r.bottom) - Math.max(me.top, r.top);\n if (overlapX > 0.5 * Math.min(me.width, r.width) && overlapY <= 0) vertical++;\n else if (overlapY > 0.5 * Math.min(me.height, r.height) && overlapX <= 0) horizontal++;\n }\n if (vertical > 0 && horizontal === 0) return \"vertical\";\n if (horizontal > 0) return \"horizontal\";\n }\n return null;\n}\n\nexport const TITLE_TOOLTIP_ATTR = \"data-matrx-title\";\nexport const TOOLTIP_TRIGGER_ATTR = \"data-matrx-tooltip-trigger\";\nexport const NATIVE_TITLE_OPT_OUT_ATTR = \"data-native-title\";\n\nexport type Side = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nconst OPEN_DELAY_MS = 350;\n/** Moving from one titled control to the next inside this window is instant. */\nconst SKIP_DELAY_MS = 500;\n/**\n * THE HOVER BRIDGE. Leaving the control does not close the tooltip at once: the pointer has this\n * long to reach the tooltip itself (Arman, 2026-10-14: a tooltip must stay long enough to put the\n * mouse on it and copy its text). Entering the tooltip holds it open.\n */\n/**\n * THE TOOLTIP LAYER — above every other layer, always (Arman, 2026-10-14: a tooltip \"coming up\n * behind the content\"). Menus and popovers share the modal tier (equal z, DOM order decides), so a\n * tooltip on that tier lost to any menu opened after it. A tooltip is transient and never takes a\n * press, so nothing ever needs to sit above it.\n */\nexport const TOOLTIP_LAYER_Z = 2_147_483_000;\n\nexport const TOOLTIP_CLOSE_DELAY_MS = 300;\nconst GAP_PX = 6;\nconst EDGE_PX = 8;\n/** How far every tooltip stays from the window's edge (both implementations). */\nexport const TOOLTIP_EDGE_PX = EDGE_PX;\n/**\n * A tooltip is a short hint, never a paragraph (Apple HIG: a tooltip is a few words): text past\n * this budget is cut at a word boundary with an ellipsis. Long detail belongs in a sheet or a\n * Copy details action, not on hover.\n */\nexport const TOOLTIP_TEXT_BUDGET = 140;\n\nexport function clipTooltipText(text: string, budget: number = TOOLTIP_TEXT_BUDGET): string {\n const flat = text.replace(/\\s+/g, \" \").trim();\n if (flat.length <= budget) return flat;\n const cut = flat.slice(0, budget - 1);\n const space = cut.lastIndexOf(\" \");\n return `${(space > budget * 0.6 ? cut.slice(0, space) : cut).replace(/[\\s,.;:–—-]+$/, \"\")}…`;\n}\n\nconst SURFACE_CLASS =\n \"matrx-tooltip matrx-title-tooltip matrx-motion-popper max-w-xs select-text rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\";\n\ninterface Installation {\n count: number;\n uninstall: () => void;\n}\n\n/**\n * Keyed on the document itself through a registered symbol, never a module\n * WeakMap: tsup bundles this module into more than one entry (`index`,\n * `tap-target`), and two module copies each holding their own map would\n * install twice — two listeners, two surfaces.\n */\nconst INSTALLATION_KEY = Symbol.for(\"@ai-matrx/design-system/title-tooltips\");\ntype DocumentWithInstallation = Document & { [INSTALLATION_KEY]?: Installation };\nconst installations = {\n get: (doc: Document) => (doc as DocumentWithInstallation)[INSTALLATION_KEY],\n set: (doc: Document, value: Installation) => {\n (doc as DocumentWithInstallation)[INSTALLATION_KEY] = value;\n },\n delete: (doc: Document) => {\n delete (doc as DocumentWithInstallation)[INSTALLATION_KEY];\n },\n};\n\n/** Install the takeover on `doc`. Returns the release function. */\nexport function acquireTitleTooltips(doc: Document | undefined = typeof document === \"undefined\" ? undefined : document): () => void {\n if (!doc) return () => {};\n const existing = installations.get(doc);\n if (existing) {\n existing.count += 1;\n } else {\n installations.set(doc, { count: 1, uninstall: install(doc) });\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const current = installations.get(doc);\n if (!current) return;\n current.count -= 1;\n if (current.count <= 0) {\n current.uninstall();\n installations.delete(doc);\n }\n };\n}\n\nfunction install(doc: Document): () => void {\n const win = doc.defaultView;\n let active: HTMLElement | null = null;\n let surface: HTMLDivElement | null = null;\n let openTimer: ReturnType<typeof setTimeout> | undefined;\n let closeTimer: ReturnType<typeof setTimeout> | undefined;\n let lastClosedAt = 0;\n /** A press began on the tooltip (selecting its text): it must not close until release. */\n let holding = false;\n\n const HTMLElementCtor = win?.HTMLElement;\n\n const titledAncestor = (node: EventTarget | null): HTMLElement | null => {\n if (!HTMLElementCtor || !(node instanceof win!.Node)) return null;\n const start = node instanceof HTMLElementCtor ? node : (node as Node).parentElement;\n if (!start) return null;\n const el = start.closest<HTMLElement>(`[title], [${TITLE_TOOLTIP_ATTR}]`);\n if (!el || !(el instanceof HTMLElementCtor)) return null;\n if (el.closest(`[${NATIVE_TITLE_OPT_OUT_ATTR}]`)) return null;\n return el;\n };\n\n const textOf = (el: HTMLElement) => clipTooltipText(el.getAttribute(TITLE_TOOLTIP_ATTR) ?? el.getAttribute(\"title\") ?? \"\");\n\n const lift = (el: HTMLElement) => {\n const title = el.getAttribute(\"title\");\n if (title === null) return;\n el.setAttribute(TITLE_TOOLTIP_ATTR, title);\n el.removeAttribute(\"title\");\n };\n\n const restore = (el: HTMLElement) => {\n const held = el.getAttribute(TITLE_TOOLTIP_ATTR);\n if (held === null) return;\n // An author who changed or removed the title while it was lifted wins:\n // only put ours back when nothing re-set it in the meantime.\n if (!el.hasAttribute(\"title\")) el.setAttribute(\"title\", held);\n el.removeAttribute(TITLE_TOOLTIP_ATTR);\n };\n\n const ensureSurface = () => {\n if (surface && surface.isConnected) return surface;\n surface = doc.createElement(\"div\");\n surface.setAttribute(\"role\", \"tooltip\");\n surface.setAttribute(\"data-slot\", \"title-tooltip\");\n surface.className = SURFACE_CLASS;\n surface.style.position = \"fixed\";\n surface.style.zIndex = String(TOOLTIP_LAYER_Z);\n surface.style.visibility = \"hidden\";\n doc.body.appendChild(surface);\n return surface;\n };\n\n /**\n * THE PART OF `el` A PERSON CAN SEE: its box clipped by every ancestor that clips (scrolls or hides\n * overflow) and by the window. A truncated cell in a sideways-scrolling table is far wider than its\n * visible part; anchored to the whole box the tooltip landed at the window's edge (2026-10-14).\n */\n const visibleRect = (el: HTMLElement, vw: number, vh: number) => {\n const box = el.getBoundingClientRect();\n let left = box.left;\n let top = box.top;\n let right = box.right;\n let bottom = box.bottom;\n for (let node = el.parentElement; node && node !== doc.body && node !== doc.documentElement; node = node.parentElement) {\n const cs = win?.getComputedStyle(node);\n if (!cs) break;\n const clipsX = cs.overflowX !== \"visible\" || cs.overflow === \"hidden\";\n const clipsY = cs.overflowY !== \"visible\" || cs.overflow === \"hidden\";\n if (!clipsX && !clipsY) continue;\n const clip = node.getBoundingClientRect();\n if (clipsX) { left = Math.max(left, clip.left); right = Math.min(right, clip.right); }\n if (clipsY) { top = Math.max(top, clip.top); bottom = Math.min(bottom, clip.bottom); }\n }\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n right = Math.min(right, vw || right);\n bottom = Math.min(bottom, vh || bottom);\n // Nothing of it is visible (scrolled away under the pointer is impossible, but a test DOM can say so): the box itself.\n if (right <= left || bottom <= top) return box;\n return { left, top, right, bottom, width: right - left, height: bottom - top };\n };\n\n const preferredSide = (el: HTMLElement): Side => tooltipSide(el);\n\n const place = (el: HTMLElement, node: HTMLDivElement) => {\n // The VISIBLE viewport, not the window: inside a clipped host (the kind\n // sandbox frame is window-wide but shown only at its column) the visual\n // viewport is what the reader sees, so a tooltip never lands past it.\n const vw = win?.visualViewport?.width ?? win?.innerWidth ?? 0;\n const vh = win?.visualViewport?.height ?? win?.innerHeight ?? 0;\n const anchor = visibleRect(el, vw, vh);\n const box = node.getBoundingClientRect();\n const fits: Record<Side, boolean> = {\n top: anchor.top - GAP_PX - box.height >= EDGE_PX,\n bottom: anchor.bottom + GAP_PX + box.height <= vh - EDGE_PX,\n left: anchor.left - GAP_PX - box.width >= EDGE_PX,\n right: anchor.right + GAP_PX + box.width <= vw - EDGE_PX,\n };\n const opposite: Record<Side, Side> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n const wanted = preferredSide(el);\n const side: Side = fits[wanted] ? wanted : fits[opposite[wanted]] ? opposite[wanted] : wanted;\n\n let x: number;\n let y: number;\n if (side === \"top\" || side === \"bottom\") {\n x = anchor.left + anchor.width / 2 - box.width / 2;\n y = side === \"top\" ? anchor.top - GAP_PX - box.height : anchor.bottom + GAP_PX;\n } else {\n y = anchor.top + anchor.height / 2 - box.height / 2;\n x = side === \"left\" ? anchor.left - GAP_PX - box.width : anchor.right + GAP_PX;\n }\n x = Math.min(Math.max(x, EDGE_PX), Math.max(EDGE_PX, vw - EDGE_PX - box.width));\n y = Math.min(Math.max(y, EDGE_PX), Math.max(EDGE_PX, vh - EDGE_PX - box.height));\n // Placed with `left`/`top`, NEVER `transform`: the open animation\n // (`.matrx-motion-popper`) animates `transform`, and a running animation\n // overrides an inline transform — the chip sat at the page's top-left\n // corner for the whole animation, then jumped to its control (2026-10-08).\n node.style.left = `${Math.round(x)}px`;\n node.style.top = `${Math.round(y)}px`;\n node.setAttribute(\"data-side\", side);\n };\n\n const isShown = (node: HTMLElement, root: HTMLElement) => {\n const rect = node.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) return false;\n for (let cur: HTMLElement | null = node; cur; cur = cur === root ? null : cur.parentElement) {\n const cs = win?.getComputedStyle(cur);\n if (!cs) return false;\n if (cs.display === \"none\" || cs.visibility === \"hidden\" || Number(cs.opacity) === 0) return false;\n }\n return true;\n };\n\n /**\n * A tooltip that repeats text the person can already read in full is noise\n * (an expanded sidebar row, a \"Save\" button titled \"Save\"). It still shows\n * when that text is hidden (a collapsed rail's label) or cut off\n * (truncated) — the two cases a title exists for.\n */\n const isClipped = (host: HTMLElement, root: HTMLElement) => {\n for (let node: HTMLElement | null = host; node; node = node.parentElement) {\n if (node.scrollWidth > node.clientWidth + 1 && node.clientWidth > 0) return true;\n if (node.scrollHeight > node.clientHeight + 1 && node.clientHeight > 0) return true;\n if (node === root) break;\n }\n return false;\n };\n\n const repeatsVisibleText = (el: HTMLElement, text: string) => {\n const norm = (t: string) => t.replace(/\\s+/g, \" \").trim().toLowerCase();\n const want = norm(text);\n if (!want || !win) return false;\n const walker = doc.createTreeWalker(el, win.NodeFilter.SHOW_TEXT);\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n if (norm(node.textContent ?? \"\") !== want) continue;\n const host = node.parentElement;\n if (!host || !isShown(host, el)) continue;\n // Cut off is measured on the BOX that clips: an inline host (a span inside a truncating\n // cell) has no box width of its own, so every ancestor up to the titled element is asked.\n if (isClipped(host, el)) continue;\n return true;\n }\n return false;\n };\n\n const show = (el: HTMLElement, instant: boolean) => {\n if (active !== el) return;\n // A Radix tooltip trigger shows its own tooltip — never a second one.\n if (el.closest(`[${TOOLTIP_TRIGGER_ATTR}]`)) return;\n const text = textOf(el);\n if (!text || !el.isConnected) return;\n if (repeatsVisibleText(el, text)) return;\n const node = ensureSurface();\n node.textContent = text;\n node.style.visibility = \"hidden\";\n // Measure and place BEFORE the open state starts the animation: measured\n // mid-animation the box reads at its 0.95 entry scale and lands off-centre.\n node.removeAttribute(\"data-state\");\n // The surface is ONE shared fixed element that keeps the `left` of its last\n // placement. Measured there, a longer text wraps against the room that is\n // left of the OLD spot, reads one line too tall, and lands a line too high\n // once it moves (the sandbox tooltip spec caught a 16px extra gap). Rewind\n // to the origin so the box is measured at its natural, unwrapped size.\n node.style.left = \"0px\";\n node.style.top = \"0px\";\n place(el, node);\n node.setAttribute(\"data-state\", instant ? \"instant-open\" : \"delayed-open\");\n node.style.visibility = \"visible\";\n if (el.id) node.id = `${el.id}-title-tooltip`;\n };\n\n const hide = () => {\n if (openTimer !== undefined) clearTimeout(openTimer);\n openTimer = undefined;\n cancelClose();\n holding = false;\n if (surface && surface.style.visibility === \"visible\") lastClosedAt = Date.now();\n if (surface) {\n surface.style.visibility = \"hidden\";\n surface.removeAttribute(\"data-state\");\n }\n };\n\n const cancelClose = () => {\n if (closeTimer !== undefined) clearTimeout(closeTimer);\n closeTimer = undefined;\n };\n\n const inSurface = (node: EventTarget | null) =>\n !!surface && !!win && node instanceof win.Node && surface.contains(node);\n\n const hasSelectionInSurface = () => {\n const sel = win?.getSelection();\n return !!sel && !sel.isCollapsed && !!surface && !!sel.anchorNode && surface.contains(sel.anchorNode);\n };\n\n /** Close after the bridge delay unless the pointer reached the tooltip or text in it is selected. */\n const scheduleClose = () => {\n cancelClose();\n // Nothing is showing yet (the open delay has not run, or the text was not worth drawing): there is\n // nothing to bridge to, so leaving simply cancels.\n if (!surface || surface.style.visibility !== \"visible\") {\n deactivate();\n return;\n }\n closeTimer = setTimeout(() => {\n closeTimer = undefined;\n if (holding || hasSelectionInSurface()) return;\n deactivate();\n }, TOOLTIP_CLOSE_DELAY_MS);\n };\n\n const activate = (el: HTMLElement) => {\n cancelClose();\n if (active === el) return;\n deactivate();\n active = el;\n lift(el);\n const instant = Date.now() - lastClosedAt < SKIP_DELAY_MS;\n if (instant) show(el, true);\n else openTimer = setTimeout(() => show(el, false), OPEN_DELAY_MS);\n };\n\n const deactivate = () => {\n hide();\n if (active) restore(active);\n active = null;\n };\n\n // A touch has no hover: the tap that focuses a button must not open its tooltip, and a tooltip\n // that is open when a finger lands closes. The compat mouse events and the focus a tap leaves\n // behind used to pin \"Copy chart source\" over the chart title on a phone (review 5, G13).\n let lastTouchAt = Number.NEGATIVE_INFINITY;\n const TOUCH_FOCUS_WINDOW_MS = 1000;\n const onPointerOver = (e: PointerEvent) => {\n if (e.pointerType === \"touch\") {\n lastTouchAt = Date.now();\n if (active) deactivate();\n return;\n }\n if (inSurface(e.target)) {\n cancelClose();\n return;\n }\n if (holding || hasSelectionInSurface()) {\n // Text is being selected in the tooltip: another control passing under the pointer must not replace it.\n return;\n }\n const el = titledAncestor(e.target);\n if (el) activate(el);\n else if (active && closeTimer === undefined) scheduleClose();\n };\n\n const onPointerOut = (e: PointerEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && (active.contains(next) || inSurface(next))) return;\n if (inSurface(e.target)) {\n if (holding) return;\n scheduleClose();\n return;\n }\n scheduleClose();\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if (e.pointerType === \"touch\") lastTouchAt = Date.now();\n if (inSurface(e.target)) {\n // Selecting the tooltip's text: keep it open until the press ends.\n holding = true;\n cancelClose();\n return;\n }\n deactivate();\n };\n\n const onPointerUp = () => {\n if (!holding) return;\n holding = false;\n if (!hasSelectionInSurface()) scheduleClose();\n };\n\n const onFocusIn = (e: FocusEvent) => {\n if (Date.now() - lastTouchAt < TOUCH_FOCUS_WINDOW_MS) return;\n const el = titledAncestor(e.target);\n if (!el) return;\n let visible = true;\n try {\n visible = (e.target as Element).matches(\":focus-visible\");\n } catch {\n visible = true;\n }\n if (visible) activate(el);\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && active.contains(next)) return;\n deactivate();\n };\n\n const onDismiss = (e?: Event) => {\n if (e && inSurface(e.target)) return;\n deactivate();\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") deactivate();\n };\n\n doc.addEventListener(\"pointerover\", onPointerOver, true);\n doc.addEventListener(\"pointerout\", onPointerOut, true);\n doc.addEventListener(\"focusin\", onFocusIn, true);\n doc.addEventListener(\"focusout\", onFocusOut, true);\n doc.addEventListener(\"pointerdown\", onPointerDown, true);\n doc.addEventListener(\"pointerup\", onPointerUp, true);\n doc.addEventListener(\"keydown\", onKeyDown, true);\n doc.addEventListener(\"scroll\", onDismiss, true);\n win?.addEventListener(\"blur\", onDismiss);\n\n return () => {\n deactivate();\n doc.removeEventListener(\"pointerover\", onPointerOver, true);\n doc.removeEventListener(\"pointerout\", onPointerOut, true);\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n doc.removeEventListener(\"focusout\", onFocusOut, true);\n doc.removeEventListener(\"pointerdown\", onPointerDown, true);\n doc.removeEventListener(\"pointerup\", onPointerUp, true);\n doc.removeEventListener(\"keydown\", onKeyDown, true);\n doc.removeEventListener(\"scroll\", onDismiss, true);\n win?.removeEventListener(\"blur\", onDismiss);\n surface?.remove();\n surface = null;\n };\n}\n","\"use client\";\n\n// THE TAP-TARGET GUARD — development builds only.\n//\n// The lock layer in tap-target.css makes a tap button's own box, pill and\n// glyph impossible to resize from outside. What CSS cannot stop is a caller\n// bending the system AROUND the button: a parent that adds `gap` between two\n// tap buttons, a wrapper with margin or padding, a local override of a\n// `--matrx-tap-*` token, a utility class smuggled in through `className`.\n// After a tap button mounts, this guard measures it in the real layout and,\n// on any of those, marks it `data-matrx-tap-violation`: the stylesheet then\n// paints it as a giant red box carrying the reason, and the console names\n// the element.\n//\n// OFF until the host turns it on with `enableTapTargetGuard()` — from code the\n// HOST compiles, e.g. matrx-frontend's dev-only client boot. Never gate it on\n// `process.env.NODE_ENV` in here: this package's own build inlines that\n// expression, so a \"dev only\" check written here would run in production too\n// (see @ai-matrx/associations' context.tsx for the outage that taught this).\n\nimport { useCallback, useRef, type MutableRefObject, type Ref } from \"react\";\nimport { layoutScale } from \"../layout-scale\";\n\n// A `Symbol.for` slot on globalThis, like the link seam: the `.` and\n// `./buttons` bundles each inline this module, and one switch must reach both.\nconst GUARD_SLOT = Symbol.for(\"@ai-matrx/tap-target:guard\");\ntype GlobalWithGuard = typeof globalThis & { [GUARD_SLOT]?: boolean };\n\n/** Turn the development guard on (or off). Call once at client boot, only in\n * development builds of the host. */\nexport function enableTapTargetGuard(on = true): void {\n (globalThis as GlobalWithGuard)[GUARD_SLOT] = on;\n if (on) startPillInsetScan();\n}\n\nfunction guardOn(): boolean {\n return (globalThis as GlobalWithGuard)[GUARD_SLOT] === true;\n}\n\nconst TOKENS = [\n \"--matrx-tap-box\",\n \"--matrx-tap-gap\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-icon-size\",\n \"--matrx-tap-touch-min\",\n \"--matrx-tap-target-size\",\n] as const;\n\n/** The only scopes that may move tap tokens, and which ones — each owned by\n * this package's own CSS: the table density scales (tap-target.css) and\n * Alchemy's 18px trigger glyph (content-transfer.css). */\nconst SANCTIONED: ReadonlyArray<{ scope: string; tokens: ReadonlySet<string> }> = [\n {\n scope: \"[data-matrx-table][data-matrx-table-density]\",\n tokens: new Set([\n \"--matrx-tap-target-size\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-icon-size\",\n ]),\n },\n { scope: \"[data-alchemy-trigger]\", tokens: new Set([\"--matrx-tap-icon-size\"]) },\n // THE ONE CONTROL scope (controls.css): tap buttons beside the 28px controls\n // take the controls' height — a 28px pill in a 34px box, the same 6px apart.\n {\n scope: \"[data-matrx-controls]\",\n tokens: new Set([\n \"--matrx-tap-target-size\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-pill-sm-size\",\n ]),\n },\n];\nconst TABLE_SCOPE = SANCTIONED[0]!.scope;\nconst CONTROL_SCOPE = SANCTIONED[2]!.scope;\nconst TAP_ITEM = \".matrx-tap-target, .matrx-tap-group\";\n\n/** `className` on a tap button is the GLYPH COLOR. Anything that sizes,\n * spaces, positions or fills is misuse. */\nconst NON_COLOR_CLASS =\n /^(?:[^\\s:]+:)*!?-?(?:\\[&|scale|translate|h|w|size|min-h|min-w|max-h|max-w|p|px|py|ps|pe|pt|pb|pl|pr|m|mx|my|ms|me|mt|mb|ml|mr|gap|space-x|space-y|bg|rounded|border|ring|shadow|absolute|relative|fixed|sticky|inset|top|left|right|bottom|flex|grid|block|inline|hidden|z|shrink|grow|basis|self|order)(?:-|$|\\[)/;\n\nexport function classNameMisuse(className: string | undefined): string | null {\n if (!guardOn() || !className) return null;\n const bad = className.split(/\\s+/).filter((t) => t && NON_COLOR_CLASS.test(t));\n return bad.length\n ? `className is the glyph color only — remove \"${bad.join(\" \")}\"`\n : null;\n}\n\n/**\n * The horizontal space a wrapper adds around what it holds. An `auto` margin (`ml-auto` pushing a\n * toolbar's actions to the end) only aligns — the browser resolves it to pixels in\n * `getComputedStyle`, so read the computed keyword from the typed OM and count it as zero.\n */\nexport function wrapperSpace(el: Element, view: Window): number {\n const pcs = view.getComputedStyle(el);\n const typed = (el as Element & { computedStyleMap?: () => { get(p: string): unknown } }).computedStyleMap?.();\n const margin = (prop: \"margin-left\" | \"margin-right\", resolved: string) =>\n typed && String(typed.get(prop)) === \"auto\" ? 0 : px(resolved);\n return margin(\"margin-left\", pcs.marginLeft) + margin(\"margin-right\", pcs.marginRight) + px(pcs.paddingLeft) + px(pcs.paddingRight);\n}\n\nfunction px(value: string): number {\n const n = Number.parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n}\n\nfunction describe(el: Element): string {\n const cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).slice(0, 4).join(\".\") : \"\";\n return `<${el.tagName.toLowerCase()}${cls ? `.${cls}` : \"\"}>`;\n}\n\n/** Elements that ride along with a tap button without taking space from it\n * (a badge, a capsule, a tooltip portal anchor). */\nfunction isDecor(el: Element, view: Window): boolean {\n const cs = view.getComputedStyle(el);\n return cs.position === \"absolute\" || cs.position === \"fixed\" || cs.display === \"none\";\n}\n\nfunction tapCount(el: Element): number {\n return el.matches(TAP_ITEM) ? 1 : el.querySelectorAll(TAP_ITEM).length;\n}\n\n/** Visible text in `container` outside `tap` and outside decor (a badge's\n * count is decor) — a wrapper with its own words is a chip, not a wrapper. */\nfunction ownText(container: Element, tap: Element, view: Window): string {\n let out = \"\";\n const walk = (node: Node) => {\n if (node === tap) return;\n if (node.nodeType === 3) out += node.textContent ?? \"\";\n else if (node.nodeType === 1 && !isDecor(node as Element, view)) node.childNodes.forEach(walk);\n };\n container.childNodes.forEach(walk);\n return out.trim();\n}\n\n/** True when `child` is a tap button, or a plain wrapper whose only content\n * is ONE tap button (plus decor) — never a search box that happens to hold\n * a clear button, never a chip with words. */\nfunction isTapSlot(child: Element, view: Window): boolean {\n if (child.matches(TAP_ITEM)) return true;\n if (tapCount(child) !== 1) return false;\n const tap = child.querySelector(TAP_ITEM)!;\n const controls = Array.from(child.querySelectorAll(\"input, select, textarea, button, a, [role='button']\"));\n if (controls.some((c) => c !== tap && !tap.contains(c))) return false;\n return ownText(child, tap, view) === \"\";\n}\n\nlet probe: { key: string; target: number; pill: number; sm: number; smPill: number; wide: number; icon: number } | null = null;\n\n/** What the package's own CSS produces with no surrounding context — the\n * canon every mounted button is measured against. Re-measured whenever the\n * root tokens change (the lab page switches the gap). */\nfunction canon(doc: Document) {\n const view = doc.defaultView!;\n const root = view.getComputedStyle(doc.documentElement);\n const key = TOKENS.map((t) => root.getPropertyValue(t)).join(\"|\");\n if (probe?.key === key) return probe;\n const host = doc.createElement(\"div\");\n host.setAttribute(\"aria-hidden\", \"true\");\n host.style.cssText = \"position:absolute;visibility:hidden;pointer-events:none;left:-9999px;top:0\";\n host.innerHTML =\n '<button class=\"matrx-tap-target\"><div class=\"matrx-tap-pill\"><svg class=\"matrx-tap-icon\"></svg></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-sm\"><div class=\"matrx-tap-pill matrx-tap-pill-sm\"></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-inline\"><div class=\"matrx-tap-pill matrx-tap-pill-inline\"></div></button>';\n doc.body.appendChild(host);\n const [a, b, w] = Array.from(host.children) as HTMLElement[];\n probe = {\n key,\n target: a!.offsetHeight,\n pill: (a!.firstElementChild as HTMLElement).offsetHeight,\n icon: px(view.getComputedStyle(a!.querySelector(\"svg\")!).height),\n sm: b!.offsetHeight,\n smPill: (b!.firstElementChild as HTMLElement).offsetHeight,\n wide: (w!.firstElementChild as HTMLElement).offsetHeight,\n };\n host.remove();\n return probe;\n}\n\n/** Returns the first rule this mounted tap button breaks, or null. */\nexport function findTapViolation(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n const cs = view.getComputedStyle(el);\n if (cs.display === \"none\") return null;\n\n // 1. Tokens are the package's alone. Only the table-density scope may move\n // the three it owns.\n const root = view.getComputedStyle(doc.documentElement);\n // Both scaled scopes size by their own tokens; the canon check below reads\n // the root canon, so it applies outside them only.\n const inTable = el.closest(TABLE_SCOPE) !== null || el.closest(CONTROL_SCOPE) !== null;\n const moved = new Set<string>();\n for (const token of TOKENS) {\n const mine = cs.getPropertyValue(token).trim();\n const base = root.getPropertyValue(token).trim();\n if (mine === base) continue;\n if (!SANCTIONED.some((s) => s.tokens.has(token) && el.closest(s.scope))) {\n return `${token} overridden to \"${mine}\" — tap geometry is not configurable`;\n }\n moved.add(token);\n }\n\n // 2. Measured geometry equals the canon (outside table density, which\n // sizes by its own tokens).\n const sm = el.classList.contains(\"matrx-tap-target-sm\");\n const inline = /matrx-tap-target-(?:inline|mobile-icon-only)/.test(el.className);\n const pill = el.querySelector<HTMLElement>(\":scope > .matrx-tap-pill\");\n const icon = pill?.querySelector(\".matrx-tap-icon\") ?? null;\n // A host touch floor (min-width / min-height) may enlarge a box; that is\n // the floor working, not a bend.\n const floored =\n px(cs.minHeight) >= el.offsetHeight - 0.5 || px(cs.minWidth) >= el.offsetWidth - 0.5;\n if (!inTable && pill && !floored) {\n const c = canon(doc);\n const box = sm ? c.sm : c.target;\n // A labeled pill is a WIDE shape (shorter than a round one); below the\n // `sm` breakpoint a mobile-icon-only pill is round again — either is canon.\n const pillSizes = sm ? [c.smPill] : inline ? [c.pill, c.wide] : [c.pill];\n if (Math.abs(el.offsetHeight - box) > 0.5) return `button is ${el.offsetHeight}px tall, canon is ${box}px`;\n if (!inline && Math.abs(el.offsetWidth - box) > 0.5) return `button is ${el.offsetWidth}px wide, canon is ${box}px`;\n if (!pillSizes.some((p) => Math.abs(pill.offsetHeight - p) <= 0.5)) {\n return `pill is ${pill.offsetHeight}px, canon is ${pillSizes.join(\" or \")}px`;\n }\n if (icon && !moved.has(\"--matrx-tap-icon-size\")) {\n const size = px(view.getComputedStyle(icon).height);\n if (Math.abs(size - c.icon) > 0.5) return `glyph is ${size}px, canon is ${c.icon}px`;\n }\n }\n\n // 3. Nothing adds space around it. Climb the wrappers that hold only this\n // button (plus decor such as a badge); none may carry inline margin or\n // padding. A tap button inside a group is represented by its group.\n let slot: Element = el;\n if (el.parentElement?.matches(\".matrx-tap-group-row, .matrx-tap-search-measure\")) {\n const group = el.closest(\".matrx-tap-group\");\n if (group && tapCount(el.parentElement) > 1) return null;\n slot = group ?? el;\n }\n for (let depth = 0; depth < 2; depth += 1) {\n const parent: HTMLElement | null = slot.parentElement;\n if (!parent || parent === doc.body) break;\n const others = Array.from(parent.children).filter((c) => c !== slot && !isDecor(c, view));\n if (others.length > 0) break; // `parent` is the row\n if (ownText(parent, slot, view) !== \"\") break; // a chip or a titled header\n const space = wrapperSpace(parent, view);\n if (space > 0.5) {\n return `${describe(parent)} adds ${space}px around a tap button — tap buttons space themselves`;\n }\n slot = parent;\n }\n\n // 4. The row adds no gap between tap buttons.\n const row = slot.parentElement;\n if (row) {\n const rcs = view.getComputedStyle(row);\n const flexOrGrid = /flex|grid/.test(rcs.display);\n const neighbours = Array.from(row.children).filter((c) => c !== slot && isTapSlot(c, view));\n if (flexOrGrid && neighbours.length > 0) {\n const horizontal = rcs.display.includes(\"grid\") || !rcs.flexDirection.startsWith(\"column\");\n const gap = px(horizontal ? rcs.columnGap : rcs.rowGap);\n if (gap > 0.5) {\n return `${describe(row)} adds a ${gap}px gap between tap buttons — remove it; tap buttons space themselves`;\n }\n }\n }\n return null;\n}\n\n/* ------------------------------------------------------------------ */\n/* PLACEMENT — the three rules a tap button's SURROUNDINGS must keep */\n/* (owner, 2026-10-02). Reported as a WARNING (a dashed outline and one */\n/* console error naming the fix), not the misuse box: they are about */\n/* the page around the button, and the whole app is being brought into */\n/* line with them. */\n/* 1. GLASS ONLY FLOATS — glass is see-through; it belongs on a bar */\n/* that floats over moving content (position fixed/sticky) or on a */\n/* plane marked `data-matrx-glass-plane`. On a page, card, toast or */\n/* table use `variant=\"transparent\"` / a solid group. */\n/* 2. ALL GLASS OR NONE — a glass item's row holds only glass items */\n/* (glass tap buttons, glass groups, or `data-matrx-glass` pieces). */\n/* 3. NEIGHBOURS KEEP THEIR HALF-GAP — a tap box carries 3px of unseen */\n/* space each side (box − pill = one gap, 6px). Anything beside it */\n/* adds its own 3px, so the visible distance is always one gap. */\n/* ------------------------------------------------------------------ */\n\nconst GLASS = \".matrx-glass-thin-border, .matrx-glass-interactive\";\n\nfunction isGlassItem(node: Element): boolean {\n if (node.hasAttribute(\"data-matrx-glass\")) return true;\n if (node.matches(\".matrx-tap-group\")) return node.querySelector(\":scope > .matrx-tap-group-capsule.matrx-glass-thin-border\") !== null;\n if (node.matches(\".matrx-tap-target\")) return node.querySelector(`:scope > .matrx-tap-pill:is(${GLASS})`) !== null;\n // A plain wrapper whose only content is ONE tap button (plus decor such as a\n // badge) is that button: a badge host around a glass button is glass.\n const view = node.ownerDocument.defaultView;\n if (view && isTapSlot(node, view)) return isGlassItem(node.querySelector(TAP_ITEM)!);\n return false;\n}\n\nconst SCROLLS = /^(auto|scroll|overlay)$/;\n\n/** True when `el` rides a bar over moving content: a fixed/sticky ancestor (or\n * a glass plane) reached BEFORE any scroll container. Inside a scroller the\n * button IS the moving content — an app root that is itself `position:\n * fixed` (the shell) must not make every page button \"float\". */\nfunction floats(el: Element, view: Window): boolean {\n for (let n: Element | null = el; n && n !== el.ownerDocument.body; n = n.parentElement) {\n if (n.hasAttribute(\"data-matrx-glass-plane\")) return true;\n const cs = view.getComputedStyle(n);\n if (cs.position === \"fixed\" || cs.position === \"sticky\") return true;\n if (n !== el && (SCROLLS.test(cs.overflowY) || SCROLLS.test(cs.overflowX))) return false;\n }\n return false;\n}\n\n/** True when the edge of `wrapper` that faces a neighbour (`side` is where the\n * wrapper sits relative to that neighbour) is itself a tap slot: that button\n * carries its own 3px half-gap, so the wrapper is spacing-correct however many\n * tap buttons it holds (the fading mic + More cluster beside Send). A wrapper\n * whose edge is text or a field is not — it still has to keep its distance. */\nfunction facesWithTapSlot(wrapper: Element, side: \"after\" | \"before\", view: Window): boolean {\n for (let node: Element | null = wrapper; node; ) {\n if (isTapSlot(node, view)) return true;\n const kids: Element[] = Array.from(node.children).filter((c) => !isDecor(c, view));\n node = (side === \"after\" ? kids[0] : kids[kids.length - 1]) ?? null;\n }\n return false;\n}\n\nfunction visible(el: Element, view: Window): boolean {\n if (el.getAttribute(\"aria-hidden\") === \"true\" || isDecor(el, view)) return false;\n const r = el.getBoundingClientRect();\n return r.width > 1 && r.height > 1;\n}\n\nconst INTERACTIVE = \"button, a[href], input, select, textarea, [role='button'], svg, img\";\n\n/** The box the eye sees on the side of `sib` that faces the tap button. An\n * unpainted layout wrapper (no fill, no border on that side, no words of its\n * own) is invisible, so the distance is judged at the first thing inside it —\n * the wrapper around ProTextarea's mic sits 3px from Expand while the mic\n * capsule, which keeps its own 3px margin, sits one gap away (2026-10-13). */\nfunction facingBox(sib: Element, side: \"after\" | \"before\", view: Window): Element {\n let node = sib;\n for (;;) {\n if (node.matches(INTERACTIVE)) return node;\n const cs = view.getComputedStyle(node);\n const fill = cs.backgroundColor;\n if ((fill && fill !== \"rgba(0, 0, 0, 0)\" && fill !== \"transparent\") || px(side === \"after\" ? cs.borderLeftWidth : cs.borderRightWidth) > 0) {\n return node;\n }\n if (Array.from(node.childNodes).some((c) => c.nodeType === 3 && c.textContent?.trim())) return node;\n const kids = Array.from(node.children).filter((c) => visible(c, view));\n const next = side === \"after\" ? kids[0] : kids[kids.length - 1];\n if (!next) return node;\n node = next;\n }\n}\n\n/** The first placement rule this tap button's surroundings break, or null. */\nexport function findTapPlacementWarning(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n // A button inside a group is judged as its group.\n const slot: Element = el.closest(\".matrx-tap-group\") ?? el;\n const glass = isGlassItem(slot);\n\n if (glass && !floats(slot, view)) {\n return 'glass on a solid surface — glass only floats over moving content; use variant=\"transparent\" (or a solid group)';\n }\n\n const row = slot.parentElement;\n if (!row) return null;\n if (glass) {\n const mixed = Array.from(row.children).find((c) => c !== slot && visible(c, view) && !isGlassItem(c));\n if (mixed) return `glass beside non-glass ${describe(mixed)} — make the row all glass or none`;\n }\n\n const pill = (el.querySelector(\":scope > .matrx-tap-pill\") as HTMLElement | null) ?? (slot.querySelector(\".matrx-tap-group-capsule\") as HTMLElement | null);\n if (!pill) return null;\n const gap = px(view.getComputedStyle(el).getPropertyValue(\"--matrx-tap-gap\")) || 6;\n const p = pill.getBoundingClientRect();\n if (p.width === 0) return null;\n // Distances are judged in LAYOUT pixels: inside a zoomed (transformed) tile a screen distance\n // is the layout distance times the scale.\n const scale = layoutScale(pill);\n for (const [side, sib] of [[\"after\", slot.nextElementSibling], [\"before\", slot.previousElementSibling]] as const) {\n if (!sib || !visible(sib, view) || isTapSlot(sib, view) || isGlassItem(sib) || facesWithTapSlot(sib, side, view)) continue;\n if (Math.abs(sib.getBoundingClientRect().top + sib.getBoundingClientRect().height / 2 - (p.top + p.height / 2)) > p.height) continue; // not on this row\n const box = facingBox(sib, side, view);\n const r = box.getBoundingClientRect();\n const cs = view.getComputedStyle(box);\n const distance =\n (side === \"after\" ? r.left - p.right : p.left - r.right) / scale + (side === \"after\" ? px(cs.paddingLeft) : px(cs.paddingRight));\n if (distance < gap - 0.5) {\n return `${describe(sib)} sits ${Math.round(distance)}px from the pill — anything beside a tap button adds its own ${gap / 2}px (the box only carries ${gap / 2}px)`;\n }\n }\n return null;\n}\n\nconst reported = new Set<string>();\n\nfunction report(el: HTMLElement, reason: string) {\n el.setAttribute(\"data-matrx-tap-violation\", reason);\n const key = `${reason}@${el.getAttribute(\"aria-label\") ?? el.textContent ?? \"\"}`;\n if (reported.has(key)) return;\n reported.add(key);\n console.error(`[tap-target] ${reason}`, el);\n}\n\nconst mounted = new Set<HTMLElement>();\nlet resizeTimer: ReturnType<typeof setTimeout> | null = null;\nlet listening = false;\n\nfunction check(node: HTMLElement) {\n const reason = findTapViolation(node);\n if (reason) {\n report(node, reason);\n return;\n }\n node.removeAttribute(\"data-matrx-tap-violation\");\n const warning = findTapPlacementWarning(node);\n if (warning) {\n node.setAttribute(\"data-matrx-tap-warning\", warning);\n const key = `w:${warning}@${node.getAttribute(\"aria-label\") ?? \"\"}`;\n if (!reported.has(key)) {\n reported.add(key);\n console.error(`[tap-target] ${warning}`, node);\n }\n } else node.removeAttribute(\"data-matrx-tap-warning\");\n}\n\nfunction listenForResize(view: Window) {\n if (listening) return;\n listening = true;\n view.addEventListener(\"resize\", () => {\n if (resizeTimer) clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => mounted.forEach((n) => (n.isConnected ? check(n) : mounted.delete(n))), 200);\n });\n // A button is judged once, at mount — but its neighbours keep changing (a\n // loading placeholder becomes the real control). Re-judge a button when the\n // row it sits in gains or loses children, so a mark never outlives the\n // neighbour it named (2026-10-13: \"New run\" kept a red outline for a\n // skeleton that had already left the header).\n const Observer = (view as Window & { MutationObserver?: typeof MutationObserver }).MutationObserver;\n if (!Observer || !view.document.body) return;\n const changedRows = new Set<Node>();\n let rowTimer: ReturnType<typeof setTimeout> | null = null;\n new Observer((records) => {\n for (const r of records) changedRows.add(r.target);\n if (rowTimer) clearTimeout(rowTimer);\n rowTimer = setTimeout(() => {\n mounted.forEach((n) => {\n if (!n.isConnected) return void mounted.delete(n);\n const row = (n.closest(\".matrx-tap-group\") ?? n).parentElement;\n if (row && changedRows.has(row)) check(n);\n });\n changedRows.clear();\n }, 200);\n }).observe(view.document.body, { childList: true, subtree: true });\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) (ref as MutableRefObject<T | null>).current = value;\n}\n\n/**\n * The callback ref every tap trigger carries. In production it only forwards\n * the caller's ref; in development it also measures the trigger once it is in\n * the layout and paints a violation.\n */\nexport function useTapGuardRef<T extends HTMLElement>(\n forwarded: Ref<T> | undefined,\n propViolation: string | null,\n): (node: T | null) => void {\n const current = useRef<T | null>(null);\n return useCallback(\n (node: T | null) => {\n assignRef(forwarded, node);\n if (current.current && current.current !== node) mounted.delete(current.current);\n current.current = node;\n if (!guardOn() || !node) return;\n if (propViolation) {\n report(node, propViolation);\n return;\n }\n const view = node.ownerDocument.defaultView;\n if (!view) return;\n mounted.add(node);\n listenForResize(view);\n view.requestAnimationFrame(() => check(node));\n },\n [forwarded, propViolation],\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* THE PILL-INSET GUARD (0.60.10). A pill is balanced when its INK sits */\n/* the same distance from both edges. On 2026-10-04 every icon+label */\n/* pill read off-centre (1.3–3.3px) because padding was shaved on the */\n/* glyph side by a guess at the glyph's air. The trim in tap-target.css */\n/* now removes each glyph's real air; this measures the result in the */\n/* real layout and marks any pill whose ink insets differ by more than */\n/* 2px — dashed red outline + one console error naming both numbers. */\n/* ------------------------------------------------------------------ */\n\nconst PILL_TOLERANCE_PX = 2;\nconst PILL_ITEMS = \"button, a[href], [role='button'], [role='tab'], [role='radio'], [role='menuitem']\";\nconst PILL_CANDIDATES = \"button, a[href], [role='button'], .rounded-full, .matrx-tap-pill-inline, .matrx-tap-pill-mobile-icon-only\";\n\n/** Horizontal ink extents inside `el`: glyph geometry for svgs, text runs for text. */\nfunction inkExtents(el: Element): { left: number; right: number } | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view) return null;\n let left = Infinity;\n let right = -Infinity;\n const walker = doc.createTreeWalker(el, 0x1 | 0x4 /* SHOW_ELEMENT | SHOW_TEXT */);\n let n: Node | null;\n while ((n = walker.nextNode())) {\n if (n.nodeType === 1) {\n const node = n as Element;\n const cs = view.getComputedStyle(node);\n if (cs.display === \"none\" || cs.visibility === \"hidden\" || cs.position === \"absolute\") continue;\n const tag = node.tagName.toLowerCase();\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\") {\n // A picture (a favicon, an avatar) is ink by its box — it draws its own pixels, and a logo\n // renders exactly as it is, never tinted to make a guard see it (2026-10-13: every\n // favicon-led link pill read \"29px left vs 10px right\" because the image was invisible here).\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.min(left, r.left);\n right = Math.max(right, r.right);\n }\n continue;\n }\n if (tag !== \"svg\" && (node.getAttribute(\"role\") === \"status\" || node.getAttribute(\"role\") === \"progressbar\")) {\n // A busy spinner drawn with borders (its rings are absolute, so nothing below sees them)\n // is ink by its box: a pill whose icon turned into a spinner read \"44px left vs 20px right\".\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.min(left, r.left);\n right = Math.max(right, r.right);\n }\n continue;\n }\n if (tag !== \"svg\") {\n // A painted chip inside the pill (a count badge) is ink by its box: its fill is what the eye sees.\n const paintedChip = (cs.backgroundColor !== \"rgba(0, 0, 0, 0)\" && cs.backgroundColor !== \"transparent\") || parseFloat(cs.borderLeftWidth) > 0;\n if (paintedChip) {\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.min(left, r.left);\n right = Math.max(right, r.right);\n }\n }\n continue;\n }\n const svg = node as SVGGraphicsElement;\n if (typeof svg.getBBox !== \"function\" || typeof svg.getScreenCTM !== \"function\") continue;\n const bb = svg.getBBox();\n const ctm = svg.getScreenCTM();\n if (!ctm || bb.width === 0) continue;\n if (Math.abs(ctm.b) > 0.001 || Math.abs(ctm.c) > 0.001) {\n // A turning glyph (a busy spinner) has no fixed ink: judge it by its layout box, centered\n // where the rotation centers it — never by a mid-turn snapshot of its paths.\n const r = node.getBoundingClientRect();\n const half = (parseFloat(cs.width) || r.width) / 2;\n const mid = r.left + r.width / 2;\n left = Math.min(left, mid - half);\n right = Math.max(right, mid + half);\n continue;\n }\n const half = ((parseFloat(cs.strokeWidth) || 0) * Math.abs(ctm.a)) / 2;\n const x1 = ctm.a * bb.x + ctm.e;\n const x2 = ctm.a * (bb.x + bb.width) + ctm.e;\n left = Math.min(left, Math.min(x1, x2) - half);\n right = Math.max(right, Math.max(x1, x2) + half);\n } else if (n.nodeValue && n.nodeValue.trim()) {\n const parent = n.parentElement;\n if (!parent || parent.closest(\"svg\")) continue;\n const pcs = view.getComputedStyle(parent);\n if (pcs.visibility === \"hidden\" || pcs.position === \"absolute\") continue;\n const range = doc.createRange();\n range.selectNodeContents(n);\n // A truncated label (`truncate max-w-*`) draws only what its clipping box shows: its text\n // run keeps going past the ellipsis, so the run is clipped to every overflow-hiding box\n // between it and the pill (2026-10-18: a scope chip \"matrx-frontend (LCP test)\" read\n // \"9.0px left vs 5.7px right\" while its ellipsis sat exactly 9px from the edge).\n const clip = textClip(parent, el, view);\n for (const r of Array.from(range.getClientRects())) {\n if (r.width <= 0) continue;\n const rl = Math.max(r.left, clip.left);\n const rr = Math.min(r.right, clip.right);\n if (rr <= rl) continue;\n left = Math.min(left, rl);\n right = Math.max(right, rr);\n }\n }\n }\n return Number.isFinite(left) && Number.isFinite(right) ? { left, right } : null;\n}\n\n/** The horizontal window a text run can paint in: its overflow-clipping ancestors up to (excluding) `pill`. */\nfunction textClip(from: Element, pill: Element, view: Window): { left: number; right: number } {\n let left = -Infinity;\n let right = Infinity;\n for (let node: Element | null = from; node && node !== pill; node = node.parentElement) {\n const cs = view.getComputedStyle(node);\n // overflow-x, or the shorthand's first (x) value where a runtime does not expand it (jsdom)\n const clipsX = (cs.overflowX && cs.overflowX !== \"visible\") || (cs.overflow && !cs.overflow.startsWith(\"visible\"));\n if (clipsX) {\n const r = node.getBoundingClientRect();\n if (r.width > 0) {\n left = Math.max(left, r.left);\n right = Math.min(right, r.right);\n }\n }\n }\n return { left, right };\n}\n\nconst FIELDS = \"input, textarea, select, [contenteditable='true'], [role='textbox'], [role='searchbox'], [role='combobox']\";\n\n/**\n * Only a BUTTON can be a pill whose ink must balance: an interactive element,\n * or the painted pill inside one (a tap button's `.matrx-tap-pill-inline`).\n * A field — or a capsule that holds one, like a rounded search box — aligns its\n * text to an edge by design, and a non-interactive container (a status chip, a\n * wrapper painted `rounded-full`) is never a pill button (2026-10-09: the\n * messenger's search field and messaging's AI chips wore the red outline).\n */\nexport function isPillButton(el: Element): boolean {\n if (el.matches(FIELDS) || el.querySelector(FIELDS) !== null) return false;\n if (el.matches(PILL_ITEMS)) return true;\n if (el.parentElement?.closest(PILL_ITEMS)) return true;\n return el.querySelector(PILL_ITEMS) !== null;\n}\n\n/** Why this pill's ink is off-centre, or null. Only judges a pill — a capsule\n * (radius ≥ half its height) with its own fill or border, carrying ink. */\nexport function findPillInsetWarning(el: HTMLElement): string | null {\n const view = el.ownerDocument.defaultView;\n if (!view || !el.isConnected) return null;\n if (!isPillButton(el)) return null;\n const box = el.getBoundingClientRect();\n const scale = layoutScale(el);\n if (box.width / scale < 20 || box.height / scale < 16 || box.height / scale > 48) return null;\n const cs = view.getComputedStyle(el);\n if (parseFloat(cs.borderTopLeftRadius) < box.height / scale / 2 - 1) return null;\n const painted = cs.backgroundColor !== \"rgba(0, 0, 0, 0)\" && cs.backgroundColor !== \"transparent\";\n if (!painted && !(parseFloat(cs.borderLeftWidth) > 0)) return null;\n // A wide capsule (a stretched select or field) aligns content to an edge on purpose.\n if (box.width / scale > 320) return null;\n // Ink balance is a question only for CENTERED content. A select trigger (value left, chevron\n // right), a field, or a full-width action row that says justify-start aligns its content on\n // purpose — content alignment is placement, not an inset to balance.\n if (cs.display.includes(\"flex\") && ![\"center\", \"normal\"].includes(cs.justifyContent)) return null;\n if (el.matches(\"[data-matrx-control='select'], [data-matrx-control='field']\")) return null;\n // A switch, checkbox or slider carries STATE, not a label: its thumb sits at one end by design\n // (measured 2026-10-04: every connector switch read \"18px left vs 2px right\" in the chat composer).\n if (el.matches(\"[role='switch'], [role='checkbox'], [role='slider'], [role='radio']\")) return null;\n // A TRACK of several controls (a segmented nav, a tab strip) is a container, not a pill: its\n // items sit where the selection puts them, so the ink is lopsided by design — each item is\n // judged on its own (measured 2026-10-05: the shell route nav's icon track read 2px vs 12.5px\n // at 768 because the selected item's fill hugs one end and the last glyph carries its air).\n if (el.querySelectorAll(PILL_ITEMS).length > 1) return null;\n const ink = inkExtents(el);\n if (!ink) return null;\n const left = (ink.left - box.left) / scale;\n const right = (box.right - ink.right) / scale;\n if (left < 0 || right < 0) return null; // clipped / overflowing content: not this guard's question\n if (Math.abs(left - right) <= PILL_TOLERANCE_PX) return null;\n return `pill ink is off-centre: ${left.toFixed(1)}px left vs ${right.toFixed(1)}px right — pad both sides alike and let the glyph trim (tap-target.css, THE OPTICAL GLYPH TRIM) remove the glyph's air; never shave one side by hand`;\n}\n\nlet pillTimer: ReturnType<typeof setTimeout> | null = null;\nlet pillObserver: MutationObserver | null = null;\n\nfunction scanPills(doc: Document) {\n if (!guardOn()) return;\n for (const node of Array.from(doc.querySelectorAll<HTMLElement>(PILL_CANDIDATES))) {\n // A tap button's own pill is judged, not its invisible box.\n if (node.classList.contains(\"matrx-tap-target\")) continue;\n const warning = findPillInsetWarning(node);\n if (warning) {\n if (node.getAttribute(\"data-matrx-pill-inset-warning\") === warning) continue;\n node.setAttribute(\"data-matrx-pill-inset-warning\", warning);\n const key = `p:${warning}@${(node.textContent ?? \"\").trim().slice(0, 40)}`;\n if (!reported.has(key)) {\n reported.add(key);\n console.error(`[tap-target] ${warning}`, node);\n }\n } else if (node.hasAttribute(\"data-matrx-pill-inset-warning\")) {\n node.removeAttribute(\"data-matrx-pill-inset-warning\");\n }\n }\n}\n\nfunction startPillInsetScan() {\n if (pillObserver || typeof document === \"undefined\" || typeof MutationObserver === \"undefined\") return;\n const doc = document;\n const schedule = () => {\n if (pillTimer) clearTimeout(pillTimer);\n pillTimer = setTimeout(() => scanPills(doc), 600);\n };\n pillObserver = new MutationObserver((records) => {\n // Our own attribute writes must not re-trigger the scan.\n if (records.every((r) => r.type === \"attributes\" && r.attributeName === \"data-matrx-pill-inset-warning\")) return;\n schedule();\n });\n const begin = () => {\n pillObserver?.observe(doc.body, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: [\"class\", \"style\", \"data-matrx-pill-inset-warning\"] });\n schedule();\n };\n if (doc.body) begin();\n else doc.addEventListener(\"DOMContentLoaded\", begin, { once: true });\n}\n","// THE LAYOUT SCALE (0.62.4). The dev guards (pill guard, tap-target guard) judge spacing, ink\n// balance and width in LAYOUT pixels — the numbers a stylesheet writes. `getBoundingClientRect`\n// returns SCREEN pixels, so inside a CSS-transformed (zoomed) container — every Board tile at\n// overview zoom — a correct 11px gap read 5.3px at 0.48 and warned falsely. The effective scale\n// is the ratio of an element's drawn width to its layout width (`offsetWidth`, which ignores\n// transforms), taken from the nearest ancestor-or-self that has a box. 1 when no engine reports\n// layout (jsdom) or the ratio is within 2% of 1, so a real violation at scale 1 reads unchanged.\n\nexport function layoutScale(el: Element | null): number {\n for (let n: Element | null = el; n; n = n.parentElement) {\n const w = (n as HTMLElement).offsetWidth;\n if (!w) continue;\n const drawn = n.getBoundingClientRect().width;\n if (!(drawn > 0)) continue;\n const s = drawn / w;\n if (!Number.isFinite(s) || s <= 0) return 1;\n return Math.abs(s - 1) < 0.02 ? 1 : s;\n }\n return 1;\n}\n","\"use client\";\n\nimport { createContext, useContext, type ReactNode } from \"react\";\n\n/** The surface a tap group sits on. \"glass\" floats over moving content; \"solid\" is a page, card,\n * toast or a header row that is itself a solid band. */\nexport type TapSurfaceKind = \"glass\" | \"solid\";\n\n// Shared through a Symbol.for slot on globalThis (like the default-variant context): the `.` and\n// `./buttons` dist bundles each inline this module, and a provider rendered by one must reach\n// buttons rendered by the other.\nconst SLOT = Symbol.for(\"@ai-matrx/tap-target:surface\");\ntype GlobalWithSlot = typeof globalThis & { [SLOT]?: ReturnType<typeof createContext<TapSurfaceKind>> };\nconst TapSurfaceContext = ((globalThis as GlobalWithSlot)[SLOT] ??= createContext<TapSurfaceKind>(\"glass\"));\n\n/**\n * GLASS ONLY FLOATS, declared once by the surface. A host whose header (or any region) is a solid\n * row wraps it in `<TapSurface surface=\"solid\">`; every `TapTargetButtonGroup` /\n * `TapTargetSearchGroup` inside then renders solid by itself — no per-page `surface=\"solid\"`.\n * A group's own `surface` prop still wins.\n */\nexport function TapSurface({ surface, children }: { surface: TapSurfaceKind; children: ReactNode }) {\n return <TapSurfaceContext.Provider value={surface}>{children}</TapSurfaceContext.Provider>;\n}\n\n/** The group's surface: its explicit prop, else the nearest `<TapSurface>`, else glass. */\nexport function useTapSurface(explicit: TapSurfaceKind | undefined): TapSurfaceKind {\n const inherited = useContext(TapSurfaceContext);\n return explicit ?? inherited;\n}\n","\"use client\";\n\n// THE BUILT-IN CAPABILITIES of every tap button — each one an enum or a flag,\n// never a class a caller writes. Rendering and geometry live in tap-target.css\n// (`.matrx-tap-badge`, `.matrx-tap-pressed`, `.matrx-tap-chevron`, …).\n\nimport { useEffect, type ReactNode } from \"react\";\n\nimport { MOTION_SPIN } from \"../motion\";\nimport { formatTapShortcut, parseShortcut, type TapShortcut } from \"../tap-shortcut\";\n\n/** Glyph color. Replaces the free-form `className`. */\nexport type TapTone = \"default\" | \"muted\" | \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"info\";\n\n/** Fill of a solid button. Replaces `bgColor` / `iconColor` / hover / active. */\nexport type TapSolidTone = \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"neutral\";\n\nexport const TAP_TONE_CLASS: Record<TapTone, string> = {\n default: \"text-foreground\",\n muted: \"text-muted-foreground group-hover/tap:text-foreground\",\n primary: \"text-primary-ink\",\n destructive: \"text-destructive-ink\",\n success: \"text-success-ink\",\n warning: \"text-warning-ink\",\n info: \"text-info-ink\",\n};\n\nexport const TAP_SOLID_TONE: Record<TapSolidTone, { fill: string; glyph: string }> = {\n primary: { fill: \"bg-primary group-hover/tap:bg-primary/85\", glyph: \"text-primary-foreground\" },\n destructive: { fill: \"bg-danger-fill group-hover/tap:bg-danger-fill/85\", glyph: \"text-danger-fill-foreground\" },\n success: { fill: \"bg-success-fill group-hover/tap:bg-success-fill/85\", glyph: \"text-success-fill-foreground\" },\n warning: { fill: \"bg-warning group-hover/tap:bg-warning/85\", glyph: \"text-warning-foreground\" },\n neutral: { fill: \"bg-foreground group-hover/tap:bg-foreground/85\", glyph: \"text-background\" },\n};\n\n/**\n * A keyboard shortcut: modifiers joined by \"+\", then one key —\n * \"mod+k\" (⌘ on Apple, Ctrl elsewhere), \"shift+mod+p\", \"alt+n\", \"/\", \"?\".\n */\nexport { formatTapShortcut, parseShortcut, type TapShortcut };\n\nexport interface TapFeatureProps {\n /** Glyph color, from the system's list. */\n tone?: TapTone | undefined;\n /** A count (99+ past 99) or a dot, drawn on the pill's corner by the system. */\n badge?: number | \"dot\" | undefined;\n /** A toggle that is on (sidebar open, filter on): tinted pill + aria-pressed. */\n pressed?: boolean | undefined;\n /** Work in flight: the glyph becomes a spinner and presses are ignored. */\n loading?: boolean | undefined;\n /** Why the button cannot be used — disables it and becomes its tooltip. */\n disabledReason?: string | undefined;\n /** Keyboard shortcut that presses the button; shown in its tooltip. */\n shortcut?: TapShortcut | undefined;\n /** A menu trigger: a small chevron after the label. */\n chevron?: boolean | undefined;\n}\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n return !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));\n}\n\nexport function matchesTapShortcut(e: KeyboardEvent, shortcut: TapShortcut): boolean {\n const p = parseShortcut(shortcut);\n if ((e.metaKey || e.ctrlKey) !== p.mod || e.altKey !== p.alt) return false;\n // \"?\" and other shifted symbols arrive with shiftKey set — only compare\n // shift for letters and named keys.\n if (/^[a-z0-9]$|^[a-z]{2,}$/.test(p.key) && e.shiftKey !== p.shift) return false;\n if (!p.mod && isTyping(e.target)) return false;\n return e.key.toLowerCase() === p.key;\n}\n\n/** Presses `node` when its shortcut is typed anywhere on the page. */\nexport function useTapShortcut(shortcut: TapShortcut | undefined, getNode: () => HTMLElement | null, enabled: boolean) {\n useEffect(() => {\n if (!shortcut || !enabled) return;\n const onKey = (e: KeyboardEvent) => {\n if (!matchesTapShortcut(e, shortcut)) return;\n const node = getNode();\n if (!node || !node.isConnected) return;\n e.preventDefault();\n node.click();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, enabled, getNode]);\n}\n\nexport function TapBadge({ badge }: { badge: number | \"dot\" }) {\n if (badge === \"dot\") return <span aria-hidden=\"true\" className=\"matrx-tap-badge\" data-dot=\"\" />;\n if (badge <= 0) return null;\n return (\n <span aria-hidden=\"true\" className=\"matrx-tap-badge\">\n {badge > 99 ? \"99+\" : badge}\n </span>\n );\n}\n\nexport function TapSpinner({ className }: { className: string }) {\n return (\n <svg className={className} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2} aria-hidden=\"true\">\n <circle\n className={MOTION_SPIN}\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n strokeDasharray=\"28.27\"\n strokeDashoffset=\"9\"\n strokeLinecap=\"round\"\n style={{ transformOrigin: \"12px 12px\" }}\n />\n </svg>\n );\n}\n\nexport function TapChevron() {\n return (\n <svg\n className=\"matrx-tap-chevron\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** Tooltip body: the label, then the shortcut as a key cap. */\nexport function tooltipBody(label: string, shortcut: TapShortcut | undefined): ReactNode {\n if (!shortcut) return label;\n return (\n <span className=\"matrx-tap-tooltip\">\n {label}\n <kbd className=\"matrx-tap-kbd\">{formatTapShortcut(shortcut)}</kbd>\n </span>\n );\n}\n","// src/tap-shortcut.ts — @ai-matrx/design-system/tap-shortcut\n//\n// THE ONE SHORTCUT FORMATTER, light (FB5, 2026-10-23). `formatTapShortcut` (\"mod+k\" → \"⌘K\" on Apple, \"Ctrl+K\"\n// elsewhere) is pure; it lived in tap-target's \"use client\" feature module, so a plain helper that only needed the\n// words (records-ui's table action list) had to import the whole tap-target entry and was itself stamped\n// \"use client\". This entry carries the parse and the words only — no React. `./tap-target` re-exports both.\n\n/** A keyboard shortcut, written \"mod+k\", \"shift+?\", \"alt+enter\". */\nexport type TapShortcut = string;\n\nexport interface ParsedShortcut {\n mod: boolean;\n shift: boolean;\n alt: boolean;\n key: string;\n}\n\nconst IS_APPLE =\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);\n\nexport function parseShortcut(shortcut: TapShortcut): ParsedShortcut {\n const parts = shortcut.toLowerCase().split(\"+\");\n const key = parts.pop() ?? \"\";\n return { mod: parts.includes(\"mod\"), shift: parts.includes(\"shift\"), alt: parts.includes(\"alt\"), key };\n}\n\n/** \"mod+k\" → \"⌘K\" on Apple, \"Ctrl+K\" elsewhere. */\nexport function formatTapShortcut(shortcut: TapShortcut): string {\n const p = parseShortcut(shortcut);\n const key = p.key.length === 1 ? p.key.toUpperCase() : p.key[0]!.toUpperCase() + p.key.slice(1);\n if (IS_APPLE) return `${p.alt ? \"⌥\" : \"\"}${p.shift ? \"⇧\" : \"\"}${p.mod ? \"⌘\" : \"\"}${key}`;\n return [p.mod && \"Ctrl\", p.alt && \"Alt\", p.shift && \"Shift\", key].filter(Boolean).join(\"+\");\n}\n","import type { ComponentType, ReactNode, Ref } from \"react\";\n\n/**\n * The injectable link seam — the package's replacement for the original\n * hard `next/link` import.\n *\n * Internal hrefs (anything NOT matching `http(s):`, `mailto:`, `tel:`) render\n * through the link component resolved here; external hrefs always render a\n * plain `<a target=\"_blank\" rel=\"noopener noreferrer\">`, exactly like the\n * original. When nothing is registered and no per-instance `linkComponent`\n * prop is given, internal hrefs fall back to a plain `<a>` (no prefetch, no\n * client-side routing — still a working link).\n */\nexport interface TapTargetLinkProps {\n href: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n /** Router prefetch hint (next/link semantics). Plain `<a>` fallback ignores it. */\n prefetch?: boolean | null | undefined;\n \"aria-label\"?: string | undefined;\n /** Tooltip text drawn through `title` (the provider's title takeover). */\n title?: string | undefined;\n className?: string | undefined;\n children?: ReactNode;\n /** The trigger's ref (the development guard measures the rendered link).\n * next/link forwards it to its `<a>`. */\n ref?: Ref<HTMLAnchorElement> | undefined;\n}\n\nexport type TapTargetLinkComponent = ComponentType<TapTargetLinkProps>;\n\n/**\n * The registered component lives in a `Symbol.for` slot on `globalThis` — NOT\n * in module state — so it survives the module graph being instantiated more\n * than once: the `.` and `./buttons` dist bundles each inline the primitives\n * (tsup `splitting: false`), and a consumer may even mix `import` and\n * `require`. One registration must reach every copy.\n */\nconst LINK_SLOT = Symbol.for(\"@ai-matrx/tap-target:link-component\");\n\ntype GlobalWithLinkSlot = typeof globalThis & {\n [LINK_SLOT]?: TapTargetLinkComponent | null;\n};\n\n/**\n * Register the app's link component once at startup (e.g. `next/link`):\n *\n * ```tsx\n * import Link from \"next/link\";\n * import { setTapTargetLinkComponent } from \"@ai-matrx/tap-target\";\n * setTapTargetLinkComponent(Link);\n * ```\n *\n * Pass `null` to unregister (plain `<a>` fallback resumes).\n */\nexport function setTapTargetLinkComponent(\n component: TapTargetLinkComponent | null,\n): void {\n (globalThis as GlobalWithLinkSlot)[LINK_SLOT] = component;\n}\n\n/** The currently registered link component, or `null` when none is set. */\nexport function getTapTargetLinkComponent(): TapTargetLinkComponent | null {\n return (globalThis as GlobalWithLinkSlot)[LINK_SLOT] ?? null;\n}\n","\"use client\";\n\nimport { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from \"../tooltip\";\n\n/**\n * Wraps a TapTargetButton (or any tap control) like the button-demo page:\n * no extra padding on the control — only `gap-0.5` before the caption.\n * Tooltip shows the full `label`; the caption truncates at max-w-[52px].\n */\nexport function TapTargetLabeled({\n label,\n children,\n hideLabel = false,\n toolTipSide = \"bottom\",\n}: {\n label: string;\n children: React.ReactNode;\n hideLabel?: boolean | undefined;\n toolTipSide?: \"top\" | \"bottom\" | \"left\" | \"right\" | undefined;\n}) {\n return (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"flex flex-col items-center p-0 gap-0 space-y-0 space-x-0 shrink-0\">\n {children}\n {!hideLabel && (\n <span className=\"text-[10px] text-muted-foreground leading-tight max-w-[52px] text-center truncate\">\n {label}\n </span>\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side={toolTipSide}>\n <span className=\"font-mono text-xs max-w-[280px] break-all\">\n {label}\n </span>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n","\"use client\";\n\n// TapTargetCopyButton — one press copies, and the button itself says so: the\n// glyph becomes a check (success tone) and the tooltip reads \"Copied\" for\n// 1.6s; a failure shows a destructive \"Copy failed\" instead of nothing.\n// Replaces the copy-then-flash logic screens used to hand-build.\n\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport { useTapButtonVariant } from \"./tap-default-variant\";\n\nimport {\n TapTargetButton,\n TapTargetButtonForGroup,\n TapTargetButtonOutline,\n TapTargetButtonTransparent,\n type TapTargetButtonProps,\n} from \"./tap-target-button\";\n\nexport interface TapTargetCopyButtonProps\n extends Omit<TapTargetButtonProps, \"onClick\" | \"icon\" | \"children\" | \"tone\" | \"loading\" | \"className\"> {\n /** What to copy — a string, or a function (sync or async) that produces it on press. */\n value: string | (() => string | Promise<string>);\n variant?: \"glass\" | \"transparent\" | \"outline\" | \"group\" | undefined;\n onCopied?: ((text: string) => void) | undefined;\n}\n\nconst COPY = (\n <>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </>\n);\nconst CHECK = <path d=\"M20 6 9 17l-5-5\" />;\nconst FAIL = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nconst VARIANTS = {\n glass: TapTargetButton,\n transparent: TapTargetButtonTransparent,\n outline: TapTargetButtonOutline,\n group: TapTargetButtonForGroup,\n} as const;\n\nexport const TapTargetCopyButton = forwardRef<HTMLButtonElement, TapTargetCopyButtonProps>(\n function TapTargetCopyButton({ value, variant: variantProp, onCopied, ariaLabel = \"Copy\", tooltip, ...rest }, ref) {\n const variant = useTapButtonVariant(variantProp);\n const [state, setState] = useState<\"idle\" | \"copied\" | \"failed\">(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => () => {\n if (timer.current) clearTimeout(timer.current);\n }, []);\n\n const copy = async () => {\n try {\n const text = typeof value === \"function\" ? await value() : value;\n if (await copyText(text)) {\n setState(\"copied\");\n onCopied?.(text);\n } else setState(\"failed\");\n } catch {\n setState(\"failed\");\n }\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setState(\"idle\"), 1600);\n };\n\n const Button = VARIANTS[variant];\n return (\n <Button\n ref={ref}\n {...rest}\n ariaLabel={ariaLabel}\n tooltip={state === \"copied\" ? \"Copied\" : state === \"failed\" ? \"Copy failed\" : tooltip}\n tone={state === \"copied\" ? \"success\" : state === \"failed\" ? \"destructive\" : undefined}\n onClick={() => void copy()}\n >\n {state === \"copied\" ? CHECK : state === \"failed\" ? FAIL : COPY}\n </Button>\n );\n },\n);\n","\"use client\";\n\nimport { createContext, useContext, type ReactNode } from \"react\";\n\nimport { useTapSurface } from \"./tap-surface\";\n\n// THE PLACEMENT DEFAULT — which variant a tap button takes when its caller\n// names none. Outside a provider that is \"glass\" (the floating-bar look). A\n// host region that holds tap buttons BESIDE text (a route header's back +\n// title cell) wraps itself in <TapDefaultVariant value=\"transparent\"> so every\n// button in it matches its neighbours (rule 2, \"all glass or none\") without\n// each call site repeating variant=\"transparent\". An explicit `variant` prop\n// always wins, so a bar whose pieces are ALL glass stays glass.\n//\n// The context object lives in a `Symbol.for` slot on globalThis, like the link\n// seam: the `.` and `./buttons` dist bundles each inline this module, and a\n// provider rendered by one must reach buttons rendered by the other.\n\nexport type TapDefaultVariantValue = \"glass\" | \"transparent\";\n\nconst SLOT = Symbol.for(\"@ai-matrx/tap-target:default-variant\");\ntype GlobalWithSlot = typeof globalThis & {\n [SLOT]?: ReturnType<typeof createContext<TapDefaultVariantValue>>;\n};\n\nfunction ctx() {\n const g = globalThis as GlobalWithSlot;\n return (g[SLOT] ??= createContext<TapDefaultVariantValue>(\"glass\"));\n}\n\n/** The variant tap buttons below take when they name none. */\nexport function useTapDefaultVariant(): TapDefaultVariantValue {\n return useContext(ctx());\n}\n\n/** Set the default variant for every tap button below that names none. */\nexport function TapDefaultVariant({ value, children }: { value: TapDefaultVariantValue; children: ReactNode }) {\n const Context = ctx();\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\n/**\n * The variant a lone tap button draws: its explicit `variant`, else a region's\n * <TapDefaultVariant>, else — on a <TapSurface surface=\"solid\"> — \"transparent\"\n * (glass only floats), else glass. An explicit variant always wins.\n */\nexport function useTapButtonVariant<V extends string>(explicit: V | undefined): V | TapDefaultVariantValue {\n const placed = useTapDefaultVariant();\n const surface = useTapSurface(undefined);\n if (explicit !== undefined) return explicit;\n if (placed !== \"glass\") return placed;\n return surface === \"solid\" ? \"transparent\" : \"glass\";\n}\n","\"use client\";\n\n// TapTargetSearchGroup — search anywhere, in the space of one group.\n//\n// The macOS toolbar search: a tap-button group carries a search button; tap it\n// and the group's other buttons give way to a search field in the SAME glass\n// capsule, focused and ready; Escape (or the close button) brings the buttons\n// back. With no other children it is a lone search button that opens into a\n// field. Origin: matrx-frontend's CSS-only SearchGroup (2026-03), rebuilt on\n// the tap geometry with real focus, keyboard and screen-reader behavior.\n//\n// Behavior, fixed (the opinions ARE the component):\n// • open → the field takes the group's place and focuses.\n// • Escape → clears a non-empty query; on an empty field, closes and\n// returns focus to the search button.\n// • close (×) → clears and closes.\n// • focus leaves with an EMPTY query → closes. A non-empty query stays open,\n// because a filter in effect must stay visible.\n// • Enter → onSubmit(query).\n\nimport { useTapSurface } from \"./tap-surface\";\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { TapTargetButtonForGroup } from \"./tap-target-button\";\n\nexport type TapTargetSearchShortcut = \"mod+k\" | \"mod+f\" | \"/\" | false;\n\nexport interface TapTargetSearchGroupProps {\n /** The group's other buttons (`TapTargetButtonForGroup` / `variant=\"group\"`). */\n children?: ReactNode;\n value?: string | undefined;\n defaultValue?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n onSubmit?: ((value: string) => void) | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n /** Field placeholder and the search button's name. Default \"Search\". */\n placeholder?: string | undefined;\n /** Where the search button sits among the group's buttons. Default \"end\". */\n searchPosition?: \"start\" | \"end\" | undefined;\n /** Open width: \"fit\" (16rem, shrinking in a tight row) or \"fill\" (the row's free space). */\n width?: \"fit\" | \"fill\" | undefined;\n /** Keyboard shortcut that opens the field. Default none. */\n shortcut?: TapTargetSearchShortcut | undefined;\n /**\n * The group's surface, as `TapTargetButtonGroup`'s: \"glass\" (default) floats over moving content;\n * \"solid\" (a muted track, no glass stroke) sits on a page, a card or a table toolbar.\n */\n surface?: \"glass\" | \"solid\" | undefined;\n}\n\nconst SHORTCUT_LABEL: Record<Exclude<TapTargetSearchShortcut, false>, string> = {\n \"mod+k\": \"⌘K\",\n \"mod+f\": \"⌘F\",\n \"/\": \"/\",\n};\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el) return false;\n return el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);\n}\n\nconst SearchGlyph = (\n <>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.34-4.34\" />\n </>\n);\nconst CloseGlyph = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nexport function TapTargetSearchGroup({\n children,\n value: valueProp,\n defaultValue = \"\",\n onValueChange,\n onSubmit,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = \"Search\",\n searchPosition = \"end\",\n width = \"fit\",\n shortcut = false,\n surface: surfaceProp,\n}: TapTargetSearchGroupProps) {\n const surface = useTapSurface(surfaceProp);\n const [ownValue, setOwnValue] = useState(defaultValue);\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const value = valueProp ?? ownValue;\n const open = openProp ?? ownOpen;\n const fieldId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const [buttonsWidth, setButtonsWidth] = useState<number | null>(null);\n\n // The buttons' real width, so open/close animate between two measured\n // widths instead of a max-width guess (which stalls, then snaps).\n useLayoutEffect(() => {\n const el = measureRef.current;\n if (!el) return;\n const read = () => setButtonsWidth(el.offsetWidth);\n read();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(read);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const setValue = useCallback(\n (next: string) => {\n if (valueProp === undefined) setOwnValue(next);\n onValueChange?.(next);\n },\n [valueProp, onValueChange],\n );\n const setOpen = useCallback(\n (next: boolean, returnFocus = false) => {\n if (openProp === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n if (returnFocus) requestAnimationFrame(() => triggerRef.current?.focus());\n },\n [openProp, onOpenChange],\n );\n\n // Focus the field the moment it opens (click, shortcut or a controlled\n // prop) — in the layout phase, before the browser moves focus off the\n // now-inert search button, so that blur never reads as \"focus left\".\n useLayoutEffect(() => {\n if (open) inputRef.current?.focus();\n }, [open]);\n\n useEffect(() => {\n if (!shortcut) return;\n const onKey = (e: globalThis.KeyboardEvent) => {\n const mod = e.metaKey || e.ctrlKey;\n const hit =\n shortcut === \"/\"\n ? e.key === \"/\" && !mod && !isTyping(e.target)\n : mod && e.key.toLowerCase() === shortcut.slice(-1);\n if (!hit) return;\n e.preventDefault();\n setOpen(true);\n inputRef.current?.focus();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, setOpen]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n if (value) setValue(\"\");\n else setOpen(false, true);\n } else if (e.key === \"Enter\") {\n onSubmit?.(value);\n }\n };\n\n const label = shortcut ? `${placeholder} (${SHORTCUT_LABEL[shortcut]})` : placeholder;\n const trigger = (\n <TapTargetButtonForGroup\n ref={triggerRef}\n ariaLabel={label}\n aria-expanded={open}\n aria-controls={fieldId}\n onClick={() => setOpen(true)}\n >\n {SearchGlyph}\n </TapTargetButtonForGroup>\n );\n\n return (\n <div\n ref={rootRef}\n role=\"search\"\n className=\"matrx-tap-group matrx-tap-search\"\n data-open={open ? \"\" : undefined}\n data-width={width}\n data-surface={surface}\n onBlur={() => {\n // Decide after focus has settled: closing on an empty query only when\n // focus really left the group.\n setTimeout(() => {\n const root = rootRef.current;\n if (root && !root.contains(document.activeElement) && !inputRef.current?.value) setOpen(false);\n }, 0);\n }}\n >\n <div\n className={\n surface === \"solid\" ? \"matrx-tap-group-capsule matrx-tap-group-capsule-solid\" : \"matrx-tap-group-capsule matrx-glass-thin-border\"\n }\n />\n <div\n className=\"matrx-tap-group-row matrx-tap-search-buttons\"\n inert={open}\n style={\n buttonsWidth === null\n ? undefined\n : ({ \"--matrx-tap-search-buttons-w\": `${buttonsWidth}px` } as CSSProperties)\n }\n >\n <div ref={measureRef} className=\"matrx-tap-search-measure\">\n {searchPosition === \"start\" ? trigger : null}\n {children}\n {searchPosition === \"end\" ? trigger : null}\n </div>\n </div>\n <div className=\"matrx-tap-search-field\" id={fieldId} inert={!open}>\n <svg\n className=\"matrx-tap-search-glyph\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {SearchGlyph}\n </svg>\n <input\n ref={inputRef}\n type=\"search\"\n className=\"matrx-tap-search-input\"\n value={value}\n placeholder={placeholder}\n aria-label={placeholder}\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={onKeyDown}\n />\n <TapTargetButtonForGroup\n ariaLabel=\"Close search\"\n tooltip={false}\n onClick={() => {\n setValue(\"\");\n setOpen(false, true);\n }}\n >\n {CloseGlyph}\n </TapTargetButtonForGroup>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AA,cAEC;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","React","visible","import_jsx_runtime","half","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","tooltipSide","TapTargetButton","TapTargetButtonTransparent","TapTargetButtonOutline","TapTargetButtonSolid","TapTargetButtonDestructive","TapTargetButtonForGroup","import_jsx_runtime","import_react","import_react","import_jsx_runtime","SLOT","import_jsx_runtime","TapTargetCopyButton","import_react","import_jsx_runtime","isTyping"]}
|