@funstack/ui 0.1.0-alpha.8 → 0.1.0-alpha.9

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.
Files changed (68) hide show
  1. package/dist/combobox/combobox-popup.mjs +1 -1
  2. package/dist/combobox/combobox-popup.mjs.map +1 -1
  3. package/dist/csp/csp-provider.d.mts +25 -0
  4. package/dist/csp/csp-provider.d.mts.map +1 -0
  5. package/dist/csp/csp-provider.mjs +24 -0
  6. package/dist/csp/csp-provider.mjs.map +1 -0
  7. package/dist/csp/index.d.mts +3 -0
  8. package/dist/csp/index.mjs +3 -0
  9. package/dist/csp/style-hashes.d.mts +19 -0
  10. package/dist/csp/style-hashes.d.mts.map +1 -0
  11. package/dist/csp/style-hashes.mjs +21 -0
  12. package/dist/csp/style-hashes.mjs.map +1 -0
  13. package/dist/index.d.mts +7 -3
  14. package/dist/index.mjs +3 -1
  15. package/dist/internal/anchor-position.d.mts +11 -3
  16. package/dist/internal/anchor-position.d.mts.map +1 -1
  17. package/dist/internal/anchor-position.mjs +169 -18
  18. package/dist/internal/anchor-position.mjs.map +1 -1
  19. package/dist/internal/csp-context.mjs +8 -0
  20. package/dist/internal/csp-context.mjs.map +1 -0
  21. package/dist/internal/tooltip-warm.mjs +29 -0
  22. package/dist/internal/tooltip-warm.mjs.map +1 -0
  23. package/dist/internal/use-resolved-placement.mjs +146 -0
  24. package/dist/internal/use-resolved-placement.mjs.map +1 -0
  25. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  26. package/dist/menu/menu-context-trigger.mjs +198 -19
  27. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  28. package/dist/menu/menu-context.mjs +11 -1
  29. package/dist/menu/menu-context.mjs.map +1 -1
  30. package/dist/menu/menu-dom.mjs +9 -5
  31. package/dist/menu/menu-dom.mjs.map +1 -1
  32. package/dist/menu/menu-popup.d.mts +20 -6
  33. package/dist/menu/menu-popup.d.mts.map +1 -1
  34. package/dist/menu/menu-popup.mjs +119 -26
  35. package/dist/menu/menu-popup.mjs.map +1 -1
  36. package/dist/menu/menu-root.d.mts.map +1 -1
  37. package/dist/menu/menu-root.mjs +11 -3
  38. package/dist/menu/menu-root.mjs.map +1 -1
  39. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  40. package/dist/menu/menu-submenu-trigger.mjs +27 -11
  41. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  42. package/dist/popover/popover-popup.d.mts +21 -7
  43. package/dist/popover/popover-popup.d.mts.map +1 -1
  44. package/dist/popover/popover-popup.mjs +16 -6
  45. package/dist/popover/popover-popup.mjs.map +1 -1
  46. package/dist/tooltip/index.d.mts +8 -5
  47. package/dist/tooltip/index.d.mts.map +1 -1
  48. package/dist/tooltip/index.mjs +6 -3
  49. package/dist/tooltip/index.mjs.map +1 -1
  50. package/dist/tooltip/tooltip-arrow.d.mts +30 -0
  51. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
  52. package/dist/tooltip/tooltip-arrow.mjs +45 -0
  53. package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
  54. package/dist/tooltip/tooltip-context.d.mts +7 -0
  55. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  56. package/dist/tooltip/tooltip-context.mjs +2 -1
  57. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  58. package/dist/tooltip/tooltip-popup.d.mts +21 -6
  59. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  60. package/dist/tooltip/tooltip-popup.mjs +28 -6
  61. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  62. package/dist/tooltip/tooltip-trigger.d.mts +9 -2
  63. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  64. package/dist/tooltip/tooltip-trigger.mjs +21 -5
  65. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  66. package/dist/tooltip/use-tooltip-interaction.mjs +26 -2
  67. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  68. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"menu-context.mjs","names":[],"sources":["../../src/menu/menu-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { DelayedPair } from \"../internal/use-delayed-pair.js\";\nimport type { PopoverRootValue } from \"../internal/use-popover-root.js\";\n\n/**\n * Where focus goes when the menu opens (design/components/menu.md 6.1): the first enabled item,\n * the last one (ArrowUp on the Trigger), or nowhere (a hover-opened submenu keeps focus on its\n * SubmenuTrigger).\n */\nexport type MenuOpenCause = \"first\" | \"last\" | \"none\";\n\n/** How the open being shown should place focus (design 6.1; review H1). */\nexport interface MenuOpenFocus {\n readonly cause: MenuOpenCause;\n /**\n * The open came from a pointer click (`detail > 0`): the item is focused without the focus\n * ring where the engine supports `focus({ focusVisible: false })`.\n */\n readonly pointer: boolean;\n}\n\n/**\n * How the current open is placed (design/components/context-menu.md 3.1): against the Trigger\n * (`anchor`: a Menu.Trigger, a foreign invoker, a controlled or platform open), or at a point\n * (`point`: a Menu.ContextTrigger). `generation` grows with every point open or move, so a second\n * right-click at a new point is a state change while the menu is open (4.3).\n */\nexport type MenuPlacement =\n | { readonly kind: \"anchor\" }\n | {\n readonly kind: \"point\";\n readonly x: number;\n readonly y: number;\n readonly generation: number;\n /** The region that opened: the `source` of `showPopover({ source })` (nesting). */\n readonly source: HTMLElement;\n /** The pointer held down at the open, re-captured after a move's re-show (2.1). */\n readonly pointerId: number | undefined;\n };\n\nexport const ANCHOR_PLACEMENT: MenuPlacement = { kind: \"anchor\" };\n\n/** What a ContextTrigger passes to `openAt`. */\nexport interface MenuOpenAtOptions {\n readonly source: HTMLElement;\n /** The `contextmenu` event, or the long-press `pointerdown` (`details.event`). */\n readonly event: Event;\n /** A pointer opened (quiet focus); `false` for the keyboard (focus ring). */\n readonly pointer: boolean;\n readonly pointerId: number | undefined;\n}\n\n/** One menu level: what its Root provides to its Trigger, Popup and items. */\nexport interface MenuContextValue {\n /** The shared popover machinery (`usePopoverRoot`). */\n readonly popover: PopoverRootValue;\n /** This Root is nested in a `Menu.Popup`. */\n readonly submenu: boolean;\n /** The top-level menu: item activation closes the whole stack through it (design 2.2). */\n readonly root: MenuContextValue;\n /** The enclosing menu of a submenu; `null` at the top level. */\n readonly parent: MenuContextValue | null;\n readonly loop: boolean;\n readonly delay: number;\n readonly closeDelay: number;\n /** The Trigger's id (`aria-labelledby` of the Popup). */\n readonly triggerId: string;\n /** Record the focus target of the next open (and whether a pointer asked for it). */\n readonly setOpenCause: (cause: MenuOpenCause, pointer?: boolean) => void;\n /** Read and clear the focus target of the open being shown (default `\"first\"`, keyboard). */\n readonly takeOpenCause: () => MenuOpenFocus;\n /** Submenu hover-intent timers, shared by the SubmenuTrigger and the Popup. */\n readonly timers: DelayedPair;\n /** Placement of the current (or last) open (context-menu.md 3.1). */\n readonly placement: MenuPlacement;\n /**\n * A ContextTrigger opens the menu at `point`, or moves it there when it is already open (no\n * dispatch, 4.3).\n */\n readonly openAt: (\n point: { readonly x: number; readonly y: number },\n options: MenuOpenAtOptions,\n ) => void;\n /**\n * Back to the anchored placement once a point open has been shown and hidden (the popup is no\n * longer visible): the next open that is not a ContextTrigger's (controlled, platform, foreign\n * invoker) places against the Trigger. Ignored when a newer point was recorded meanwhile.\n */\n readonly resetPlacement: (generation: number) => void;\n}\n\nexport const MenuContext = createContext<MenuContextValue | null>(null);\n\n/**\n * `true` inside a `Menu.ContextTrigger`: a `Menu.Root` there is a nested context region's own\n * top-level menu (context-menu.md 2.4), not a misplaced submenu.\n */\nexport const MenuRegionContext = createContext(false);\n\n/**\n * `contextmenu` events a ContextTrigger handled (opened or moved its menu), with the top-level\n * menu they belong to: that menu's document listener leaves its menu open for them\n * (context-menu.md 5 and 14).\n */\nconst handledEvents = new WeakMap<Event, object>();\n\n/**\n * `pointerdown` events that are not a long-press of an enclosing region: claimed by the innermost\n * region that started its timer for them (nested regions), and by every `Menu.Popup` for the\n * presses inside it (a menu inside a region, review M1). As `contextmenu`'s `defaultPrevented`\n * rule (context-menu.md 2.4).\n */\nconst claimedPresses = new WeakSet<Event>();\n\nexport function claimPress(event: Event): void {\n claimedPresses.add(event);\n}\n\nexport function isPressClaimed(event: Event): boolean {\n return claimedPresses.has(event);\n}\n\n/** The top-level menu's identity: its popup ref object, stable for the Root's lifetime. */\nconst menuKey = (menu: MenuContextValue): object => menu.root.popover.popupRef;\n\nexport function markHandled(event: Event, menu: MenuContextValue): void {\n handledEvents.set(event, menuKey(menu));\n}\n\nexport function isHandledBy(event: Event, menu: MenuContextValue): boolean {\n return handledEvents.get(event) === menuKey(menu);\n}\n\n/**\n * The close an activated item runs once its action settled: the whole stack, through the\n * top-level Root (design 2.2). Recorded at activation: if the menu was dismissed and opened again\n * meanwhile, the close belongs to the previous opening and does nothing (as `useActionTrigger`).\n */\nexport function closeStackLater(menu: MenuContextValue, event: Event): () => void {\n const { popover } = menu.root;\n const generation = popover.openGeneration();\n return () => {\n if (popover.openGeneration() === generation) popover.requestClose(event, \"activate\");\n };\n}\n\nexport function useMenuContext(part: string): MenuContextValue {\n const context = use(MenuContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Menu.Root.`);\n }\n return context;\n}\n\n/** What a `Menu.Popup` tells the items rendered in it. */\nexport interface MenuListContextValue {\n /** The menu this popup belongs to. */\n readonly menu: MenuContextValue;\n /**\n * `experimental_focusgroup` is on and the engine implements it: items render no `tabindex`\n * (Chromium leaves `tabindex=\"-1\"` elements out of a focusgroup) and the JS arrow keys step\n * aside.\n */\n readonly nativeFocusgroup: boolean;\n /** A typeahead buffer is active: Space is a character, not an activation (design 5.1). */\n readonly typingAhead: () => boolean;\n}\n\nexport const MenuListContext = createContext<MenuListContextValue | null>(null);\n\n/** `Menu.Group` / `Menu.RadioGroup`: the id their `Menu.GroupLabel` renders. */\nexport interface MenuGroupContextValue {\n readonly labelId: string;\n}\n\nexport const MenuGroupContext = createContext<MenuGroupContextValue | null>(null);\n\n/** `Menu.RadioGroup`'s state for its `Menu.RadioItem`s. */\nexport interface MenuRadioGroupContextValue {\n /** Optimistic value. */\n readonly value: string | null;\n readonly pending: boolean;\n /**\n * Dispatch `value` through the group's transition; `then` runs once the change action\n * resolved (an item's `closeOnActivate`).\n */\n readonly select: (value: string, event: Event, then: (() => void) | undefined) => void;\n}\n\nexport const MenuRadioGroupContext = createContext<MenuRadioGroupContextValue | null>(null);\n"],"mappings":";;;AAyCA,MAAa,mBAAkC,EAAE,MAAM,SAAS;AAmDhE,MAAa,cAAc,cAAuC,IAAI;;;;;AAMtE,MAAa,oBAAoB,cAAc,KAAK;;;;;;AAOpD,MAAM,gCAAgB,IAAI,QAAuB;;;;;;;AAQjD,MAAM,iCAAiB,IAAI,QAAe;AAE1C,SAAgB,WAAW,OAAoB;CAC7C,eAAe,IAAI,KAAK;AAC1B;AAEA,SAAgB,eAAe,OAAuB;CACpD,OAAO,eAAe,IAAI,KAAK;AACjC;;AAGA,MAAM,WAAW,SAAmC,KAAK,KAAK,QAAQ;AAEtE,SAAgB,YAAY,OAAc,MAA8B;CACtE,cAAc,IAAI,OAAO,QAAQ,IAAI,CAAC;AACxC;AAEA,SAAgB,YAAY,OAAc,MAAiC;CACzE,OAAO,cAAc,IAAI,KAAK,MAAM,QAAQ,IAAI;AAClD;;;;;;AAOA,SAAgB,gBAAgB,MAAwB,OAA0B;CAChF,MAAM,EAAE,YAAY,KAAK;CACzB,MAAM,aAAa,QAAQ,eAAe;CAC1C,aAAa;EACX,IAAI,QAAQ,eAAe,MAAM,YAAY,QAAQ,aAAa,OAAO,UAAU;CACrF;AACF;AAEA,SAAgB,eAAe,MAAgC;CAC7D,MAAM,UAAU,IAAI,WAAW;CAC/B,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,sCAAsC;CAEhE,OAAO;AACT;AAgBA,MAAa,kBAAkB,cAA2C,IAAI;AAO9E,MAAa,mBAAmB,cAA4C,IAAI;AAchF,MAAa,wBAAwB,cAAiD,IAAI"}
