@nldd/design-system 0.12.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/custom-elements.json +3253 -398
  2. package/dist/components/actions/button/button.d.ts +6 -1
  3. package/dist/components/actions/button/button.d.ts.map +1 -1
  4. package/dist/components/actions/button/button.i18n.d.ts +1 -0
  5. package/dist/components/actions/button/button.i18n.d.ts.map +1 -1
  6. package/dist/components/actions/button/button.i18n.js +1 -0
  7. package/dist/components/actions/button/button.i18n.js.map +1 -1
  8. package/dist/components/actions/button/button.js +7 -0
  9. package/dist/components/actions/button/button.js.map +1 -1
  10. package/dist/components/actions/button/button.template.d.ts.map +1 -1
  11. package/dist/components/actions/button/button.template.js +5 -2
  12. package/dist/components/actions/button/button.template.js.map +1 -1
  13. package/dist/components/actions/button-group/button-group.d.ts +4 -3
  14. package/dist/components/actions/button-group/button-group.d.ts.map +1 -1
  15. package/dist/components/actions/button-group/button-group.js +4 -3
  16. package/dist/components/actions/button-group/button-group.js.map +1 -1
  17. package/dist/components/actions/button-group/button-group.styles.d.ts.map +1 -1
  18. package/dist/components/actions/button-group/button-group.styles.js +6 -6
  19. package/dist/components/actions/button-group/button-group.styles.js.map +1 -1
  20. package/dist/components/actions/icon-button/icon-button.d.ts +8 -1
  21. package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
  22. package/dist/components/actions/icon-button/icon-button.i18n.d.ts +1 -0
  23. package/dist/components/actions/icon-button/icon-button.i18n.d.ts.map +1 -1
  24. package/dist/components/actions/icon-button/icon-button.i18n.js +1 -0
  25. package/dist/components/actions/icon-button/icon-button.i18n.js.map +1 -1
  26. package/dist/components/actions/icon-button/icon-button.js +9 -0
  27. package/dist/components/actions/icon-button/icon-button.js.map +1 -1
  28. package/dist/components/actions/icon-button/icon-button.template.d.ts.map +1 -1
  29. package/dist/components/actions/icon-button/icon-button.template.js +5 -2
  30. package/dist/components/actions/icon-button/icon-button.template.js.map +1 -1
  31. package/dist/components/actions/menu/menu-divider.d.ts +14 -0
  32. package/dist/components/actions/menu/menu-divider.d.ts.map +1 -0
  33. package/dist/components/actions/menu/menu-divider.js +33 -0
  34. package/dist/components/actions/menu/menu-divider.js.map +1 -0
  35. package/dist/components/actions/menu/menu-group.d.ts +35 -0
  36. package/dist/components/actions/menu/menu-group.d.ts.map +1 -0
  37. package/dist/components/actions/menu/menu-group.js +69 -0
  38. package/dist/components/actions/menu/menu-group.js.map +1 -0
  39. package/dist/components/actions/menu/menu-item.d.ts +86 -0
  40. package/dist/components/actions/menu/menu-item.d.ts.map +1 -0
  41. package/dist/components/actions/menu/menu-item.js +279 -0
  42. package/dist/components/actions/menu/menu-item.js.map +1 -0
  43. package/dist/components/actions/menu/menu.chain.d.ts +40 -0
  44. package/dist/components/actions/menu/menu.chain.d.ts.map +1 -0
  45. package/dist/components/actions/menu/menu.chain.js +150 -0
  46. package/dist/components/actions/menu/menu.chain.js.map +1 -0
  47. package/dist/components/actions/menu/menu.d.ts +54 -269
  48. package/dist/components/actions/menu/menu.d.ts.map +1 -1
  49. package/dist/components/actions/menu/menu.js +106 -981
  50. package/dist/components/actions/menu/menu.js.map +1 -1
  51. package/dist/components/actions/menu/menu.pointer.d.ts +61 -0
  52. package/dist/components/actions/menu/menu.pointer.d.ts.map +1 -0
  53. package/dist/components/actions/menu/menu.pointer.js +143 -0
  54. package/dist/components/actions/menu/menu.pointer.js.map +1 -0
  55. package/dist/components/actions/menu/menu.safe-triangle.d.ts +79 -0
  56. package/dist/components/actions/menu/menu.safe-triangle.d.ts.map +1 -0
  57. package/dist/components/actions/menu/menu.safe-triangle.js +198 -0
  58. package/dist/components/actions/menu/menu.safe-triangle.js.map +1 -0
  59. package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
  60. package/dist/components/actions/menu/menu.template.js +5 -4
  61. package/dist/components/actions/menu/menu.template.js.map +1 -1
  62. package/dist/components/actions/toolbar/toolbar-item.d.ts +46 -0
  63. package/dist/components/actions/toolbar/toolbar-item.d.ts.map +1 -0
  64. package/dist/components/actions/toolbar/toolbar-item.js +113 -0
  65. package/dist/components/actions/toolbar/toolbar-item.js.map +1 -0
  66. package/dist/components/actions/toolbar/toolbar-item.template.d.ts +3 -0
  67. package/dist/components/actions/toolbar/toolbar-item.template.d.ts.map +1 -0
  68. package/dist/components/actions/toolbar/toolbar-item.template.js +12 -0
  69. package/dist/components/actions/toolbar/toolbar-item.template.js.map +1 -0
  70. package/dist/components/actions/toolbar/toolbar-title.d.ts +43 -0
  71. package/dist/components/actions/toolbar/toolbar-title.d.ts.map +1 -0
  72. package/dist/components/actions/toolbar/toolbar-title.js +111 -0
  73. package/dist/components/actions/toolbar/toolbar-title.js.map +1 -0
  74. package/dist/components/actions/toolbar/toolbar-title.template.d.ts +3 -0
  75. package/dist/components/actions/toolbar/toolbar-title.template.d.ts.map +1 -0
  76. package/dist/components/actions/toolbar/toolbar-title.template.js +33 -0
  77. package/dist/components/actions/toolbar/toolbar-title.template.js.map +1 -0
  78. package/dist/components/actions/toolbar/toolbar.d.ts +16 -111
  79. package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
  80. package/dist/components/actions/toolbar/toolbar.js +50 -423
  81. package/dist/components/actions/toolbar/toolbar.js.map +1 -1
  82. package/dist/components/actions/toolbar/toolbar.layout.d.ts +40 -0
  83. package/dist/components/actions/toolbar/toolbar.layout.d.ts.map +1 -0
  84. package/dist/components/actions/toolbar/toolbar.layout.js +76 -0
  85. package/dist/components/actions/toolbar/toolbar.layout.js.map +1 -0
  86. package/dist/components/actions/toolbar/toolbar.overflow-menu.d.ts +52 -0
  87. package/dist/components/actions/toolbar/toolbar.overflow-menu.d.ts.map +1 -0
  88. package/dist/components/actions/toolbar/toolbar.overflow-menu.js +105 -0
  89. package/dist/components/actions/toolbar/toolbar.overflow-menu.js.map +1 -0
  90. package/dist/components/actions/toolbar/toolbar.template.d.ts +1 -4
  91. package/dist/components/actions/toolbar/toolbar.template.d.ts.map +1 -1
  92. package/dist/components/actions/toolbar/toolbar.template.js +0 -41
  93. package/dist/components/actions/toolbar/toolbar.template.js.map +1 -1
  94. package/dist/components/{breakpoints-Bpf2MgjM.js → breakpoints-Bti55RWY.js} +1 -2
  95. package/dist/components/components.js +5511 -3932
  96. package/dist/components/content/avatar/avatar.d.ts +2 -1
  97. package/dist/components/content/avatar/avatar.d.ts.map +1 -1
  98. package/dist/components/content/avatar/avatar.js +12 -1
  99. package/dist/components/content/avatar/avatar.js.map +1 -1
  100. package/dist/components/content/avatar-group/avatar-group.d.ts +30 -2
  101. package/dist/components/content/avatar-group/avatar-group.d.ts.map +1 -1
  102. package/dist/components/content/avatar-group/avatar-group.i18n.d.ts +1 -0
  103. package/dist/components/content/avatar-group/avatar-group.i18n.d.ts.map +1 -1
  104. package/dist/components/content/avatar-group/avatar-group.i18n.js +1 -0
  105. package/dist/components/content/avatar-group/avatar-group.i18n.js.map +1 -1
  106. package/dist/components/content/avatar-group/avatar-group.js +96 -7
  107. package/dist/components/content/avatar-group/avatar-group.js.map +1 -1
  108. package/dist/components/content/avatar-group/avatar-group.styles.d.ts.map +1 -1
  109. package/dist/components/content/avatar-group/avatar-group.styles.js +35 -1
  110. package/dist/components/content/avatar-group/avatar-group.styles.js.map +1 -1
  111. package/dist/components/content/avatar-group/avatar-group.template.d.ts +1 -0
  112. package/dist/components/content/avatar-group/avatar-group.template.d.ts.map +1 -1
  113. package/dist/components/content/avatar-group/avatar-group.template.js +52 -29
  114. package/dist/components/content/avatar-group/avatar-group.template.js.map +1 -1
  115. package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
  116. package/dist/components/content/code-viewer/code-viewer.styles.js +48 -14
  117. package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
  118. package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
  119. package/dist/components/content/icon/icon-aliases.js +30 -0
  120. package/dist/components/content/icon/icon-aliases.js.map +1 -1
  121. package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
  122. package/dist/components/content/icon/icon-gallery-status.js +16 -0
  123. package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
  124. package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
  125. package/dist/components/content/icon/icon-registry.js +16 -3
  126. package/dist/components/content/icon/icon-registry.js.map +1 -1
  127. package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
  128. package/dist/components/content/tooltip/tooltip.js +2 -0
  129. package/dist/components/content/tooltip/tooltip.js.map +1 -1
  130. package/dist/components/{decorate-CO88j7Lc.js → decorate-Cz9-peTN.js} +1 -2
  131. package/dist/components/{dist-B5E3q-ea.js → dist-B9YBOGFW.js} +4 -6
  132. package/dist/components/{dist-BWlUmyq3.js → dist-BFZM0YsR.js} +57 -36
  133. package/dist/components/{dist-BFw_yEMS.js → dist-BNkeFjc3.js} +5 -7
  134. package/dist/components/{dist-Co-tsc9S.js → dist-BaLc58I_.js} +7 -9
  135. package/dist/components/{dist-BOVSVPSz.js → dist-Bm3708s5.js} +3 -4
  136. package/dist/components/{dist-IPm8ilWf.js → dist-CJ9uLG0u.js} +5 -17
  137. package/dist/components/{dist-Dz28se9B.js → dist-CJm4tkNC.js} +4 -6
  138. package/dist/components/{dist-CC8oiVtm.js → dist-CSC1dG3L.js} +2 -3
  139. package/dist/components/{dist-BPB3rWnd.js → dist-DHhnz3Gv.js} +3 -4
  140. package/dist/components/{dist-Dn9pjiud.js → dist-DgjvHvsN.js} +6 -8
  141. package/dist/components/{dist-COKR0tYU.js → dist-PeUX4vPq.js} +3 -6
  142. package/dist/components/{dist-D_9ZyZ5v.js → dist-YYLChwRq.js} +5 -7
  143. package/dist/components/{dist-BNLAXAyO.js → dist-m70B83qb.js} +4 -6
  144. package/dist/components/{gherkin-uCVRxsGf.js → gherkin-DzYbEwDO.js} +1 -2
  145. package/dist/components/{icon-DFhgRf3P.js → icon-DZ1UXCzO.js} +42 -16
  146. package/dist/components/{icon-button-Sxkh5cVr.js → icon-button-984CwkU1.js} +106 -43
  147. package/dist/components/{input-modality-DhTeUxKi.js → input-modality-CiPLYYMN.js} +1 -2
  148. package/dist/components/inputs/code-editor/code-editor.styles.d.ts.map +1 -1
  149. package/dist/components/inputs/code-editor/code-editor.styles.js +42 -7
  150. package/dist/components/inputs/code-editor/code-editor.styles.js.map +1 -1
  151. package/dist/components/inputs/combo-box/combo-box.styles.d.ts.map +1 -1
  152. package/dist/components/inputs/combo-box/combo-box.styles.js +1 -0
  153. package/dist/components/inputs/combo-box/combo-box.styles.js.map +1 -1
  154. package/dist/components/inputs/date-field/date-field.d.ts +41 -28
  155. package/dist/components/inputs/date-field/date-field.d.ts.map +1 -1
  156. package/dist/components/inputs/date-field/date-field.dates.d.ts +60 -0
  157. package/dist/components/inputs/date-field/date-field.dates.d.ts.map +1 -0
  158. package/dist/components/inputs/date-field/date-field.dates.js +106 -0
  159. package/dist/components/inputs/date-field/date-field.dates.js.map +1 -0
  160. package/dist/components/inputs/date-field/date-field.i18n.d.ts +4 -0
  161. package/dist/components/inputs/date-field/date-field.i18n.d.ts.map +1 -1
  162. package/dist/components/inputs/date-field/date-field.i18n.js +6 -0
  163. package/dist/components/inputs/date-field/date-field.i18n.js.map +1 -1
  164. package/dist/components/inputs/date-field/date-field.js +110 -142
  165. package/dist/components/inputs/date-field/date-field.js.map +1 -1
  166. package/dist/components/inputs/date-field/date-field.styles.d.ts.map +1 -1
  167. package/dist/components/inputs/date-field/date-field.styles.js +1 -0
  168. package/dist/components/inputs/date-field/date-field.styles.js.map +1 -1
  169. package/dist/components/inputs/date-field/date-field.template.d.ts.map +1 -1
  170. package/dist/components/inputs/date-field/date-field.template.js +21 -17
  171. package/dist/components/inputs/date-field/date-field.template.js.map +1 -1
  172. package/dist/components/inputs/date-picker/date-picker.d.ts +2 -2
  173. package/dist/components/inputs/date-picker/date-picker.i18n.d.ts +1 -1
  174. package/dist/components/inputs/date-picker/date-picker.i18n.js +1 -1
  175. package/dist/components/inputs/date-picker/date-picker.i18n.js.map +1 -1
  176. package/dist/components/inputs/date-picker/date-picker.template.js +1 -1
  177. package/dist/components/inputs/date-picker/date-picker.template.js.map +1 -1
  178. package/dist/components/inputs/file-field/file-field.d.ts +86 -10
  179. package/dist/components/inputs/file-field/file-field.d.ts.map +1 -1
  180. package/dist/components/inputs/file-field/file-field.drop.d.ts +34 -0
  181. package/dist/components/inputs/file-field/file-field.drop.d.ts.map +1 -0
  182. package/dist/components/inputs/file-field/file-field.drop.js +176 -0
  183. package/dist/components/inputs/file-field/file-field.drop.js.map +1 -0
  184. package/dist/components/inputs/file-field/file-field.i18n.d.ts +20 -1
  185. package/dist/components/inputs/file-field/file-field.i18n.d.ts.map +1 -1
  186. package/dist/components/inputs/file-field/file-field.i18n.js +20 -1
  187. package/dist/components/inputs/file-field/file-field.i18n.js.map +1 -1
  188. package/dist/components/inputs/file-field/file-field.js +283 -15
  189. package/dist/components/inputs/file-field/file-field.js.map +1 -1
  190. package/dist/components/inputs/file-field/file-field.styles.d.ts.map +1 -1
  191. package/dist/components/inputs/file-field/file-field.styles.js +245 -10
  192. package/dist/components/inputs/file-field/file-field.styles.js.map +1 -1
  193. package/dist/components/inputs/file-field/file-field.template.d.ts +1 -0
  194. package/dist/components/inputs/file-field/file-field.template.d.ts.map +1 -1
  195. package/dist/components/inputs/file-field/file-field.template.js +167 -28
  196. package/dist/components/inputs/file-field/file-field.template.js.map +1 -1
  197. package/dist/components/inputs/file-field/file-field.truncate.d.ts +22 -0
  198. package/dist/components/inputs/file-field/file-field.truncate.d.ts.map +1 -0
  199. package/dist/components/inputs/file-field/file-field.truncate.js +62 -0
  200. package/dist/components/inputs/file-field/file-field.truncate.js.map +1 -0
  201. package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.d.ts.map +1 -1
  202. package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.js +1 -0
  203. package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.js.map +1 -1
  204. package/dist/components/inputs/password-field/password-field.styles.d.ts.map +1 -1
  205. package/dist/components/inputs/password-field/password-field.styles.js +1 -0
  206. package/dist/components/inputs/password-field/password-field.styles.js.map +1 -1
  207. package/dist/components/inputs/search-field/search-field.d.ts +1 -1
  208. package/dist/components/inputs/search-field/search-field.js +1 -1
  209. package/dist/components/inputs/search-field/search-field.styles.d.ts.map +1 -1
  210. package/dist/components/inputs/search-field/search-field.styles.js +1 -0
  211. package/dist/components/inputs/search-field/search-field.styles.js.map +1 -1
  212. package/dist/components/inputs/segmented-control/segmented-control.d.ts +6 -3
  213. package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
  214. package/dist/components/inputs/segmented-control/segmented-control.js +8 -10
  215. package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
  216. package/dist/components/inputs/text-editor/text-editor.code-copy.d.ts +10 -0
  217. package/dist/components/inputs/text-editor/text-editor.code-copy.d.ts.map +1 -0
  218. package/dist/components/inputs/text-editor/text-editor.code-copy.js +141 -0
  219. package/dist/components/inputs/text-editor/text-editor.code-copy.js.map +1 -0
  220. package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
  221. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.d.ts.map +1 -1
  222. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.js +55 -7
  223. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.js.map +1 -1
  224. package/dist/components/inputs/text-editor/text-editor.i18n.d.ts +5 -0
  225. package/dist/components/inputs/text-editor/text-editor.i18n.d.ts.map +1 -1
  226. package/dist/components/inputs/text-editor/text-editor.i18n.js +7 -0
  227. package/dist/components/inputs/text-editor/text-editor.i18n.js.map +1 -1
  228. package/dist/components/inputs/text-editor/text-editor.js +34 -3
  229. package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
  230. package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -1
  231. package/dist/components/inputs/text-editor/text-editor.markdown.js +6 -2
  232. package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -1
  233. package/dist/components/inputs/text-editor/text-editor.selection.d.ts.map +1 -1
  234. package/dist/components/inputs/text-editor/text-editor.selection.js +43 -7
  235. package/dist/components/inputs/text-editor/text-editor.selection.js.map +1 -1
  236. package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
  237. package/dist/components/inputs/text-editor/text-editor.styles.js +147 -7
  238. package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
  239. package/dist/components/inputs/text-editor/text-editor.tasks.d.ts +17 -0
  240. package/dist/components/inputs/text-editor/text-editor.tasks.d.ts.map +1 -0
  241. package/dist/components/inputs/text-editor/text-editor.tasks.js +113 -0
  242. package/dist/components/inputs/text-editor/text-editor.tasks.js.map +1 -0
  243. package/dist/components/inputs/text-field/text-field.styles.d.ts.map +1 -1
  244. package/dist/components/inputs/text-field/text-field.styles.js +1 -0
  245. package/dist/components/inputs/text-field/text-field.styles.js.map +1 -1
  246. package/dist/components/inputs/time-field/time-field.d.ts +26 -40
  247. package/dist/components/inputs/time-field/time-field.d.ts.map +1 -1
  248. package/dist/components/inputs/time-field/time-field.i18n.d.ts +3 -0
  249. package/dist/components/inputs/time-field/time-field.i18n.d.ts.map +1 -1
  250. package/dist/components/inputs/time-field/time-field.i18n.js +5 -0
  251. package/dist/components/inputs/time-field/time-field.i18n.js.map +1 -1
  252. package/dist/components/inputs/time-field/time-field.js +68 -162
  253. package/dist/components/inputs/time-field/time-field.js.map +1 -1
  254. package/dist/components/inputs/time-field/time-field.styles.d.ts.map +1 -1
  255. package/dist/components/inputs/time-field/time-field.styles.js +1 -0
  256. package/dist/components/inputs/time-field/time-field.styles.js.map +1 -1
  257. package/dist/components/inputs/time-field/time-field.times.d.ts +74 -0
  258. package/dist/components/inputs/time-field/time-field.times.d.ts.map +1 -0
  259. package/dist/components/inputs/time-field/time-field.times.js +154 -0
  260. package/dist/components/inputs/time-field/time-field.times.js.map +1 -0
  261. package/dist/components/layout/card/card.d.ts +6 -1
  262. package/dist/components/layout/card/card.d.ts.map +1 -1
  263. package/dist/components/layout/card/card.i18n.d.ts +1 -0
  264. package/dist/components/layout/card/card.i18n.d.ts.map +1 -1
  265. package/dist/components/layout/card/card.i18n.js +1 -0
  266. package/dist/components/layout/card/card.i18n.js.map +1 -1
  267. package/dist/components/layout/card/card.js +7 -0
  268. package/dist/components/layout/card/card.js.map +1 -1
  269. package/dist/components/layout/card/card.template.d.ts.map +1 -1
  270. package/dist/components/layout/card/card.template.js +5 -2
  271. package/dist/components/layout/card/card.template.js.map +1 -1
  272. package/dist/components/layout/page/page.d.ts +3 -0
  273. package/dist/components/layout/page/page.d.ts.map +1 -1
  274. package/dist/components/layout/page/page.js +20 -3
  275. package/dist/components/layout/page/page.js.map +1 -1
  276. package/dist/components/layout/page/page.styles.d.ts.map +1 -1
  277. package/dist/components/layout/page/page.styles.js +25 -2
  278. package/dist/components/layout/page/page.styles.js.map +1 -1
  279. package/dist/components/layout/page/page.template.js +1 -1
  280. package/dist/components/layout/page/page.template.js.map +1 -1
  281. package/dist/components/layout/page-sections/hero/hero-corner.styles.d.ts.map +1 -1
  282. package/dist/components/layout/page-sections/hero/hero-corner.styles.js +61 -0
  283. package/dist/components/layout/page-sections/hero/hero-corner.styles.js.map +1 -1
  284. package/dist/components/layout/page-sections/hero/hero.d.ts +1 -1
  285. package/dist/components/layout/page-sections/hero/hero.js +1 -1
  286. package/dist/components/layout/popover/popover.d.ts +6 -0
  287. package/dist/components/layout/popover/popover.d.ts.map +1 -1
  288. package/dist/components/layout/popover/popover.js +16 -0
  289. package/dist/components/layout/popover/popover.js.map +1 -1
  290. package/dist/components/layout/popover/popover.styles.d.ts.map +1 -1
  291. package/dist/components/layout/popover/popover.styles.js +13 -0
  292. package/dist/components/layout/popover/popover.styles.js.map +1 -1
  293. package/dist/components/layout/sheet/sheet.d.ts +5 -0
  294. package/dist/components/layout/sheet/sheet.d.ts.map +1 -1
  295. package/dist/components/layout/sheet/sheet.js +14 -6
  296. package/dist/components/layout/sheet/sheet.js.map +1 -1
  297. package/dist/components/layout/sheet/sheet.template.d.ts.map +1 -1
  298. package/dist/components/layout/sheet/sheet.template.js +1 -0
  299. package/dist/components/layout/sheet/sheet.template.js.map +1 -1
  300. package/dist/components/lists-and-tables/list-item/list-item.d.ts +6 -1
  301. package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
  302. package/dist/components/lists-and-tables/list-item/list-item.i18n.d.ts +1 -0
  303. package/dist/components/lists-and-tables/list-item/list-item.i18n.d.ts.map +1 -1
  304. package/dist/components/lists-and-tables/list-item/list-item.i18n.js +1 -0
  305. package/dist/components/lists-and-tables/list-item/list-item.i18n.js.map +1 -1
  306. package/dist/components/lists-and-tables/list-item/list-item.js +12 -3
  307. package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
  308. package/dist/components/lists-and-tables/list-item/list-item.template.d.ts +1 -1
  309. package/dist/components/lists-and-tables/list-item/list-item.template.d.ts.map +1 -1
  310. package/dist/components/lists-and-tables/list-item/list-item.template.js +2 -1
  311. package/dist/components/lists-and-tables/list-item/list-item.template.js.map +1 -1
  312. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts +6 -1
  313. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts.map +1 -1
  314. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.i18n.d.ts +1 -0
  315. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.i18n.d.ts.map +1 -1
  316. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.i18n.js +1 -0
  317. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.i18n.js.map +1 -1
  318. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js +12 -3
  319. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js.map +1 -1
  320. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts +1 -1
  321. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts.map +1 -1
  322. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.js +2 -1
  323. package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.js.map +1 -1
  324. package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts.map +1 -1
  325. package/dist/components/navigation/document-tab-bar/document-tab-bar.js +5 -0
  326. package/dist/components/navigation/document-tab-bar/document-tab-bar.js.map +1 -1
  327. package/dist/components/navigation/link/link.d.ts +6 -1
  328. package/dist/components/navigation/link/link.d.ts.map +1 -1
  329. package/dist/components/navigation/link/link.i18n.d.ts +1 -0
  330. package/dist/components/navigation/link/link.i18n.d.ts.map +1 -1
  331. package/dist/components/navigation/link/link.i18n.js +1 -0
  332. package/dist/components/navigation/link/link.i18n.js.map +1 -1
  333. package/dist/components/navigation/link/link.js +7 -0
  334. package/dist/components/navigation/link/link.js.map +1 -1
  335. package/dist/components/navigation/link/link.template.d.ts.map +1 -1
  336. package/dist/components/navigation/link/link.template.js +5 -2
  337. package/dist/components/navigation/link/link.template.js.map +1 -1
  338. package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
  339. package/dist/components/navigation/menu-bar/menu-bar.js +2 -0
  340. package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
  341. package/dist/components/navigation/tab-bar/tab-bar.d.ts +1 -0
  342. package/dist/components/navigation/tab-bar/tab-bar.d.ts.map +1 -1
  343. package/dist/components/navigation/tab-bar/tab-bar.js +9 -0
  344. package/dist/components/navigation/tab-bar/tab-bar.js.map +1 -1
  345. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts +9 -24
  346. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts.map +1 -1
  347. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +29 -220
  348. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js.map +1 -1
  349. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.menu-sheet.d.ts +48 -0
  350. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.menu-sheet.d.ts.map +1 -0
  351. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.menu-sheet.js +220 -0
  352. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.menu-sheet.js.map +1 -0
  353. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.d.ts.map +1 -1
  354. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js +22 -2
  355. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js.map +1 -1
  356. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.template.d.ts.map +1 -1
  357. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.template.js +4 -0
  358. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.template.js.map +1 -1
  359. package/dist/components/{reflect-non-default-OLaK60rT.js → reflect-non-default-B9wQcnne.js} +1 -2
  360. package/dist/components/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
  361. package/dist/components/{shadow-resets-CPa58rmc.js → shadow-resets-BwOyyZFH.js} +1 -2
  362. package/dist/components/{shell-C61GCsJA.js → shell-Dh5IwHd-.js} +1 -2
  363. package/dist/components/status-and-feedback/banner/banner.d.ts +1 -1
  364. package/dist/components/status-and-feedback/banner/banner.js +2 -2
  365. package/dist/components/status-and-feedback/banner/banner.js.map +1 -1
  366. package/dist/components/status-and-feedback/notification/notification.d.ts +1 -1
  367. package/dist/components/status-and-feedback/notification/notification.d.ts.map +1 -1
  368. package/dist/components/status-and-feedback/notification/notification.js +4 -2
  369. package/dist/components/status-and-feedback/notification/notification.js.map +1 -1
  370. package/dist/components/status-and-feedback/progress-bar/progress-bar.i18n.d.ts +1 -1
  371. package/dist/components/status-and-feedback/progress-bar/progress-bar.i18n.js +1 -1
  372. package/dist/components/status-and-feedback/progress-bar/progress-bar.i18n.js.map +1 -1
  373. package/dist/components/status-and-feedback/progress-bar/progress-bar.js +1 -1
  374. package/dist/components/status-and-feedback/progress-bar/progress-bar.js.map +1 -1
  375. package/dist/components/status-and-feedback/progress-circle/progress-circle.i18n.d.ts +1 -1
  376. package/dist/components/status-and-feedback/progress-circle/progress-circle.i18n.js +1 -1
  377. package/dist/components/status-and-feedback/progress-circle/progress-circle.i18n.js.map +1 -1
  378. package/dist/components/status-and-feedback/progress-circle/progress-circle.js +1 -1
  379. package/dist/components/status-and-feedback/progress-circle/progress-circle.js.map +1 -1
  380. package/dist/components/status-and-feedback/step-bar/step-bar.d.ts +10 -1
  381. package/dist/components/status-and-feedback/step-bar/step-bar.d.ts.map +1 -1
  382. package/dist/components/status-and-feedback/step-bar/step-bar.js +22 -1
  383. package/dist/components/status-and-feedback/step-bar/step-bar.js.map +1 -1
  384. package/dist/components/status-and-feedback/step-bar/step-bar.template.d.ts.map +1 -1
  385. package/dist/components/status-and-feedback/step-bar/step-bar.template.js +2 -0
  386. package/dist/components/status-and-feedback/step-bar/step-bar.template.js.map +1 -1
  387. package/dist/components/{toml-C2HBbPgG.js → toml-D0Pix_8Q.js} +1 -2
  388. package/dist/components/{visibility-mixin-djNSG5ZN.js → visibility-mixin-C-K7ho5Q.js} +4 -6
  389. package/dist/components/{with-translations-C6QfP6_S.js → with-translations-DRuOq3QK.js} +14 -10
  390. package/dist/css/themes/donkergeel.css +5 -0
  391. package/dist/css/themes/geel.css +5 -0
  392. package/dist/css/themes.css +10 -0
  393. package/dist/css/variables.css +11 -11
  394. package/dist/nldd.min.js +2089 -1398
  395. package/dist/translations/en-US.d.ts.map +1 -1
  396. package/dist/translations/en-US.js +42 -4
  397. package/dist/translations/en-US.js.map +1 -1
  398. package/dist/translations/fy.d.ts.map +1 -1
  399. package/dist/translations/fy.js +42 -4
  400. package/dist/translations/fy.js.map +1 -1
  401. package/dist/translations/nl.generated.d.ts +42 -4
  402. package/dist/translations/nl.generated.d.ts.map +1 -1
  403. package/dist/translations/pap-AW.d.ts.map +1 -1
  404. package/dist/translations/pap-AW.js +42 -4
  405. package/dist/translations/pap-AW.js.map +1 -1
  406. package/dist/translations/pap-CW.d.ts.map +1 -1
  407. package/dist/translations/pap-CW.js +42 -4
  408. package/dist/translations/pap-CW.js.map +1 -1
  409. package/dist/types/vue.d.ts +69 -33
  410. package/dist/utilities/carried-context.d.ts +20 -0
  411. package/dist/utilities/carried-context.d.ts.map +1 -0
  412. package/dist/utilities/carried-context.js +76 -0
  413. package/dist/utilities/carried-context.js.map +1 -0
  414. package/dist/utilities/codemirror/languages.d.ts +5 -1
  415. package/dist/utilities/codemirror/languages.d.ts.map +1 -1
  416. package/dist/utilities/codemirror/languages.js +21 -1
  417. package/dist/utilities/codemirror/languages.js.map +1 -1
  418. package/dist/utilities/dismiss-from-title-bar.d.ts +1 -1
  419. package/dist/utilities/dismiss-from-title-bar.js +1 -1
  420. package/dist/utilities/form-associated-mixin.d.ts +7 -0
  421. package/dist/utilities/form-associated-mixin.d.ts.map +1 -1
  422. package/dist/utilities/form-associated-mixin.js +13 -1
  423. package/dist/utilities/form-associated-mixin.js.map +1 -1
  424. package/dist/utilities/link-hint.d.ts +11 -0
  425. package/dist/utilities/link-hint.d.ts.map +1 -1
  426. package/dist/utilities/link-hint.js +15 -0
  427. package/dist/utilities/link-hint.js.map +1 -1
  428. package/package.json +2 -2
@@ -8,8 +8,8 @@ import { LitElement } from 'lit';
8
8
  import { property, state } from 'lit/decorators.js';
9
9
  import { computePosition, flip, shift, offset, size, autoUpdate } from '@floating-ui/dom';
10
10
  import { reflectNonDefault } from '../../../utilities/reflect-non-default.js';
11
- import { menuStyles, menuItemStyles, menuDividerStyles, menuGroupStyles } from './menu.styles.js';
12
- import { menuTemplate, menuItemTemplate, menuDividerTemplate, menuGroupTemplate } from './menu.template.js';
11
+ import { menuStyles } from './menu.styles.js';
12
+ import { menuTemplate } from './menu.template.js';
13
13
  import { nlddMenuTranslations } from './menu.i18n.js';
14
14
  import '../../lists-and-tables/cells/icon-cell/icon-cell.js';
15
15
  import '../../lists-and-tables/cells/spacer-cell/spacer-cell.js';
@@ -20,354 +20,12 @@ import '../../status-and-feedback/inline-dialog/inline-dialog.js';
20
20
  import { isKeyboardMode, isTouchMode } from '../../../utilities/input-modality.js';
21
21
  import { queryBreakpoints } from '../../../assets/styles/breakpoints.js';
22
22
  import { translate } from '../../../utilities/translations.js';