1
+ {"version":3,"file":"menu-context.mjs","names":[],"sources":["../../src/menu/menu-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { DelayedPair } from \"../internal/use-delayed-pair.js\";\nimport type { PopoverRootValue } from \"../internal/use-popover-root.js\";\n\n/**\n * Where focus goes when the menu opens (design/components/menu.md 6.1): the first enabled item,\n * the last one (ArrowUp on the Trigger), or nowhere (a hover-opened submenu keeps focus on its\n * SubmenuTrigger).\n */\nexport type MenuOpenCause = \"first\" | \"last\" | \"none\";\n\n/** How the open being shown should place focus (design 6.1; review H1). */\nexport interface MenuOpenFocus {\n readonly cause: MenuOpenCause;\n /**\n * The open came from a pointer click (`detail > 0`): the item is focused without the focus\n * ring where the engine supports `focus({ focusVisible: false })`.\n */\n readonly pointer: boolean;\n}\n\n/**\n * How the current open is placed (design/components/context-menu.md 3.1): against the Trigger\n * (`anchor`: a Menu.Trigger, a foreign invoker, a controlled or platform open), or at a point\n * (`point`: a Menu.ContextTrigger). `generation` grows with every point open or move, so a second\n * right-click at a new point is a state change while the menu is open (4.3).\n */\nexport type MenuPlacement =\n | { readonly kind: \"anchor\" }\n | {\n readonly kind: \"point\";\n readonly x: number;\n readonly y: number;\n readonly generation: number;\n /** The region that opened: the `source` of `showPopover({ source })` (nesting). */\n readonly source: HTMLElement;\n /** The pointer held down at the open, re-captured after a move's re-show (2.1). */\n readonly pointerId: number | undefined;\n /**\n * The popup's computed `direction` at this open or move (#88, 4.6): which edge of the menu\n * sits at the point. Read once by `openAt`, never during render.\n */\n readonly direction: \"ltr\" | \"rtl\";\n /**\n * A touch or pen open (#88, 4.7): the menu is placed above the point with\n * `--menu-point-gap`, so it does not open under the finger.\n */\n readonly offset: boolean;\n };\n\nexport const ANCHOR_PLACEMENT: MenuPlacement = { kind: \"anchor\" };\n\n/** What a ContextTrigger passes to `openAt`. */\nexport interface MenuOpenAtOptions {\n readonly source: HTMLElement;\n /** The `contextmenu` event, or the long-press `pointerdown` (`details.event`). */\n readonly event: Event;\n /** A pointer opened (quiet focus); `false` for the keyboard (focus ring). */\n readonly pointer: boolean;\n readonly pointerId: number | undefined;\n /** A touch or pen open: placed above the point (4.7). */\n readonly offset: boolean;\n}\n\n/** One menu level: what its Root provides to its Trigger, Popup and items. */\nexport interface MenuContextValue {\n /** The shared popover machinery (`usePopoverRoot`). */\n readonly popover: PopoverRootValue;\n /** This Root is nested in a `Menu.Popup`. */\n readonly submenu: boolean;\n /** The top-level menu: item activation closes the whole stack through it (design 2.2). */\n readonly root: MenuContextValue;\n /** The enclosing menu of a submenu; `null` at the top level. */\n readonly parent: MenuContextValue | null;\n readonly loop: boolean;\n readonly delay: number;\n readonly closeDelay: number;\n /** The Trigger's id (`aria-labelledby` of the Popup). */\n readonly triggerId: string;\n /** Record the focus target of the next open (and whether a pointer asked for it). */\n readonly setOpenCause: (cause: MenuOpenCause, pointer?: boolean) => void;\n /** Read and clear the focus target of the open being shown (default `\"first\"`, keyboard). */\n readonly takeOpenCause: () => MenuOpenFocus;\n /** Submenu hover-intent timers, shared by the SubmenuTrigger and the Popup. */\n readonly timers: DelayedPair;\n /** Placement of the current (or last) open (context-menu.md 3.1). */\n readonly placement: MenuPlacement;\n /**\n * A ContextTrigger opens the menu at `point`, or moves it there when it is already open (no\n * dispatch, 4.3).\n */\n readonly openAt: (\n point: { readonly x: number; readonly y: number },\n options: MenuOpenAtOptions,\n ) => void;\n /**\n * Back to the anchored placement once a point open has been shown and hidden (the popup is no\n * longer visible): the next open that is not a ContextTrigger's (controlled, platform, foreign\n * invoker) places against the Trigger. Ignored when a newer point was recorded meanwhile.\n */\n readonly resetPlacement: (generation: number) => void;\n}\n\nexport const MenuContext = createContext<MenuContextValue | null>(null);\n\n/**\n * `true` inside a `Menu.ContextTrigger`: a `Menu.Root` there is a nested context region's own\n * top-level menu (context-menu.md 2.4), not a misplaced submenu.\n */\nexport const MenuRegionContext = createContext(false);\n\n/**\n * `contextmenu` events a ContextTrigger handled (opened or moved its menu), with the top-level\n * menu they belong to: that menu's document listener leaves its menu open for them\n * (context-menu.md 5 and 14).\n */\nconst handledEvents = new WeakMap<Event, object>();\n\n/**\n * `pointerdown` events that are not a long-press of an enclosing region: claimed by the innermost\n * region that started its timer for them (nested regions), and by every `Menu.Popup` for the\n * presses inside it (a menu inside a region, review M1). As `contextmenu`'s `defaultPrevented`\n * rule (context-menu.md 2.4).\n */\nconst claimedPresses = new WeakSet<Event>();\n\nexport function claimPress(event: Event): void {\n claimedPresses.add(event);\n}\n\nexport function isPressClaimed(event: Event): boolean {\n return claimedPresses.has(event);\n}\n\n/**\n * What a hit on a `Menu.SubmenuTrigger` during a press-drag-release gesture does (context-menu.md\n * 2.6): the hover intent a real `pointerenter` / `pointerleave` would start. Registered by the\n * SubmenuTrigger on its element; the gesture runs under pointer capture, so the element never\n * receives boundary events itself.\n */\nexport interface SubmenuHover {\n readonly enter: (event: Event) => void;\n readonly leave: (event: Event) => void;\n}\n\nconst submenuHovers = new WeakMap<Element, SubmenuHover>();\n\nexport function registerSubmenuHover(element: Element, hover: SubmenuHover): () => void {\n submenuHovers.set(element, hover);\n return () => {\n if (submenuHovers.get(element) === hover) submenuHovers.delete(element);\n };\n}\n\nexport function submenuHover(element: Element): SubmenuHover | undefined {\n return submenuHovers.get(element);\n}\n\n/** The top-level menu's identity: its popup ref object, stable for the Root's lifetime. */\nconst menuKey = (menu: MenuContextValue): object => menu.root.popover.popupRef;\n\nexport function markHandled(event: Event, menu: MenuContextValue): void {\n handledEvents.set(event, menuKey(menu));\n}\n\nexport function isHandledBy(event: Event, menu: MenuContextValue): boolean {\n return handledEvents.get(event) === menuKey(menu);\n}\n\n/**\n * The close an activated item runs once its action settled: the whole stack, through the\n * top-level Root (design 2.2). Recorded at activation: if the menu was dismissed and opened again\n * meanwhile, the close belongs to the previous opening and does nothing (as `useActionTrigger`).\n */\nexport function closeStackLater(menu: MenuContextValue, event: Event): () => void {\n const { popover } = menu.root;\n const generation = popover.openGeneration();\n return () => {\n if (popover.openGeneration() === generation) popover.requestClose(event, \"activate\");\n };\n}\n\nexport function useMenuContext(part: string): MenuContextValue {\n const context = use(MenuContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Menu.Root.`);\n }\n return context;\n}\n\n/** What a `Menu.Popup` tells the items rendered in it. */\nexport interface MenuListContextValue {\n /** The menu this popup belongs to. */\n readonly menu: MenuContextValue;\n /**\n * `experimental_focusgroup` is on and the engine implements it: items render no `tabindex`\n * (Chromium leaves `tabindex=\"-1\"` elements out of a focusgroup) and the JS arrow keys step\n * aside.\n */\n readonly nativeFocusgroup: boolean;\n /** A typeahead buffer is active: Space is a character, not an activation (design 5.1). */\n readonly typingAhead: () => boolean;\n}\n\nexport const MenuListContext = createContext<MenuListContextValue | null>(null);\n\n/** `Menu.Group` / `Menu.RadioGroup`: the id their `Menu.GroupLabel` renders. */\nexport interface MenuGroupContextValue {\n readonly labelId: string;\n}\n\nexport const MenuGroupContext = createContext<MenuGroupContextValue | null>(null);\n\n/** `Menu.RadioGroup`'s state for its `Menu.RadioItem`s. */\nexport interface MenuRadioGroupContextValue {\n /** Optimistic value. */\n readonly value: string | null;\n readonly pending: boolean;\n /**\n * Dispatch `value` through the group's transition; `then` runs once the change action\n * resolved (an item's `closeOnActivate`).\n */\n readonly select: (value: string, event: Event, then: (() => void) | undefined) => void;\n}\n\nexport const MenuRadioGroupContext = createContext<MenuRadioGroupContextValue | null>(null);\n"],"mappings":";;;AAmDA,MAAa,mBAAkC,EAAE,MAAM,SAAS;AAqDhE,MAAa,cAAc,cAAuC,IAAI;;;;;AAMtE,MAAa,oBAAoB,cAAc,KAAK;;;;;;AAOpD,MAAM,gCAAgB,IAAI,QAAuB;;;;;;;AAQjD,MAAM,iCAAiB,IAAI,QAAe;AAE1C,SAAgB,WAAW,OAAoB;CAC7C,eAAe,IAAI,KAAK;AAC1B;AAEA,SAAgB,eAAe,OAAuB;CACpD,OAAO,eAAe,IAAI,KAAK;AACjC;AAaA,MAAM,gCAAgB,IAAI,QAA+B;AAEzD,SAAgB,qBAAqB,SAAkB,OAAiC;CACtF,cAAc,IAAI,SAAS,KAAK;CAChC,aAAa;EACX,IAAI,cAAc,IAAI,OAAO,MAAM,OAAO,cAAc,OAAO,OAAO;CACxE;AACF;AAEA,SAAgB,aAAa,SAA4C;CACvE,OAAO,cAAc,IAAI,OAAO;AAClC;;AAGA,MAAM,WAAW,SAAmC,KAAK,KAAK,QAAQ;AAEtE,SAAgB,YAAY,OAAc,MAA8B;CACtE,cAAc,IAAI,OAAO,QAAQ,IAAI,CAAC;AACxC;AAEA,SAAgB,YAAY,OAAc,MAAiC;CACzE,OAAO,cAAc,IAAI,KAAK,MAAM,QAAQ,IAAI;AAClD;;;;;;AAOA,SAAgB,gBAAgB,MAAwB,OAA0B;CAChF,MAAM,EAAE,YAAY,KAAK;CACzB,MAAM,aAAa,QAAQ,eAAe;CAC1C,aAAa;EACX,IAAI,QAAQ,eAAe,MAAM,YAAY,QAAQ,aAAa,OAAO,UAAU;CACrF;AACF;AAEA,SAAgB,eAAe,MAAgC;CAC7D,MAAM,UAAU,IAAI,WAAW;CAC/B,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,sCAAsC;CAEhE,OAAO;AACT;AAgBA,MAAa,kBAAkB,cAA2C,IAAI;AAO9E,MAAa,mBAAmB,cAA4C,IAAI;AAchF,MAAa,wBAAwB,cAAiD,IAAI"}
@@ -6,7 +6,7 @@ function menuItems(popup) {
6
6
  return Array.from(popup.querySelectorAll(ITEM_SELECTOR)).filter((item) => item.closest("[role=\"menu\"]") === popup);
7
7
  }
8
8
  function isMenuItem(element, popup) {
9
- return element.matches(ITEM_SELECTOR) && element.closest("[role=\"menu\"]") === popup;
9
+ return element.matches("[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]") && element.closest("[role=\"menu\"]") === popup;
10
10
  }
11
11
  /**
12
12
  * Disabled by its `disabled` prop. Keys on `data-disabled`, not `aria-disabled`: an item is also
@@ -36,13 +36,17 @@ function isRtl(element) {
36
36
  }
37
37
  /**
38
38
  * `setPointerCapture`, which throws `NotFoundError` for a pointer the engine no longer tracks
39
- * (context-menu.md 2.1). A silent no-op when no button is down.
39
+ * (context-menu.md 2.1). A silent no-op when no button is down. `true` when the capture was
40
+ * taken (the press-drag-release gesture runs only then, 2.6).
40
41
  */
41
42
  function capturePointer(element, pointerId) {
42
- if (element === null || pointerId === void 0) return;
43
+ if (element === null || pointerId === void 0) return false;
43
44
  try {
44
45
  element.setPointerCapture(pointerId);
45
- } catch {}
46
+ return true;
47
+ } catch {
48
+ return false;
49
+ }
46
50
  }
47
51
  /** `<input>` types that take no text: their `contextmenu` is not an editing one. */