23
- /** Makes `host` a list item while its menu is a navigation menu, and takes
24
- * that back when it is not. A `listitem` the consumer set by hand on an item
25
- * goes too when the variant changes back; nothing else uses that role here. */
26
- function syncListItemRole(host, variant) {
27
- if (variant === 'navigation')
28
- host.setAttribute('role', 'listitem');
29
- else if (host.getAttribute('role') === 'listitem')
30
- host.removeAttribute('role');
31
- }
32
- // # nldd-menu-divider
33
- /**
34
- * A horizontal rule between groups of items in an `nldd-menu`.
35
- *
36
- * @element nldd-menu-divider
37
- */
38
- export class NLDDMenuDivider extends LitElement {
39
- constructor() {
40
- super(...arguments);
41
- /** @internal The variant of the menu around it, set by that nldd-menu. */
42
- this.menuVariant = null;
43
- }
44
- render() {
45
- return menuDividerTemplate(this.menuVariant);
46
- }
47
- }
48
- NLDDMenuDivider.styles = menuDividerStyles;
49
- __decorate([
50
- state()
51
- ], NLDDMenuDivider.prototype, "menuVariant", void 0);
52
- if (!customElements.get('nldd-menu-divider')) {
53
- customElements.define('nldd-menu-divider', NLDDMenuDivider);
54
- }
55
- // # nldd-menu-group
56
- /**
57
- * A labeled group of menu items inside an nldd-menu. Wraps its slotted
58
- * items in `role="group"` with `aria-labelledby` pointing to the group's
59
- * `text`, providing native ARIA group semantics that a flat title element
60
- * can't deliver.
61
- *
62
- * The group renders an automatic divider above itself, except when it's
63
- * the first child of the menu — so consumers don't need to manage
64
- * separator placement around groups themselves. Spacing above the title
65
- * is intentionally larger than below, to bind the title visually to the
66
- * items it labels.
67
- *
68
- * Use the wrapper for grouping with a title; for ungrouped flat menus or
69
- * a divider without a title, the existing `nldd-menu-item` +
70
- * `nldd-menu-divider` flat structure keeps working unchanged.
71
- *
72
- * @element nldd-menu-group
73
- *
74
- * @attr {string} text - Group title text shown above the items.
75
- *
76
- * @slot - nldd-menu-item children (the items belonging to this group).
77
- */
78
- export class NLDDMenuGroup extends LitElement {
79
- constructor() {
80
- super(...arguments);
81
- this.text = '';
82
- this._titleId = `nldd-menu-group-title-${NLDDMenuGroup._idCounter++}`;
83
- /** @internal The variant of the menu around it, set by that nldd-menu. */
84
- this.menuVariant = null;
85
- }
86
- updated(changed) {
87
- // In a navigation menu the group is a list item that holds a list of
88
- // its own, named by the title: a list may only own list items.
89
- if (changed.has('menuVariant'))
90
- syncListItemRole(this, this.menuVariant);
91
- }
92
- render() {
93
- return menuGroupTemplate(this);
94
- }
95
- }
96
- NLDDMenuGroup.styles = menuGroupStyles;
97
- // SSR caveat: this counter is per module instance, not per render. If
98
- // the component ever runs in a context where modules reload between
99
- // server and client (SSR hydration, Vite HMR with fresh module state),
100
- // IDs will mismatch and aria-labelledby refs will break. Browser-only
101
- // today; revisit if hydration is added.
102
- NLDDMenuGroup._idCounter = 0;
103
- __decorate([
104
- property({ reflect: true, converter: reflectNonDefault('') })
105
- ], NLDDMenuGroup.prototype, "text", void 0);
106
- __decorate([
107
- state()
108
- ], NLDDMenuGroup.prototype, "menuVariant", void 0);
109
- if (!customElements.get('nldd-menu-group')) {
110
- customElements.define('nldd-menu-group', NLDDMenuGroup);
111
- }
112
- // # nldd-menu-item
113
- /**
114
- * A single item within an nldd-menu.
115
- *
116
- * @element nldd-menu-item
117
- *
118
- * @attr {boolean} destructive - Marks the item as destructive (red text; red highlight bg). Use for irreversible actions like "Delete". Color is the only built-in signal, so per WCAG 1.4.1 the item's own label must convey the destructive nature (e.g. "Verwijder") — don't rely on the red alone. Confirming the action (e.g. a follow-up dialog) is the consumer's responsibility.
119
- * @attr {string} text - Display text. Supports **bold** markdown syntax.
120
- * @attr {string} details - Secondary label shown on the right side.
121
- * @attr {string} icon - Icon name rendered before the text.
122
- * @attr {string} shortcut - Keyboard shortcut hint shown on the right, e.g. 'Cmd+E'. Display only (rendered via nldd-keyboard-shortcut) — it does not bind the key; wire up the handling in your app. Hidden on touch-only devices, where it isn't invokable.
123
- * @attr {string} shortcut-mac / shortcut-windows / shortcut-linux - Per-OS overrides for `shortcut`, picked by detected OS (falls back to `shortcut`).
124
- * @attr {string} href - Optional link target. A plain button item with an href renders as an `<a>` so it is a real link (middle-click, open in new tab, copy link). Ignored for submenu openers, checkbox/radio items, and while disabled.
125
- * @attr {string} type - Item type: 'button' | 'checkbox' | 'radio'. Default: 'button'. One checkbox or radio item gives every item in its menu the check-mark column, so the text of the whole menu starts at one line, as in a native menu. Submenus decide for themselves.
126
- * @attr {boolean} selected - Selected state for checkbox and radio types.
127
- * @attr {boolean} disabled - Disabled state.
128
- * @attr {string} value - A value of the item's own, read off the item in a `select` handler. The default filter matches on it as well as on `text` and `aliases`. Not a form value: this component is not form-associated.
129
- * @attr {string} aliases - Space-separated alternative search terms.
130
- * @attr {string} query - Query substring to bold-highlight in text. Set by menu's filter(); also settable by consumers.
131
- * @attr {string} query-mark-mode - 'match' | 'predictive' (default: 'predictive'). See text-cell for details.
132
- *
133
- * @fires select - Fired when the item is clicked and not disabled.
134
- */
135
- export class NLDDMenuItem extends LitElement {
136
- constructor() {
137
- super(...arguments);
138
- this.destructive = false;
139
- this.text = '';
140
- this.details = '';
141
- this.icon = '';
142
- this.shortcut = '';
143
- this.shortcutMac = '';
144
- this.shortcutWindows = '';
145
- this.shortcutLinux = '';
146
- this.href = '';
147
- this.type = 'button';
148
- this.selected = false;
149
- this.disabled = false;
150
- this.value = '';
151
- this.aliases = '';
152
- this.query = '';
153
- this.queryMarkMode = 'predictive';
154
- /**
155
- * Which menu owns this item, set by that nldd-menu. Not part of the public API.
156
- *
157
- * `null` until one claims it, and an unclaimed item carries no menu role.
158
- * A menu role is a promise about what is around you, so an item cannot make
159
- * it on its own. `nldd-toolbar-item` holds exactly such an item: the
160
- * declaration of what belongs in the overflow menu, which the toolbar clones
161
- * into the real menu when it collapses. The clone is claimed there and the
162
- * declaration stays what it is.
163
- */
164
- this.menuVariant = null;
165
- /** Whether this item keeps the check-mark column free without being
166
- * checkable, because another item in its menu is. Set by that nldd-menu.
167
- * Not part of the public API. */
168
- this.checkColumn = false;
169
- /** Tracks whether this item's submenu (if any) is currently open. Set by
170
- * the parent nldd-menu via the `submenu-open`/`submenu-close` lifecycle. */
171
- this._submenuOpen = false;
172
- /** Cached reference to the direct child `<nldd-menu>` (this item's
173
- * submenu). Resolved once at firstUpdated; mutating the children after
174
- * mount is not supported in v1. */
175
- this._cachedSubmenuEl = null;
176
- this._submenuMutationObserver = null;
177
- }
178
- connectedCallback() {
179
- super.connectedCallback();
180
- if (!this.id) {
181
- this.id = `nldd-menu-item-${NLDDMenuItem._idCounter++}`;
182
- }
183
- this.addEventListener('focusin', (e) => {
184
- // Only react when focus actually lands on our own shadow content
185
- // (the .menu__item button). focusin is composed and bubbles, so it
186
- // also fires here when focus moves into a slotted descendant —
187
- // notably when a child submenu's .menu element gets focused on
188
- // open. Without this guard the parent's _handleMenuItemFocused
189
- // re-highlights the opener after we just cleared it.
190
- const realTarget = e.composedPath()[0];
191
- if (!realTarget || !this.shadowRoot?.contains(realTarget))
192
- return;
193
- this.setAttribute('data-focused', '');
194
- this.dispatchEvent(new CustomEvent('menu-item-focused', {
195
- bubbles: true,
196
- composed: true,
197
- }));
198
- });
199
- this.addEventListener('focusout', (e) => {
200
- // Mirror the focusin guard so a slotted descendant losing focus
201
- // doesn't strip data-focused from the opener while it's still
202
- // keyboard-focused itself.
203
- const realTarget = e.composedPath()[0];
204
- if (!realTarget || !this.shadowRoot?.contains(realTarget))
205
- return;
206
- this.removeAttribute('data-focused');
207
- });
208
- }
209
- focus(options) {
210
- const focusable = this.shadowRoot?.querySelector('button, a');
211
- focusable?.focus(options);
212
- }
213
- get _submenuEl() {
214
- return this._cachedSubmenuEl;
215
- }
216
- get _hasSubmenu() {
217
- return this._cachedSubmenuEl !== null;
218
- }
219
- willUpdate() {
220
- if (this.hasUpdated)
221
- return;
222
- // Before the first render, off the light DOM, so the chevron and the ARIA
223
- // attributes are right the first time. Resolving it in `firstUpdated` asks
224
- // for a second render from inside the first.
225
- this._cachedSubmenuEl = this.querySelector(':scope > nldd-menu');
226
- }
227
- updated(changedProperties) {
228
- // In a navigation menu the item is a list item, and the link inside it
229
- // is just a link.
230
- if (changedProperties.has('menuVariant'))
231
- syncListItemRole(this, this.menuVariant);
232
- // An item that becomes checkable, or stops being so, changes whether its
233
- // menu reserves the check-mark column, also while the menu is open.
234
- if (changedProperties.has('type') && changedProperties.get('type') !== undefined && this.menuVariant) {
235
- this.closest('nldd-menu')?._claimItems();
236
- }
237
- }
238
- firstUpdated() {
239
- // Submenu attachment is one-shot in v1 — a nldd-menu added after this
240
- // point would silently miss aria-controls, the chevron indicator, the
241
- // hover-open lifecycle, and the close-state sync. Watch for late
242
- // additions and warn so consumers don't chase the symptom.
243
- this._submenuMutationObserver = new MutationObserver(() => {
244
- const current = this.querySelector(':scope > nldd-menu');
245
- if (current && current !== this._cachedSubmenuEl) {
246
- console.warn('[nldd-menu-item] A nldd-menu child was added after mount. '
247
- + 'Submenu attachment is resolved once at firstUpdated in v1, '
248
- + 'so this menu will not be treated as a submenu. Define the '
249
- + 'nldd-menu child before the item is connected to the DOM.');
250
- }
251
- });
252
- this._submenuMutationObserver.observe(this, { childList: true });
253
- }
254
- disconnectedCallback() {
255
- super.disconnectedCallback();
256
- this._submenuMutationObserver?.disconnect();
257
- this._submenuMutationObserver = null;
258
- }
259
- _handleClick(event) {
260
- if (this.disabled)
261
- return;
262
- // Submenu items don't fire `select` — they open their submenu instead.
263
- // Item is either an action OR a submenu opener, not both.
264
- if (this._hasSubmenu) {
265
- // The button is wired to the submenu via the popoverTargetElement
266
- // IDL property (set in the template). That marks it as the
267
- // submenu's invoker so the browser excludes the opener from
268
- // popover light-dismiss — clicking the opener no longer closes
269
- // the submenu underneath it. The flip side: the browser would
270
- // also auto-show the popover with its default positioning,
271
- // which races our anchor + placement set in `_handleSubmenuOpen`.
272
- // preventDefault stops the browser action and lets our flow
273
- // own positioning.
274
- //
275
- // We use the IDL property rather than the `popovertarget`
276
- // attribute because the button lives in this menu-item's shadow
277
- // root while the submenu is a light-DOM child — attribute-based
278
- // ID resolution is tree-scoped and would silently fail to find
279
- // the cross-tree target. The IDL property takes a direct element
280
- // reference and works across shadow boundaries.
281
- event?.preventDefault();
282
- // Click on an already-open opener: keep the submenu visible and
283
- // the opener visually "active" (aria-expanded + :hover). A second
284
- // click should not toggle it closed — that conflicts with the
285
- // hover-open semantics of cascade mode.
286
- if (this._submenuOpen)
287
- return;
288
- this.dispatchEvent(new CustomEvent('submenu-open', {
289
- detail: { submenu: this._submenuEl, item: this },
290
- bubbles: true,
291
- composed: false,
292
- }));
293
- return;
294
- }
295
- this.dispatchEvent(new CustomEvent('select', {
296
- bubbles: true,
297
- composed: true,
298
- }));
299
- this.closest('nldd-menu')?.hidePopover?.();
300
- }
301
- /** Programmatically select this item. */
302
- select() {
303
- this._handleClick();
304
- }
305
- render() {
306
- return menuItemTemplate.call(this, this.menuVariant);
307
- }
308
- }
309
- NLDDMenuItem.styles = menuItemStyles;
310
- NLDDMenuItem._idCounter = 0;
311
- __decorate([
312
- property({ type: Boolean, reflect: true })
313
- ], NLDDMenuItem.prototype, "destructive", void 0);
314
- __decorate([
315
- property({ reflect: true, converter: reflectNonDefault('') })
316
- ], NLDDMenuItem.prototype, "text", void 0);
317
- __decorate([
318
- property({ reflect: true, converter: reflectNonDefault('') })
319
- ], NLDDMenuItem.prototype, "details", void 0);
320
- __decorate([
321
- property({ type: String, reflect: true })
322
- ], NLDDMenuItem.prototype, "icon", void 0);
323
- __decorate([
324
- property({ reflect: true, converter: reflectNonDefault('') })
325
- ], NLDDMenuItem.prototype, "shortcut", void 0);
326
- __decorate([
327
- property({ reflect: true, attribute: 'shortcut-mac', converter: reflectNonDefault('') })
328
- ], NLDDMenuItem.prototype, "shortcutMac", void 0);
329
- __decorate([
330
- property({ reflect: true, attribute: 'shortcut-windows', converter: reflectNonDefault('') })
331
- ], NLDDMenuItem.prototype, "shortcutWindows", void 0);
332
- __decorate([
333
- property({ reflect: true, attribute: 'shortcut-linux', converter: reflectNonDefault('') })
334
- ], NLDDMenuItem.prototype, "shortcutLinux", void 0);
335
- __decorate([
336
- property({ type: String, reflect: true })
337
- ], NLDDMenuItem.prototype, "href", void 0);
338
- __decorate([
339
- property({ type: String, reflect: true })
340
- ], NLDDMenuItem.prototype, "type", void 0);
341
- __decorate([
342
- property({ type: Boolean, reflect: true })
343
- ], NLDDMenuItem.prototype, "selected", void 0);
344
- __decorate([
345
- property({ type: Boolean, reflect: true })
346
- ], NLDDMenuItem.prototype, "disabled", void 0);
347
- __decorate([
348
- property({ type: String, reflect: true })
349
- ], NLDDMenuItem.prototype, "value", void 0);
350
- __decorate([
351
- property({ reflect: true, converter: reflectNonDefault('') })
352
- ], NLDDMenuItem.prototype, "aliases", void 0);
353
- __decorate([
354
- property({ reflect: true, converter: reflectNonDefault('') })
355
- ], NLDDMenuItem.prototype, "query", void 0);
356
- __decorate([
357
- property({ reflect: true, attribute: 'query-mark-mode', converter: reflectNonDefault('predictive') })
358
- ], NLDDMenuItem.prototype, "queryMarkMode", void 0);
359
- __decorate([
360
- state()
361
- ], NLDDMenuItem.prototype, "menuVariant", void 0);
362
- __decorate([
363
- state()
364
- ], NLDDMenuItem.prototype, "checkColumn", void 0);
365
- __decorate([
366
- state()
367
- ], NLDDMenuItem.prototype, "_submenuOpen", void 0);
368
- if (!customElements.get('nldd-menu-item')) {
369
- customElements.define('nldd-menu-item', NLDDMenuItem);
370
- }
23
+ import { MenuPointerController } from './menu.pointer.js';
24
+ import { SubmenuLevel } from './menu.chain.js';
25
+ import { SafeTriangleController, rectContainsPoint } from './menu.safe-triangle.js';
26
+ export { NLDDMenuItem } from './menu-item.js';
27
+ export { NLDDMenuGroup } from './menu-group.js';
28
+ export { NLDDMenuDivider } from './menu-divider.js';
371
29
  // # nldd-menu
372
30
  const defaultFilterFn = (query, item) => {
373
31
  const q = query.toLowerCase();
@@ -376,6 +34,22 @@ const defaultFilterFn = (query, item) => {
376
34
  const aliasesMatch = item.aliases !== '' && item.aliases.split(' ').some(s => s.toLowerCase().includes(q));
377
35
  return textMatch || valueMatch || aliasesMatch;
378
36
  };
37
+ /** The name of what a menu hangs off. A field that anchors its list to an
38
+ * element inside its own shadow root (nldd-token-field) has the name on its
39
+ * host, so a nameless anchor in a shadow root asks the host. The property is
40
+ * read before the attribute: nldd-form-field sets `accessibleLabel` as one. */
41
+ function nameOfAnchor(anchor) {
42
+ const name = (anchor.accessibleLabel
43
+ || anchor.getAttribute('accessible-label')
44
+ || anchor.getAttribute('aria-label')
45
+ || anchor.getAttribute('text')
46
+ || (anchor.shadowRoot ? '' : anchor.textContent)
47
+ || '').trim();
48
+ if (name)
49
+ return name;
50
+ const root = anchor.getRootNode();
51
+ return root instanceof ShadowRoot ? nameOfAnchor(root.host) : '';
52
+ }
379
53
  /**
380
54
  * A floating menu component using the Popover API.
381
55
  * Positioned relative to an anchor element using Floating UI.
@@ -390,6 +64,7 @@ const defaultFilterFn = (query, item) => {
390
64
  *
391
65
  * @attr {'menu'|'listbox'|'navigation'} variant - What the menu is (default 'menu'). `menu` is a menu of actions: `role="menu"` with menu items, for things you do. `listbox` is the popup of a combobox: `role="listbox"` with options, focus stays in the field. `navigation` is a submenu in a site navigation: a list of links (`role="list"`, each item a list item around a real link), because a screen reader treats a menu as an application and reads a list of links as what it is. Every item takes an `href`. Tab reaches each link, the arrow keys, Home and End move between them, Escape closes and returns focus to the trigger, and the menu closes when focus leaves it. The trigger says `aria-expanded` and promises no menu. Checkbox and radio items, shortcuts and `filter()` belong to actions and warn in development here. A submenu of a navigation menu is a navigation menu too. The variant sets `role="listitem"` on its items and groups, and takes it off again when it changes back, also where you had set that role yourself.
392
66
  * @attr {string} width - Explicit width, pinned exactly. Without it the menu sizes to its content between a minimum and a viewport-aware maximum (min(100vw - inset, 640px)).
67
+ * @attr {string} accessible-label - Name of the menu or listbox for assistive technology, on the element that has the role. Without it the menu takes the name of its anchor (the `accessible-label`, `aria-label`, `text` or text of the button or field it hangs off), and a submenu the text of the item that opens it, so a listbox under a search field is "Zoeken" rather than nameless (WCAG 4.1.2). The list of an nldd-combo-box or nldd-token-field takes the name of the field.
393
68
  * @attr {string} anchor - ID of the anchor element. Positions the menu against it AND makes it a toggle: the menu listens on document click and opens/closes itself when the click lands on the anchor. Use this for a menu hung off a button. For a menu you open yourself (a type-ahead under a text field, say), set the `anchorElement` property instead — same positioning, no toggle.
394
69
  * @attr {string} placement - Floating UI placement. Default: 'bottom-start'.
395
70
  * @attr {number} max-items - Maximum number of visible items before scrolling. Sets --_menu-max-items internally. Default: 0 (no limit).
@@ -426,6 +101,7 @@ export class NLDDMenu extends LitElement {
426
101
  * nldd-token-field do: their input must stay an input, not a menu button.
427
102
  */
428
103
  this.anchorElement = null;
104
+ this.accessibleLabel = '';
429
105
  this.placement = 'bottom-start';
430
106
  /**
431
107
  * @internal Distance in px between the anchor and the menu, along the placement
@@ -470,34 +146,30 @@ export class NLDDMenu extends LitElement {
470
146
  * template (a separate module) reads them via `this`. */
471
147
  this._hasHeader = false;
472
148
  this._hasFooter = false;
473
- /** Currently open child submenu (a direct descendant nldd-menu opened
474
- * by one of this menu's items). null when no submenu is open. */
149
+ // — Submenu chain ——
150
+ // The open submenus are levels: see menu.chain.ts. These fields are what
151
+ // the levels and the rest of the menu read.
152
+ /** The submenu open from one of this menu's own items, and that item.
153
+ * null while none is open. @internal */
475
154
  this._activeSubmenu = null;
155
+ /** @internal */
476
156
  this._activeSubmenuOpener = null;
477
- /** Cleanup closure for the currently open child submenu. Invoked by the
478
- * submenu's `toggle→closed` event, but also callable directly from a
479
- * chain-close walk so the upper levels can be torn down without waiting
480
- * for stale toggle events that will never fire (e.g. a hidden drill-in
481
- * parent whose popover state is already 'closed'). */
482
- this._activeSubmenuCleanup = null;
157
+ /** The level of that submenu. @internal */
158
+ this._activeLevel = null;
483
159
  /** Signal that this menu is hiding itself to make room for a deeper drill-in
484
160
  * level — its parent's onToggle should skip the normal close cleanup
485
161
  * (re-parent + re-show) so the chain stays in deeper-level state. */
486
162
  this._drillInHidingForDeeper = false;
487
- /** Root-owned registry of every submenu currently open in this chain,
488
- * in open order. Lives on the root menu only; submenus reach it via
489
- * `_chainRoot`. Drives `_collapseChain()` so collapsing the whole
490
- * stack never depends on `_activeSubmenu`/`_parentMenu` threading
491
- * (which real interaction can leave stale). @internal */
163
+ /** Root-owned registry of every level open in this chain, in open order.
164
+ * Lives on the root only; submenus reach it via `_chainRoot`. Drives
165
+ * `_collapseChain()`, so collapsing the whole stack never depends on
166
+ * `_activeSubmenu`/`_parentMenu`, which real interaction can leave
167
+ * stale. @internal */
492
168
  this._openChain = [];
493
169
  /** Back-reference to the chain's root, set on every submenu when it
494
170
  * opens. Lets `_collapseChain()` find the registry without walking
495
171
  * the (possibly stale) parent links. null on the root. @internal */
496
172
  this._chainRoot = null;
497
- /** Force-teardown for this submenu (detach toggle listener, hide,
498
- * restore DOM, reset state — no parent re-show). Set when the submenu
499
- * opens; called by `_collapseChain()`. @internal */
500
- this._collapseSelf = null;
501
173
  /** When this menu is itself a submenu, points to the parent menu that
502
174
  * opened it. Set by the parent's _handleSubmenuOpen. null on the root.
503
175
  * @internal */
@@ -621,29 +293,12 @@ export class NLDDMenu extends LitElement {
621
293
  this.showPopover();
622
294
  }
623
295
  };