48
52
  const NON_TEXT_INPUTS = /* @__PURE__ */ new Set([
@@ -74,6 +78,6 @@ function hasModifier(event) {
74
78
  return event.altKey || event.ctrlKey || event.metaKey;
75
79
  }
76
80
  //#endregion
77
- export { capturePointer, edgeItem, focusItem, hasModifier, isDisabledItem, isEditableTarget, isMenuItem, isRtl, menuItems, typeaheadText };
81
+ export { ITEM_SELECTOR, capturePointer, edgeItem, focusItem, hasModifier, isDisabledItem, isEditableTarget, isMenuItem, isRtl, menuItems, typeaheadText };
78
82
 
79
83
  //# sourceMappingURL=menu-dom.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu-dom.mjs","names":[],"sources":["../../src/menu/menu-dom.ts"],"sourcesContent":["\"use client\";\n// DOM helpers shared by the Menu parts. Items are read from the DOM when they are needed (a key\n// press, an open), never registered (design/components/menu.md 13 and 14).\n\nconst ITEM_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]';\n\n/** The items of `popup` in DOM order, without the items of its submenus. Disabled included. */\nexport function menuItems(popup: Element): HTMLElement[] {\n return Array.from(popup.querySelectorAll<HTMLElement>(ITEM_SELECTOR)).filter(\n (item) => item.closest('[role=\"menu\"]') === popup,\n );\n}\n\nexport function isMenuItem(element: Element, popup: Element): boolean {\n return element.matches(ITEM_SELECTOR) && element.closest('[role=\"menu\"]') === popup;\n}\n\n/**\n * Disabled by its `disabled` prop. Keys on `data-disabled`, not `aria-disabled`: an item is also\n * `aria-disabled` while its own action is pending (#81). A pending item is an ordinary item for\n * navigation; only the open focus (`edgeItem`) skips items with the `disabled` prop. Arrow keys,\n * Home / End and typeahead skip nothing.\n */\nexport function isDisabledItem(item: Element): boolean {\n return item.hasAttribute(\"data-disabled\");\n}\n\n/** The first (or last) enabled item; the first (or last) item if all are disabled. */\nexport function edgeItem(popup: Element, which: \"first\" | \"last\"): HTMLElement | null {\n const items = menuItems(popup);\n const ordered = which === \"first\" ? items : [...items].reverse();\n return ordered.find((item) => !isDisabledItem(item)) ?? ordered[0] ?? null;\n}\n\n/** Keyboard focus: the ring shows even where the engine's heuristic would not (as Tabs). */\nexport function focusItem(item: HTMLElement): void {\n item.focus({ focusVisible: true } as FocusOptions);\n}\n\n/** The text typeahead matches: the item's `label` prop, else its text content. */\nexport function typeaheadText(item: Element): string {\n return (item.getAttribute(\"data-typeahead\") ?? item.textContent ?? \"\").trim().toLowerCase();\n}\n\nexport function isRtl(element: Element): boolean {\n return getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * `setPointerCapture`, which throws `NotFoundError` for a pointer the engine no longer tracks\n * (context-menu.md 2.1). A silent no-op when no button is down.\n */\nexport function capturePointer(element: Element | null, pointerId: number | undefined): void {\n if (element === null || pointerId === undefined) return;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // Not an active pointer (a synthetic event, a released button): nothing to capture.\n }\n}\n\n/** `<input>` types that take no text: their `contextmenu` is not an editing one. */\nconst NON_TEXT_INPUTS = new Set([\n \"button\",\n \"submit\",\n \"reset\",\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"hidden\",\n]);\n\n/**\n * An editable target keeps the browser's own context menu by default (context-menu.md 2.3): a\n * text-taking `<input>`, a `<textarea>`, or editable content.\n */\nexport function isEditableTarget(target: EventTarget | null): boolean {\n if (target === null || (target as Node).nodeType !== 1) return false;\n const element = target as HTMLElement;\n if (element.closest(\"textarea\") !== null) return true;\n const input = element.closest(\"input\");\n if (input !== null && !NON_TEXT_INPUTS.has(input.type)) return true;\n // `isContentEditable` where implemented (every engine; not jsdom).\n if (typeof element.isContentEditable === \"boolean\") return element.isContentEditable;\n return element.closest('[contenteditable]:not([contenteditable=\"false\"])') !== null;\n}\n\nexport function hasModifier(event: { altKey: boolean; ctrlKey: boolean; metaKey: boolean }) {\n return event.altKey || event.ctrlKey || event.metaKey;\n}\n"],"mappings":";;AAIA,MAAM,gBAAgB;;AAGtB,SAAgB,UAAU,OAA+B;CACvD,OAAO,MAAM,KAAK,MAAM,iBAA8B,aAAa,CAAC,CAAC,CAAC,QACnE,SAAS,KAAK,QAAQ,iBAAe,MAAM,KAC9C;AACF;AAEA,SAAgB,WAAW,SAAkB,OAAyB;CACpE,OAAO,QAAQ,QAAQ,aAAa,KAAK,QAAQ,QAAQ,iBAAe,MAAM;AAChF;;;;;;;AAQA,SAAgB,eAAe,MAAwB;CACrD,OAAO,KAAK,aAAa,eAAe;AAC1C;;AAGA,SAAgB,SAAS,OAAgB,OAA6C;CACpF,MAAM,QAAQ,UAAU,KAAK;CAC7B,MAAM,UAAU,UAAU,UAAU,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ;CAC/D,OAAO,QAAQ,MAAM,SAAS,CAAC,eAAe,IAAI,CAAC,KAAK,QAAQ,MAAM;AACxE;;AAGA,SAAgB,UAAU,MAAyB;CACjD,KAAK,MAAM,EAAE,cAAc,KAAK,CAAiB;AACnD;;AAGA,SAAgB,cAAc,MAAuB;CACnD,QAAQ,KAAK,aAAa,gBAAgB,KAAK,KAAK,eAAe,GAAA,CAAI,KAAK,CAAC,CAAC,YAAY;AAC5F;AAEA,SAAgB,MAAM,SAA2B;CAC/C,OAAO,iBAAiB,OAAO,CAAC,CAAC,cAAc;AACjD;;;;;AAMA,SAAgB,eAAe,SAAyB,WAAqC;CAC3F,IAAI,YAAY,QAAQ,cAAc,KAAA,GAAW;CACjD,IAAI;EACF,QAAQ,kBAAkB,SAAS;CACrC,QAAQ,CAER;AACF;;AAGA,MAAM,kCAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,iBAAiB,QAAqC;CACpE,IAAI,WAAW,QAAS,OAAgB,aAAa,GAAG,OAAO;CAC/D,MAAM,UAAU;CAChB,IAAI,QAAQ,QAAQ,UAAU,MAAM,MAAM,OAAO;CACjD,MAAM,QAAQ,QAAQ,QAAQ,OAAO;CACrC,IAAI,UAAU,QAAQ,CAAC,gBAAgB,IAAI,MAAM,IAAI,GAAG,OAAO;CAE/D,IAAI,OAAO,QAAQ,sBAAsB,WAAW,OAAO,QAAQ;CACnE,OAAO,QAAQ,QAAQ,oDAAkD,MAAM;AACjF;AAEA,SAAgB,YAAY,OAAgE;CAC1F,OAAO,MAAM,UAAU,MAAM,WAAW,MAAM;AAChD"}
1
+ {"version":3,"file":"menu-dom.mjs","names":[],"sources":["../../src/menu/menu-dom.ts"],"sourcesContent":["\"use client\";\n// DOM helpers shared by the Menu parts. Items are read from the DOM when they are needed (a key\n// press, an open), never registered (design/components/menu.md 13 and 14).\n\nexport const ITEM_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]';\n\n/** The items of `popup` in DOM order, without the items of its submenus. Disabled included. */\nexport function menuItems(popup: Element): HTMLElement[] {\n return Array.from(popup.querySelectorAll<HTMLElement>(ITEM_SELECTOR)).filter(\n (item) => item.closest('[role=\"menu\"]') === popup,\n );\n}\n\nexport function isMenuItem(element: Element, popup: Element): boolean {\n return element.matches(ITEM_SELECTOR) && element.closest('[role=\"menu\"]') === popup;\n}\n\n/**\n * Disabled by its `disabled` prop. Keys on `data-disabled`, not `aria-disabled`: an item is also\n * `aria-disabled` while its own action is pending (#81). A pending item is an ordinary item for\n * navigation; only the open focus (`edgeItem`) skips items with the `disabled` prop. Arrow keys,\n * Home / End and typeahead skip nothing.\n */\nexport function isDisabledItem(item: Element): boolean {\n return item.hasAttribute(\"data-disabled\");\n}\n\n/** The first (or last) enabled item; the first (or last) item if all are disabled. */\nexport function edgeItem(popup: Element, which: \"first\" | \"last\"): HTMLElement | null {\n const items = menuItems(popup);\n const ordered = which === \"first\" ? items : [...items].reverse();\n return ordered.find((item) => !isDisabledItem(item)) ?? ordered[0] ?? null;\n}\n\n/** Keyboard focus: the ring shows even where the engine's heuristic would not (as Tabs). */\nexport function focusItem(item: HTMLElement): void {\n item.focus({ focusVisible: true } as FocusOptions);\n}\n\n/** The text typeahead matches: the item's `label` prop, else its text content. */\nexport function typeaheadText(item: Element): string {\n return (item.getAttribute(\"data-typeahead\") ?? item.textContent ?? \"\").trim().toLowerCase();\n}\n\nexport function isRtl(element: Element): boolean {\n return getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * `setPointerCapture`, which throws `NotFoundError` for a pointer the engine no longer tracks\n * (context-menu.md 2.1). A silent no-op when no button is down. `true` when the capture was\n * taken (the press-drag-release gesture runs only then, 2.6).\n */\nexport function capturePointer(element: Element | null, pointerId: number | undefined): boolean {\n if (element === null || pointerId === undefined) return false;\n try {\n element.setPointerCapture(pointerId);\n return true;\n } catch {\n // Not an active pointer (a synthetic event, a released button): nothing to capture.\n return false;\n }\n}\n\n/** `<input>` types that take no text: their `contextmenu` is not an editing one. */\nconst NON_TEXT_INPUTS = new Set([\n \"button\",\n \"submit\",\n \"reset\",\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"hidden\",\n]);\n\n/**\n * An editable target keeps the browser's own context menu by default (context-menu.md 2.3): a\n * text-taking `<input>`, a `<textarea>`, or editable content.\n */\nexport function isEditableTarget(target: EventTarget | null): boolean {\n if (target === null || (target as Node).nodeType !== 1) return false;\n const element = target as HTMLElement;\n if (element.closest(\"textarea\") !== null) return true;\n const input = element.closest(\"input\");\n if (input !== null && !NON_TEXT_INPUTS.has(input.type)) return true;\n // `isContentEditable` where implemented (every engine; not jsdom).\n if (typeof element.isContentEditable === \"boolean\") return element.isContentEditable;\n return element.closest('[contenteditable]:not([contenteditable=\"false\"])') !== null;\n}\n\nexport function hasModifier(event: { altKey: boolean; ctrlKey: boolean; metaKey: boolean }) {\n return event.altKey || event.ctrlKey || event.metaKey;\n}\n"],"mappings":";;AAIA,MAAa,gBAAgB;;AAG7B,SAAgB,UAAU,OAA+B;CACvD,OAAO,MAAM,KAAK,MAAM,iBAA8B,aAAa,CAAC,CAAC,CAAC,QACnE,SAAS,KAAK,QAAQ,iBAAe,MAAM,KAC9C;AACF;AAEA,SAAgB,WAAW,SAAkB,OAAyB;CACpE,OAAO,QAAQ,QAAA,4EAAqB,KAAK,QAAQ,QAAQ,iBAAe,MAAM;AAChF;;;;;;;AAQA,SAAgB,eAAe,MAAwB;CACrD,OAAO,KAAK,aAAa,eAAe;AAC1C;;AAGA,SAAgB,SAAS,OAAgB,OAA6C;CACpF,MAAM,QAAQ,UAAU,KAAK;CAC7B,MAAM,UAAU,UAAU,UAAU,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ;CAC/D,OAAO,QAAQ,MAAM,SAAS,CAAC,eAAe,IAAI,CAAC,KAAK,QAAQ,MAAM;AACxE;;AAGA,SAAgB,UAAU,MAAyB;CACjD,KAAK,MAAM,EAAE,cAAc,KAAK,CAAiB;AACnD;;AAGA,SAAgB,cAAc,MAAuB;CACnD,QAAQ,KAAK,aAAa,gBAAgB,KAAK,KAAK,eAAe,GAAA,CAAI,KAAK,CAAC,CAAC,YAAY;AAC5F;AAEA,SAAgB,MAAM,SAA2B;CAC/C,OAAO,iBAAiB,OAAO,CAAC,CAAC,cAAc;AACjD;;;;;;AAOA,SAAgB,eAAe,SAAyB,WAAwC;CAC9F,IAAI,YAAY,QAAQ,cAAc,KAAA,GAAW,OAAO;CACxD,IAAI;EACF,QAAQ,kBAAkB,SAAS;EACnC,OAAO;CACT,QAAQ;EAEN,OAAO;CACT;AACF;;AAGA,MAAM,kCAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,iBAAiB,QAAqC;CACpE,IAAI,WAAW,QAAS,OAAgB,aAAa,GAAG,OAAO;CAC/D,MAAM,UAAU;CAChB,IAAI,QAAQ,QAAQ,UAAU,MAAM,MAAM,OAAO;CACjD,MAAM,QAAQ,QAAQ,QAAQ,OAAO;CACrC,IAAI,UAAU,QAAQ,CAAC,gBAAgB,IAAI,MAAM,IAAI,GAAG,OAAO;CAE/D,IAAI,OAAO,QAAQ,sBAAsB,WAAW,OAAO,QAAQ;CACnE,OAAO,QAAQ,QAAQ,oDAAkD,MAAM;AACjF;AAEA,SAAgB,YAAY,OAAgE;CAC1F,OAAO,MAAM,UAAU,MAAM,WAAW,MAAM;AAChD"}
@@ -2,13 +2,19 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { AnchorAlign, AnchorSide } from "../internal/anchor-position.mjs";
3
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
4
4
  //#region src/menu/menu-popup.d.ts
5
+ /** `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). */
5
6
  export type MenuSide = AnchorSide;
6
7
  export type MenuAlign = AnchorAlign;
7
8
  export interface MenuPopupState {
8
9
  /** Committed open state. Read `:popover-open` for the DOM truth. */
9
10
  readonly open: boolean;
10
- /** `null` with `side={null}`, and while the menu is placed at a point (`context`). */
11
+ /**
12
+ * While shown: the physical side the browser placed the popup on (after any fallback flip;
13
+ * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`, and while the menu
14
+ * is placed at a point (`context`).
15
+ */
11
16
  readonly side: MenuSide | null;
17
+ /** While shown: the resolved alignment; otherwise the `align` prop. */
12
18
  readonly align: MenuAlign;
13
19
  /** This popup belongs to a submenu. */
14
20
  readonly submenu: boolean;
@@ -21,15 +27,20 @@ export interface MenuPopupState {
21
27
  export interface MenuPopupProps extends Omit<ComponentPropsWithRef<"div">, "id" | "popover" | "role" | "aria-labelledby" | "onKeyDown" | "onFocus" | "onBlur" | "onMouseDown" | "onContextMenu" | "onPointerEnter" | "onPointerLeave" | "onToggle" | "onBeforeToggle" | "className" | "style" | "children"> {
22
28
  /**
23
29
  * Placement against the Trigger through inline `position-area`, with `position-try-fallbacks`
24
- * flipping it when it does not fit. Default `"bottom"` for a top-level menu, `"right"` for a
25
- * submenu (whose fallback is `flip-inline` only). `null` emits no inline positioning (and no
30
+ * flipping it when it does not fit. Default `"bottom"` for a top-level menu, `"inline-end"` for
31
+ * a submenu (the right of the item in LTR, its left in RTL; its fallback is `flip-inline`
32
+ * only). `"left"` / `"right"` stay physical. `null` emits no inline positioning (and no
26
33
  * `data-side` / `data-align`): the stylesheet owns placement. Ignored for an open from a
27
34
  * `Menu.ContextTrigger`, which is placed at the pointer; there `null` also opts out of the
28
35
  * inline point placement and the library's `@position-try` rules, leaving only
29
36
  * `--menu-point-x` / `--menu-point-y`.
30
37
  */
31
38
  side?: MenuSide | null;
32
- /** Alignment along the side. Default `"start"`. Ignored when `side` is `null`. */
39
+ /**
40
+ * Alignment along the side. Default `"start"` (both levels): inline-relative on a top / bottom
41
+ * side (mirrored under `direction: rtl`), the top edges on the others. Ignored when `side` is
42
+ * `null`.
43
+ */
33
44
  align?: MenuAlign;
34
45
  /**
35
46
  * `false` (default): the items are not rendered while the menu is closed; mounting them is part
@@ -63,7 +74,9 @@ export interface MenuPopupProps extends Omit<ComponentPropsWithRef<"div">, "id"
63
74
  * ArrowUp / ArrowDown / Home / End move focus between items (or the browser does, with
64
75
  * `experimental_focusgroup` where supported), printable characters run typeahead, ArrowLeft
65
76
  * closes a submenu. The top-level popup closes the whole menu at once when focus leaves it (Tab).
66
- * Style it with `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.
77
+ * Style it with `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While
78
+ * shown, those are where the browser placed it (conventions 13.2), otherwise the requested
79
+ * values.
67
80
  *
68
81
  * Owned keys (conventions 1.2): `id`, `popover`, `role`, `aria-labelledby` (token-merged),
69
82
  * `tabIndex`, `focusgroup` (with the flag), `onKeyDown`, `onBlur`, `onMouseDown` (a press on
@@ -71,7 +84,8 @@ export interface MenuPopupProps extends Omit<ComponentPropsWithRef<"div">, "id"
71
84
  * one), `onPointerEnter` / `onPointerLeave`, `data-side` / `data-align` unless `side` is `null`
72
85
  * or the menu is placed at a point, and `data-context` for an open from a `Menu.ContextTrigger`
73
86
  * (placed at the pointer: `--menu-point-x` / `--menu-point-y` inline, and unless `side` is
74
- * `null`, `left` / `top` at the point with the library's `@position-try` fallbacks, whose rules
87
+ * `null`, `top` and `left` (`right` for an RTL popup) at the point with the library's
88
+ * `@position-try` fallbacks, whose rules
75
89
  * it renders as a hoisted `<style>`). A top-level menu closes at once on a right- or
76
90
  * middle-click outside it.
77
91
  */
@@ -1 +1 @@
1
- {"version":3,"file":"menu-popup.d.mts","names":[],"sources":["../../src/menu/menu-popup.tsx"],"mappings":";;;;YAoDY,WAAW;YACX,YAAY;iBAEP;;WAEN;;WAEA,MAAM;WACN,OAAO;;WAEP;;;;;WAKA;;iBAGM,uBAAuB,KACtC;;;;;;;;;;EA2BA,OAAO;;EAEP,QAAQ;;;;;;EAMR;;;;;;;EAOA;;;;;;;EAOA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;;;;;;;;wBAsFpC,YACd,MAAM,UACN,OACA,aACA,yBACA,YACA,WACA,OACA,UACA,WACG,QACF,iBAAc;yBAXD"}
1
+ {"version":3,"file":"menu-popup.d.mts","names":[],"sources":["../../src/menu/menu-popup.tsx"],"mappings":";;;;;YA2DY,WAAW;YACX,YAAY;iBAEP;;WAEN;;;;;;WAMA,MAAM;;WAEN,OAAO;;WAEP;;;;;WAKA;;iBAGM,uBAAuB,KACtC;;;;;;;;;;;EA4BA,OAAO;;;;;;EAMP,QAAQ;;;;;;EAMR;;;;;;;EAOA;;;;;;;EAOA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;wBAkLpC,YACd,MAAM,UACN,OACA,aACA,yBACA,YACA,WACA,OACA,UACA,WACG,QACF,iBAAc;yBAXD"}
@@ -4,12 +4,15 @@ import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
4
4
  import { mergeRefs } from "../internal/merge-props.mjs";
5
5
  import { resolveStateValue } from "../internal/render-element.mjs";
6
6
  import { useRender } from "../internal/use-render.mjs";
7
- import { FSUI_PRECEDENCE, MENU_POINT_FALLBACKS, MENU_POINT_HREF, MENU_POINT_RULES, MENU_POINT_X, MENU_POINT_Y, POSITION_TRY_FALLBACKS, positionArea } from "../internal/anchor-position.mjs";
7
+ import { useLatest } from "../internal/use-latest.mjs";
8
+ import { FSUI_PRECEDENCE, MENU_POINT_FALLBACKS, MENU_POINT_GAP, MENU_POINT_HREF, MENU_POINT_RULES, MENU_POINT_TOUCH_GAP, MENU_POINT_X, MENU_POINT_Y, POSITION_TRY_FALLBACKS, positionArea } from "../internal/anchor-position.mjs";
9
+ import { useResolvedPlacement } from "../internal/use-resolved-placement.mjs";
10
+ import { CSPContext } from "../internal/csp-context.mjs";
8
11
  import { usePopoverPopup } from "../internal/use-popover-popup.mjs";
9
12
  import { MenuListContext, claimPress, isHandledBy, useMenuContext } from "./menu-context.mjs";
10
13
  import { capturePointer, edgeItem, focusItem, hasModifier, isMenuItem, isRtl, menuItems, typeaheadText } from "./menu-dom.mjs";
11
14
  import { scheduleHoverClose } from "./menu-hover.mjs";
12
- import { Activity, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from "react";
15
+ import { Activity, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from "react";
13
16
  import { jsx, jsxs } from "react/jsx-runtime";
14
17
  //#region src/menu/menu-popup.tsx
15
18
  /** Engine capabilities never change while the page lives. */
@@ -20,36 +23,73 @@ const isDev = process.env.NODE_ENV !== "production";
20
23
  /** What a press may focus inside a popup: items, the popup itself, the consumer's controls. */
21
24
  const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]:not([contenteditable=\"false\"])";
22
25
  /**
23
- * The inline placement of a point open (context-menu.md 3.3): the point as two custom
24
- * properties, and unless the stylesheet owns placement, `left` / `top` at it with the other two
25
- * insets `auto` (longhands, so React never sees a shorthand next to its longhands),
26
- * `position-area: none` (a consumer's anchored `position-area` would otherwise place the popup
27
- * inside a grid area) and the library's fallbacks, spelled by generation parity (4.3).
26
+ * The inline placement of a point open (context-menu.md 3.3): the point and the gap as custom
27
+ * properties (`--menu-point-gap`: `0px`, `16px` for a touch or pen open, 4.7), and unless the
28
+ * stylesheet owns placement, the menu below the point (`top`) or, for a touch or pen open, above
29
+ * it (`bottom`), and by the popup's direction read at the open (4.6, #88), `left` (LTR) or
30
+ * `right` (RTL: the menu's right edge at the point), with the other two insets `auto`
31
+ * (longhands, so React never sees a shorthand next to its longhands), `position-area: none` (a
32
+ * consumer's anchored `position-area` would otherwise place the popup inside a grid area) and
33
+ * the library's fallbacks for that direction and pointer kind, spelled by generation parity
34
+ * (4.3).
28
35
  */
29
36
  function pointStyle(point, stylesheetOwned) {
30
37
  const vars = {
31
38
  [MENU_POINT_X]: `${point.x}px`,
32
- [MENU_POINT_Y]: `${point.y}px`
39
+ [MENU_POINT_Y]: `${point.y}px`,
40
+ [MENU_POINT_GAP]: point.offset ? MENU_POINT_TOUCH_GAP : "0px"
33
41
  };
34
42
  if (stylesheetOwned) return vars;
43
+ const rtl = point.direction === "rtl";
44
+ const kind = point.offset ? "touch" : "mouse";
35
45
  return {
36
46
  ...vars,
37
- top: `var(${MENU_POINT_Y})`,
38
- right: "auto",
39
- bottom: "auto",
40
- left: `var(${MENU_POINT_X})`,
47
+ top: point.offset ? "auto" : `calc(var(${MENU_POINT_Y}) + var(${MENU_POINT_GAP}))`,
48
+ right: rtl ? `calc(100% - var(${MENU_POINT_X}))` : "auto",
49
+ bottom: point.offset ? `calc(100% - var(${MENU_POINT_Y}) + var(${MENU_POINT_GAP}))` : "auto",
50
+ left: rtl ? "auto" : `var(${MENU_POINT_X})`,
41
51
  positionArea: "none",
42
- positionTryFallbacks: MENU_POINT_FALLBACKS[point.generation % 2]
52
+ positionTryFallbacks: MENU_POINT_FALLBACKS[point.direction][kind][point.generation % 2]
43
53
  };
44
54
  }
45
55
  /**
56
+ * The element under a wheel event that can scroll the way the wheel turns, up to `popup`: then
57
+ * the wheel is the menu's own and the page under it is not involved.
58
+ */
59
+ function scrollsWithin(popup, target, event) {
60
+ const vertical = Math.abs(event.deltaY) >= Math.abs(event.deltaX);
61
+ const delta = vertical ? event.deltaY : event.deltaX;
62
+ if (delta === 0) return true;
63
+ let element = target instanceof Element ? target : null;
64
+ while (element !== null && popup.contains(element)) {
65
+ const computed = element.ownerDocument.defaultView?.getComputedStyle(element);
66
+ const overflow = computed?.[vertical ? "overflowY" : "overflowX"] ?? "";
67
+ if (overflow === "auto" || overflow === "scroll" || overflow === "overlay") {
68
+ const room = vertical ? element.scrollHeight - element.clientHeight : element.scrollWidth - element.clientWidth;
69
+ const offset = vertical ? element.scrollTop : element.scrollLeft;
70
+ const min = !vertical && computed?.direction === "rtl" ? -room : 0;
71
+ if (room > 0 && (delta > 0 ? offset < min + room - .5 : offset > min + .5)) return true;
72
+ }
73
+ element = element.parentElement;
74
+ }
75
+ return false;
76
+ }
77
+ /**
46
78
  * The outside right- and middle-click close of a top-level menu (context-menu.md 5): a
47
79
  * `contextmenu` outside the menu tree that this menu's ContextTrigger did not handle, or a
48
80
  * middle-button `pointerdown` outside it, hides the root popup at once (`"dismiss"` through the
49
- * `toggle` notification). Chromium's click-based light dismiss ignores those buttons. Returns the
50
- * cleanup.
81
+ * `toggle` notification). Chromium's click-based light dismiss ignores those buttons.
82
+ *
83
+ * Wave 11 (#88, 4.8): while the menu is placed at a point (read at each event: a right-click may
84
+ * re-place a Trigger-opened menu), a `scroll` of the document or of an element that contains the
85
+ * region closes it the same way; scrolls elsewhere and inside the menu are ignored. Scrolling
86
+ * already in flight at the open (a smooth scroll, trackpad momentum) does not count: scroll
87
+ * events are ignored until the first animation frame without one (review L6). And a `wheel`
88
+ * over any menu never scrolls the page: it is prevented unless something in the menu under the
89
+ * pointer can scroll that way, or it is a zoom (`ctrlKey`: Ctrl+wheel, trackpad pinch). Returns
90
+ * the cleanup.
51
91
  */
52
- function listenOutside(popup, menu) {
92
+ function listenOutside(popup, menu, placement) {
53
93
  const doc = popup.ownerDocument;
54
94
  const inside = (target) => target instanceof Node && popup.contains(target);
55
95
  const close = () => {
@@ -63,11 +103,47 @@ function listenOutside(popup, menu) {
63
103
  if (event.button !== 1 || inside(event.target)) return;
64
104
  close();
65
105
  };
106
+ const view = doc.defaultView;
107
+ let settling = typeof view?.requestAnimationFrame === "function";
108
+ let scrolledThisFrame = false;
109
+ let frame = 0;
110
+ const tick = () => {
111
+ if (scrolledThisFrame) {
112
+ scrolledThisFrame = false;
113
+ frame = view.requestAnimationFrame(tick);
114
+ } else settling = false;
115
+ };
116
+ if (settling) frame = view.requestAnimationFrame(tick);
117
+ const onScroll = (event) => {
118
+ if (settling) {
119
+ scrolledThisFrame = true;
120
+ return;
121
+ }
122
+ const current = placement();
123
+ if (current.kind !== "point") return;
124
+ const target = event.target;
125
+ if (target instanceof Node && target.nodeType !== Node.DOCUMENT_NODE) {
126
+ if (inside(target) || !target.contains(current.source)) return;
127
+ }
128
+ close();
129
+ };
130
+ const onWheel = (event) => {
131
+ if (event.ctrlKey) return;
132
+ if (!scrollsWithin(popup, event.target, event)) event.preventDefault();
133
+ };
66
134
  doc.addEventListener("contextmenu", onContextMenu);
67
135
  doc.addEventListener("pointerdown", onPointerDown, true);
136
+ doc.addEventListener("scroll", onScroll, {
137
+ capture: true,
138
+ passive: true
139
+ });
140
+ popup.addEventListener("wheel", onWheel, { passive: false });
68
141
  return () => {
142
+ if (settling) view.cancelAnimationFrame(frame);
69
143
  doc.removeEventListener("contextmenu", onContextMenu);
70
144
  doc.removeEventListener("pointerdown", onPointerDown, true);
145
+ doc.removeEventListener("scroll", onScroll, { capture: true });
146
+ popup.removeEventListener("wheel", onWheel);
71
147
  };
72
148
  }
73
149
  /**
@@ -76,7 +152,9 @@ function listenOutside(popup, menu) {
76
152
  * ArrowUp / ArrowDown / Home / End move focus between items (or the browser does, with
77
153
  * `experimental_focusgroup` where supported), printable characters run typeahead, ArrowLeft
78
154
  * closes a submenu. The top-level popup closes the whole menu at once when focus leaves it (Tab).
79
- * Style it with `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.
155
+ * Style it with `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While
156
+ * shown, those are where the browser placed it (conventions 13.2), otherwise the requested
157
+ * values.
80
158
  *
81
159
  * Owned keys (conventions 1.2): `id`, `popover`, `role`, `aria-labelledby` (token-merged),
82
160
  * `tabIndex`, `focusgroup` (with the flag), `onKeyDown`, `onBlur`, `onMouseDown` (a press on
@@ -84,16 +162,25 @@ function listenOutside(popup, menu) {
84
162
  * one), `onPointerEnter` / `onPointerLeave`, `data-side` / `data-align` unless `side` is `null`
85
163
  * or the menu is placed at a point, and `data-context` for an open from a `Menu.ContextTrigger`
86
164
  * (placed at the pointer: `--menu-point-x` / `--menu-point-y` inline, and unless `side` is
87
- * `null`, `left` / `top` at the point with the library's `@position-try` fallbacks, whose rules
165
+ * `null`, `top` and `left` (`right` for an RTL popup) at the point with the library's
166
+ * `@position-try` fallbacks, whose rules
88
167
  * it renders as a hoisted `<style>`). A top-level menu closes at once on a right- or
89
168
  * middle-click outside it.
90
169
  */
91
170
  function MenuPopup({ side: sideProp, align = "start", keepMounted, experimental_focusgroup = false, transition, className, style, children, render, ...rest }) {
92
171
  const menu = useMenuContext("Menu.Popup");
93
172
  const { popover, submenu, loop } = menu;
94
- const sideOption = sideProp === void 0 ? submenu ? "right" : "bottom" : sideProp;
173
+ const csp = use(CSPContext);
174
+ const latestPlacement = useLatest(menu.placement);
175
+ const sideOption = sideProp === void 0 ? submenu ? "inline-end" : "bottom" : sideProp;
95
176
  const point = menu.placement.kind === "point" ? menu.placement : null;
96
- const side = point !== null ? null : sideOption;
177
+ const requestedSide = point !== null ? null : sideOption;
178
+ const placement = useResolvedPlacement({
179
+ side: requestedSide,
180
+ align
181
+ });
182
+ const { side } = placement;
183
+ const resolvedAlign = placement.align;
97
184
  const nativeFocusgroup = useSyncExternalStore(subscribeNever, () => experimental_focusgroup && "focusGroup" in HTMLElement.prototype, () => false);
98
185
  const typeahead = useRef({
99
186
  text: "",
@@ -127,7 +214,7 @@ function MenuPopup({ side: sideProp, align = "start", keepMounted, experimental_
127
214
  onToggle: (event) => {
128
215
  if (submenu) return;
129
216
  const element = popover.popupRef.current;
130
- if (event.newState === "open" && element !== null && element.matches(":popover-open")) outside.current ??= listenOutside(element, menu);
217
+ if (event.newState === "open" && element !== null && element.matches(":popover-open")) outside.current ??= listenOutside(element, menu, () => latestPlacement.current);
131
218
  else if (event.newState === "closed") stopOutside();
132
219
  }
133
220
  });
@@ -150,7 +237,12 @@ function MenuPopup({ side: sideProp, align = "start", keepMounted, experimental_
150
237
  element.addEventListener("pointerdown", onPointerDown);
151
238
  return () => element.removeEventListener("pointerdown", onPointerDown);
152
239
  }, []);
153
- const ref = useMemo(() => mergeRefs(setElement, devRef), [setElement, devRef]);
240
+ const placementRef = placement.ref;
241
+ const ref = useMemo(() => mergeRefs(setElement, devRef, placementRef), [
242
+ setElement,
243
+ devRef,
244
+ placementRef
245
+ ]);
154
246
  const listContext = useMemo(() => ({
155
247
  menu,
156
248
  nativeFocusgroup,
@@ -163,7 +255,7 @@ function MenuPopup({ side: sideProp, align = "start", keepMounted, experimental_
163
255
  const state = {
164
256
  open: popover.committed,
165
257
  side,
166
- align,
258
+ align: resolvedAlign,
167
259
  submenu,
168
260
  context: point !== null
169
261
  };
@@ -260,13 +352,14 @@ function MenuPopup({ side: sideProp, align = "start", keepMounted, experimental_
260
352
  },
261
353
  ...side !== null && {
262
354
  "data-side": side,
263
- "data-align": align
355
+ "data-align": resolvedAlign
264
356
  },
265
357
  "data-context": point !== null ? "" : void 0
266
358
  };
267
359
  const pointRules = point !== null && sideOption !== null ? /* @__PURE__ */ jsx("style", {
268
360
  href: MENU_POINT_HREF,
269
361
  precedence: FSUI_PRECEDENCE,
362
+ nonce: csp?.nonce,
270
363
  children: MENU_POINT_RULES
271
364
  }) : null;
272
365
  const content = (s) => {
@@ -292,8 +385,8 @@ function MenuPopup({ side: sideProp, align = "start", keepMounted, experimental_
292
385
  style: point !== null ? (s) => ({
293
386
  ...pointStyle(point, sideOption === null),
294
387
  ...resolveStateValue(style, s)
295
- }) : side === null ? style : (s) => ({
296
- positionArea: positionArea(side, align),
388
+ }) : requestedSide === null ? style : (s) => ({
389
+ positionArea: positionArea(requestedSide, align),
297
390
  positionTryFallbacks: submenu ? "flip-inline" : POSITION_TRY_FALLBACKS,
298
391
  ...resolveStateValue(style, s)
299
392
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"menu-popup.mjs","names":[],"sources":["../../src/menu/menu-popup.tsx"],"sourcesContent":["\"use client\";\nimport {\n Activity,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n PointerEvent,\n ReactNode,\n ViewTransitionClass,\n} from \"react\";\nimport {\n FSUI_PRECEDENCE,\n MENU_POINT_FALLBACKS,\n MENU_POINT_HREF,\n MENU_POINT_RULES,\n MENU_POINT_X,\n MENU_POINT_Y,\n POSITION_TRY_FALLBACKS,\n positionArea,\n} from \"../internal/anchor-position.js\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { mergeRefs } from \"../internal/merge-props.js\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { claimPress, isHandledBy, MenuListContext, useMenuContext } from \"./menu-context.js\";\nimport type { MenuContextValue, MenuListContextValue, MenuPlacement } from \"./menu-context.js\";\nimport {\n capturePointer,\n edgeItem,\n focusItem,\n hasModifier,\n isMenuItem,\n isRtl,\n menuItems,\n typeaheadText,\n} from \"./menu-dom.js\";\nimport { scheduleHoverClose } from \"./menu-hover.js\";\n\nexport type MenuSide = AnchorSide;\nexport type MenuAlign = AnchorAlign;\n\nexport interface MenuPopupState {\n /** Committed open state. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n /** `null` with `side={null}`, and while the menu is placed at a point (`context`). */\n readonly side: MenuSide | null;\n readonly align: MenuAlign;\n /** This popup belongs to a submenu. */\n readonly submenu: boolean;\n /**\n * The current open came from a `Menu.ContextTrigger`: the popup is placed at the pointer, with\n * `--menu-point-x` / `--menu-point-y` set inline (`data-context`).\n */\n readonly context: boolean;\n}\n\nexport interface MenuPopupProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"id\"\n | \"popover\"\n | \"role\"\n | \"aria-labelledby\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onMouseDown\"\n | \"onContextMenu\"\n | \"onPointerEnter\"\n | \"onPointerLeave\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement against the Trigger through inline `position-area`, with `position-try-fallbacks`\n * flipping it when it does not fit. Default `\"bottom\"` for a top-level menu, `\"right\"` for a\n * submenu (whose fallback is `flip-inline` only). `null` emits no inline positioning (and no\n * `data-side` / `data-align`): the stylesheet owns placement. Ignored for an open from a\n * `Menu.ContextTrigger`, which is placed at the pointer; there `null` also opts out of the\n * inline point placement and the library's `@position-try` rules, leaving only\n * `--menu-point-x` / `--menu-point-y`.\n */\n side?: MenuSide | null;\n /** Alignment along the side. Default `\"start\"`. Ignored when `side` is `null`. */\n align?: MenuAlign;\n /**\n * `false` (default): the items are not rendered while the menu is closed; mounting them is part\n * of the opening transition, so items that suspend hold the open (and the Trigger pending)\n * until they are ready. `true`: they stay mounted inside `<Activity mode=\"hidden\">`.\n */\n keepMounted?: boolean;\n /**\n * Experimental (Chromium 150+). Renders `focusgroup=\"menu wrap|nowrap\"` and, where the engine\n * implements `focusGroup`, lets the browser handle ArrowUp / ArrowDown / Home / End: items then\n * render no `tabindex` and the library's arrow-key handling steps aside. Typeahead, activation,\n * submenu keys and Tab stay in JS. No effect in other engines. Default `false`.\n */\n experimental_focusgroup?: boolean;\n /**\n * Forwarded to the `<ViewTransition default>` around the popup element. Animates the opening\n * commit and every library-driven close (an item's activation, the Trigger, ArrowLeft, hover\n * leaving a submenu, controlled `open={false}`) in all engines; dismissals (Escape, a click\n * outside, Tab) animate with CSS only. Without it the part renders no `<ViewTransition>`.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, MenuPopupState>;\n style?: StateValue<CSSProperties | undefined, MenuPopupState>;\n children?: StateValue<ReactNode, MenuPopupState>;\n /** Should render a `<div>`; a `<dialog>` would run the dialog focusing steps. */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, MenuPopupState>;\n}\n\n/** Engine capabilities never change while the page lives. */\nconst subscribeNever = () => () => {};\n\n/** Typeahead buffer lifetime after the last keystroke (design 5.1). */\nconst TYPEAHEAD_RESET_MS = 500;\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** What a press may focus inside a popup: items, the popup itself, the consumer's controls. */\nconst FOCUSABLE_SELECTOR =\n 'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]:not([contenteditable=\"false\"])';\n\ntype PointPlacement = Extract<MenuPlacement, { kind: \"point\" }>;\n\n/**\n * The inline placement of a point open (context-menu.md 3.3): the point as two custom\n * properties, and unless the stylesheet owns placement, `left` / `top` at it with the other two\n * insets `auto` (longhands, so React never sees a shorthand next to its longhands),\n * `position-area: none` (a consumer's anchored `position-area` would otherwise place the popup\n * inside a grid area) and the library's fallbacks, spelled by generation parity (4.3).\n */\nfunction pointStyle(point: PointPlacement, stylesheetOwned: boolean): CSSProperties {\n const vars = { [MENU_POINT_X]: `${point.x}px`, [MENU_POINT_Y]: `${point.y}px` };\n if (stylesheetOwned) return vars as CSSProperties;\n return {\n ...vars,\n top: `var(${MENU_POINT_Y})`,\n right: \"auto\",\n bottom: \"auto\",\n left: `var(${MENU_POINT_X})`,\n positionArea: \"none\",\n positionTryFallbacks: MENU_POINT_FALLBACKS[point.generation % 2],\n } as CSSProperties;\n}\n\n/**\n * The outside right- and middle-click close of a top-level menu (context-menu.md 5): a\n * `contextmenu` outside the menu tree that this menu's ContextTrigger did not handle, or a\n * middle-button `pointerdown` outside it, hides the root popup at once (`\"dismiss\"` through the\n * `toggle` notification). Chromium's click-based light dismiss ignores those buttons. Returns the\n * cleanup.\n */\nfunction listenOutside(popup: HTMLElement, menu: MenuContextValue): () => void {\n const doc = popup.ownerDocument;\n const inside = (target: EventTarget | null) => target instanceof Node && popup.contains(target);\n const close = () => {\n if (popup.matches(\":popover-open\")) popup.hidePopover();\n };\n // Bubble phase: the region's handler ran first and marked a move.\n const onContextMenu = (event: Event) => {\n if (inside(event.target) || isHandledBy(event, menu)) return;\n close();\n };\n const onPointerDown = (event: Event) => {\n if ((event as globalThis.PointerEvent).button !== 1 || inside(event.target)) return;\n close();\n };\n doc.addEventListener(\"contextmenu\", onContextMenu);\n doc.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => {\n doc.removeEventListener(\"contextmenu\", onContextMenu);\n doc.removeEventListener(\"pointerdown\", onPointerDown, true);\n };\n}\n\n/**\n * The menu itself: `<div popover=\"auto\" role=\"menu\" aria-labelledby={trigger} tabindex=\"-1\">`,\n * placed against its Trigger with CSS Anchor Positioning. Owns the keyboard model (design 5):\n * ArrowUp / ArrowDown / Home / End move focus between items (or the browser does, with\n * `experimental_focusgroup` where supported), printable characters run typeahead, ArrowLeft\n * closes a submenu. The top-level popup closes the whole menu at once when focus leaves it (Tab).\n * Style it with `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `role`, `aria-labelledby` (token-merged),\n * `tabIndex`, `focusgroup` (with the flag), `onKeyDown`, `onBlur`, `onMouseDown` (a press on\n * non-item space keeps focus on the current item), `onContextMenu` (no native menu over this\n * one), `onPointerEnter` / `onPointerLeave`, `data-side` / `data-align` unless `side` is `null`\n * or the menu is placed at a point, and `data-context` for an open from a `Menu.ContextTrigger`\n * (placed at the pointer: `--menu-point-x` / `--menu-point-y` inline, and unless `side` is\n * `null`, `left` / `top` at the point with the library's `@position-try` fallbacks, whose rules\n * it renders as a hoisted `<style>`). A top-level menu closes at once on a right- or\n * middle-click outside it.\n */\nexport function MenuPopup({\n side: sideProp,\n align = \"start\",\n keepMounted,\n experimental_focusgroup = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: MenuPopupProps) {\n const menu = useMenuContext(\"Menu.Popup\");\n const { popover, submenu, loop } = menu;\n const sideOption = sideProp === undefined ? (submenu ? \"right\" : \"bottom\") : sideProp;\n // A ContextTrigger's open is placed at the point; nothing is anchored (context-menu.md 3.3).\n const point = menu.placement.kind === \"point\" ? menu.placement : null;\n const side = point !== null ? null : sideOption;\n\n // As Tabs.List (#43): detected only with the flag, never during SSR or hydration.\n const nativeFocusgroup = useSyncExternalStore(\n subscribeNever,\n () => experimental_focusgroup && \"focusGroup\" in HTMLElement.prototype,\n () => false,\n );\n\n const typeahead = useRef({ text: \"\", at: 0 });\n const typingAhead = useCallback(() => {\n const { text, at } = typeahead.current;\n return text !== \"\" && Date.now() - at <= TYPEAHEAD_RESET_MS;\n }, []);\n\n // The outside right- / middle-click listeners of a top-level menu, while it is shown.\n const outside = useRef<(() => void) | null>(null);\n const stopOutside = useCallback(() => {\n outside.current?.();\n outside.current = null;\n }, []);\n useEffect(() => stopOutside, [stopOutside]);\n\n const { setElement, visible, wrapContent, reshow } = usePopoverPopup(popover, {\n part: \"Menu.Popup\",\n initialFocus: undefined,\n // Design 6.1: the first (or last) enabled item by open cause, nothing for a hover open, the\n // popup itself when there are no items.\n // A pointer open focuses without the focus ring where the engine can be told so (H1).\n resolveInitialFocus: (popup) => {\n const { cause, pointer } = menu.takeOpenCause();\n if (cause === \"none\") return null;\n const element = edgeItem(popup, cause) ?? popup;\n return pointer ? { element, focusVisible: false } : element;\n },\n keepMounted,\n transition,\n // A point open nests through the region that opened it (context-menu.md 3.1).\n source: () => (point !== null ? point.source : popover.triggerRef.current),\n onToggle: (event) => {\n if (submenu) return;\n const element = popover.popupRef.current;\n if (event.newState === \"open\" && element !== null && element.matches(\":popover-open\")) {\n outside.current ??= listenOutside(element, menu);\n } else if (event.newState === \"closed\") {\n stopOutside();\n }\n },\n });\n\n // A move (context-menu.md 4.3): the popup is shown and the placement changed since it was\n // shown (a new point, or a right-click in the region while a Trigger open is shown). Re-show\n // it so the respelled fallbacks place it afresh, the source is the region and the first item\n // is focused again; then capture the still-pressed pointer again, against the Firefox / WebKit\n // `pointerup` light dismiss. Runs after the hook's apply effect (declared after it).\n // Once the popup is not visible (hidden, exit animation over) and no open is intended or in\n // flight, a point placement goes back to anchored for the next open that is not a\n // ContextTrigger's: after a point open that was shown and closed, and after one that was\n // rejected or refused (review L1).\n const shownKey = useRef<number | \"anchor\" | null>(null);\n useLayoutEffect(() => {\n const element = popover.popupRef.current;\n if (element === null) return;\n const key = point !== null ? point.generation : \"anchor\";\n if (element.matches(\":popover-open\")) {\n if (shownKey.current !== null && shownKey.current !== key && reshow()) {\n capturePointer(element, point?.pointerId);\n }\n shownKey.current = key;\n } else {\n shownKey.current = null;\n if (!visible && point !== null && !popover.pending && !popover.intended()) {\n menu.resetPlacement(point.generation);\n }\n }\n });\n\n const devRef = useCallback((element: HTMLElement) => {\n if (isDev && element.tagName === \"DIALOG\") {\n console.error(\n \"Menu.Popup: rendered a <dialog>. Render a <div>: a <dialog popover> runs the dialog \" +\n \"focusing steps, which fight the menu's item focus.\",\n );\n }\n // A press inside a menu is never a long-press of a Menu.ContextTrigger around it (review M1).\n // Native, so it runs before React's root listener dispatches to the region.\n const onPointerDown = (event: Event) => claimPress(event);\n element.addEventListener(\"pointerdown\", onPointerDown);\n return () => element.removeEventListener(\"pointerdown\", onPointerDown);\n }, []);\n const ref = useMemo(() => mergeRefs(setElement, devRef), [setElement, devRef]);\n\n const listContext = useMemo<MenuListContextValue>(\n () => ({ menu, nativeFocusgroup, typingAhead }),\n [menu, nativeFocusgroup, typingAhead],\n );\n\n const state: MenuPopupState = {\n open: popover.committed,\n side,\n align,\n submenu,\n context: point !== null,\n };\n\n const runTypeahead = (popup: HTMLElement, current: HTMLElement | null, key: string): boolean => {\n const now = Date.now();\n const buffer = typeahead.current;\n if (buffer.text === \"\" || now - buffer.at > TYPEAHEAD_RESET_MS) buffer.text = \"\";\n if (key === \" \" && buffer.text === \"\") return false;\n buffer.text += key.toLowerCase();\n buffer.at = now;\n const items = menuItems(popup);\n if (items.length === 0) return true;\n // A repeated single character cycles through the items starting with it; a longer buffer\n // keeps the current item while it still matches (design 5.1).\n const repeated = [...buffer.text].every((c) => c === buffer.text[0]);\n const search = repeated ? buffer.text[0]! : buffer.text;\n const index = current === null ? -1 : items.indexOf(current);\n const start = repeated || index < 0 ? index + 1 : index;\n for (let i = 0; i < items.length; i++) {\n const item = items[(start + i) % items.length]!;\n if (typeaheadText(item).startsWith(search)) {\n if (item !== current) focusItem(item);\n break;\n }\n }\n return true;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.defaultPrevented || hasModifier(event)) return;\n const popup = event.currentTarget;\n const target = event.target as HTMLElement;\n const onItem = isMenuItem(target, popup);\n if (!onItem && target !== popup) return;\n const key = event.key;\n\n // ArrowLeft (ArrowRight in RTL) closes a submenu; focus returns to its SubmenuTrigger\n // through the popover hook's nested focus rule (design 6.3).\n if (submenu && key === (isRtl(popup) ? \"ArrowRight\" : \"ArrowLeft\")) {\n event.preventDefault();\n popover.requestClose(event.nativeEvent, \"activate\");\n return;\n }\n\n if (key === \"ArrowDown\" || key === \"ArrowUp\" || key === \"Home\" || key === \"End\") {\n if (!onItem) {\n // The popup itself has focus (no items at open, or focus landed on it some other way):\n // into the list from its edge (review M1).\n event.preventDefault();\n const items = menuItems(popup);\n const item = key === \"ArrowDown\" || key === \"Home\" ? items[0] : items.at(-1);\n if (item !== undefined) focusItem(item);\n return;\n }\n // The browser moves focus itself where `focusgroup` is implemented.\n if (nativeFocusgroup) return;\n event.preventDefault();\n const items = menuItems(popup);\n const index = items.indexOf(target);\n const last = items.length - 1;\n let next: number;\n if (key === \"Home\") next = 0;\n else if (key === \"End\") next = last;\n else if (key === \"ArrowDown\") next = index >= last ? (loop ? 0 : last) : index + 1;\n else next = index <= 0 ? (loop ? last : 0) : index - 1;\n const item = items[next];\n if (item !== undefined && item !== target) focusItem(item);\n return;\n }\n\n if (key.length === 1 && runTypeahead(popup, onItem ? target : null, key)) {\n event.preventDefault();\n }\n };\n\n // Tab / Shift+Tab or any focus move out of the tree closes the whole stack at once (design\n // 2.2): submenus are DOM descendants of the top-level popup, the Trigger is outside on purpose.\n // A null `relatedTarget` (window blur, a removed element) closes nothing.\n const onBlur = (event: FocusEvent<HTMLElement>) => {\n if (submenu) return;\n const popup = event.currentTarget;\n const next = event.relatedTarget;\n if (!(next instanceof Node) || popup.contains(next)) return;\n if (popup.matches(\":popover-open\")) popup.hidePopover();\n };\n\n // A press on non-item space (padding, a Separator, a GroupLabel) would focus the popup itself\n // (`tabindex=\"-1\"`) and take focus off the current item; keep it where it is (review M1, the\n // pointer-focus model of design 6.2). Focusable content of the consumer's (a text field) still\n // takes focus.\n const onMouseDown = (event: MouseEvent<HTMLElement>) => {\n if (event.button !== 0) return;\n const target = event.target as Element;\n const focusable = target.closest(FOCUSABLE_SELECTOR);\n if (focusable === null || focusable.getAttribute(\"role\") === \"menu\") event.preventDefault();\n };\n\n const libraryProps: ComponentPropsWithRef<\"div\"> & DataAttributes = {\n id: popover.ids.popup,\n popover: \"auto\",\n role: \"menu\",\n \"aria-labelledby\": menu.triggerId,\n // The popup itself takes focus as the last resort when a menu has no items.\n tabIndex: -1,\n ...(experimental_focusgroup && { focusgroup: `menu ${loop ? \"wrap\" : \"nowrap\"}` }),\n onKeyDown,\n onBlur,\n onMouseDown,\n // No native menu over the custom one. The popup is a sibling of any ContextTrigger, so this\n // event never reaches a region as a move; an outer region sees it prevented and stays quiet.\n onContextMenu: (event: MouseEvent<HTMLElement>) => {\n event.preventDefault();\n },\n ...(submenu && {\n onPointerEnter: (event: PointerEvent<HTMLElement>) => {\n if (event.pointerType !== \"touch\") menu.timers.cancelClose();\n },\n onPointerLeave: (event: PointerEvent<HTMLElement>) => {\n if (event.pointerType !== \"touch\") scheduleHoverClose(menu, event.nativeEvent);\n },\n }),\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n \"data-context\": point !== null ? \"\" : undefined,\n };\n\n // The shipped `@position-try` rules (conventions 12): hoisted into <head> and deduplicated by\n // React, rendered only by a point open that does not opt out with `side={null}`.\n const pointRules =\n point !== null && sideOption !== null ? (\n <style href={MENU_POINT_HREF} precedence={FSUI_PRECEDENCE}>\n {MENU_POINT_RULES}\n </style>\n ) : null;\n\n const content = (s: MenuPopupState): ReactNode => {\n let node: ReactNode;\n if (keepMounted === true) {\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n // Not part of an enclosing Toolbar: a Menu.Trigger or ToggleGroup in here sees no Toolbar.\n return (\n <MenuListContext value={listContext}>\n {pointRules}\n <ToolbarContext value={null}>{node}</ToolbarContext>\n </MenuListContext>\n );\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, MenuPopupState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The inline placement sits under the consumer's style: the consumer wins.\n style:\n point !== null\n ? (s) => ({ ...pointStyle(point, sideOption === null), ...resolveStateValue(style, s) })\n : side === null\n ? style\n : (s) => ({\n positionArea: positionArea(side, align),\n positionTryFallbacks: submenu ? \"flip-inline\" : POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n props: rest,\n libraryProps,\n ref,\n });\n\n return useTransitionBoundary(\"Menu.Popup\", transition, element);\n}\n\nMenuPopup.displayName = \"MenuPopup\";\n"],"mappings":";;;;;;;;;;;;;;;AAiIA,MAAM,6BAA6B,CAAC;;AAGpC,MAAM,qBAAqB;AAE3B,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AAGvC,MAAM,qBACJ;;;;;;;;AAWF,SAAS,WAAW,OAAuB,iBAAyC;CAClF,MAAM,OAAO;GAAG,eAAe,GAAG,MAAM,EAAE;GAAM,eAAe,GAAG,MAAM,EAAE;CAAI;CAC9E,IAAI,iBAAiB,OAAO;CAC5B,OAAO;EACL,GAAG;EACH,KAAK,OAAO,aAAa;EACzB,OAAO;EACP,QAAQ;EACR,MAAM,OAAO,aAAa;EAC1B,cAAc;EACd,sBAAsB,qBAAqB,MAAM,aAAa;CAChE;AACF;;;;;;;;AASA,SAAS,cAAc,OAAoB,MAAoC;CAC7E,MAAM,MAAM,MAAM;CAClB,MAAM,UAAU,WAA+B,kBAAkB,QAAQ,MAAM,SAAS,MAAM;CAC9F,MAAM,cAAc;EAClB,IAAI,MAAM,QAAQ,eAAe,GAAG,MAAM,YAAY;CACxD;CAEA,MAAM,iBAAiB,UAAiB;EACtC,IAAI,OAAO,MAAM,MAAM,KAAK,YAAY,OAAO,IAAI,G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AEA,UAAU,cAAc"}
1
+ {"version":3,"file":"menu-popup.mjs","names":[],"sources":["../../src/menu/menu-popup.tsx"],"sourcesContent":["\"use client\";\nimport {\n Activity,\n use,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n PointerEvent,\n ReactNode,\n ViewTransitionClass,\n} from \"react\";\nimport {\n FSUI_PRECEDENCE,\n MENU_POINT_FALLBACKS,\n MENU_POINT_GAP,\n MENU_POINT_HREF,\n MENU_POINT_RULES,\n MENU_POINT_TOUCH_GAP,\n MENU_POINT_X,\n MENU_POINT_Y,\n POSITION_TRY_FALLBACKS,\n positionArea,\n} from \"../internal/anchor-position.js\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { CSPContext } from \"../internal/csp-context.js\";\nimport { mergeRefs } from \"../internal/merge-props.js\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { useResolvedPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { claimPress, isHandledBy, MenuListContext, useMenuContext } from \"./menu-context.js\";\nimport type { MenuContextValue, MenuListContextValue, MenuPlacement } from \"./menu-context.js\";\nimport {\n capturePointer,\n edgeItem,\n focusItem,\n hasModifier,\n isMenuItem,\n isRtl,\n menuItems,\n typeaheadText,\n} from \"./menu-dom.js\";\nimport { scheduleHoverClose } from \"./menu-hover.js\";\n\n/** `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). */\nexport type MenuSide = AnchorSide;\nexport type MenuAlign = AnchorAlign;\n\nexport interface MenuPopupState {\n /** Committed open state. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (after any fallback flip;\n * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`, and while the menu\n * is placed at a point (`context`).\n */\n readonly side: MenuSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: MenuAlign;\n /** This popup belongs to a submenu. */\n readonly submenu: boolean;\n /**\n * The current open came from a `Menu.ContextTrigger`: the popup is placed at the pointer, with\n * `--menu-point-x` / `--menu-point-y` set inline (`data-context`).\n */\n readonly context: boolean;\n}\n\nexport interface MenuPopupProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"id\"\n | \"popover\"\n | \"role\"\n | \"aria-labelledby\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onMouseDown\"\n | \"onContextMenu\"\n | \"onPointerEnter\"\n | \"onPointerLeave\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement against the Trigger through inline `position-area`, with `position-try-fallbacks`\n * flipping it when it does not fit. Default `\"bottom\"` for a top-level menu, `\"inline-end\"` for\n * a submenu (the right of the item in LTR, its left in RTL; its fallback is `flip-inline`\n * only). `\"left\"` / `\"right\"` stay physical. `null` emits no inline positioning (and no\n * `data-side` / `data-align`): the stylesheet owns placement. Ignored for an open from a\n * `Menu.ContextTrigger`, which is placed at the pointer; there `null` also opts out of the\n * inline point placement and the library's `@position-try` rules, leaving only\n * `--menu-point-x` / `--menu-point-y`.\n */\n side?: MenuSide | null;\n /**\n * Alignment along the side. Default `\"start\"` (both levels): inline-relative on a top / bottom\n * side (mirrored under `direction: rtl`), the top edges on the others. Ignored when `side` is\n * `null`.\n */\n align?: MenuAlign;\n /**\n * `false` (default): the items are not rendered while the menu is closed; mounting them is part\n * of the opening transition, so items that suspend hold the open (and the Trigger pending)\n * until they are ready. `true`: they stay mounted inside `<Activity mode=\"hidden\">`.\n */\n keepMounted?: boolean;\n /**\n * Experimental (Chromium 150+). Renders `focusgroup=\"menu wrap|nowrap\"` and, where the engine\n * implements `focusGroup`, lets the browser handle ArrowUp / ArrowDown / Home / End: items then\n * render no `tabindex` and the library's arrow-key handling steps aside. Typeahead, activation,\n * submenu keys and Tab stay in JS. No effect in other engines. Default `false`.\n */\n experimental_focusgroup?: boolean;\n /**\n * Forwarded to the `<ViewTransition default>` around the popup element. Animates the opening\n * commit and every library-driven close (an item's activation, the Trigger, ArrowLeft, hover\n * leaving a submenu, controlled `open={false}`) in all engines; dismissals (Escape, a click\n * outside, Tab) animate with CSS only. Without it the part renders no `<ViewTransition>`.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, MenuPopupState>;\n style?: StateValue<CSSProperties | undefined, MenuPopupState>;\n children?: StateValue<ReactNode, MenuPopupState>;\n /** Should render a `<div>`; a `<dialog>` would run the dialog focusing steps. */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, MenuPopupState>;\n}\n\n/** Engine capabilities never change while the page lives. */\nconst subscribeNever = () => () => {};\n\n/** Typeahead buffer lifetime after the last keystroke (design 5.1). */\nconst TYPEAHEAD_RESET_MS = 500;\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** What a press may focus inside a popup: items, the popup itself, the consumer's controls. */\nconst FOCUSABLE_SELECTOR =\n 'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]:not([contenteditable=\"false\"])';\n\ntype PointPlacement = Extract<MenuPlacement, { kind: \"point\" }>;\n\n/**\n * The inline placement of a point open (context-menu.md 3.3): the point and the gap as custom\n * properties (`--menu-point-gap`: `0px`, `16px` for a touch or pen open, 4.7), and unless the\n * stylesheet owns placement, the menu below the point (`top`) or, for a touch or pen open, above\n * it (`bottom`), and by the popup's direction read at the open (4.6, #88), `left` (LTR) or\n * `right` (RTL: the menu's right edge at the point), with the other two insets `auto`\n * (longhands, so React never sees a shorthand next to its longhands), `position-area: none` (a\n * consumer's anchored `position-area` would otherwise place the popup inside a grid area) and\n * the library's fallbacks for that direction and pointer kind, spelled by generation parity\n * (4.3).\n */\nfunction pointStyle(point: PointPlacement, stylesheetOwned: boolean): CSSProperties {\n const vars = {\n [MENU_POINT_X]: `${point.x}px`,\n [MENU_POINT_Y]: `${point.y}px`,\n [MENU_POINT_GAP]: point.offset ? MENU_POINT_TOUCH_GAP : \"0px\",\n };\n if (stylesheetOwned) return vars as CSSProperties;\n const rtl = point.direction === \"rtl\";\n const kind = point.offset ? \"touch\" : \"mouse\";\n return {\n ...vars,\n top: point.offset ? \"auto\" : `calc(var(${MENU_POINT_Y}) + var(${MENU_POINT_GAP}))`,\n right: rtl ? `calc(100% - var(${MENU_POINT_X}))` : \"auto\",\n bottom: point.offset ? `calc(100% - var(${MENU_POINT_Y}) + var(${MENU_POINT_GAP}))` : \"auto\",\n left: rtl ? \"auto\" : `var(${MENU_POINT_X})`,\n positionArea: \"none\",\n positionTryFallbacks: MENU_POINT_FALLBACKS[point.direction][kind][point.generation % 2],\n } as CSSProperties;\n}\n\n/**\n * The element under a wheel event that can scroll the way the wheel turns, up to `popup`: then\n * the wheel is the menu's own and the page under it is not involved.\n */\nfunction scrollsWithin(popup: HTMLElement, target: EventTarget | null, event: WheelEvent) {\n const vertical = Math.abs(event.deltaY) >= Math.abs(event.deltaX);\n const delta = vertical ? event.deltaY : event.deltaX;\n if (delta === 0) return true;\n let element = target instanceof Element ? target : null;\n while (element !== null && popup.contains(element)) {\n const computed = element.ownerDocument.defaultView?.getComputedStyle(element);\n const overflow = computed?.[vertical ? \"overflowY\" : \"overflowX\"] ?? \"\";\n if (overflow === \"auto\" || overflow === \"scroll\" || overflow === \"overlay\") {\n // Scroll offsets run 0..room (down, or right in LTR) or -room..0 (right to left).\n const room = vertical\n ? element.scrollHeight - element.clientHeight\n : element.scrollWidth - element.clientWidth;\n const offset = vertical ? element.scrollTop : element.scrollLeft;\n const min = !vertical && computed?.direction === \"rtl\" ? -room : 0;\n if (room > 0 && (delta > 0 ? offset < min + room - 0.5 : offset > min + 0.5)) return true;\n }\n element = element.parentElement;\n }\n return false;\n}\n\n/**\n * The outside right- and middle-click close of a top-level menu (context-menu.md 5): a\n * `contextmenu` outside the menu tree that this menu's ContextTrigger did not handle, or a\n * middle-button `pointerdown` outside it, hides the root popup at once (`\"dismiss\"` through the\n * `toggle` notification). Chromium's click-based light dismiss ignores those buttons.\n *\n * Wave 11 (#88, 4.8): while the menu is placed at a point (read at each event: a right-click may\n * re-place a Trigger-opened menu), a `scroll` of the document or of an element that contains the\n * region closes it the same way; scrolls elsewhere and inside the menu are ignored. Scrolling\n * already in flight at the open (a smooth scroll, trackpad momentum) does not count: scroll\n * events are ignored until the first animation frame without one (review L6). And a `wheel`\n * over any menu never scrolls the page: it is prevented unless something in the menu under the\n * pointer can scroll that way, or it is a zoom (`ctrlKey`: Ctrl+wheel, trackpad pinch). Returns\n * the cleanup.\n */\nfunction listenOutside(\n popup: HTMLElement,\n menu: MenuContextValue,\n placement: () => MenuPlacement,\n): () => void {\n const doc = popup.ownerDocument;\n const inside = (target: EventTarget | null) => target instanceof Node && popup.contains(target);\n const close = () => {\n if (popup.matches(\":popover-open\")) popup.hidePopover();\n };\n // Bubble phase: the region's handler ran first and marked a move.\n const onContextMenu = (event: Event) => {\n if (inside(event.target) || isHandledBy(event, menu)) return;\n close();\n };\n const onPointerDown = (event: Event) => {\n if ((event as globalThis.PointerEvent).button !== 1 || inside(event.target)) return;\n close();\n };\n // Scroll events run in a frame's rendering steps, before its animation frame callbacks: the\n // first callback that saw none since the last one ends the in-flight scroll window.\n const view = doc.defaultView;\n let settling = typeof view?.requestAnimationFrame === \"function\";\n let scrolledThisFrame = false;\n let frame = 0;\n const tick = () => {\n if (scrolledThisFrame) {\n scrolledThisFrame = false;\n frame = view!.requestAnimationFrame(tick);\n } else settling = false;\n };\n if (settling) frame = view!.requestAnimationFrame(tick);\n const onScroll = (event: Event) => {\n if (settling) {\n scrolledThisFrame = true;\n return;\n }\n const current = placement();\n if (current.kind !== \"point\") return;\n const target = event.target;\n // The point is meaningless once the content under it moved: the document, or a scroller\n // around the region (React Aria's rule). A scroller elsewhere or inside the menu is not.\n if (target instanceof Node && target.nodeType !== Node.DOCUMENT_NODE) {\n if (inside(target) || !target.contains(current.source)) return;\n }\n close();\n };\n // Native menus never scroll the page from inside the menu; a non-overflowing popup would chain\n // the wheel to the page (Firefox ignores `overscroll-behavior` there).\n const onWheel = (event: WheelEvent) => {\n // A zoom, not a scroll: Ctrl+wheel and a trackpad pinch (`wheel` with `ctrlKey`) stay the\n // user's (review L3).\n if (event.ctrlKey) return;\n if (!scrollsWithin(popup, event.target, event)) event.preventDefault();\n };\n doc.addEventListener(\"contextmenu\", onContextMenu);\n doc.addEventListener(\"pointerdown\", onPointerDown, true);\n doc.addEventListener(\"scroll\", onScroll, { capture: true, passive: true });\n popup.addEventListener(\"wheel\", onWheel, { passive: false });\n return () => {\n if (settling) view!.cancelAnimationFrame(frame);\n doc.removeEventListener(\"contextmenu\", onContextMenu);\n doc.removeEventListener(\"pointerdown\", onPointerDown, true);\n doc.removeEventListener(\"scroll\", onScroll, { capture: true });\n popup.removeEventListener(\"wheel\", onWheel);\n };\n}\n\n/**\n * The menu itself: `<div popover=\"auto\" role=\"menu\" aria-labelledby={trigger} tabindex=\"-1\">`,\n * placed against its Trigger with CSS Anchor Positioning. Owns the keyboard model (design 5):\n * ArrowUp / ArrowDown / Home / End move focus between items (or the browser does, with\n * `experimental_focusgroup` where supported), printable characters run typeahead, ArrowLeft\n * closes a submenu. The top-level popup closes the whole menu at once when focus leaves it (Tab).\n * Style it with `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While\n * shown, those are where the browser placed it (conventions 13.2), otherwise the requested\n * values.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `role`, `aria-labelledby` (token-merged),\n * `tabIndex`, `focusgroup` (with the flag), `onKeyDown`, `onBlur`, `onMouseDown` (a press on\n * non-item space keeps focus on the current item), `onContextMenu` (no native menu over this\n * one), `onPointerEnter` / `onPointerLeave`, `data-side` / `data-align` unless `side` is `null`\n * or the menu is placed at a point, and `data-context` for an open from a `Menu.ContextTrigger`\n * (placed at the pointer: `--menu-point-x` / `--menu-point-y` inline, and unless `side` is\n * `null`, `top` and `left` (`right` for an RTL popup) at the point with the library's\n * `@position-try` fallbacks, whose rules\n * it renders as a hoisted `<style>`). A top-level menu closes at once on a right- or\n * middle-click outside it.\n */\nexport function MenuPopup({\n side: sideProp,\n align = \"start\",\n keepMounted,\n experimental_focusgroup = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: MenuPopupProps) {\n const menu = useMenuContext(\"Menu.Popup\");\n const { popover, submenu, loop } = menu;\n const csp = use(CSPContext);\n // The listeners installed at the open read the placement of the latest commit (4.8).\n const latestPlacement = useLatest(menu.placement);\n // A submenu opens on the inline-end side of its item: the side ArrowRight (ArrowLeft in RTL)\n // points to (wave 11, #53).\n const sideOption = sideProp === undefined ? (submenu ? \"inline-end\" : \"bottom\") : sideProp;\n // A ContextTrigger's open is placed at the point; nothing is anchored (context-menu.md 3.3).\n const point = menu.placement.kind === \"point\" ? menu.placement : null;\n const requestedSide = point !== null ? null : sideOption;\n // Resolved while shown (conventions 13.2); idle for a point open, which has no side.\n const placement = useResolvedPlacement({ side: requestedSide, align });\n const { side } = placement;\n const resolvedAlign = placement.align;\n\n // As Tabs.List (#43): detected only with the flag, never during SSR or hydration.\n const nativeFocusgroup = useSyncExternalStore(\n subscribeNever,\n () => experimental_focusgroup && \"focusGroup\" in HTMLElement.prototype,\n () => false,\n );\n\n const typeahead = useRef({ text: \"\", at: 0 });\n const typingAhead = useCallback(() => {\n const { text, at } = typeahead.current;\n return text !== \"\" && Date.now() - at <= TYPEAHEAD_RESET_MS;\n }, []);\n\n // The outside right- / middle-click listeners of a top-level menu, while it is shown.\n const outside = useRef<(() => void) | null>(null);\n const stopOutside = useCallback(() => {\n outside.current?.();\n outside.current = null;\n }, []);\n useEffect(() => stopOutside, [stopOutside]);\n\n const { setElement, visible, wrapContent, reshow } = usePopoverPopup(popover, {\n part: \"Menu.Popup\",\n initialFocus: undefined,\n // Design 6.1: the first (or last) enabled item by open cause, nothing for a hover open, the\n // popup itself when there are no items.\n // A pointer open focuses without the focus ring where the engine can be told so (H1).\n resolveInitialFocus: (popup) => {\n const { cause, pointer } = menu.takeOpenCause();\n if (cause === \"none\") return null;\n const element = edgeItem(popup, cause) ?? popup;\n return pointer ? { element, focusVisible: false } : element;\n },\n keepMounted,\n transition,\n // A point open nests through the region that opened it (context-menu.md 3.1).\n source: () => (point !== null ? point.source : popover.triggerRef.current),\n onToggle: (event) => {\n if (submenu) return;\n const element = popover.popupRef.current;\n if (event.newState === \"open\" && element !== null && element.matches(\":popover-open\")) {\n outside.current ??= listenOutside(element, menu, () => latestPlacement.current);\n } else if (event.newState === \"closed\") {\n stopOutside();\n }\n },\n });\n\n // A move (context-menu.md 4.3): the popup is shown and the placement changed since it was\n // shown (a new point, or a right-click in the region while a Trigger open is shown). Re-show\n // it so the respelled fallbacks place it afresh, the source is the region and the first item\n // is focused again; then capture the still-pressed pointer again, against the Firefox / WebKit\n // `pointerup` light dismiss. Runs after the hook's apply effect (declared after it).\n // Once the popup is not visible (hidden, exit animation over) and no open is intended or in\n // flight, a point placement goes back to anchored for the next open that is not a\n // ContextTrigger's: after a point open that was shown and closed, and after one that was\n // rejected or refused (review L1).\n const shownKey = useRef<number | \"anchor\" | null>(null);\n useLayoutEffect(() => {\n const element = popover.popupRef.current;\n if (element === null) return;\n const key = point !== null ? point.generation : \"anchor\";\n if (element.matches(\":popover-open\")) {\n if (shownKey.current !== null && shownKey.current !== key && reshow()) {\n capturePointer(element, point?.pointerId);\n }\n shownKey.current = key;\n } else {\n shownKey.current = null;\n if (!visible && point !== null && !popover.pending && !popover.intended()) {\n menu.resetPlacement(point.generation);\n }\n }\n });\n\n const devRef = useCallback((element: HTMLElement) => {\n if (isDev && element.tagName === \"DIALOG\") {\n console.error(\n \"Menu.Popup: rendered a <dialog>. Render a <div>: a <dialog popover> runs the dialog \" +\n \"focusing steps, which fight the menu's item focus.\",\n );\n }\n // A press inside a menu is never a long-press of a Menu.ContextTrigger around it (review M1).\n // Native, so it runs before React's root listener dispatches to the region.\n const onPointerDown = (event: Event) => claimPress(event);\n element.addEventListener(\"pointerdown\", onPointerDown);\n return () => element.removeEventListener(\"pointerdown\", onPointerDown);\n }, []);\n const placementRef = placement.ref;\n const ref = useMemo(\n () => mergeRefs(setElement, devRef, placementRef),\n [setElement, devRef, placementRef],\n );\n\n const listContext = useMemo<MenuListContextValue>(\n () => ({ menu, nativeFocusgroup, typingAhead }),\n [menu, nativeFocusgroup, typingAhead],\n );\n\n const state: MenuPopupState = {\n open: popover.committed,\n side,\n align: resolvedAlign,\n submenu,\n context: point !== null,\n };\n\n const runTypeahead = (popup: HTMLElement, current: HTMLElement | null, key: string): boolean => {\n const now = Date.now();\n const buffer = typeahead.current;\n if (buffer.text === \"\" || now - buffer.at > TYPEAHEAD_RESET_MS) buffer.text = \"\";\n if (key === \" \" && buffer.text === \"\") return false;\n buffer.text += key.toLowerCase();\n buffer.at = now;\n const items = menuItems(popup);\n if (items.length === 0) return true;\n // A repeated single character cycles through the items starting with it; a longer buffer\n // keeps the current item while it still matches (design 5.1).\n const repeated = [...buffer.text].every((c) => c === buffer.text[0]);\n const search = repeated ? buffer.text[0]! : buffer.text;\n const index = current === null ? -1 : items.indexOf(current);\n const start = repeated || index < 0 ? index + 1 : index;\n for (let i = 0; i < items.length; i++) {\n const item = items[(start + i) % items.length]!;\n if (typeaheadText(item).startsWith(search)) {\n if (item !== current) focusItem(item);\n break;\n }\n }\n return true;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.defaultPrevented || hasModifier(event)) return;\n const popup = event.currentTarget;\n const target = event.target as HTMLElement;\n const onItem = isMenuItem(target, popup);\n if (!onItem && target !== popup) return;\n const key = event.key;\n\n // ArrowLeft (ArrowRight in RTL) closes a submenu; focus returns to its SubmenuTrigger\n // through the popover hook's nested focus rule (design 6.3).\n if (submenu && key === (isRtl(popup) ? \"ArrowRight\" : \"ArrowLeft\")) {\n event.preventDefault();\n popover.requestClose(event.nativeEvent, \"activate\");\n return;\n }\n\n if (key === \"ArrowDown\" || key === \"ArrowUp\" || key === \"Home\" || key === \"End\") {\n if (!onItem) {\n // The popup itself has focus (no items at open, or focus landed on it some other way):\n // into the list from its edge (review M1).\n event.preventDefault();\n const items = menuItems(popup);\n const item = key === \"ArrowDown\" || key === \"Home\" ? items[0] : items.at(-1);\n if (item !== undefined) focusItem(item);\n return;\n }\n // The browser moves focus itself where `focusgroup` is implemented.\n if (nativeFocusgroup) return;\n event.preventDefault();\n const items = menuItems(popup);\n const index = items.indexOf(target);\n const last = items.length - 1;\n let next: number;\n if (key === \"Home\") next = 0;\n else if (key === \"End\") next = last;\n else if (key === \"ArrowDown\") next = index >= last ? (loop ? 0 : last) : index + 1;\n else next = index <= 0 ? (loop ? last : 0) : index - 1;\n const item = items[next];\n if (item !== undefined && item !== target) focusItem(item);\n return;\n }\n\n if (key.length === 1 && runTypeahead(popup, onItem ? target : null, key)) {\n event.preventDefault();\n }\n };\n\n // Tab / Shift+Tab or any focus move out of the tree closes the whole stack at once (design\n // 2.2): submenus are DOM descendants of the top-level popup, the Trigger is outside on purpose.\n // A null `relatedTarget` (window blur, a removed element) closes nothing.\n const onBlur = (event: FocusEvent<HTMLElement>) => {\n if (submenu) return;\n const popup = event.currentTarget;\n const next = event.relatedTarget;\n if (!(next instanceof Node) || popup.contains(next)) return;\n if (popup.matches(\":popover-open\")) popup.hidePopover();\n };\n\n // A press on non-item space (padding, a Separator, a GroupLabel) would focus the popup itself\n // (`tabindex=\"-1\"`) and take focus off the current item; keep it where it is (review M1, the\n // pointer-focus model of design 6.2). Focusable content of the consumer's (a text field) still\n // takes focus.\n const onMouseDown = (event: MouseEvent<HTMLElement>) => {\n if (event.button !== 0) return;\n const target = event.target as Element;\n const focusable = target.closest(FOCUSABLE_SELECTOR);\n if (focusable === null || focusable.getAttribute(\"role\") === \"menu\") event.preventDefault();\n };\n\n const libraryProps: ComponentPropsWithRef<\"div\"> & DataAttributes = {\n id: popover.ids.popup,\n popover: \"auto\",\n role: \"menu\",\n \"aria-labelledby\": menu.triggerId,\n // The popup itself takes focus as the last resort when a menu has no items.\n tabIndex: -1,\n ...(experimental_focusgroup && { focusgroup: `menu ${loop ? \"wrap\" : \"nowrap\"}` }),\n onKeyDown,\n onBlur,\n onMouseDown,\n // No native menu over the custom one. The popup is a sibling of any ContextTrigger, so this\n // event never reaches a region as a move; an outer region sees it prevented and stays quiet.\n onContextMenu: (event: MouseEvent<HTMLElement>) => {\n event.preventDefault();\n },\n ...(submenu && {\n onPointerEnter: (event: PointerEvent<HTMLElement>) => {\n if (event.pointerType !== \"touch\") menu.timers.cancelClose();\n },\n onPointerLeave: (event: PointerEvent<HTMLElement>) => {\n if (event.pointerType !== \"touch\") scheduleHoverClose(menu, event.nativeEvent);\n },\n }),\n ...(side !== null && { \"data-side\": side, \"data-align\": resolvedAlign }),\n \"data-context\": point !== null ? \"\" : undefined,\n };\n\n // The shipped `@position-try` rules (conventions 12): hoisted into <head> and deduplicated by\n // React, rendered only by a point open that does not opt out with `side={null}`, with the\n // `<CSPProvider>` nonce for a nonce-based `style-src`.\n const pointRules =\n point !== null && sideOption !== null ? (\n <style href={MENU_POINT_HREF} precedence={FSUI_PRECEDENCE} nonce={csp?.nonce}>\n {MENU_POINT_RULES}\n </style>\n ) : null;\n\n const content = (s: MenuPopupState): ReactNode => {\n let node: ReactNode;\n if (keepMounted === true) {\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n // Not part of an enclosing Toolbar: a Menu.Trigger or ToggleGroup in here sees no Toolbar.\n return (\n <MenuListContext value={listContext}>\n {pointRules}\n <ToolbarContext value={null}>{node}</ToolbarContext>\n </MenuListContext>\n );\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, MenuPopupState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The inline placement (the requested one: the browser keeps choosing from it) sits under\n // the consumer's style: the consumer wins.\n style:\n point !== null\n ? (s) => ({ ...pointStyle(point, sideOption === null), ...resolveStateValue(style, s) })\n : requestedSide === null\n ? style\n : (s) => ({\n positionArea: positionArea(requestedSide, align),\n positionTryFallbacks: submenu ? \"flip-inline\" : POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n props: rest,\n libraryProps,\n ref,\n });\n\n return useTransitionBoundary(\"Menu.Popup\", transition, element);\n}\n\nMenuPopup.displayName = \"MenuPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkJA,MAAM,6BAA6B,CAAC;;AAGpC,MAAM,qBAAqB;AAE3B,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AAGvC,MAAM,qBACJ;;;;;;;;;;;;AAeF,SAAS,WAAW,OAAuB,iBAAyC;CAClF,MAAM,OAAO;GACV,eAAe,GAAG,MAAM,EAAE;GAC1B,eAAe,GAAG,MAAM,EAAE;GAC1B,iBAAiB,MAAM,SAAS,uBAAuB;CAC1D;CACA,IAAI,iBAAiB,OAAO;CAC5B,MAAM,MAAM,MAAM,cAAc;CAChC,MAAM,OAAO,MAAM,SAAS,UAAU;CACtC,OAAO;EACL,GAAG;EACH,KAAK,MAAM,SAAS,SAAS,YAAY,aAAa,UAAU,eAAe;EAC/E,OAAO,MAAM,mBAAmB,aAAa,MAAM;EACnD,QAAQ,MAAM,SAAS,mBAAmB,aAAa,UAAU,eAAe,MAAM;EACtF,MAAM,MAAM,SAAS,OAAO,aAAa;EACzC,cAAc;EACd,sBAAsB,qBAAqB,MAAM,UAAU,CAAC,KAAK,CAAC,MAAM,aAAa;CACvF;AACF;;;;;AAMA,SAAS,cAAc,OAAoB,QAA4B,OAAmB;CACxF,MAA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ACd,MACA,aACA,kBACA,MACA,OACA,YACA,YACC,gCAAa,IAAA;yBARA"}
1
+ {"version":3,"file":"menu-root.d.mts","names":[],"sources":["../../src/menu/menu-root.tsx"],"mappings":";;;;iBAuBiB,8BAA8B;;;;;;;;;;WAUpC,QAAQ;;iBAGF;;WAEN;;WAEA;;WAEA;;;;;WAKA;;iBAGM;;EAEf;;EAEA;;;;;;;;EAQA,mBAAmB,sBAAsB;;EAEzC;;EAEA;;;;;EAKA;EACA,WAAW,WAAW,WAAW;;wBAenB,WACd,MACA,aACA,kBACA,MACA,OACA,YACA,YACC,gCAAa,IAAA;yBARA"}