624
- // — Safe triangle (cascade only) ——————————————————————————————————————
625
- //
626
- // While a cascade submenu is open, a global mousemove listener tracks
627
- // the cursor against a "safe triangle" (Mayank/ishadeed pattern). The
628
- // triangle's apex is captured once on the first mousemove after submenu
629
- // open; the base is the submenu's two near corners (top + bottom of the
630
- // edge facing the parent — left edge if submenu is right of cursor,
631
- // right edge if floating-ui flipped it to the other side). The wedge
632
- // stays fixed until the cursor enters the submenu, so the user has a
633
- // predictable, stable area to traverse without losing the submenu.
634
- // While the cursor is inside the triangle, peer items don't activate.
635
- //
636
- // We deliberately do NOT auto-close on hover-out: moving the cursor to
637
- // empty space outside every menu leaves the chain open. The native
638
- // popover light-dismiss takes care of click-outside, which is the only
639
- // gesture that should collapse the chain.
296
+ // — Hover and the safe triangle (cascade only) ——————————————————————————
297
+ // See menu.safe-triangle.ts for the wedge that keeps a submenu open on a
298
+ // diagonal route to it.
640
299
  this._hoverOpenTimer = null;
641
- this._safeTriangleListener = null;
642
- this._safeTriangleStallTimer = null;
643
- this._lastCursorPos = null;
644
- this._safeTriangleApex = null;
645
- this._safeTriangleSubmenu = null;
646
- this._movingTowardSubmenu = false;
300
+ /** @internal */
301
+ this._safeTriangle = new SafeTriangleController(this);
647
302
  this._handleMenuItemMouseenter = (event) => {
648
303
  // Touch suppress: synthesised mouseenter from touch (e.g. lifting
649
304
  // after a scroll gesture on a long menu) shouldn't paint a highlight.
@@ -662,8 +317,6 @@ export class NLDDMenu extends LitElement {
662
317
  // open. Click-outside (popover light-dismiss) is the only gesture
663
318
  // that collapses the chain.
664
319
  };
665
- // — Debug overlay ————————————————————————————————————————————————————
666
- this._safeTriangleOverlay = null;
667
320
  this._handleMenuItemFocused = (event) => {
668
321
  const item = event.target.closest('nldd-menu-item');
669
322
  if (!item || item.disabled || item.hasAttribute('hidden'))
@@ -677,9 +330,7 @@ export class NLDDMenu extends LitElement {
677
330
  };
678
331
  /**
679
332
  * Open a submenu in response to one of this menu's items dispatching
680
- * `submenu-open`. Branches on drill-in vs cascade mode for anchor +
681
- * placement, but the lifecycle (popover.show, listen for close, clear
682
- * state on hide) is the same for both modes.
333
+ * `submenu-open`, as a new level of the chain (menu.chain.ts).
683
334
  */
684
335
  this._handleSubmenuOpen = (event) => {
685
336
  // Only handle events from items that are direct children of this menu.
@@ -696,178 +347,7 @@ export class NLDDMenu extends LitElement {
696
347
  // the next close.
697
348
  if (this._activeSubmenu === submenu)
698
349
  return;
699
- // Close any other submenu that's already open in this menu before
700
- // opening a new one — only one peer submenu visible at a time.
701
- if (this._activeSubmenu && this._activeSubmenu !== submenu) {
702
- this._activeSubmenu.hidePopover?.();
703
- }
704
- submenu._parentMenu = this;
705
- submenu._parentItem = item;
706
- // Register this submenu in the root's open-chain so `_collapseChain()`
707
- // can tear the whole stack down without relying on parent links being
708
- // intact at collapse time. Captured here, while links are fresh.
709
- const chainRoot = this._rootMenu;
710
- submenu._chainRoot = chainRoot;
711
- if (!chainRoot._openChain.includes(submenu))
712
- chainRoot._openChain.push(submenu);
713
- if (this._drillInMode) {
714
- // Drill-in: anchor to the root's anchor so all submenus open at the
715
- // same screen position — visually stacks. Inherit root placement
716
- // for consistent direction. Back button rendered in template.
717
- const root = this._rootMenu;
718
- submenu.anchorElement = root._getAnchorEl();
719
- submenu.placement = root.placement;
720
- }
721
- else {
722
- // Cascade: anchor to the parent item, open beside it.
723
- submenu.anchorElement = item;
724
- submenu.placement = 'right-start';
725
- }
726
- this._activeSubmenu = submenu;
727
- this._activeSubmenuOpener = item;
728
- item._submenuOpen = true;
729
- // Clear [highlighted] on the opener — the "logically current" item is
730
- // now in the submenu, not on the opener. The opener still shows visibly
731
- // active via .menu__item[aria-expanded="true"] (lighter neutral); CSS
732
- // :hover upgrades it to accent if the cursor returns to it.
733
- item.removeAttribute('highlighted');
734
- // Listen once for the submenu's close so we can clear state, ARIA and
735
- // any leftover safe-triangle plumbing from the cascade open path.
736
- const wasDrillIn = this._drillInMode;
737
- // Shared teardown — runs from `toggle→closed` in the normal flow, and
738
- // invoked directly from a select-chain-close walk for hidden ancestors
739
- // whose toggle event will never fire (they were already closed when
740
- // the deeper level took over the screen). `skipReshow` lets the chain
741
- // walk suppress the parent-restore step so the whole stack collapses.
742
- const cleanup = (skipReshow) => {
743
- submenu.removeEventListener('toggle', onToggle);
744
- if (this._activeSubmenu === submenu) {
745
- this._activeSubmenu = null;
746
- this._activeSubmenuOpener = null;
747
- this._activeSubmenuCleanup = null;
748
- }
749
- submenu._parentMenu = null;
750
- submenu._parentItem = null;
751
- // Deregister from the root's open-chain registry.
752
- const ci = chainRoot._openChain.indexOf(submenu);
753
- if (ci !== -1)
754
- chainRoot._openChain.splice(ci, 1);
755
- submenu._collapseSelf = null;
756
- submenu._chainRoot = null;
757
- item._submenuOpen = false;
758
- // Drill-in: restore the submenu to its original DOM position and
759
- // re-show the parent so the user returns to the previous view.
760
- // Captured at open-time so a viewport flip during navigation
761
- // doesn't leave the chain in an inconsistent state.
762
- if (wasDrillIn) {
763
- if (drillInOriginalParent && drillInOriginalParent.isConnected) {
764
- drillInOriginalParent.insertBefore(submenu, drillInNextSibling);
765
- }
766
- else {
767
- // Original parent was removed from the DOM while the
768
- // submenu was reparented to <body> (SPA navigation,
769
- // story teardown, etc.). There's nowhere to restore it
770
- // to — drop the orphaned node instead of leaking a
771
- // detached-but-connected element in <body> forever.
772
- submenu.remove();
773
- }
774
- if (!skipReshow && this.isConnected && !this.matches(':popover-open')) {
775
- this.showPopover?.();
776
- }
777
- // One level back (back button / ArrowLeft / Esc) — announce the
778
- // destination view on the now-visible parent. `skipReshow` is a
779
- // collapse-the-whole-chain teardown (select / outside-tap /
780
- // resize): that's a dismiss, not a back-nav, so it stays silent.
781
- if (!skipReshow && this.isConnected) {
782
- const dest = this._parentItem?.text;
783
- this._announce(dest
784
- ? this._t('components.menu.submenu-back-action', { title: dest })
785
- : this._t('components.menu.back-action'));
786
- }
787
- }
788
- // Drop any safe-triangle "in transit" highlight on the opener —
789
- // without this, an opener whose submenu was closed via stall-
790
- // dismissal or programmatic hidePopover keeps the bold accent
791
- // even though the close should also drop the visual signal.
792
- // Skip when the item is currently focused — keyboard close
793
- // (ArrowLeft) sync-focuses the opener before this async toggle
794
- // fires, and that focus already set [highlighted] via the
795
- // menu-item-focused chain; stripping it here would leave the
796
- // opener visibly unhighlighted despite being focused.
797
- if (!item.hasAttribute('data-focused')) {
798
- item.removeAttribute('highlighted');
799
- }
800
- this._stopSafeTriangle();
801
- // Counterpart to `submenu-open` — consumers tracking submenu state
802
- // via declarative event listeners (rather than reaching into our
803
- // internals) get a clean close signal here.
804
- this.dispatchEvent(new CustomEvent('submenu-close', {
805
- detail: { submenu, item },
806
- bubbles: true,
807
- composed: false,
808
- }));
809
- };
810
- const onToggle = (e) => {
811
- const tg = e;
812
- if (tg.newState !== 'closed')
813
- return;
814
- // Submenu is hiding to make room for a deeper drill — leave the
815
- // chain state alone, keep the listener around for the eventual
816
- // real close.
817
- if (submenu._drillInHidingForDeeper) {
818
- submenu._drillInHidingForDeeper = false;
819
- return;
820
- }
821
- // A real toggle-close = one level back: tear down and re-show
822
- // the parent. Collapsing the whole chain doesn't come through
823
- // here — `_collapseChain()` drives `_collapseSelf` directly.
824
- cleanup(false);
825
- };
826
- submenu.addEventListener('toggle', onToggle);
827
- this._activeSubmenuCleanup = cleanup;
828
- // Force-teardown used by `_collapseChain()`: detach the toggle
829
- // listener (so this hide doesn't also run the back-nav onToggle),
830
- // hide, then run the shared cleanup with no parent re-show.
831
- submenu._collapseSelf = () => {
832
- submenu.removeEventListener('toggle', onToggle);
833
- submenu.hidePopover?.();
834
- cleanup(true);
835
- };
836
- // Drill-in: re-parent the submenu to <body> before show so it isn't
837
- // a popover-stack descendant of the parent — that lets us close the
838
- // parent without cascading the submenu closed. Original placement is
839
- // restored when the submenu closes.
840
- let drillInOriginalParent = null;
841
- let drillInNextSibling = null;
842
- if (wasDrillIn) {
843
- drillInOriginalParent = submenu.parentElement;
844
- drillInNextSibling = submenu.nextSibling;
845
- document.body.appendChild(submenu);
846
- }
847
- submenu.showPopover?.();
848
- if (wasDrillIn) {
849
- // View just swapped to the submenu — announce the level we
850
- // entered (the opener's label is this view's title, same string
851
- // the back button shows). Fires on the now-visible submenu.
852
- submenu._announce(submenu._t('components.menu.submenu-title', { title: item.text }));
853
- // Signal to our own parent's onToggle (if any) that this hide is
854
- // "intentional, making room for a deeper drill" — skip the normal
855
- // close cleanup that would re-parent us back and re-open them.
856
- this._drillInHidingForDeeper = true;
857
- this.hidePopover?.();
858
- }
859
- // Start the safe-triangle tracker for cascade-mode submenus only.
860
- // Drill-in mode replaces the parent view, so there's no "moving toward"
861
- // path between two visible menus to protect.
862
- if (!wasDrillIn) {
863
- // Wait one frame so the submenu's getBoundingClientRect reflects its
864
- // final position (computePosition runs in the toggle handler).
865
- requestAnimationFrame(() => {
866
- if (this._activeSubmenu === submenu) {
867
- this._startSafeTriangle(submenu);
868
- }
869
- });
870
- }
350
+ new SubmenuLevel(this, item, submenu, this._drillInMode).open();
871
351
  };
872
352
  /** Close this submenu when the back button is clicked, returning to the
873
353
  * parent view (which is still open as a popover behind this one in
@@ -883,34 +363,11 @@ export class NLDDMenu extends LitElement {
883
363
  this._handleBackMouseenter = () => {
884
364
  this._clearHighlight();
885
365
  };
886
- this._touchStartX = 0;
887
- this._touchStartY = 0;
888
- /** @internal */
889
- this._handleMenuTouchStart = (event) => {
890
- const t = event.touches[0];
891
- if (!t)
892
- return;
893
- this._touchStartX = t.clientX;
894
- this._touchStartY = t.clientY;
895
- this.removeAttribute('scroll-active');
896
- };
366
+ // — Pointer gestures ————————————————————————————————————————————————————
367
+ // Press-drag-release, no press flash while scrolling, and a tap beside a
368
+ // drill-in chain: see menu.pointer.ts.
897
369
  /** @internal */
898
- this._handleMenuTouchMove = (event) => {
899
- if (this.hasAttribute('scroll-active'))
900
- return;
901
- const t = event.touches[0];
902
- if (!t)
903
- return;
904
- const dx = t.clientX - this._touchStartX;
905
- const dy = t.clientY - this._touchStartY;
906
- if (Math.hypot(dx, dy) > NLDDMenu._TOUCH_SCROLL_THRESHOLD_PX) {
907
- this.setAttribute('scroll-active', '');
908
- }
909
- };
910
- /** @internal */
911
- this._handleMenuTouchEnd = () => {
912
- this.removeAttribute('scroll-active');
913
- };
370
+ this._pointer = new MenuPointerController(this);
914
371
  /** Close the menu on a window resize. Floating-UI's autoUpdate keeps
915
372
  * the position in sync with scrolls (where users genuinely expect the
916
373
  * menu to follow the anchor), but a full window resize is a layout-
@@ -929,8 +386,8 @@ export class NLDDMenu extends LitElement {
929
386
  * selecting an item, clicking the anchor, clicking/tapping outside, or
930
387
  * a viewport resize.
931
388
  *
932
- * Driven by the root's `_openChain` registry and each submenu's
933
- * `_collapseSelf`, so it never depends on `_activeSubmenu` /
389
+ * Driven by the root's `_openChain` registry of levels, so it never
390
+ * depends on `_activeSubmenu` /
934
391
  * `_parentMenu` threading being intact at collapse time — real
935
392
  * interaction can leave those stale, which was the source of the
936
393
  * recurring "anchor click doesn't close after the 2nd navigation"
@@ -944,7 +401,7 @@ export class NLDDMenu extends LitElement {
944
401
  const chain = root._openChain;
945
402
  root._openChain = [];
946
403
  for (let i = chain.length - 1; i >= 0; i--)
947
- chain[i]._collapseSelf?.();
404
+ chain[i].collapse();
948
405
  if (root._isOpen)
949
406
  root.hidePopover?.();
950
407
  };
@@ -975,43 +432,6 @@ export class NLDDMenu extends LitElement {
975
432
  * tap (pointerup without crossing the scroll threshold); a scroll
976
433
  * leaves the chain untouched, matching root-menu behavior.
977
434
  */
978
- this._dragStartItem = null;
979
- /**
980
- * Native HTML `<select>` lets you press on one option, drag to another,
981
- * and release to pick the one under the pointer. Standard click events
982
- * don't fire across different elements, so we replicate it manually:
983
- * remember the pointerdown'd item, listen for the matching pointerup,
984
- * and if the release lands on a different non-disabled item, fire its
985
- * `select` directly. The original button's click handler still owns the
986
- * single-click no-drag path.
987
- */
988
- this._handleItemPointerdown = (event) => {
989
- if (event.button !== 0)
990
- return;
991
- const item = event.target?.closest('nldd-menu-item');
992
- if (!item || item.disabled)
993
- return;
994
- this._dragStartItem = item;
995
- document.addEventListener('pointerup', this._handleDragRelease, { capture: true, once: true });
996
- };
997
- this._handleDragRelease = (event) => {
998
- const startItem = this._dragStartItem;
999
- this._dragStartItem = null;
1000
- if (!startItem)
1001
- return;
1002
- // If the menu closed between pointerdown and pointerup (light-dismiss,
1003
- // keyboard shortcut), bail — elementFromPoint could otherwise resolve
1004
- // to an item in a different, newly-opened menu and fire its select.
1005
- if (!this._isOpen)
1006
- return;
1007
- const releaseItem = this._menuItemFromPoint(event.clientX, event.clientY);
1008
- if (!releaseItem || releaseItem === startItem || releaseItem.disabled)
1009
- return;
1010
- // Different item — fire its select. Browser won't dispatch click here
1011
- // because pointerdown and pointerup landed on different targets, so
1012
- // there's no double-fire to suppress.
1013
- releaseItem._handleClick();
1014
- };
1015
435
  this._handleDocumentPointerdown = (event) => {
1016
436
  if (!this._isOpen)
1017
437
  return;
@@ -1053,40 +473,15 @@ export class NLDDMenu extends LitElement {
1053
473
  // the chain doesn't collapse it (consistent with the root menu,
1054
474
  // which stays open while scrolling outside).
1055
475
  if (event.pointerType === 'touch') {
1056
- this._outsideTapStartX = event.clientX;
1057
- this._outsideTapStartY = event.clientY;
1058
- this._teardownOutsideTap();
1059
- this._outsideTapTracking = true;
1060
- document.addEventListener('pointermove', this._outsideTapMove, true);
1061
- document.addEventListener('pointerup', this._outsideTapEnd, true);
1062
- document.addEventListener('pointercancel', this._outsideTapCancel, true);
476
+ this._pointer.trackOutsideTap(event, () => {
477
+ (this._chainRoot ?? this)._collapsedByPointerGesture = true;
478
+ this._collapseChain();
479
+ });
1063
480
  return;
1064
481
  }
1065
482
  (this._chainRoot ?? this)._collapsedByPointerGesture = true;
1066
483
  this._collapseChain();
1067
484
  };
1068
- this._outsideTapStartX = 0;
1069
- this._outsideTapStartY = 0;
1070
- this._outsideTapTracking = false;
1071
- this._outsideTapMove = (e) => {
1072
- const dx = e.clientX - this._outsideTapStartX;
1073
- const dy = e.clientY - this._outsideTapStartY;
1074
- if (Math.hypot(dx, dy) > NLDDMenu._TOUCH_SCROLL_THRESHOLD_PX) {
1075
- // Became a scroll — leave the chain open.
1076
- this._teardownOutsideTap();
1077
- }
1078
- };
1079
- this._outsideTapEnd = () => {
1080
- const wasTap = this._outsideTapTracking;
1081
- this._teardownOutsideTap();
1082
- if (wasTap) {
1083
- (this._chainRoot ?? this)._collapsedByPointerGesture = true;
1084
- this._collapseChain();
1085
- }
1086
- };
1087
- this._outsideTapCancel = () => {
1088
- this._teardownOutsideTap();
1089
- };
1090
485
  // — Private handlers ——————————————————————————————————————————————————————
1091
486
  this._handleKeydown = (event) => {
1092
487
  // Only a navigation menu closes on a Tab out; see _handleFocusOut.
@@ -1275,7 +670,7 @@ export class NLDDMenu extends LitElement {
1275
670
  this._cleanupAutoUpdate = null;
1276
671
  window.removeEventListener('resize', this._handleWindowResize);
1277
672
  document.removeEventListener('pointerdown', this._handleDocumentPointerdown, true);
1278
- this._teardownOutsideTap();
673
+ this._pointer.stopOutsideTap();
1279
674
  this._clearHighlight();
1280
675
  return;
1281
676
  }
@@ -1314,6 +709,7 @@ export class NLDDMenu extends LitElement {
1314
709
  };
1315
710
  }
1316
711
  // — i18n ——————————————————————————————————————————————————————————————————
712
+ /** @internal */
1317
713
  _t(key, vars) {
1318
714
  return translate(this.translations, nlddMenuTranslations, key, vars);
1319
715
  }
@@ -1341,6 +737,7 @@ export class NLDDMenu extends LitElement {
1341
737
  * announces only the level you land on); once flushed, the same text may
1342
738
  * be announced again for a later genuine transition (e.g. re-entering a
1343
739
  * submenu after going back).
740
+ * @internal
1344
741
  */
1345
742
  _announce(message) {
1346
743
  if (!message)
@@ -1407,7 +804,18 @@ export class NLDDMenu extends LitElement {
1407
804
  this._syncAnchorPopupState(this._isOpen);
1408
805
  }
1409
806
  }
807
+ /** @internal The name of the element with the menu or listbox role: its
808
+ * own, else the name of what it hangs off. */
809
+ get _listLabel() {
810
+ if (this.accessibleLabel)
811
+ return this.accessibleLabel;
812
+ if (this._parentItem?.text)
813
+ return this._parentItem.text;
814
+ const anchor = this._getAnchorEl();
815
+ return anchor ? nameOfAnchor(anchor) : '';
816
+ }
1410
817
  // — Anchor ————————————————————————————————————————————————————————————————
818
+ /** @internal */
1411
819
  _getAnchorEl() {
1412
820
  if (this.anchorElement)
1413
821
  return this.anchorElement;
@@ -1464,6 +872,27 @@ export class NLDDMenu extends LitElement {
1464
872
  anchor.popoverTargetAction = isOpen ? 'hide' : 'show';
1465
873
  }
1466
874
  }
875
+ /** @internal For the safe triangle: the item whose submenu is open. */
876
+ get safeTriangleOpener() {
877
+ return this._activeSubmenuOpener;
878
+ }
879
+ /** @internal For the safe triangle. */
880
+ highlightOpener() {
881
+ if (this._activeSubmenuOpener)
882
+ this._setHighlight(this._activeSubmenuOpener);
883
+ }
884
+ /** @internal For the safe triangle: whether a point is in `submenu` or a
885
+ * submenu below it, so a cursor that went on into a deeper submenu still
886
+ * reads as arrived rather than re-pinning a stale apex. */
887
+ isPointInSubmenus(p, submenu) {
888
+ let menu = submenu;
889
+ while (menu) {
890
+ if (rectContainsPoint(menu.getBoundingClientRect(), p))
891
+ return true;
892
+ menu = menu._activeSubmenu;
893
+ }
894
+ return false;
895
+ }
1467
896
  /**
1468
897
  * Item-activation logic shared between the native `mouseenter` capture
1469
898
  * handler and the safe-triangle recovery paths (sideways exit, direction
@@ -1487,7 +916,7 @@ export class NLDDMenu extends LitElement {
1487
916
  // submenu, peer items don't get highlighted and don't schedule
1488
917
  // hover-opens. Without this, the highlight flickers across every item
1489
918
  // the cursor brushes past on its diagonal route to the submenu.
1490
- if (this._movingTowardSubmenu && item !== this._activeSubmenuOpener)
919
+ if (this._safeTriangle.movingToward && item !== this._activeSubmenuOpener)
1491
920
  return;
1492
921
  this._setHighlight(item);
1493
922
  if (this._drillInMode)
@@ -1510,274 +939,22 @@ export class NLDDMenu extends LitElement {
1510
939
  }, 150);
1511
940
  }
1512
941
  }
1513
- /** Resolve the menu-item under a viewport point and activate it via
1514
- * `_activateItem`. Used by safe-triangle recovery paths whose natural
1515
- * mouseenter has already fired (and bailed) — they need to re-trigger
1516
- * activation without synthesizing a MouseEvent. */
1517
- _activateItemAt(p) {
942
+ /** @internal Resolve the menu-item under a viewport point and activate it
943
+ * via `_activateItem`. Used by the safe triangle, whose natural mouseenter
944
+ * has already fired (and bailed): it re-triggers activation without
945
+ * synthesizing a MouseEvent. */
946
+ activateItemAt(p) {
1518
947
  const el = document.elementFromPoint(p.x, p.y);
1519
948
  const item = el?.closest('nldd-menu-item');
1520
949
  if (item)
1521
950
  this._activateItem(item);
1522
951
  }
1523
- /** Start the global mouse tracker that powers the safe triangle. Called
1524
- * by _handleSubmenuOpen when a submenu opens in cascade mode. The
1525
- * listener is a thin orchestrator over the named phase methods below. */
1526
- _startSafeTriangle(submenu) {
1527
- this._stopSafeTriangle();
1528
- this._lastCursorPos = null;
1529
- this._safeTriangleApex = null;
1530
- this._safeTriangleSubmenu = submenu;
1531
- this._movingTowardSubmenu = false;
1532
- this._safeTriangleListener = (e) => {
1533
- const p = { x: e.clientX, y: e.clientY };
1534
- const r = submenu.getBoundingClientRect();
1535
- // 1. In submenu (or any nested submenu) — arrived, clean up.
1536
- if (NLDDMenu._isPointInMenuTree(p, submenu)) {
1537
- this._safeTriangleArrived(p);
1538
- return;
1539
- }
1540
- const openerRect = this._activeSubmenuOpener?.getBoundingClientRect();
1541
- const cursorOnOpener = NLDDMenu._rectContainsPoint(openerRect, p);
1542
- const lastOnOpener = NLDDMenu._rectContainsPoint(openerRect, this._lastCursorPos);
1543
- // 2. Returned to opener — drop apex so the next exit can re-pin
1544
- // a fresh wedge. Overlay stays drawn until next render.
1545
- if (this._safeTriangleApex !== null && cursorOnOpener) {
1546
- this._safeTriangleApex = null;
1547
- }
1548
- const wasMoving = this._movingTowardSubmenu;
1549
- if (this._safeTriangleApex === null) {
1550
- // 3a. Still on opener — wait for an exit direction.
1551
- if (cursorOnOpener) {
1552
- this._safeTriangleWaitOnOpener(p, r, openerRect);
1553
- return;
1554
- }
1555
- // 3b. Crossed top/bottom edge of opener — pin apex.
1556
- if (openerRect && lastOnOpener && (p.y > openerRect.bottom || p.y < openerRect.top)) {
1557
- this._safeTrianglePinApex(p, openerRect);
1558
- }
1559
- else {
1560
- // 3c. Exited sideways — no protection. Drop the apex and
1561
- // activate whatever item is under the cursor so peers
1562
- // take over immediately.
1563
- this._safeTriangleSidewaysExit(p, wasMoving);
1564
- }
1565
- }
1566
- else {
1567
- // 4. Apex pinned — test whether cursor is inside the wedge.
1568
- this._safeTrianglePolygonTest(p, r);
1569
- }
1570
- this._lastCursorPos = p;
1571
- // 5. Common per-frame work: highlight, recovery, stall timer.
1572
- this._safeTriangleSyncOpenerHighlight();
1573
- this._safeTriangleDirectionReversalRecovery(p, wasMoving);
1574
- this._safeTriangleScheduleStall();
1575
- };
1576
- window.addEventListener('mousemove', this._safeTriangleListener);
1577
- }
1578
- // — Safe-triangle phase methods ————————————————————————————————————————
1579
- /** Cursor entered the submenu (or any nested submenu) — clean up triangle
1580
- * state but leave the window mousemove listener alive. The listener still
1581
- * needs to fire while the cursor is inside the submenu so we can detect a
1582
- * return trip to the opener and re-pin a fresh apex for another exit. */
1583
- _safeTriangleArrived(p) {
1584
- this._movingTowardSubmenu = false;
1585
- this._lastCursorPos = p;
1586
- this._safeTriangleApex = null;
1587
- this._activeSubmenuOpener?.removeAttribute('highlighted');
1588
- this._removeSafeTriangleOverlay();
1589
- }
1590
- /** Cursor still on the opener — wait for an exit direction. Sets the
1591
- * "in transit" flag (so brief peer pass-throughs don't activate) and
1592
- * renders a live debug preview that follows the cursor. */
1593
- _safeTriangleWaitOnOpener(p, r, openerRect) {
1594
- this._movingTowardSubmenu = true;
1595
- this._lastCursorPos = p;
1596
- // Set opener highlight up front so the bold accent is already on
1597
- // while the cursor is still on the opener — avoids a visible "pop"
1598
- // when the cursor first crosses the bottom edge.
1599
- if (this._activeSubmenuOpener
1600
- && !this._activeSubmenuOpener.hasAttribute('highlighted')) {
1601
- this._setHighlight(this._activeSubmenuOpener);
1602
- }
1603
- if (this.debugSafeTriangle && openerRect) {
1604
- const nearX = p.x < r.left ? r.left : r.right;
1605
- this._renderSafeTriangleOverlay([
1606
- { x: p.x - NLDDMenu._SAFE_TRIANGLE_APEX_X_OFFSET, y: p.y },
1607
- { x: nearX, y: r.top },
1608
- { x: nearX, y: r.bottom },
1609
- ]);
1610
- }
1611
- }
1612
- /** Cursor crossed the opener's top or bottom edge — pin apex there.
1613
- * x is clamped to the opener's range so the wedge starts at the visual
1614
- * edge regardless of how far past the edge this mousemove sample is, then
1615
- * shifted by _SAFE_TRIANGLE_APEX_X_OFFSET to widen the wedge at the
1616
- * cursor side (the 4px headroom that makes brief diagonal wobble forgive). */
1617
- _safeTrianglePinApex(p, openerRect) {
1618
- const apexX = Math.max(openerRect.left, Math.min(openerRect.right, p.x))
1619
- - NLDDMenu._SAFE_TRIANGLE_APEX_X_OFFSET;
1620
- const apexY = p.y > openerRect.bottom ? openerRect.bottom : openerRect.top;
1621
- this._safeTriangleApex = { x: apexX, y: apexY };
1622
- this._movingTowardSubmenu = true;
1623
- }
1624
- /** Cursor exited the opener sideways (left/right) or with no opener
1625
- * history — no triangle protection. Drop the flag and the overlay,
1626
- * and synthesize mouseenter on the element under the cursor so peers
1627
- * activate immediately (the natural mouseenter fired with flag=true
1628
- * during the on-opener phase and got bailed). */
1629
- _safeTriangleSidewaysExit(p, wasMoving) {
1630
- this._movingTowardSubmenu = false;
1631
- this._lastCursorPos = p;
1632
- this._removeSafeTriangleOverlay();
1633
- if (wasMoving)
1634
- this._activateItemAt(p);
1635
- }
1636
- /** Apex pinned — test whether the current cursor position is inside the
1637
- * wedge. Picks the submenu edge facing the cursor (left for right-start,
1638
- * right when floating-ui flipped it). */
1639
- _safeTrianglePolygonTest(p, r) {
1640
- const nearX = p.x < r.left ? r.left : r.right;
1641
- const apex = this._safeTriangleApex;
1642
- // Single-point apex (no jitter band): the apex is already offset left
1643
- // of the actual crossing point by _SAFE_TRIANGLE_APEX_X_OFFSET, so the
1644
- // cursor sits comfortably inside the wedge near the opener edge — no
1645
- // degenerate cases where a 1px jitter pops the cursor out at the apex.
1646
- const wedge = [
1647
- apex,
1648
- { x: nearX, y: r.top },
1649
- { x: nearX, y: r.bottom },
1650
- ];
1651
- this._movingTowardSubmenu = NLDDMenu._pointInPolygon(p, wedge);
1652
- if (this.debugSafeTriangle) {
1653
- this._renderSafeTriangleOverlay(wedge);
1654
- }
1655
- }
1656
- /** Sync opener highlight with the in-transit flag. Uses _setHighlight so
1657
- * any peer that briefly got highlighted (e.g. via the synthetic
1658
- * mouseenter on a wedge-edge wobble) is cleared. Skip when the opener
1659
- * already has the attribute to avoid DOM churn each frame. */
1660
- _safeTriangleSyncOpenerHighlight() {
1661
- if (this._activeSubmenuOpener && this._movingTowardSubmenu
1662
- && !this._activeSubmenuOpener.hasAttribute('highlighted')) {
1663
- this._setHighlight(this._activeSubmenuOpener);
1664
- }
1665
- }
1666
- /** When the in-transit flag flips true → false, the cursor may already
1667
- * be sitting on a peer item whose natural mouseenter fired (and bailed)
1668
- * earlier. mouseenter won't re-fire until the cursor leaves and re-
1669
- * enters, so synthesize one here to activate the peer immediately. */
1670
- _safeTriangleDirectionReversalRecovery(p, wasMoving) {
1671
- if (!wasMoving || this._movingTowardSubmenu)
1672
- return;
1673
- this._activateItemAt(p);
1674
- }
1675
- /** Re-arm the stall-dismissal timer. If the cursor sits motionless
1676
- * inside the safe triangle long enough, drop the protection so the
1677
- * element under the cursor can become interactive without nudging. */
1678
- _safeTriangleScheduleStall() {
1679
- if (this._safeTriangleStallTimer !== null) {
1680
- clearTimeout(this._safeTriangleStallTimer);
1681
- this._safeTriangleStallTimer = null;
1682
- }
1683
- if (!this._movingTowardSubmenu)
1684
- return;
1685
- this._safeTriangleStallTimer = window.setTimeout(() => {
1686
- this._safeTriangleStallTimer = null;
1687
- this._movingTowardSubmenu = false;
1688
- this._safeTriangleApex = null;
1689
- if (this._lastCursorPos)
1690
- this._activateItemAt(this._lastCursorPos);
1691
- }, NLDDMenu._SAFE_TRIANGLE_STALL_DISMISS_MS);
1692
- }
1693
- /** True when the rect contains the point (inclusive). Returns false for
1694
- * a missing rect or point — convenient for the optional-chained call
1695
- * sites in the safe-triangle logic. */
1696
- static _rectContainsPoint(rect, point) {
1697
- return !!rect && !!point
1698
- && point.x >= rect.left && point.x <= rect.right
1699
- && point.y >= rect.top && point.y <= rect.bottom;
1700
- }
1701
- _stopSafeTriangle() {
1702
- if (this._safeTriangleListener !== null) {
1703
- window.removeEventListener('mousemove', this._safeTriangleListener);
1704
- this._safeTriangleListener = null;
1705
- }
1706
- if (this._safeTriangleStallTimer !== null) {
1707
- clearTimeout(this._safeTriangleStallTimer);
1708
- this._safeTriangleStallTimer = null;
1709
- }
1710
- this._lastCursorPos = null;
1711
- this._safeTriangleApex = null;
1712
- this._safeTriangleSubmenu = null;
1713
- this._movingTowardSubmenu = false;
1714
- this._removeSafeTriangleOverlay();
1715
- }
1716
- _renderSafeTriangleOverlay(vertices) {
1717
- const NS = 'http://www.w3.org/2000/svg';
1718
- if (this._safeTriangleOverlay === null) {
1719
- const wrapper = document.createElement('div');
1720
- wrapper.setAttribute('popover', 'manual');
1721
- wrapper.setAttribute('aria-hidden', 'true');
1722
- wrapper.style.cssText = 'position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;border:0;padding:0;margin:0;background:transparent;overflow:visible;';
1723
- const svg = document.createElementNS(NS, 'svg');
1724
- svg.setAttribute('width', '100%');
1725
- svg.setAttribute('height', '100%');
1726
- const polygon = document.createElementNS(NS, 'polygon');
1727
- polygon.setAttribute('fill', 'rgba(255, 0, 128, 0.15)');
1728
- polygon.setAttribute('stroke', 'rgba(255, 0, 128, 0.85)');
1729
- polygon.setAttribute('stroke-width', '1');
1730
- svg.appendChild(polygon);
1731
- wrapper.appendChild(svg);
1732
- document.body.appendChild(wrapper);
1733
- wrapper.showPopover();
1734
- this._safeTriangleOverlay = wrapper;
1735
- }
1736
- const polygon = this._safeTriangleOverlay.querySelector('polygon');
1737
- polygon.setAttribute('points', vertices.map(v => `${v.x},${v.y}`).join(' '));
1738
- }
1739
- _removeSafeTriangleOverlay() {
1740
- this._safeTriangleOverlay?.hidePopover?.();
1741
- this._safeTriangleOverlay?.remove();
1742
- this._safeTriangleOverlay = null;
1743
- }
1744
952
  _cancelHoverOpen() {
1745
953
  if (this._hoverOpenTimer !== null) {
1746
954
  clearTimeout(this._hoverOpenTimer);
1747
955
  this._hoverOpenTimer = null;
1748
956
  }
1749
957
  }
1750
- /** Recursively checks whether a point sits inside the given menu OR any of
1751
- * its descendant submenus. Used by the safe-triangle "arrived" check so a
1752
- * cursor that has continued past the immediate submenu into a deeper
1753
- * nested submenu still reads as "in the safe area" — without the recursive
1754
- * walk we'd treat the deeper hover as an exit and re-pin a stale apex. */
1755
- static _isPointInMenuTree(p, menu) {
1756
- const r = menu.getBoundingClientRect();
1757
- if (p.x >= r.left && p.x <= r.right && p.y >= r.top && p.y <= r.bottom)
1758
- return true;
1759
- if (menu._activeSubmenu)
1760
- return NLDDMenu._isPointInMenuTree(p, menu._activeSubmenu);
1761
- return false;
1762
- }
1763
- /** Convex point-in-polygon test via consistent edge-cross-product sign.
1764
- * Vertices must be ordered (clockwise or counter-clockwise). */
1765
- static _pointInPolygon(p, vertices) {
1766
- let hasNeg = false;
1767
- let hasPos = false;
1768
- for (let i = 0; i < vertices.length; i++) {
1769
- const a = vertices[i];
1770
- const b = vertices[(i + 1) % vertices.length];
1771
- const cross = (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);
1772
- if (cross < 0)
1773
- hasNeg = true;
1774
- if (cross > 0)
1775
- hasPos = true;
1776
- if (hasNeg && hasPos)
1777
- return false;
1778
- }
1779
- return true;
1780
- }
1781
958
  static _getDrillInModeQuery() {
1782
959
  if (NLDDMenu._drillInModeQuery === null) {
1783
960
  // Use the shared breakpoint constant so the JS-side threshold can't
@@ -1803,37 +980,9 @@ export class NLDDMenu extends LitElement {
1803
980
  get _isSubmenu() {
1804
981
  return this._parentMenu !== null;
1805
982
  }
1806
- /**
1807
- * Resolves the menu-item under the pointer, piercing shadow boundaries.
1808
- * `document.elementFromPoint` stops at the outermost shadow host, so a menu
1809
- * nested inside another component's shadow DOM (e.g. nldd-split-button)
1810
- * resolves the release target to that host and never finds the item — which
1811
- * silently disables press-drag-release there. Descending the shadow roots
1812
- * restores it and is a no-op for light-DOM menus.
1813
- */
1814
- _menuItemFromPoint(x, y) {
1815
- let root = document;
1816
- // Depth guard: a backstop against pathologically deep shadow nesting;
1817
- // real menus are at most a few roots deep.
1818
- const MAX_PIERCE_DEPTH = 20;
1819
- for (let depth = 0; depth < MAX_PIERCE_DEPTH; depth++) {
1820
- const el = root.elementFromPoint(x, y);
1821
- if (!el)
1822
- return null;
1823
- const item = el.closest('nldd-menu-item');
1824
- if (item)
1825
- return item;
1826
- if (!el.shadowRoot)
1827
- return null;
1828
- root = el.shadowRoot;
1829
- }
1830
- return null;
1831
- }
1832
- _teardownOutsideTap() {
1833
- this._outsideTapTracking = false;
1834
- document.removeEventListener('pointermove', this._outsideTapMove, true);
1835
- document.removeEventListener('pointerup', this._outsideTapEnd, true);
1836
- document.removeEventListener('pointercancel', this._outsideTapCancel, true);
983
+ /** @internal For the pointer gestures. */
984
+ get _isMenuOpen() {
985
+ return this._isOpen;
1837
986
  }
1838
987
  connectedCallback() {
1839
988
  super.connectedCallback();
@@ -1853,7 +1002,6 @@ export class NLDDMenu extends LitElement {
1853
1002
  this.addEventListener('menu-item-focused', this._handleMenuItemFocused);
1854
1003
  this.addEventListener('submenu-open', this._handleSubmenuOpen);
1855
1004
  this.addEventListener('select', this._collapseChain);
1856
- this.addEventListener('pointerdown', this._handleItemPointerdown);
1857
1005
  document.addEventListener('click', this._handleDocumentClick);
1858
1006
  }
1859
1007
  willUpdate() {
@@ -1900,17 +1048,15 @@ export class NLDDMenu extends LitElement {
1900
1048
  this.removeEventListener('menu-item-focused', this._handleMenuItemFocused);
1901
1049
  this.removeEventListener('submenu-open', this._handleSubmenuOpen);
1902
1050
  this.removeEventListener('select', this._collapseChain);
1903
- this.removeEventListener('pointerdown', this._handleItemPointerdown);
1904
1051
  document.removeEventListener('click', this._handleDocumentClick);
1905
- document.removeEventListener('pointerup', this._handleDragRelease, true);
1906
1052
  // Defensive: the pointerdown + resize listeners are added on open
1907
1053
  // and removed on close, but if the menu is torn down mid-open we'd
1908
1054
  // otherwise leak the global listeners.
1909
1055
  document.removeEventListener('pointerdown', this._handleDocumentPointerdown, true);
1910
- this._teardownOutsideTap();
1056
+ this._pointer.stopOutsideTap();
1911
1057
  window.removeEventListener('resize', this._handleWindowResize);
1912
1058
  this._cancelHoverOpen();
1913
- this._stopSafeTriangle();
1059
+ this._safeTriangle.stop();
1914
1060
  if (this._typeaheadTimer !== null) {
1915
1061
  clearTimeout(this._typeaheadTimer);
1916
1062
  this._typeaheadTimer = null;
@@ -2236,19 +1382,6 @@ export class NLDDMenu extends LitElement {
2236
1382
  }
2237
1383
  }
2238
1384
  NLDDMenu.styles = menuStyles;
2239
- /** When the cursor sits motionless inside the safe triangle for this
2240
- * long, dismiss the triangle and let whatever item is under the cursor
2241
- * become interactive. Without this, a paused cursor would stay
2242
- * "protected" indefinitely and the user couldn't peer-hover. */
2243
- NLDDMenu._SAFE_TRIANGLE_STALL_DISMISS_MS = 500;
2244
- /** Pull the wedge apex this many pixels away from the submenu edge (i.e.
2245
- * to the left when the submenu is on the right). Widens the wedge near
2246
- * the cursor so brief diagonal wobble doesn't pop the cursor out at the
2247
- * apex, and avoids the degenerate single-line wedge when the cursor
2248
- * crossed the opener edge exactly at the same x as the near submenu
2249
- * corner. The shift is always negative — the standard placement is
2250
- * submenu-right, so "left" is the intuitive forgive direction. */
2251
- NLDDMenu._SAFE_TRIANGLE_APEX_X_OFFSET = 4;
2252
1385
  /**
2253
1386
  * Drill-in mode is the touch-friendly rendering: a submenu replaces its
2254
1387
  * parent's view by anchoring to the root anchor (so visually it stacks
@@ -2264,17 +1397,6 @@ NLDDMenu._SAFE_TRIANGLE_APEX_X_OFFSET = 4;
2264
1397
  * is wasteful.
2265
1398
  */
2266
1399
  NLDDMenu._drillInModeQuery = null;
2267
- // — Touch-scroll press-flash suppression ————————————————————————————————
2268
- //
2269
- // On touch, pressing an item sets :active and the synthetic sticky
2270
- // :hover lands on it, so `.menu__item:active:hover` flashes. If the
2271
- // gesture becomes an internal scroll (cramped menu), :active lingers
2272
- // until the browser recognizes the pan and the highlight stays for
2273
- // the whole scroll. We detect a scroll from the touch delta and set
2274
- // `scroll-active` on the host; the styles neutralise the press flash
2275
- // while it's set. A pure tap never moves past the threshold, so its
2276
- // brief press feedback is preserved.
2277
- NLDDMenu._TOUCH_SCROLL_THRESHOLD_PX = 8;
2278
1400
  // — Lifecycle callbacks ————————————————————————————————————————————————————
2279
1401
  NLDDMenu._menuIdCounter = 0;
2280
1402
  /** Reset the typeahead buffer after this much idle time. 500ms is the
@@ -2294,6 +1416,9 @@ __decorate([
2294
1416
  __decorate([
2295
1417
  property({ attribute: false })
2296
1418
  ], NLDDMenu.prototype, "anchorElement", void 0);
1419
+ __decorate([
1420
+ property({ attribute: 'accessible-label' })
1421
+ ], NLDDMenu.prototype, "accessibleLabel", void 0);
2297
1422
  __decorate([
2298
1423
  property({ reflect: true, converter: reflectNonDefault('bottom-start') })
2299
1424
  ], NLDDMenu.prototype, "placement", void 0);