@ds-mo/ui 12.7.0 → 12.9.0

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 (313) hide show
  1. package/dist/.build-stamp +1 -1
  2. package/dist/agent-patterns.json +22 -9
  3. package/dist/agent.json +246 -19
  4. package/dist/angular/ds-button-filled.d.ts +1 -1
  5. package/dist/angular/ds-button-filled.js +3 -3
  6. package/dist/angular/ds-button-unfilled.d.ts +1 -1
  7. package/dist/angular/ds-button-unfilled.js +3 -3
  8. package/dist/angular/ds-card-overview.d.ts +19 -0
  9. package/dist/angular/ds-card-overview.js +42 -0
  10. package/dist/angular/index.d.ts +1 -1
  11. package/dist/angular/index.js +1 -0
  12. package/dist/angular/proxies.d.ts +1 -0
  13. package/dist/angular/proxies.js +1 -0
  14. package/dist/components/ds-agent-activity.js +1 -1
  15. package/dist/components/ds-agent-response.js +1 -1
  16. package/dist/components/ds-agent-source-list.js +1 -1
  17. package/dist/components/ds-agent-tool-call.js +1 -1
  18. package/dist/components/ds-attachment-list.js +1 -1
  19. package/dist/components/ds-badge.js +1 -1
  20. package/dist/components/ds-bar-nav.js +1 -1
  21. package/dist/components/ds-bar-title.js +1 -1
  22. package/dist/components/ds-bar-title.js.map +1 -1
  23. package/dist/components/ds-bar-workflow.js +1 -1
  24. package/dist/components/ds-breadcrumb.js +1 -1
  25. package/dist/components/ds-button-filled.js +1 -1
  26. package/dist/components/ds-button-unfilled.js +1 -1
  27. package/dist/components/ds-card-data-viz-bar.js +1 -1
  28. package/dist/components/ds-card-data-viz-bar.js.map +1 -1
  29. package/dist/components/ds-card-data-viz-donut.js +1 -1
  30. package/dist/components/ds-card-data-viz-donut.js.map +1 -1
  31. package/dist/components/ds-card-data-viz-line.js +1 -1
  32. package/dist/components/ds-card-data-viz-line.js.map +1 -1
  33. package/dist/components/ds-card-overview.d.ts +11 -0
  34. package/dist/components/ds-card-overview.js +2 -0
  35. package/dist/components/ds-card-overview.js.map +1 -0
  36. package/dist/components/ds-card-setting.js +1 -1
  37. package/dist/components/ds-card-shell-data-viz.js +1 -1
  38. package/dist/components/ds-chart-bar-stacked.js +1 -1
  39. package/dist/components/ds-chart-bar-stacked.js.map +1 -1
  40. package/dist/components/ds-chart-bar.js +1 -1
  41. package/dist/components/ds-chart-bar.js.map +1 -1
  42. package/dist/components/ds-chart-donut.js +1 -1
  43. package/dist/components/ds-chart-donut.js.map +1 -1
  44. package/dist/components/ds-chart-legend.js +1 -1
  45. package/dist/components/ds-chart-line.js +1 -1
  46. package/dist/components/ds-chart-line.js.map +1 -1
  47. package/dist/components/ds-checkbox.js +1 -1
  48. package/dist/components/ds-chip.js +1 -1
  49. package/dist/components/ds-code-block.js +1 -1
  50. package/dist/components/ds-conversation-list-item.js +1 -1
  51. package/dist/components/ds-conversation-list-item.js.map +1 -1
  52. package/dist/components/ds-conversation-list-section.js +1 -1
  53. package/dist/components/ds-conversation-list.js +1 -1
  54. package/dist/components/ds-conversation-list.js.map +1 -1
  55. package/dist/components/ds-divider.js +1 -1
  56. package/dist/components/ds-empty-state.js +1 -1
  57. package/dist/components/ds-field.js +1 -1
  58. package/dist/components/ds-input.js +1 -1
  59. package/dist/components/ds-markdown.js +1 -1
  60. package/dist/components/ds-menu.js +1 -1
  61. package/dist/components/ds-message-bubble.js +1 -1
  62. package/dist/components/ds-message-composer.js +1 -1
  63. package/dist/components/ds-message-scroller.js +1 -1
  64. package/dist/components/ds-message-scroller.js.map +1 -1
  65. package/dist/components/ds-message.js +1 -1
  66. package/dist/components/ds-mobile-bar-nav.js +1 -1
  67. package/dist/components/ds-mobile-header.js +1 -1
  68. package/dist/components/ds-mobile-section-switcher.js +1 -1
  69. package/dist/components/ds-mobile-sheet-nav.js +1 -1
  70. package/dist/components/ds-modal.js +1 -1
  71. package/dist/components/ds-modal.js.map +1 -1
  72. package/dist/components/ds-panel-nav.js +1 -1
  73. package/dist/components/ds-panel-nav.js.map +1 -1
  74. package/dist/components/ds-panel-sub-nav.js +1 -1
  75. package/dist/components/ds-panel-tool-header.js +1 -1
  76. package/dist/components/ds-panel-tool-search.js +1 -1
  77. package/dist/components/ds-panel-tools.js +1 -1
  78. package/dist/components/ds-radio.js +1 -1
  79. package/dist/components/ds-scroll-overlay.js +1 -1
  80. package/dist/components/ds-scroll-overlay.js.map +1 -1
  81. package/dist/components/ds-select-multi.js +1 -1
  82. package/dist/components/ds-select-multi.js.map +1 -1
  83. package/dist/components/ds-select.js +1 -1
  84. package/dist/components/ds-select.js.map +1 -1
  85. package/dist/components/ds-shell-app.js +1 -1
  86. package/dist/components/ds-shell-gradient-picker.js +1 -1
  87. package/dist/components/ds-shell-gradient-picker.js.map +1 -1
  88. package/dist/components/ds-shell-gradient-swatch.js +1 -1
  89. package/dist/components/ds-shell-page.js +1 -1
  90. package/dist/components/ds-shell-page.js.map +1 -1
  91. package/dist/components/ds-shell-tools.js +1 -1
  92. package/dist/components/ds-skeleton.js +1 -1
  93. package/dist/components/ds-skeleton.js.map +1 -1
  94. package/dist/components/ds-slider.js +1 -1
  95. package/dist/components/ds-slider.js.map +1 -1
  96. package/dist/components/ds-swatch-picker.js +1 -1
  97. package/dist/components/ds-switch.js +1 -1
  98. package/dist/components/ds-tab-group.js +1 -1
  99. package/dist/components/ds-tag.js +1 -1
  100. package/dist/components/ds-text.js +1 -1
  101. package/dist/components/ds-toast.js +1 -1
  102. package/dist/components/ds-toast.js.map +1 -1
  103. package/dist/components/ds-tooltip-data-viz.js +1 -1
  104. package/dist/components/ds-tooltip.js +1 -1
  105. package/dist/components/ds-typing-indicator.js +1 -1
  106. package/dist/components/p-2foAUsDN.js +2 -0
  107. package/dist/components/p-2foAUsDN.js.map +1 -0
  108. package/dist/components/{p-BuiZcSga.js → p-8GK7B7K4.js} +2 -2
  109. package/dist/components/p-8GK7B7K4.js.map +1 -0
  110. package/dist/components/p-B5tMlca-.js +2 -0
  111. package/dist/components/p-B5tMlca-.js.map +1 -0
  112. package/dist/components/p-B6Vuayt6.js +2 -0
  113. package/dist/components/p-B6Vuayt6.js.map +1 -0
  114. package/dist/components/{p-B-9A0e_0.js → p-B88n0pO3.js} +2 -2
  115. package/dist/components/p-BBePKRHC.js +2 -0
  116. package/dist/components/p-BBePKRHC.js.map +1 -0
  117. package/dist/components/p-BBxcMVqk.js +2 -0
  118. package/dist/components/p-BBxcMVqk.js.map +1 -0
  119. package/dist/components/p-BDKtu6Wb.js +2 -0
  120. package/dist/components/{p-Bl001G0Y.js.map → p-BDKtu6Wb.js.map} +1 -1
  121. package/dist/components/p-BKOlvCGS.js +2 -0
  122. package/dist/components/p-BKOlvCGS.js.map +1 -0
  123. package/dist/components/{p-C7bZ-jiU.js → p-BO5aqZcf.js} +2 -2
  124. package/dist/components/{p-guQ7hv6W.js → p-BOCfICln.js} +2 -2
  125. package/dist/components/p-BX0BMhgz.js +2 -0
  126. package/dist/components/p-BX0BMhgz.js.map +1 -0
  127. package/dist/components/p-BhV5e6vF.js +2 -0
  128. package/dist/components/{p-1darPzys.js.map → p-BhV5e6vF.js.map} +1 -1
  129. package/dist/components/p-C8HU4W8q.js +2 -0
  130. package/dist/components/{p-pgxlkvUy.js.map → p-C8HU4W8q.js.map} +1 -1
  131. package/dist/components/{p-CvyTZ4Mg.js → p-CChcuL04.js} +2 -2
  132. package/dist/components/{p-Crsn82rz.js → p-CCzG5xDD.js} +2 -2
  133. package/dist/components/p-CGVXbXv9.js +2 -0
  134. package/dist/components/p-CGVXbXv9.js.map +1 -0
  135. package/dist/components/{p-BT5hgg5i.js → p-CIiBpjCn.js} +2 -2
  136. package/dist/components/{p-B_5nxOeB.js → p-CgEYdMee.js} +2 -2
  137. package/dist/components/{p-k0Hmj1KV.js → p-Cr3tEx7o.js} +2 -2
  138. package/dist/components/p-Cr3tEx7o.js.map +1 -0
  139. package/dist/components/{p-5-QAFB4j.js → p-Cuih680v.js} +2 -2
  140. package/dist/components/{p-C_9ZH0A3.js → p-Cuqxh-Tq.js} +2 -2
  141. package/dist/components/{p--eKXTylf.js → p-DCvA3Dc9.js} +2 -2
  142. package/dist/components/{p-DNFd4Ao-.js → p-DLZm_-sU.js} +2 -2
  143. package/dist/components/{p-C9h13YnX.js → p-DRnIuCiT.js} +2 -2
  144. package/dist/components/p-DhKvqh5G.js +2 -0
  145. package/dist/components/p-DhKvqh5G.js.map +1 -0
  146. package/dist/components/p-DjKkSqrG.js +2 -0
  147. package/dist/components/p-DjKkSqrG.js.map +1 -0
  148. package/dist/components/{p-CUAYsK44.js → p-DlscFn2m.js} +2 -2
  149. package/dist/components/{p-BcfC6phQ.js → p-DxkEC0hR.js} +2 -2
  150. package/dist/components/p-DxkEC0hR.js.map +1 -0
  151. package/dist/components/{p-C6xC48hG.js → p-Re2kPrXm.js} +2 -2
  152. package/dist/components/{p-DIa73GJP.js → p-XMZCaXs7.js} +2 -2
  153. package/dist/components/p-YR1XeuZf.js +2 -0
  154. package/dist/components/p-YR1XeuZf.js.map +1 -0
  155. package/dist/components/{p-CqWV4Hl_.js → p-dyUp3Adm.js} +2 -2
  156. package/dist/components/{p-CnAkobDW.js → p-nkYN0Bub.js} +2 -2
  157. package/dist/components/p-yhj1lIPx.js +2 -0
  158. package/dist/docs/components.json +847 -167
  159. package/dist/lib/components/Menu/menu-position.d.ts +6 -6
  160. package/dist/lib/toast/toast-types.d.ts +3 -3
  161. package/dist/lib/utils/anchored-position.d.ts +34 -0
  162. package/dist/lib/utils/choice-popup-alignment.d.ts +2 -2
  163. package/dist/lib/utils/index.d.ts +2 -0
  164. package/dist/lib/utils/index.js +31 -0
  165. package/dist/lib/utils/index.js.map +3 -3
  166. package/dist/lib/utils/metric-change.d.ts +52 -0
  167. package/dist/lib/utils/token-defaults.d.ts +3 -0
  168. package/dist/mcp-data/registry/agent-activity.json +1 -1
  169. package/dist/mcp-data/registry/agent-response.json +1 -1
  170. package/dist/mcp-data/registry/agent-source-list.json +1 -1
  171. package/dist/mcp-data/registry/agent-tool-call.json +1 -1
  172. package/dist/mcp-data/registry/attachment-list.json +1 -1
  173. package/dist/mcp-data/registry/avatar.json +1 -1
  174. package/dist/mcp-data/registry/badge.json +1 -1
  175. package/dist/mcp-data/registry/bar-nav.json +1 -1
  176. package/dist/mcp-data/registry/bar-title.json +2 -2
  177. package/dist/mcp-data/registry/bar-workflow.json +1 -1
  178. package/dist/mcp-data/registry/breadcrumb.json +1 -1
  179. package/dist/mcp-data/registry/button-filled.json +122 -6
  180. package/dist/mcp-data/registry/button-unfilled.json +49 -5
  181. package/dist/mcp-data/registry/card-data-viz-bar.json +2 -2
  182. package/dist/mcp-data/registry/card-data-viz-donut.json +2 -1
  183. package/dist/mcp-data/registry/card-data-viz-line.json +2 -2
  184. package/dist/mcp-data/registry/card-overview.json +360 -0
  185. package/dist/mcp-data/registry/card-setting.json +1 -1
  186. package/dist/mcp-data/registry/card-shell-data-viz.json +1 -1
  187. package/dist/mcp-data/registry/chart-bar-stacked.json +14 -9
  188. package/dist/mcp-data/registry/chart-bar.json +15 -10
  189. package/dist/mcp-data/registry/chart-donut.json +3 -2
  190. package/dist/mcp-data/registry/chart-legend.json +1 -1
  191. package/dist/mcp-data/registry/chart-line.json +15 -10
  192. package/dist/mcp-data/registry/checkbox.json +1 -1
  193. package/dist/mcp-data/registry/chip.json +1 -1
  194. package/dist/mcp-data/registry/code-block.json +1 -1
  195. package/dist/mcp-data/registry/conversation-list-item.json +1 -1
  196. package/dist/mcp-data/registry/conversation-list-section.json +1 -1
  197. package/dist/mcp-data/registry/conversation-list.json +1 -1
  198. package/dist/mcp-data/registry/divider.json +1 -1
  199. package/dist/mcp-data/registry/empty-state.json +1 -1
  200. package/dist/mcp-data/registry/field.json +1 -1
  201. package/dist/mcp-data/registry/icon.json +1 -1
  202. package/dist/mcp-data/registry/input.json +1 -1
  203. package/dist/mcp-data/registry/loader.json +1 -1
  204. package/dist/mcp-data/registry/markdown.json +1 -1
  205. package/dist/mcp-data/registry/menu.json +3 -3
  206. package/dist/mcp-data/registry/message-bubble.json +1 -1
  207. package/dist/mcp-data/registry/message-composer.json +1 -1
  208. package/dist/mcp-data/registry/message-scroller.json +1 -1
  209. package/dist/mcp-data/registry/message.json +1 -1
  210. package/dist/mcp-data/registry/mobile-bar-nav.json +1 -1
  211. package/dist/mcp-data/registry/mobile-header.json +1 -1
  212. package/dist/mcp-data/registry/mobile-section-switcher.json +1 -1
  213. package/dist/mcp-data/registry/mobile-sheet-nav.json +1 -1
  214. package/dist/mcp-data/registry/modal.json +1 -1
  215. package/dist/mcp-data/registry/panel-nav.json +1 -1
  216. package/dist/mcp-data/registry/panel-sub-nav.json +1 -1
  217. package/dist/mcp-data/registry/panel-tool-header.json +1 -1
  218. package/dist/mcp-data/registry/panel-tool-search.json +1 -1
  219. package/dist/mcp-data/registry/panel-tools.json +3 -2
  220. package/dist/mcp-data/registry/radio.json +1 -1
  221. package/dist/mcp-data/registry/registry.json +249 -19
  222. package/dist/mcp-data/registry/scroll-overlay.json +1 -1
  223. package/dist/mcp-data/registry/select-multi.json +2 -2
  224. package/dist/mcp-data/registry/select.json +2 -2
  225. package/dist/mcp-data/registry/shell-app.json +1 -1
  226. package/dist/mcp-data/registry/shell-gradient-picker.json +1 -1
  227. package/dist/mcp-data/registry/shell-gradient-swatch.json +1 -1
  228. package/dist/mcp-data/registry/shell-page.json +5 -4
  229. package/dist/mcp-data/registry/shell-tools.json +1 -1
  230. package/dist/mcp-data/registry/skeleton.json +1 -1
  231. package/dist/mcp-data/registry/slider.json +1 -1
  232. package/dist/mcp-data/registry/swatch-picker.json +1 -1
  233. package/dist/mcp-data/registry/switch.json +1 -1
  234. package/dist/mcp-data/registry/tab-group.json +1 -1
  235. package/dist/mcp-data/registry/tag.json +1 -1
  236. package/dist/mcp-data/registry/text.json +3 -3
  237. package/dist/mcp-data/registry/toast.json +2 -2
  238. package/dist/mcp-data/registry/tooltip-data-viz.json +3 -1
  239. package/dist/mcp-data/registry/tooltip.json +3 -8
  240. package/dist/mcp-data/registry/typing-indicator.json +1 -1
  241. package/dist/react/components.d.ts +1 -0
  242. package/dist/react/components.js +1 -0
  243. package/dist/react/ds-card-overview.d.ts +12 -0
  244. package/dist/react/ds-card-overview.js +12 -0
  245. package/dist/styles/control-elevation.css +11 -0
  246. package/dist/types/components/ButtonFilled/ButtonFilled.d.ts +32 -0
  247. package/dist/types/components/ButtonUnfilled/ButtonUnfilled.d.ts +20 -0
  248. package/dist/types/components/CardOverview/CardOverview.d.ts +64 -0
  249. package/dist/types/components/CardOverview/card-overview-types.d.ts +34 -0
  250. package/dist/types/components/CardOverview/index.d.ts +2 -0
  251. package/dist/types/components/ChartBar/ChartBar.d.ts +11 -0
  252. package/dist/types/components/ChartBarStacked/ChartBarStacked.d.ts +11 -0
  253. package/dist/types/components/ChartLine/ChartLine.d.ts +11 -0
  254. package/dist/types/components/Menu/Menu.d.ts +7 -5
  255. package/dist/types/components/Menu/menu-position.d.ts +6 -6
  256. package/dist/types/components/ShellPage/ShellPage.d.ts +1 -0
  257. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -4
  258. package/dist/types/components.d.ts +234 -2
  259. package/dist/types/toast/toast-types.d.ts +3 -3
  260. package/dist/types/utils/anchored-position-controller.d.ts +105 -0
  261. package/dist/types/utils/anchored-position.d.ts +35 -0
  262. package/dist/types/utils/cartesian-chart-layout.d.ts +13 -0
  263. package/dist/types/utils/chart-viewport-controller.d.ts +21 -0
  264. package/dist/types/utils/choice-popup-alignment.d.ts +2 -2
  265. package/dist/types/utils/index.d.ts +2 -0
  266. package/dist/types/utils/metric-change.d.ts +53 -0
  267. package/dist/types/utils/select-controller.d.ts +3 -3
  268. package/dist/types/utils/token-defaults.d.ts +3 -0
  269. package/package.json +3 -3
  270. package/dist/components/p-1darPzys.js +0 -2
  271. package/dist/components/p-B8C_yfLQ.js +0 -2
  272. package/dist/components/p-B8C_yfLQ.js.map +0 -1
  273. package/dist/components/p-BcfC6phQ.js.map +0 -1
  274. package/dist/components/p-Bl001G0Y.js +0 -2
  275. package/dist/components/p-BuiZcSga.js.map +0 -1
  276. package/dist/components/p-Bv9frkvW.js +0 -2
  277. package/dist/components/p-Bv9frkvW.js.map +0 -1
  278. package/dist/components/p-C0-K8vnW.js +0 -2
  279. package/dist/components/p-C0-K8vnW.js.map +0 -1
  280. package/dist/components/p-C2ym_Ich.js +0 -2
  281. package/dist/components/p-C_ewSXTT.js +0 -2
  282. package/dist/components/p-C_ewSXTT.js.map +0 -1
  283. package/dist/components/p-Ca9-fnFl.js +0 -2
  284. package/dist/components/p-Ca9-fnFl.js.map +0 -1
  285. package/dist/components/p-CydY-v7X.js +0 -2
  286. package/dist/components/p-CydY-v7X.js.map +0 -1
  287. package/dist/components/p-De7NquTI.js +0 -2
  288. package/dist/components/p-De7NquTI.js.map +0 -1
  289. package/dist/components/p-Dg3xLna0.js +0 -2
  290. package/dist/components/p-Dg3xLna0.js.map +0 -1
  291. package/dist/components/p-k0Hmj1KV.js.map +0 -1
  292. package/dist/components/p-pgxlkvUy.js +0 -2
  293. package/dist/lib/utils/anchored-popup.d.ts +0 -23
  294. package/dist/types/components/Tooltip/tooltip-position.d.ts +0 -21
  295. package/dist/types/utils/anchored-popup.d.ts +0 -24
  296. /package/dist/components/{p-B-9A0e_0.js.map → p-B88n0pO3.js.map} +0 -0
  297. /package/dist/components/{p-C7bZ-jiU.js.map → p-BO5aqZcf.js.map} +0 -0
  298. /package/dist/components/{p-guQ7hv6W.js.map → p-BOCfICln.js.map} +0 -0
  299. /package/dist/components/{p-CvyTZ4Mg.js.map → p-CChcuL04.js.map} +0 -0
  300. /package/dist/components/{p-Crsn82rz.js.map → p-CCzG5xDD.js.map} +0 -0
  301. /package/dist/components/{p-BT5hgg5i.js.map → p-CIiBpjCn.js.map} +0 -0
  302. /package/dist/components/{p-B_5nxOeB.js.map → p-CgEYdMee.js.map} +0 -0
  303. /package/dist/components/{p-5-QAFB4j.js.map → p-Cuih680v.js.map} +0 -0
  304. /package/dist/components/{p-C_9ZH0A3.js.map → p-Cuqxh-Tq.js.map} +0 -0
  305. /package/dist/components/{p--eKXTylf.js.map → p-DCvA3Dc9.js.map} +0 -0
  306. /package/dist/components/{p-DNFd4Ao-.js.map → p-DLZm_-sU.js.map} +0 -0
  307. /package/dist/components/{p-C9h13YnX.js.map → p-DRnIuCiT.js.map} +0 -0
  308. /package/dist/components/{p-CUAYsK44.js.map → p-DlscFn2m.js.map} +0 -0
  309. /package/dist/components/{p-C6xC48hG.js.map → p-Re2kPrXm.js.map} +0 -0
  310. /package/dist/components/{p-DIa73GJP.js.map → p-XMZCaXs7.js.map} +0 -0
  311. /package/dist/components/{p-CqWV4Hl_.js.map → p-dyUp3Adm.js.map} +0 -0
  312. /package/dist/components/{p-CnAkobDW.js.map → p-nkYN0Bub.js.map} +0 -0
  313. /package/dist/components/{p-C2ym_Ich.js.map → p-yhj1lIPx.js.map} +0 -0
@@ -60,7 +60,8 @@
60
60
  "Authored datum colors override the shared categorical palette."
61
61
  ],
62
62
  "responsiveBehavior": [
63
- "The owner supplies dimensions and updates them with its layout; the chart does not measure its container.",
63
+ "Width and height provide the standalone intrinsic viewport; container constraints are measured and reflow the plot across the available pixels.",
64
+ "Responsive layout changes bar positions and plot extents without scaling SVG text, strokes, corner radii, or margins.",
64
65
  "Limit or pre-format long category labels so they remain legible at the chosen width.",
65
66
  "Time labels remain ordered, pre-formatted buckets with equal spacing rather than raw continuous timestamps."
66
67
  ],
@@ -69,10 +70,10 @@
69
70
  "Assign data as a JavaScript property; arrays are not supported as HTML attributes."
70
71
  ],
71
72
  "react": [
72
- "Pass a stable data array and dimensions derived from the containing layout."
73
+ "Pass a stable data array; width and height provide standalone intrinsic dimensions while constrained containers reflow automatically."
73
74
  ],
74
75
  "angular": [
75
- "Bind data as a property and update dimensions from the containing layout."
76
+ "Bind data as a property; width and height provide standalone intrinsic dimensions while constrained containers reflow automatically."
76
77
  ]
77
78
  },
78
79
  "references": [
@@ -98,7 +99,8 @@
98
99
  "attribute": "height",
99
100
  "default": "240",
100
101
  "required": false,
101
- "mutable": false
102
+ "mutable": false,
103
+ "description": "Standalone intrinsic height. Container constraints reflow the plot at rendered pixel size."
102
104
  },
103
105
  "width": {
104
106
  "type": "number",
@@ -106,7 +108,8 @@
106
108
  "attribute": "width",
107
109
  "default": "480",
108
110
  "required": false,
109
- "mutable": false
111
+ "mutable": false,
112
+ "description": "Standalone intrinsic width. Container constraints reflow the plot at rendered pixel size."
110
113
  }
111
114
  },
112
115
  "events": [],
@@ -128,7 +131,8 @@
128
131
  "attribute": "height",
129
132
  "default": "240",
130
133
  "required": false,
131
- "mutable": false
134
+ "mutable": false,
135
+ "description": "Standalone intrinsic height. Container constraints reflow the plot at rendered pixel size."
132
136
  },
133
137
  "width": {
134
138
  "type": "number",
@@ -136,7 +140,8 @@
136
140
  "attribute": "width",
137
141
  "default": "480",
138
142
  "required": false,
139
- "mutable": false
143
+ "mutable": false,
144
+ "description": "Standalone intrinsic width. Container constraints reflow the plot at rendered pixel size."
140
145
  }
141
146
  },
142
147
  "events": [],
@@ -165,7 +170,7 @@
165
170
  "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: data.",
166
171
  "peerDependencies": {
167
172
  "required": [
168
- "@ds-mo/tokens ^3.1.1",
173
+ "@ds-mo/tokens ^5.0.0",
169
174
  "@ds-mo/icons ^6.4.0"
170
175
  ],
171
176
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -180,12 +185,12 @@
180
185
  "files": [
181
186
  {
182
187
  "path": "src/wc/components/ChartBar/ChartBar.css",
183
- "content": ":host {\n display: inline-flex;\n font-family: var(--typography-font-family);\n}\n\n.chart-bar__gridline {\n stroke: var(--color-border-tertiary);\n stroke-width: 1;\n}\n\n/* Matches ds-text text-caption regular (SVG cannot host ds-text). */\n.chart-bar__axis-label {\n fill: var(--color-foreground-secondary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-xs);\n font-weight: var(--typography-weight-medium);\n letter-spacing: var(--typography-letterspacing-positive);\n text-transform: uppercase;\n}\n\n.chart-bar__bar--rounded {\n rx: var(--dimension-radius-025);\n}\n",
188
+ "content": ":host {\n display: inline-block;\n max-width: 100%;\n font-family: var(--typography-font-family);\n}\n\n.chart-bar__svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.chart-bar__gridline {\n stroke: var(--color-border-tertiary);\n stroke-width: var(--dimension-stroke-width-012);\n vector-effect: non-scaling-stroke;\n}\n\n/* Matches ds-text text-caption regular (SVG cannot host ds-text). */\n.chart-bar__axis-label {\n fill: var(--color-foreground-secondary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-xs);\n font-weight: var(--typography-weight-medium);\n letter-spacing: var(--typography-letterspacing-positive);\n text-transform: uppercase;\n}\n\n.chart-bar__bar--rounded {\n rx: var(--dimension-radius-025);\n}\n",
184
189
  "type": "registry:ui"
185
190
  },
186
191
  {
187
192
  "path": "src/wc/components/ChartBar/ChartBar.tsx",
188
- "content": "import { Component, Prop, h, Host } from '@stencil/core';\nimport { scaleBand, scaleLinear } from 'd3-scale';\nimport { max } from 'd3-array';\nimport { categoryColor } from '../../utils/chart-colors';\nimport type { ChartDatum } from '../../utils/chart-types';\n\nconst MARGIN = { top: 16, right: 16, bottom: 24, left: 32 };\n\n@Component({\n tag: 'ds-chart-bar',\n styleUrl: 'ChartBar.css',\n scoped: true,\n})\nexport class ChartBar {\n /** Bars to render. Set as a JS property (not an HTML attribute). */\n @Prop() data: ChartDatum[] = [];\n @Prop() width: number = 480;\n @Prop() height: number = 240;\n\n render() {\n const innerWidth = this.width - MARGIN.left - MARGIN.right;\n const innerHeight = this.height - MARGIN.top - MARGIN.bottom;\n\n const yMax = max(this.data, d => d.value) ?? 0;\n\n const xScale = scaleBand()\n .domain(this.data.map(d => d.label))\n .range([0, innerWidth])\n .padding(0.35);\n\n const yScale = scaleLinear()\n .domain([0, yMax || 1])\n .range([innerHeight, 0])\n .nice();\n\n const yTicks = yScale.ticks(4);\n\n return (\n <Host class=\"chart-bar\">\n <svg\n class=\"chart-bar__svg\"\n viewBox={`0 0 ${this.width} ${this.height}`}\n width={this.width}\n height={this.height}\n role=\"img\"\n aria-label={this.data.map(d => `${d.label}: ${d.value}`).join(', ')}\n >\n <g transform={`translate(${MARGIN.left}, ${MARGIN.top})`}>\n {yTicks.map(tick => (\n <g key={`grid-${tick}`} transform={`translate(0, ${yScale(tick)})`}>\n <line class=\"chart-bar__gridline\" x1={0} x2={innerWidth} />\n <text class=\"chart-bar__axis-label\" x={-8} text-anchor=\"end\" dominant-baseline=\"middle\">\n {tick}\n </text>\n </g>\n ))}\n\n {this.data.map((d, i) => {\n const barWidth = xScale.bandwidth();\n const barX = xScale(d.label) ?? 0;\n const barY = yScale(d.value);\n const barHeight = innerHeight - barY;\n const squareBaseY = barY + barHeight / 2;\n const squareBaseHeight = barHeight / 2;\n const fill = d.color ?? categoryColor(i);\n return (\n <g key={d.label}>\n <rect\n class=\"chart-bar__bar chart-bar__bar--rounded\"\n x={barX}\n y={barY}\n width={barWidth}\n height={barHeight}\n fill={fill}\n />\n <rect\n class=\"chart-bar__bar chart-bar__bar--square-base\"\n x={barX}\n y={squareBaseY}\n width={barWidth}\n height={squareBaseHeight}\n fill={fill}\n />\n <text\n class=\"chart-bar__axis-label\"\n x={barX + barWidth / 2}\n y={innerHeight + 16}\n text-anchor=\"middle\"\n >\n {d.label}\n </text>\n </g>\n );\n })}\n </g>\n </svg>\n </Host>\n );\n }\n}\n",
193
+ "content": "import { Component, Prop, State, Watch, h, Host } from '@stencil/core';\nimport { scaleBand, scaleLinear } from 'd3-scale';\nimport { max } from 'd3-array';\nimport { categoryColor } from '../../utils/chart-colors';\nimport { resolveCartesianChartLayout } from '../../utils/cartesian-chart-layout';\nimport {\n ChartViewportController,\n type ChartViewportSize,\n} from '../../utils/chart-viewport-controller';\nimport type { ChartDatum } from '../../utils/chart-types';\n\n@Component({\n tag: 'ds-chart-bar',\n styleUrl: 'ChartBar.css',\n scoped: true,\n})\nexport class ChartBar {\n /** Bars to render. Set as a JS property (not an HTML attribute). */\n @Prop() data: ChartDatum[] = [];\n /** Standalone intrinsic width. Container constraints reflow the plot at rendered pixel size. */\n @Prop() width: number = 480;\n /** Standalone intrinsic height. Container constraints reflow the plot at rendered pixel size. */\n @Prop() height: number = 240;\n\n @State() private viewport: ChartViewportSize | undefined;\n\n private viewportController: ChartViewportController | null = null;\n private svgEl: SVGElement | null = null;\n\n componentDidLoad() {\n this.connectViewportController();\n }\n\n connectedCallback() {\n if (this.svgEl && !this.viewportController) this.connectViewportController();\n }\n\n componentDidRender() {\n if (!this.viewportController) this.connectViewportController();\n }\n\n private connectViewportController() {\n if (!this.svgEl) return;\n this.viewportController = new ChartViewportController(this.svgEl, viewport => {\n if (\n viewport.width !== this.viewport?.width ||\n viewport.height !== this.viewport?.height\n ) {\n this.viewport = viewport;\n }\n });\n this.viewportController.connect();\n }\n\n disconnectedCallback() {\n this.viewportController?.disconnect();\n this.viewportController = null;\n }\n\n @Watch('width')\n @Watch('height')\n handleIntrinsicSizeChange() {\n this.viewport = undefined;\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => this.viewportController?.measure());\n }\n }\n\n render() {\n const viewportWidth = this.viewport?.width ?? this.width;\n const viewportHeight = this.viewport?.height ?? this.height;\n const { margin, axisLabelGap, categoryLabelOffset } =\n resolveCartesianChartLayout();\n const innerWidth = Math.max(0, viewportWidth - margin.left - margin.right);\n const innerHeight = Math.max(0, viewportHeight - margin.top - margin.bottom);\n\n const yMax = max(this.data, d => d.value) ?? 0;\n\n const xScale = scaleBand()\n .domain(this.data.map(d => d.label))\n .range([0, innerWidth])\n .padding(0.35);\n\n const yScale = scaleLinear()\n .domain([0, yMax || 1])\n .range([innerHeight, 0])\n .nice();\n\n const yTicks = yScale.ticks(4);\n\n return (\n <Host class=\"chart-bar\">\n <svg\n class=\"chart-bar__svg\"\n ref={element => {\n this.svgEl = element ?? null;\n }}\n width={viewportWidth}\n height={viewportHeight}\n role=\"img\"\n aria-label={this.data.map(d => `${d.label}: ${d.value}`).join(', ')}\n >\n <g transform={`translate(${margin.left}, ${margin.top})`}>\n {yTicks.map(tick => (\n <g key={`grid-${tick}`} transform={`translate(0, ${yScale(tick)})`}>\n <line class=\"chart-bar__gridline\" x1={0} x2={innerWidth} />\n <text\n class=\"chart-bar__axis-label\"\n x={-axisLabelGap}\n text-anchor=\"end\"\n dominant-baseline=\"middle\"\n >\n {tick}\n </text>\n </g>\n ))}\n\n {this.data.map((d, i) => {\n const barWidth = xScale.bandwidth();\n const barX = xScale(d.label) ?? 0;\n const barY = yScale(d.value);\n const barHeight = innerHeight - barY;\n const squareBaseY = barY + barHeight / 2;\n const squareBaseHeight = barHeight / 2;\n const fill = d.color ?? categoryColor(i);\n return (\n <g key={d.label}>\n <rect\n class=\"chart-bar__bar chart-bar__bar--rounded\"\n x={barX}\n y={barY}\n width={barWidth}\n height={barHeight}\n fill={fill}\n />\n <rect\n class=\"chart-bar__bar chart-bar__bar--square-base\"\n x={barX}\n y={squareBaseY}\n width={barWidth}\n height={squareBaseHeight}\n fill={fill}\n />\n <text\n class=\"chart-bar__axis-label\"\n x={barX + barWidth / 2}\n y={innerHeight + categoryLabelOffset}\n text-anchor=\"middle\"\n >\n {d.label}\n </text>\n </g>\n );\n })}\n </g>\n </svg>\n </Host>\n );\n }\n}\n",
189
194
  "type": "registry:ui"
190
195
  }
191
196
  ]
@@ -57,6 +57,7 @@
57
57
  "responsiveBehavior": [
58
58
  "Prefer container-fill sizing inside data-viz cards and explicit sizing only in layouts that own a stable diameter.",
59
59
  "Fill sizing remains centered and constrained to the shared donut size band.",
60
+ "Changing the measured diameter changes the ring radius without scaling its token-based thickness, typography, focus stroke, or corner treatment.",
60
61
  "The owner adapts category count and legend placement for available space."
61
62
  ],
62
63
  "frameworkCaveats": {
@@ -314,7 +315,7 @@
314
315
  "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: data.",
315
316
  "peerDependencies": {
316
317
  "required": [
317
- "@ds-mo/tokens ^3.1.1",
318
+ "@ds-mo/tokens ^5.0.0",
318
319
  "@ds-mo/icons ^6.4.0"
319
320
  ],
320
321
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -331,7 +332,7 @@
331
332
  "files": [
332
333
  {
333
334
  "path": "src/wc/components/ChartDonut/ChartDonut.css",
334
- "content": ":host {\n display: inline-block;\n font-family: var(--typography-font-family);\n user-select: none;\n}\n\n:host(.chart-donut--fill) {\n display: block;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n}\n\n.chart-donut__wrapper {\n position: relative;\n overflow: visible;\n}\n\n:host(.chart-donut--fill) .chart-donut__wrapper {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.chart-donut__svg path {\n cursor: default;\n transition: opacity var(--effect-motion-short-2);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .chart-donut__svg path {\n transition: none;\n }\n}\n\n.chart-donut__svg path:focus-visible {\n outline: none;\n stroke: var(--color-interaction-focus);\n stroke-width: 2;\n}\n\n/* Matches ds-text text-title-large + emphasis (SVG cannot host ds-text). */\n.chart-donut__center-value {\n fill: var(--color-foreground-primary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-xl);\n line-height: var(--typography-lineheight-xl);\n font-weight: var(--typography-weight-semibold);\n letter-spacing: var(--typography-letterspacing-negative-double);\n cursor: default;\n pointer-events: none;\n}\n\n/* Matches ds-text text-body-medium regular. */\n.chart-donut__center-caption {\n fill: var(--color-foreground-secondary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-md);\n line-height: var(--typography-lineheight-md);\n font-weight: var(--typography-weight-regular);\n letter-spacing: var(--typography-letterspacing-negative-half);\n cursor: default;\n pointer-events: none;\n}\n",
335
+ "content": ":host {\n display: inline-block;\n font-family: var(--typography-font-family);\n user-select: none;\n}\n\n:host(.chart-donut--fill) {\n display: block;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n}\n\n.chart-donut__wrapper {\n position: relative;\n overflow: visible;\n}\n\n:host(.chart-donut--fill) .chart-donut__wrapper {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.chart-donut__svg path {\n cursor: default;\n transition: opacity var(--effect-motion-short-2);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .chart-donut__svg path {\n transition: none;\n }\n}\n\n.chart-donut__svg path:focus-visible {\n outline: none;\n stroke: var(--color-interaction-focus);\n stroke-width: var(--dimension-stroke-width-025);\n vector-effect: non-scaling-stroke;\n}\n\n/* Matches ds-text text-title-large + emphasis (SVG cannot host ds-text). */\n.chart-donut__center-value {\n fill: var(--color-foreground-primary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-xl);\n line-height: var(--typography-lineheight-xl);\n font-weight: var(--typography-weight-semibold);\n letter-spacing: var(--typography-letterspacing-negative-double);\n cursor: default;\n pointer-events: none;\n}\n\n/* Matches ds-text text-body-medium regular. */\n.chart-donut__center-caption {\n fill: var(--color-foreground-secondary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-md);\n line-height: var(--typography-lineheight-md);\n font-weight: var(--typography-weight-regular);\n letter-spacing: var(--typography-letterspacing-negative-half);\n cursor: default;\n pointer-events: none;\n}\n",
335
336
  "type": "registry:ui"
336
337
  },
337
338
  {
@@ -276,7 +276,7 @@
276
276
  "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: items.",
277
277
  "peerDependencies": {
278
278
  "required": [
279
- "@ds-mo/tokens ^3.1.1",
279
+ "@ds-mo/tokens ^5.0.0",
280
280
  "@ds-mo/icons ^6.4.0"
281
281
  ],
282
282
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -55,7 +55,8 @@
55
55
  "Authored series colors override the shared categorical palette."
56
56
  ],
57
57
  "responsiveBehavior": [
58
- "The owner supplies intrinsic dimensions; the SVG preserves its aspect ratio while shrinking to fit a narrower parent.",
58
+ "Width and height provide the standalone intrinsic viewport; constrained card regions are measured and reflow both axes to their rendered pixel dimensions.",
59
+ "Responsive layout changes point positions and plot extents without scaling SVG text, line strokes, point markers, or margins.",
59
60
  "Category positions are always equally spaced, even when labels represent time.",
60
61
  "Reduce or pre-format dense labels before passing them; the chart renders authored labels without a continuous time scale."
61
62
  ],
@@ -64,10 +65,10 @@
64
65
  "Assign series and categories as JavaScript properties and keep every series aligned to the category count."
65
66
  ],
66
67
  "react": [
67
- "Pass stable series and category arrays with dimensions derived from the containing layout."
68
+ "Pass stable series and category arrays; width and height provide standalone intrinsic dimensions while constrained containers reflow automatically."
68
69
  ],
69
70
  "angular": [
70
- "Bind series and categories as properties with dimensions derived from the containing layout."
71
+ "Bind series and categories as properties; width and height provide standalone intrinsic dimensions while constrained containers reflow automatically."
71
72
  ]
72
73
  },
73
74
  "references": [
@@ -93,7 +94,8 @@
93
94
  "attribute": "height",
94
95
  "default": "240",
95
96
  "required": false,
96
- "mutable": false
97
+ "mutable": false,
98
+ "description": "Standalone intrinsic height. Container constraints reflow the plot at rendered pixel size."
97
99
  },
98
100
  "series": {
99
101
  "type": "ChartSeries[]",
@@ -117,7 +119,8 @@
117
119
  "attribute": "width",
118
120
  "default": "480",
119
121
  "required": false,
120
- "mutable": false
122
+ "mutable": false,
123
+ "description": "Standalone intrinsic width. Container constraints reflow the plot at rendered pixel size."
121
124
  }
122
125
  },
123
126
  "events": [],
@@ -139,7 +142,8 @@
139
142
  "attribute": "height",
140
143
  "default": "240",
141
144
  "required": false,
142
- "mutable": false
145
+ "mutable": false,
146
+ "description": "Standalone intrinsic height. Container constraints reflow the plot at rendered pixel size."
143
147
  },
144
148
  "series": {
145
149
  "type": "ChartSeries[]",
@@ -163,7 +167,8 @@
163
167
  "attribute": "width",
164
168
  "default": "480",
165
169
  "required": false,
166
- "mutable": false
170
+ "mutable": false,
171
+ "description": "Standalone intrinsic width. Container constraints reflow the plot at rendered pixel size."
167
172
  }
168
173
  },
169
174
  "events": [],
@@ -192,7 +197,7 @@
192
197
  "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: categories, series.",
193
198
  "peerDependencies": {
194
199
  "required": [
195
- "@ds-mo/tokens ^3.1.1",
200
+ "@ds-mo/tokens ^5.0.0",
196
201
  "@ds-mo/icons ^6.4.0"
197
202
  ],
198
203
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -207,12 +212,12 @@
207
212
  "files": [
208
213
  {
209
214
  "path": "src/wc/components/ChartLine/ChartLine.css",
210
- "content": ":host {\n display: inline-block;\n max-width: 100%;\n font-family: var(--typography-font-family);\n}\n\n.chart-line__svg {\n display: block;\n max-width: 100%;\n height: auto;\n}\n\n.chart-line__gridline {\n stroke: var(--color-border-tertiary);\n stroke-width: 1;\n}\n\n/* Matches ds-text text-caption regular (SVG cannot host ds-text). */\n.chart-line__axis-label {\n fill: var(--color-foreground-secondary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-xs);\n font-weight: var(--typography-weight-medium);\n letter-spacing: var(--typography-letterspacing-positive);\n text-transform: uppercase;\n}\n\n.chart-line__path {\n fill: none;\n stroke-width: 2;\n}\n\n.chart-line__point {\n stroke: var(--color-background-primary);\n stroke-width: 1.5;\n}\n",
215
+ "content": ":host {\n display: inline-block;\n max-width: 100%;\n font-family: var(--typography-font-family);\n}\n\n.chart-line__svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.chart-line__gridline {\n stroke: var(--color-border-tertiary);\n stroke-width: var(--dimension-stroke-width-012);\n vector-effect: non-scaling-stroke;\n}\n\n/* Matches ds-text text-caption regular (SVG cannot host ds-text). */\n.chart-line__axis-label {\n fill: var(--color-foreground-secondary);\n font-family: var(--typography-font-family);\n font-size: var(--typography-fontsize-xs);\n font-weight: var(--typography-weight-medium);\n letter-spacing: var(--typography-letterspacing-positive);\n text-transform: uppercase;\n}\n\n.chart-line__path {\n fill: none;\n stroke-width: var(--dimension-stroke-width-025);\n vector-effect: non-scaling-stroke;\n}\n\n.chart-line__point {\n stroke: var(--color-background-primary);\n stroke-width: var(--dimension-stroke-width-018);\n r: calc(var(--dimension-size-075) / 2);\n vector-effect: non-scaling-stroke;\n}\n",
211
216
  "type": "registry:ui"
212
217
  },
213
218
  {
214
219
  "path": "src/wc/components/ChartLine/ChartLine.tsx",
215
- "content": "import { Component, Prop, h, Host } from '@stencil/core';\nimport { line as lineShape } from 'd3-shape';\nimport { scaleLinear, scalePoint } from 'd3-scale';\nimport { max } from 'd3-array';\nimport { categoryColor } from '../../utils/chart-colors';\nimport type { ChartSeries } from '../../utils/chart-types';\n\nconst MARGIN = { top: 16, right: 16, bottom: 24, left: 32 };\n\n@Component({\n tag: 'ds-chart-line',\n styleUrl: 'ChartLine.css',\n scoped: true,\n})\nexport class ChartLine {\n /** One or more series to plot. Set as a JS property (not an HTML attribute). */\n @Prop() series: ChartSeries[] = [];\n /** X-axis labels — must match each series' `data` length. Set as a JS property. */\n @Prop() categories: string[] = [];\n @Prop() width: number = 480;\n @Prop() height: number = 240;\n @Prop() showPoints: boolean = true;\n\n render() {\n const innerWidth = this.width - MARGIN.left - MARGIN.right;\n const innerHeight = this.height - MARGIN.top - MARGIN.bottom;\n\n const allValues = this.series.flatMap(s => s.data);\n const yMax = max(allValues) ?? 0;\n\n const xScale = scalePoint<number>()\n .domain(this.categories.map((_, i) => i))\n .range([0, innerWidth]);\n\n const yScale = scaleLinear()\n .domain([0, yMax || 1])\n .range([innerHeight, 0])\n .nice();\n\n const lineGenerator = lineShape<number>()\n .x((_, i) => xScale(i) ?? 0)\n .y(d => yScale(d));\n\n const yTicks = yScale.ticks(4);\n\n return (\n <Host class=\"chart-line\">\n <svg\n class=\"chart-line__svg\"\n viewBox={`0 0 ${this.width} ${this.height}`}\n width={this.width}\n height={this.height}\n role=\"img\"\n aria-label={this.series.map(s => s.name).join(', ')}\n >\n <g transform={`translate(${MARGIN.left}, ${MARGIN.top})`}>\n {yTicks.map(tick => (\n <g key={`grid-${tick}`} transform={`translate(0, ${yScale(tick)})`}>\n <line class=\"chart-line__gridline\" x1={0} x2={innerWidth} />\n <text class=\"chart-line__axis-label\" x={-8} text-anchor=\"end\" dominant-baseline=\"middle\">\n {tick}\n </text>\n </g>\n ))}\n\n {this.categories.map((label, i) => (\n <text\n key={`x-${label}`}\n class=\"chart-line__axis-label\"\n x={xScale(i) ?? 0}\n y={innerHeight + 16}\n text-anchor=\"middle\"\n >\n {label}\n </text>\n ))}\n\n {this.series.map((s, si) => {\n const color = s.color ?? categoryColor(si);\n return (\n <g key={s.name}>\n <path class=\"chart-line__path\" d={lineGenerator(s.data) ?? undefined} stroke={color} />\n {this.showPoints &&\n s.data.map((d, i) => (\n <circle\n key={`${s.name}-${i}`}\n class=\"chart-line__point\"\n cx={xScale(i) ?? 0}\n cy={yScale(d)}\n r={3}\n fill={color}\n />\n ))}\n </g>\n );\n })}\n </g>\n </svg>\n </Host>\n );\n }\n}\n",
220
+ "content": "import { Component, Prop, State, Watch, h, Host } from '@stencil/core';\nimport { line as lineShape } from 'd3-shape';\nimport { scaleLinear, scalePoint } from 'd3-scale';\nimport { max } from 'd3-array';\nimport { categoryColor } from '../../utils/chart-colors';\nimport { resolveCartesianChartLayout } from '../../utils/cartesian-chart-layout';\nimport {\n ChartViewportController,\n type ChartViewportSize,\n} from '../../utils/chart-viewport-controller';\nimport type { ChartSeries } from '../../utils/chart-types';\n\n@Component({\n tag: 'ds-chart-line',\n styleUrl: 'ChartLine.css',\n scoped: true,\n})\nexport class ChartLine {\n /** One or more series to plot. Set as a JS property (not an HTML attribute). */\n @Prop() series: ChartSeries[] = [];\n /** X-axis labels — must match each series' `data` length. Set as a JS property. */\n @Prop() categories: string[] = [];\n /** Standalone intrinsic width. Container constraints reflow the plot at rendered pixel size. */\n @Prop() width: number = 480;\n /** Standalone intrinsic height. Container constraints reflow the plot at rendered pixel size. */\n @Prop() height: number = 240;\n @Prop() showPoints: boolean = true;\n\n @State() private viewport: ChartViewportSize | undefined;\n\n private viewportController: ChartViewportController | null = null;\n private svgEl: SVGElement | null = null;\n\n componentDidLoad() {\n this.connectViewportController();\n }\n\n connectedCallback() {\n if (this.svgEl && !this.viewportController) this.connectViewportController();\n }\n\n componentDidRender() {\n if (!this.viewportController) this.connectViewportController();\n }\n\n private connectViewportController() {\n if (!this.svgEl) return;\n this.viewportController = new ChartViewportController(this.svgEl, viewport => {\n if (\n viewport.width !== this.viewport?.width ||\n viewport.height !== this.viewport?.height\n ) {\n this.viewport = viewport;\n }\n });\n this.viewportController.connect();\n }\n\n disconnectedCallback() {\n this.viewportController?.disconnect();\n this.viewportController = null;\n }\n\n @Watch('width')\n @Watch('height')\n handleIntrinsicSizeChange() {\n this.viewport = undefined;\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => this.viewportController?.measure());\n }\n }\n\n render() {\n const viewportWidth = this.viewport?.width ?? this.width;\n const viewportHeight = this.viewport?.height ?? this.height;\n const { margin, axisLabelGap, categoryLabelOffset } =\n resolveCartesianChartLayout();\n const innerWidth = Math.max(0, viewportWidth - margin.left - margin.right);\n const innerHeight = Math.max(0, viewportHeight - margin.top - margin.bottom);\n\n const allValues = this.series.flatMap(s => s.data);\n const yMax = max(allValues) ?? 0;\n\n const xScale = scalePoint<number>()\n .domain(this.categories.map((_, i) => i))\n .range([0, innerWidth]);\n\n const yScale = scaleLinear()\n .domain([0, yMax || 1])\n .range([innerHeight, 0])\n .nice();\n\n const lineGenerator = lineShape<number>()\n .x((_, i) => xScale(i) ?? 0)\n .y(d => yScale(d));\n\n const yTicks = yScale.ticks(4);\n\n return (\n <Host class=\"chart-line\">\n <svg\n class=\"chart-line__svg\"\n ref={element => {\n this.svgEl = element ?? null;\n }}\n width={viewportWidth}\n height={viewportHeight}\n role=\"img\"\n aria-label={this.series.map(s => s.name).join(', ')}\n >\n <g transform={`translate(${margin.left}, ${margin.top})`}>\n {yTicks.map(tick => (\n <g key={`grid-${tick}`} transform={`translate(0, ${yScale(tick)})`}>\n <line class=\"chart-line__gridline\" x1={0} x2={innerWidth} />\n <text\n class=\"chart-line__axis-label\"\n x={-axisLabelGap}\n text-anchor=\"end\"\n dominant-baseline=\"middle\"\n >\n {tick}\n </text>\n </g>\n ))}\n\n {this.categories.map((label, i) => (\n <text\n key={`x-${label}`}\n class=\"chart-line__axis-label\"\n x={xScale(i) ?? 0}\n y={innerHeight + categoryLabelOffset}\n text-anchor=\"middle\"\n >\n {label}\n </text>\n ))}\n\n {this.series.map((s, si) => {\n const color = s.color ?? categoryColor(si);\n return (\n <g key={s.name}>\n <path class=\"chart-line__path\" d={lineGenerator(s.data) ?? undefined} stroke={color} />\n {this.showPoints &&\n s.data.map((d, i) => (\n <circle\n key={`${s.name}-${i}`}\n class=\"chart-line__point\"\n cx={xScale(i) ?? 0}\n cy={yScale(d)}\n fill={color}\n />\n ))}\n </g>\n );\n })}\n </g>\n </svg>\n </Host>\n );\n }\n}\n",
216
221
  "type": "registry:ui"
217
222
  }
218
223
  ]
@@ -332,7 +332,7 @@
332
332
  },
333
333
  "peerDependencies": {
334
334
  "required": [
335
- "@ds-mo/tokens ^3.1.1",
335
+ "@ds-mo/tokens ^5.0.0",
336
336
  "@ds-mo/icons ^6.4.0"
337
337
  ],
338
338
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -245,7 +245,7 @@
245
245
  },
246
246
  "peerDependencies": {
247
247
  "required": [
248
- "@ds-mo/tokens ^3.1.1",
248
+ "@ds-mo/tokens ^5.0.0",
249
249
  "@ds-mo/icons ^6.4.0"
250
250
  ],
251
251
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -120,7 +120,7 @@
120
120
  },
121
121
  "peerDependencies": {
122
122
  "required": [
123
- "@ds-mo/tokens ^3.1.1",
123
+ "@ds-mo/tokens ^5.0.0",
124
124
  "@ds-mo/icons ^6.4.0"
125
125
  ],
126
126
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -253,7 +253,7 @@
253
253
  },
254
254
  "peerDependencies": {
255
255
  "required": [
256
- "@ds-mo/tokens ^3.1.1",
256
+ "@ds-mo/tokens ^5.0.0",
257
257
  "@ds-mo/icons ^6.4.0"
258
258
  ],
259
259
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -110,7 +110,7 @@
110
110
  },
111
111
  "peerDependencies": {
112
112
  "required": [
113
- "@ds-mo/tokens ^3.1.1",
113
+ "@ds-mo/tokens ^5.0.0",
114
114
  "@ds-mo/icons ^6.4.0"
115
115
  ],
116
116
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -102,7 +102,7 @@
102
102
  },
103
103
  "peerDependencies": {
104
104
  "required": [
105
- "@ds-mo/tokens ^3.1.1",
105
+ "@ds-mo/tokens ^5.0.0",
106
106
  "@ds-mo/icons ^6.4.0"
107
107
  ],
108
108
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -198,7 +198,7 @@
198
198
  },
199
199
  "peerDependencies": {
200
200
  "required": [
201
- "@ds-mo/tokens ^3.1.1",
201
+ "@ds-mo/tokens ^5.0.0",
202
202
  "@ds-mo/icons ^6.4.0"
203
203
  ],
204
204
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -170,7 +170,7 @@
170
170
  },
171
171
  "peerDependencies": {
172
172
  "required": [
173
- "@ds-mo/tokens ^3.1.1",
173
+ "@ds-mo/tokens ^5.0.0",
174
174
  "@ds-mo/icons ^6.4.0"
175
175
  ],
176
176
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -194,7 +194,7 @@
194
194
  },
195
195
  "peerDependencies": {
196
196
  "required": [
197
- "@ds-mo/tokens ^3.1.1",
197
+ "@ds-mo/tokens ^5.0.0",
198
198
  "@ds-mo/icons ^6.4.0"
199
199
  ],
200
200
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -194,7 +194,7 @@
194
194
  },
195
195
  "peerDependencies": {
196
196
  "required": [
197
- "@ds-mo/tokens ^3.1.1",
197
+ "@ds-mo/tokens ^5.0.0",
198
198
  "@ds-mo/icons ^6.4.0"
199
199
  ],
200
200
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -566,7 +566,7 @@
566
566
  },
567
567
  "peerDependencies": {
568
568
  "required": [
569
- "@ds-mo/tokens ^3.1.1",
569
+ "@ds-mo/tokens ^5.0.0",
570
570
  "@ds-mo/icons ^6.4.0"
571
571
  ],
572
572
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -165,7 +165,7 @@
165
165
  },
166
166
  "peerDependencies": {
167
167
  "required": [
168
- "@ds-mo/tokens ^3.1.1",
168
+ "@ds-mo/tokens ^5.0.0",
169
169
  "@ds-mo/icons ^6.4.0"
170
170
  ],
171
171
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -117,7 +117,7 @@
117
117
  },
118
118
  "peerDependencies": {
119
119
  "required": [
120
- "@ds-mo/tokens ^3.1.1",
120
+ "@ds-mo/tokens ^5.0.0",
121
121
  "@ds-mo/icons ^6.4.0"
122
122
  ],
123
123
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -469,7 +469,7 @@
469
469
  "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: anchor, items, sections.",
470
470
  "peerDependencies": {
471
471
  "required": [
472
- "@ds-mo/tokens ^3.1.1",
472
+ "@ds-mo/tokens ^5.0.0",
473
473
  "@ds-mo/icons ^6.4.0"
474
474
  ],
475
475
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -494,7 +494,7 @@
494
494
  },
495
495
  {
496
496
  "path": "src/wc/components/Menu/Menu.tsx",
497
- "content": "import {\n Component,\n Prop,\n State,\n Event,\n EventEmitter,\n Element,\n Watch,\n Listen,\n h,\n Host,\n} from '@stencil/core';\nimport {\n choicePopupMinWidth,\n CONTROL_SUPPORTING_TEXT_VARIANT,\n CONTROL_TEXT_VARIANT,\n resolveChoicePopupAlignOffset,\n resolveCssLengthPx,\n resolveMotionTimeMs,\n TOKEN_CSS_LENGTHS,\n TOKEN_DEFAULTS,\n type ChoicePopupAnchorAlignment,\n type ControlSize,\n} from '../../utils';\nimport { computeMenuPosition, type MenuAlign, type MenuSide } from './menu-position';\nimport type { MenuItemData, MenuSection } from './menu-types';\n\nexport type MenuSelectionMode = 'none' | 'single';\nexport type MenuSize = ControlSize;\nimport {\n isMenuGradientPickerSection,\n isMenuPickerSection,\n isMenuSwatchPickerSection,\n} from './menu-types';\nimport {\n shellGradientPickerSections,\n type ShellGradientPreset,\n} from '../../shell/shell-gradient-presets';\n\n/** rAF retries while the popup mounts or the anchor resolves. */\nconst POSITION_RETRY_BUDGET = 8;\nconst MENU_FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',');\n\nfunction snapshotMenuSections(sections: MenuSection[]): MenuSection[] {\n return sections.map(section => {\n if (isMenuGradientPickerSection(section)) return { ...section };\n if (isMenuSwatchPickerSection(section)) {\n return {\n ...section,\n options: section.options?.map(option => ({ ...option })),\n sections: section.sections?.map(swatchSection => ({\n ...swatchSection,\n options: swatchSection.options.map(option => ({ ...option })),\n })),\n };\n }\n return { ...section, items: section.items.map(item => ({ ...item })) };\n });\n}\n\n@Component({\n tag: 'ds-menu',\n styleUrl: 'Menu.css',\n scoped: true,\n})\nexport class Menu {\n @Element() el!: HTMLElement;\n\n @Prop({ mutable: true }) open: boolean = false;\n @Prop() items: MenuItemData[] = [];\n /** Choice-row density. */\n @Prop() size: MenuSize = 'md';\n /** Give ordinary rows mutually-exclusive menu semantics using isSelected. */\n @Prop() selectionMode: MenuSelectionMode = 'none';\n @Prop() sections: MenuSection[] = [];\n /** Preferred side; placement flips to the opposite side when that offers a better fit. */\n @Prop() side: MenuSide = 'bottom';\n @Prop() align: MenuAlign = 'start';\n /** Align choice-row edges to the anchor by default; use `popup-frame` only for custom frame geometry. */\n @Prop() anchorAlignment: ChoicePopupAnchorAlignment = 'choice-cell';\n /** Gap between anchor and menu — number (px) or TokoMo length (`var(--dimension-space-050)`, etc.). */\n @Prop() sideOffset: number | string = TOKEN_CSS_LENGTHS.space050;\n /** Cross-axis offset — number (px) or TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n @Prop() menuWidth: string | undefined;\n @Prop() minWidth: string | undefined;\n /** External trigger element to position against. Set via JS: menuEl.anchor = buttonEl */\n @Prop() anchor: HTMLElement | undefined;\n /** ID of the external trigger element for positioning */\n @Prop() anchorId: string | undefined;\n /** Show a visible ring on the initially focused menu item. Use only when the opener was keyboard-driven. */\n @Prop() initialFocusVisible: boolean = false;\n /** Accessible name for the popup menu. */\n @Prop() menuLabel: string = 'Menu';\n\n @State() private shouldRender: boolean = false;\n @State() private closing: boolean = false;\n @State() private pos: { x: number; y: number } = { x: 0, y: 0 };\n @State() private focusedIndex: number = 0;\n @State() private positionReady: boolean = false;\n @State() private focusRingVisible: boolean = false;\n\n @Event() dsClose!: EventEmitter<void>;\n /** Emitted after the popup's exit motion is complete and its rendered content is removed. */\n @Event() dsAfterClose!: EventEmitter<void>;\n @Event() dsSelect!: EventEmitter<MenuItemData>;\n /** Emitted when a `gradient-picker` section swatch is chosen. */\n @Event() dsGradientSelect!: EventEmitter<ShellGradientPreset>;\n /** Emitted when a generic `swatch-picker` section option is chosen. */\n @Event() dsSwatchSelect!: EventEmitter<string>;\n\n private clickOutsideHandler: ((e: MouseEvent) => void) | null = null;\n private scrollResizeHandler: (() => void) | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private positionRetryRaf: number | null = null;\n private livePositionRaf: number | null = null;\n /** Last content actually painted while open; retained unchanged through exit motion. */\n private lastRenderedSections: MenuSection[] = [];\n private closingSections: MenuSection[] | null = null;\n\n componentDidLoad() {\n if (this.open) this.onOpenChange(true);\n }\n\n componentDidRender() {\n if (!this.shouldRender) return;\n const popup = this.el.querySelector<HTMLElement>('.menu-popup');\n if (!popup || typeof popup.showPopover !== 'function') return;\n if (!popup.matches(':popover-open')) popup.showPopover();\n }\n\n disconnectedCallback() {\n this.cancelPositionRetry();\n this.cancelLivePositionUpdate();\n this.teardownListeners();\n }\n\n @Watch('open')\n onOpenChange(isOpen: boolean) {\n if (isOpen) {\n this.teardownListeners();\n this.closingSections = null;\n this.shouldRender = true;\n this.closing = false;\n this.positionReady = false;\n this.focusRingVisible = this.initialFocusVisible;\n this.setupListeners();\n this.schedulePositionUpdate(() => {\n this.focusInitialItem();\n });\n } else if (this.shouldRender) {\n this.cancelPositionRetry();\n this.captureClosingSections();\n this.closing = true;\n this.teardownListeners();\n const closeAnimationMs = this.closeAnimationMs;\n if (closeAnimationMs <= 0) {\n this.finishClose();\n return;\n }\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null;\n this.finishClose();\n }, closeAnimationMs);\n }\n }\n\n @Watch('anchor')\n @Watch('anchorId')\n onAnchorChange() {\n if (this.open) this.schedulePositionUpdate();\n }\n\n @Watch('side')\n @Watch('align')\n @Watch('anchorAlignment')\n @Watch('sideOffset')\n @Watch('alignOffset')\n onPositionPropsChange() {\n if (this.open) this.schedulePositionUpdate();\n }\n\n private get viewportPadPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get sideOffsetPx(): number {\n return resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050);\n }\n\n private get alignOffsetPx(): number {\n return resolveCssLengthPx(this.alignOffset, 0);\n }\n\n private get popupFallbackWidthPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuWidthXs, TOKEN_DEFAULTS.menuWidthXs);\n }\n\n private get popupFallbackHeightPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuFallbackHeight, TOKEN_DEFAULTS.menuFallbackHeight);\n }\n\n private get closeAnimationMs(): number {\n return resolveMotionTimeMs(TOKEN_DEFAULTS.motionShort2, TOKEN_DEFAULTS.animationDurationShort3);\n }\n\n private finishClose() {\n const popup = this.el.querySelector<HTMLElement>('.menu-popup');\n if (popup?.matches(':popover-open')) popup.hidePopover();\n this.shouldRender = false;\n this.closing = false;\n this.lastRenderedSections = [];\n this.closingSections = null;\n this.dsAfterClose.emit();\n }\n\n private captureClosingSections() {\n if (this.closingSections) return;\n const visibleSections = this.lastRenderedSections.length\n ? this.lastRenderedSections\n : this.activeSections;\n this.closingSections = snapshotMenuSections(visibleSections);\n }\n\n private get resolvedAnchor(): HTMLElement | null {\n if (this.anchor) return this.anchor;\n if (this.anchorId) return document.getElementById(this.anchorId);\n return null;\n }\n\n private get anchorFocusTarget(): HTMLElement | null {\n const anchor = this.resolvedAnchor;\n if (!anchor) return null;\n if (anchor.matches(MENU_FOCUSABLE_SELECTOR)) return anchor;\n return anchor.querySelector<HTMLElement>(MENU_FOCUSABLE_SELECTOR) ?? anchor;\n }\n\n private focusAnchor() {\n const anchor = this.resolvedAnchor as\n | (HTMLElement & { setFocus?: () => Promise<void> | void })\n | null;\n if (anchor?.setFocus) {\n anchor.setFocus();\n return;\n }\n this.anchorFocusTarget?.focus();\n }\n\n private moveFocusAfterTab(backwards: boolean) {\n const anchor = this.anchorFocusTarget;\n if (!anchor) return;\n if (backwards) {\n anchor.focus();\n return;\n }\n\n const candidates = Array.from(\n document.querySelectorAll<HTMLElement>(MENU_FOCUSABLE_SELECTOR)\n ).filter(\n element =>\n !element.closest('.menu-popup') &&\n !element.closest('[inert]') &&\n element.getClientRects().length > 0\n );\n const index = candidates.indexOf(anchor);\n (candidates[index + 1] ?? anchor).focus();\n }\n\n private compositeTabLeavesPopup(event: KeyboardEvent): boolean {\n const popup = this.el.querySelector<HTMLElement>('.menu-popup');\n if (!popup) return true;\n const focusables = Array.from(\n popup.querySelectorAll<HTMLElement>(MENU_FOCUSABLE_SELECTOR)\n ).filter(element => element.getClientRects().length > 0);\n const currentIndex = focusables.indexOf(event.target as HTMLElement);\n if (currentIndex < 0) return true;\n return event.shiftKey ? currentIndex === 0 : currentIndex === focusables.length - 1;\n }\n\n private get activeSections(): MenuSection[] {\n if (this.sections.length > 0) return this.sections;\n if (this.items.length > 0) return [{ items: this.items }];\n return [];\n }\n\n private get flatItems(): MenuItemData[] {\n return this.activeSections.flatMap(section =>\n isMenuPickerSection(section) ? [] : section.items\n );\n }\n\n /** Rich preference content is a non-modal dialog, not an ARIA action menu. */\n private get hasCompositeSections(): boolean {\n return this.activeSections.some(isMenuPickerSection);\n }\n\n private cancelPositionRetry() {\n if (this.positionRetryRaf !== null) {\n cancelAnimationFrame(this.positionRetryRaf);\n this.positionRetryRaf = null;\n }\n }\n\n private cancelLivePositionUpdate() {\n if (this.livePositionRaf !== null) {\n cancelAnimationFrame(this.livePositionRaf);\n this.livePositionRaf = null;\n }\n }\n\n /** Reposition after the current scroll/layout frame without hiding the open popup. */\n private scheduleLivePositionUpdate() {\n if (this.livePositionRaf !== null) return;\n this.livePositionRaf = requestAnimationFrame(() => {\n if (this.shouldRender && !this.closing) this.calculatePosition();\n // Scroll-driven owners such as ShellPage may commit their compact header\n // render in this frame. Re-read once after that render, then stop tracking.\n this.livePositionRaf = requestAnimationFrame(() => {\n this.livePositionRaf = null;\n if (this.shouldRender && !this.closing) this.calculatePosition();\n });\n });\n }\n\n /** Retry until anchor + popup exist — do not reveal at 0,0 on a failed first pass. */\n private schedulePositionUpdate(onReady?: () => void) {\n if (!this.open) return;\n\n this.cancelPositionRetry();\n this.positionReady = false;\n\n let remaining = POSITION_RETRY_BUDGET;\n\n const attempt = () => {\n this.positionRetryRaf = null;\n if (!this.open) return;\n\n if (this.calculatePosition()) {\n this.positionReady = true;\n onReady?.();\n return;\n }\n\n if (remaining > 0) {\n remaining -= 1;\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n };\n\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n\n /** @returns `true` when anchor and popup were found and `pos` was updated. */\n private calculatePosition(): boolean {\n const anchorEl = this.resolvedAnchor;\n if (!anchorEl) return false;\n const popup = this.el.querySelector('.menu-popup') as HTMLElement | null;\n if (!popup) return false;\n\n const anchorRect = anchorEl.getBoundingClientRect();\n const sectionInsetPx = this.viewportPadPx;\n if (!this.minWidth) {\n if (\n this.anchorAlignment === 'choice-cell' &&\n (this.side === 'top' || this.side === 'bottom')\n ) {\n popup.style.minWidth = `max(var(--dimension-menu-width-xs), ${choicePopupMinWidth(\n anchorRect.width,\n sectionInsetPx\n )}px)`;\n } else {\n popup.style.removeProperty('min-width');\n }\n }\n\n const next = computeMenuPosition({\n anchorRect,\n popupWidth: popup.offsetWidth || this.popupFallbackWidthPx,\n popupHeight: popup.offsetHeight || this.popupFallbackHeightPx,\n side: this.side,\n align: this.align,\n sideOffsetPx: this.sideOffsetPx,\n alignOffsetPx: resolveChoicePopupAlignOffset({\n align: this.align,\n alignOffsetPx: this.alignOffsetPx,\n sectionInsetPx,\n anchorAlignment: this.anchorAlignment,\n }),\n viewportPadPx: this.viewportPadPx,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n });\n if (next.x !== this.pos.x || next.y !== this.pos.y) this.pos = next;\n return true;\n }\n\n /** Focus the selected item when present, otherwise the first enabled item. */\n private focusInitialItem() {\n if (this.hasCompositeSections) {\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>('.menu-popup [tabindex=\"0\"]')?.focus();\n });\n return;\n }\n\n const flat = this.flatItems;\n const selectedIdx = flat.findIndex(it => it.isSelected && !it.isInactive);\n const firstEnabledIdx = flat.findIndex(it => !it.isInactive);\n this.focusedIndex = selectedIdx >= 0 ? selectedIdx : firstEnabledIdx >= 0 ? firstEnabledIdx : 0;\n\n requestAnimationFrame(() => {\n const btns = this.el.querySelectorAll<HTMLElement>('.menu-item');\n btns[this.focusedIndex]?.focus();\n });\n }\n\n private setupListeners() {\n this.clickOutsideHandler = (e: MouseEvent) => {\n const t = e.target as Node;\n const popup = this.el.querySelector('.menu-popup');\n const anchorEl = this.resolvedAnchor;\n if (popup?.contains(t) || anchorEl?.contains(t)) return;\n this.close();\n };\n\n this.scrollResizeHandler = () => this.scheduleLivePositionUpdate();\n\n document.addEventListener('mousedown', this.clickOutsideHandler, true);\n window.addEventListener('scroll', this.scrollResizeHandler, true);\n window.addEventListener('resize', this.scrollResizeHandler);\n }\n\n private teardownListeners() {\n this.cancelLivePositionUpdate();\n if (this.clickOutsideHandler) {\n document.removeEventListener('mousedown', this.clickOutsideHandler, true);\n this.clickOutsideHandler = null;\n }\n if (this.scrollResizeHandler) {\n window.removeEventListener('scroll', this.scrollResizeHandler, true);\n window.removeEventListener('resize', this.scrollResizeHandler);\n this.scrollResizeHandler = null;\n }\n if (this.closeTimer) {\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n }\n\n private close(restoreFocus = true) {\n this.captureClosingSections();\n if (restoreFocus) this.focusAnchor();\n this.dsClose.emit();\n this.open = false;\n this.onOpenChange(false);\n }\n\n @Listen('keydown')\n handleKeyDown(e: KeyboardEvent) {\n if (!this.shouldRender || this.closing) return;\n\n if (e.key === 'Escape') {\n e.preventDefault();\n this.close();\n return;\n }\n\n if (e.key === 'Tab') {\n if (this.hasCompositeSections && !this.compositeTabLeavesPopup(e)) return;\n e.preventDefault();\n this.close(false);\n this.moveFocusAfterTab(e.shiftKey);\n return;\n }\n\n if (this.hasCompositeSections) return;\n\n const flat = this.flatItems;\n const enabled = flat\n .map((it, i) => ({ it, i }))\n .filter(({ it }) => !it.isInactive)\n .map(({ i }) => i);\n if (!enabled.length) return;\n\n const cur = enabled.indexOf(this.focusedIndex);\n const safe = cur < 0 ? 0 : cur;\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[(safe + 1) % enabled.length];\n this.focusItem(this.focusedIndex);\n break;\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[(safe - 1 + enabled.length) % enabled.length];\n this.focusItem(this.focusedIndex);\n break;\n case 'Home':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[0];\n this.focusItem(this.focusedIndex);\n break;\n case 'End':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[enabled.length - 1];\n this.focusItem(this.focusedIndex);\n break;\n }\n }\n\n private focusItem(idx: number) {\n const btns = this.el.querySelectorAll<HTMLElement>('.menu-item');\n btns[idx]?.focus();\n }\n\n private handleItemClick(item: MenuItemData) {\n if (item.isInactive) return;\n // Consumers commonly change the item source while handling selection.\n // Capture first so the exit animation never paints the next menu context.\n this.captureClosingSections();\n this.dsSelect.emit(item);\n }\n\n private handleGradientSelect(preset: ShellGradientPreset) {\n this.dsGradientSelect.emit(preset);\n }\n\n private handleSwatchSelect(value: string) {\n this.dsSwatchSelect.emit(value);\n }\n\n render() {\n if (!this.shouldRender) return <Host style={{ display: 'contents' }} />;\n\n const sections = this.closing\n ? (this.closingSections ?? this.lastRenderedSections)\n : this.activeSections;\n const hasCompositeSections = sections.some(isMenuPickerSection);\n if (!this.closing) {\n this.lastRenderedSections = snapshotMenuSections(sections);\n this.closingSections = null;\n }\n let flatIdx = 0;\n\n const popupStyle: Record<string, string> = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.pos.x)}px, ${Math.round(this.pos.y)}px)`,\n zIndex: '9998',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n\n if (this.menuWidth) popupStyle['width'] = this.menuWidth;\n if (this.minWidth) popupStyle['min-width'] = this.minWidth;\n\n return (\n <Host style={{ display: 'contents' }}>\n <div\n popover=\"manual\"\n class={{\n 'menu-popup': true,\n 'menu-popup--closing': this.closing,\n 'ds-choice-popup': true,\n 'ds-choice-popup--closing': this.closing,\n }}\n style={popupStyle}\n role={hasCompositeSections ? 'dialog' : 'menu'}\n aria-label={this.menuLabel}\n aria-orientation={hasCompositeSections ? undefined : 'vertical'}\n >\n <div class=\"ds-choice-list\">\n {sections.map((section, si) => (\n <div\n key={si}\n class={{\n 'menu-section': true,\n 'menu-section--divided': si < sections.length - 1,\n 'menu-section--gradient-picker': isMenuPickerSection(section),\n 'ds-choice-section': true,\n 'ds-chrome-column': true,\n 'ds-chrome-space--sm': true,\n 'ds-choice-section--divided': si < sections.length - 1,\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <ds-text\n class={`section-header ds-choice-section__header ds-control--${this.size}`}\n as=\"span\"\n variant={CONTROL_SUPPORTING_TEXT_VARIANT[this.size]}\n emphasis\n color=\"primary\"\n aria-hidden=\"true\"\n >\n {section.header}\n </ds-text>\n )}\n {isMenuGradientPickerSection(section) ? (\n <ds-swatch-picker\n value={section.value}\n groupLabel={section.header ?? 'Shell gradient theme'}\n sections={shellGradientPickerSections()}\n onDsChange={(e: CustomEvent<string>) => {\n e.stopPropagation();\n this.handleGradientSelect(e.detail as ShellGradientPreset);\n }}\n />\n ) : isMenuSwatchPickerSection(section) ? (\n <ds-swatch-picker\n value={section.value}\n groupLabel={section.groupLabel ?? section.header ?? 'Swatch options'}\n options={section.options ?? []}\n sections={section.sections ?? []}\n onDsChange={(e: CustomEvent<string>) => {\n e.stopPropagation();\n this.handleSwatchSelect(e.detail);\n }}\n />\n ) : (\n section.items.map(item => {\n const idx = flatIdx++;\n const isFocused = this.focusedIndex === idx;\n const isSingleSelectionItem =\n !hasCompositeSections &&\n this.selectionMode === 'single' &&\n !item.showSwitch;\n return (\n <button\n key={idx}\n type=\"button\"\n class={{\n 'menu-item': true,\n 'ds-choice-item': true,\n 'ds-control-frame': true,\n [`ds-control--${this.size}`]: true,\n 'ds-focus-ring-inset': true,\n 'ds-focus-ring--visible': isFocused && this.focusRingVisible,\n 'ds-interaction-fill': !item.isInactive,\n 'ds-interaction-fill--selected': !!item.isSelected && !item.isInactive,\n 'menu-item--selected': !!item.isSelected,\n 'ds-control-inactive': !!item.isInactive,\n 'menu-item--destructive': !!item.isDestructive,\n 'menu-item--focused': isFocused,\n }}\n role={\n hasCompositeSections\n ? undefined\n : item.showSwitch\n ? 'menuitemcheckbox'\n : isSingleSelectionItem\n ? 'menuitemradio'\n : 'menuitem'\n }\n aria-checked={\n !hasCompositeSections && item.showSwitch\n ? String(!!item.switchValue)\n : isSingleSelectionItem\n ? String(!!item.isSelected)\n : undefined\n }\n aria-pressed={\n hasCompositeSections\n ? String(item.showSwitch ? !!item.switchValue : !!item.isSelected)\n : undefined\n }\n aria-current={\n !hasCompositeSections &&\n !item.showSwitch &&\n !isSingleSelectionItem &&\n item.isSelected\n ? 'true'\n : undefined\n }\n disabled={item.isInactive}\n tabIndex={hasCompositeSections ? 0 : isFocused ? 0 : -1}\n onMouseDown={() => {\n this.focusRingVisible = false;\n }}\n onClick={() => this.handleItemClick(item)}\n onFocus={() => {\n this.focusedIndex = idx;\n }}\n >\n <div class=\"menu-item__content ds-choice-item__content ds-interaction-fill__content\">\n <ds-text\n class=\"menu-item__label ds-choice-item__label ds-control-label-box\"\n as=\"span\"\n variant={CONTROL_TEXT_VARIANT[this.size]}\n color={item.isSelected ? 'primary' : 'secondary'}\n >\n {item.label}\n </ds-text>\n {item.subtext && (\n <ds-text\n class=\"menu-item__subtext ds-choice-item__subtext ds-control-label-box\"\n as=\"span\"\n variant={CONTROL_SUPPORTING_TEXT_VARIANT[this.size]}\n color=\"secondary\"\n >\n {item.subtext}\n </ds-text>\n )}\n </div>\n {item.dot && (\n <span\n class=\"menu-item__dot-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-badge\n class=\"menu-item__dot\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n />\n </span>\n )}\n {item.showSwitch && (\n <ds-switch\n class=\"menu-item__switch ds-interaction-fill__content\"\n size={this.size}\n checked={!!item.switchValue}\n presentation\n />\n )}\n </button>\n );\n })\n )}\n </div>\n ))}\n </div>\n </div>\n </Host>\n );\n }\n}\n",
497
+ "content": "import {\n Component,\n Prop,\n State,\n Event,\n EventEmitter,\n Element,\n Watch,\n Listen,\n h,\n Host,\n} from '@stencil/core';\nimport {\n choicePopupMinWidth,\n CONTROL_SUPPORTING_TEXT_VARIANT,\n CONTROL_TEXT_VARIANT,\n resolveChoicePopupAlignOffset,\n resolveCssLengthPx,\n resolveMotionTimeMs,\n TOKEN_CSS_LENGTHS,\n TOKEN_DEFAULTS,\n type ChoicePopupAnchorAlignment,\n type ControlSize,\n} from '../../utils';\nimport { AnchoredPositionController } from '../../utils/anchored-position-controller';\nimport type { MenuAlign, MenuSide } from './menu-position';\nimport type { MenuItemData, MenuSection } from './menu-types';\n\nexport type MenuSelectionMode = 'none' | 'single';\nexport type MenuSize = ControlSize;\nimport {\n isMenuGradientPickerSection,\n isMenuPickerSection,\n isMenuSwatchPickerSection,\n} from './menu-types';\nimport {\n shellGradientPickerSections,\n type ShellGradientPreset,\n} from '../../shell/shell-gradient-presets';\n\nconst MENU_FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',');\n\nfunction snapshotMenuSections(sections: MenuSection[]): MenuSection[] {\n return sections.map(section => {\n if (isMenuGradientPickerSection(section)) return { ...section };\n if (isMenuSwatchPickerSection(section)) {\n return {\n ...section,\n options: section.options?.map(option => ({ ...option })),\n sections: section.sections?.map(swatchSection => ({\n ...swatchSection,\n options: swatchSection.options.map(option => ({ ...option })),\n })),\n };\n }\n return { ...section, items: section.items.map(item => ({ ...item })) };\n });\n}\n\n@Component({\n tag: 'ds-menu',\n styleUrl: 'Menu.css',\n scoped: true,\n})\nexport class Menu {\n @Element() el!: HTMLElement;\n\n @Prop({ mutable: true }) open: boolean = false;\n @Prop() items: MenuItemData[] = [];\n /** Choice-row density. */\n @Prop() size: MenuSize = 'md';\n /** Give ordinary rows mutually-exclusive menu semantics using isSelected. */\n @Prop() selectionMode: MenuSelectionMode = 'none';\n @Prop() sections: MenuSection[] = [];\n /** Preferred side; placement flips to the opposite side when that offers a better fit. */\n @Prop() side: MenuSide = 'bottom';\n @Prop() align: MenuAlign = 'start';\n /** Align choice-row edges to the anchor by default; use `popup-frame` only for custom frame geometry. */\n @Prop() anchorAlignment: ChoicePopupAnchorAlignment = 'choice-cell';\n /** Gap between anchor and menu — number (px) or TokoMo length (`var(--dimension-space-050)`, etc.). */\n @Prop() sideOffset: number | string = TOKEN_CSS_LENGTHS.space050;\n /** Cross-axis offset — number (px) or TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n @Prop() menuWidth: string | undefined;\n @Prop() minWidth: string | undefined;\n /** External trigger element to position against. Set via JS: menuEl.anchor = buttonEl */\n @Prop() anchor: HTMLElement | undefined;\n /** ID of the external trigger element for positioning */\n @Prop() anchorId: string | undefined;\n /** Show a visible ring on the initially focused menu item. Use only when the opener was keyboard-driven. */\n @Prop() initialFocusVisible: boolean = false;\n /** Accessible name for the popup menu. */\n @Prop() menuLabel: string = 'Menu';\n\n @State() private shouldRender: boolean = false;\n @State() private closing: boolean = false;\n @State() private pos: { x: number; y: number } = { x: 0, y: 0 };\n @State() private focusedIndex: number = 0;\n @State() private positionReady: boolean = false;\n @State() private focusRingVisible: boolean = false;\n\n @Event() dsClose!: EventEmitter<void>;\n /** Emitted after the popup's exit motion is complete and its rendered content is removed. */\n @Event() dsAfterClose!: EventEmitter<void>;\n @Event() dsSelect!: EventEmitter<MenuItemData>;\n /** Emitted when a `gradient-picker` section swatch is chosen. */\n @Event() dsGradientSelect!: EventEmitter<ShellGradientPreset>;\n /** Emitted when a generic `swatch-picker` section option is chosen. */\n @Event() dsSwatchSelect!: EventEmitter<string>;\n\n private clickOutsideHandler: ((e: MouseEvent) => void) | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n /**\n * Anchored placement. The choice-cell measurement stays here on purpose: the\n * inner-cell align offset and the `--dimension-menu-width-xs` floor are Menu\n * semantics, not shared geometry.\n */\n private readonly position = new AnchoredPositionController({\n getAnchor: () => this.resolvedAnchor ?? null,\n getPopup: () => this.el.querySelector<HTMLElement>('.menu-popup'),\n measure: (anchorEl, popup) => {\n if (!this.open) return null;\n\n const anchorRect = anchorEl.getBoundingClientRect();\n const sectionInsetPx = this.viewportPadPx;\n if (!this.minWidth) {\n if (\n this.anchorAlignment === 'choice-cell' &&\n (this.side === 'top' || this.side === 'bottom')\n ) {\n popup.style.minWidth = `max(var(--dimension-menu-width-xs), ${choicePopupMinWidth(\n anchorRect.width,\n sectionInsetPx\n )}px)`;\n } else {\n popup.style.removeProperty('min-width');\n }\n }\n\n return {\n anchorRect,\n popupWidth: popup.offsetWidth || this.popupFallbackWidthPx,\n popupHeight: popup.offsetHeight || this.popupFallbackHeightPx,\n side: this.side,\n align: this.align,\n sideOffsetPx: this.sideOffsetPx,\n alignOffsetPx: resolveChoicePopupAlignOffset({\n align: this.align,\n alignOffsetPx: this.alignOffsetPx,\n sectionInsetPx,\n anchorAlignment: this.anchorAlignment,\n }),\n viewportPadPx: this.viewportPadPx,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n };\n },\n apply: ({ x, y }) => {\n this.pos = { x, y };\n },\n onReady: () => {\n this.positionReady = true;\n },\n liveUpdate: 'double-frame',\n topLayer: true,\n });\n /** Last content actually painted while open; retained unchanged through exit motion. */\n private lastRenderedSections: MenuSection[] = [];\n private closingSections: MenuSection[] | null = null;\n\n componentDidLoad() {\n if (this.open) this.onOpenChange(true);\n }\n\n disconnectedCallback() {\n this.cancelPositionRetry();\n this.cancelLivePositionUpdate();\n this.teardownListeners();\n }\n\n @Watch('open')\n onOpenChange(isOpen: boolean) {\n if (isOpen) {\n this.teardownListeners();\n this.closingSections = null;\n this.shouldRender = true;\n this.closing = false;\n this.positionReady = false;\n this.focusRingVisible = this.initialFocusVisible;\n this.setupListeners();\n this.schedulePositionUpdate(() => {\n this.focusInitialItem();\n });\n } else if (this.shouldRender) {\n this.cancelPositionRetry();\n this.captureClosingSections();\n this.closing = true;\n this.teardownListeners();\n const closeAnimationMs = this.closeAnimationMs;\n if (closeAnimationMs <= 0) {\n this.finishClose();\n return;\n }\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null;\n this.finishClose();\n }, closeAnimationMs);\n }\n }\n\n @Watch('anchor')\n @Watch('anchorId')\n onAnchorChange() {\n if (this.open) this.schedulePositionUpdate();\n }\n\n @Watch('side')\n @Watch('align')\n @Watch('anchorAlignment')\n @Watch('sideOffset')\n @Watch('alignOffset')\n onPositionPropsChange() {\n if (this.open) this.schedulePositionUpdate();\n }\n\n private get viewportPadPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get sideOffsetPx(): number {\n return resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050);\n }\n\n private get alignOffsetPx(): number {\n return resolveCssLengthPx(this.alignOffset, 0);\n }\n\n private get popupFallbackWidthPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuWidthXs, TOKEN_DEFAULTS.menuWidthXs);\n }\n\n private get popupFallbackHeightPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuFallbackHeight, TOKEN_DEFAULTS.menuFallbackHeight);\n }\n\n private get closeAnimationMs(): number {\n return resolveMotionTimeMs(TOKEN_DEFAULTS.motionShort2, TOKEN_DEFAULTS.animationDurationShort3);\n }\n\n private finishClose() {\n const popup = this.el.querySelector<HTMLElement>('.menu-popup');\n if (popup?.matches(':popover-open')) popup.hidePopover();\n this.shouldRender = false;\n this.closing = false;\n this.lastRenderedSections = [];\n this.closingSections = null;\n this.dsAfterClose.emit();\n }\n\n private captureClosingSections() {\n if (this.closingSections) return;\n const visibleSections = this.lastRenderedSections.length\n ? this.lastRenderedSections\n : this.activeSections;\n this.closingSections = snapshotMenuSections(visibleSections);\n }\n\n private get resolvedAnchor(): HTMLElement | null {\n if (this.anchor) return this.anchor;\n if (this.anchorId) return document.getElementById(this.anchorId);\n return null;\n }\n\n private get anchorFocusTarget(): HTMLElement | null {\n const anchor = this.resolvedAnchor;\n if (!anchor) return null;\n if (anchor.matches(MENU_FOCUSABLE_SELECTOR)) return anchor;\n return anchor.querySelector<HTMLElement>(MENU_FOCUSABLE_SELECTOR) ?? anchor;\n }\n\n private focusAnchor() {\n const anchor = this.resolvedAnchor as\n (HTMLElement & { setFocus?: () => Promise<void> | void }) | null;\n if (anchor?.setFocus) {\n anchor.setFocus();\n return;\n }\n this.anchorFocusTarget?.focus();\n }\n\n private moveFocusAfterTab(backwards: boolean) {\n const anchor = this.anchorFocusTarget;\n if (!anchor) return;\n if (backwards) {\n anchor.focus();\n return;\n }\n\n const candidates = Array.from(\n document.querySelectorAll<HTMLElement>(MENU_FOCUSABLE_SELECTOR)\n ).filter(\n element =>\n !element.closest('.menu-popup') &&\n !element.closest('[inert]') &&\n element.getClientRects().length > 0\n );\n const index = candidates.indexOf(anchor);\n (candidates[index + 1] ?? anchor).focus();\n }\n\n private compositeTabLeavesPopup(event: KeyboardEvent): boolean {\n const popup = this.el.querySelector<HTMLElement>('.menu-popup');\n if (!popup) return true;\n const focusables = Array.from(\n popup.querySelectorAll<HTMLElement>(MENU_FOCUSABLE_SELECTOR)\n ).filter(element => element.getClientRects().length > 0);\n const currentIndex = focusables.indexOf(event.target as HTMLElement);\n if (currentIndex < 0) return true;\n return event.shiftKey ? currentIndex === 0 : currentIndex === focusables.length - 1;\n }\n\n private get activeSections(): MenuSection[] {\n if (this.sections.length > 0) return this.sections;\n if (this.items.length > 0) return [{ items: this.items }];\n return [];\n }\n\n private get flatItems(): MenuItemData[] {\n return this.activeSections.flatMap(section =>\n isMenuPickerSection(section) ? [] : section.items\n );\n }\n\n /** Rich preference content is a non-modal dialog, not an ARIA action menu. */\n private get hasCompositeSections(): boolean {\n return this.activeSections.some(isMenuPickerSection);\n }\n\n private cancelPositionRetry() {\n this.position.cancel();\n }\n\n private cancelLivePositionUpdate() {\n this.position.cancel();\n }\n\n /** Reposition after the current scroll/layout frame without hiding the open popup. */\n private scheduleLivePositionUpdate() {\n this.position.scheduleLiveUpdate();\n }\n\n /** Retry until anchor + popup exist — do not reveal at 0,0 on a failed first pass. */\n private schedulePositionUpdate(onReady?: () => void) {\n if (!this.open) return;\n this.positionReady = false;\n this.position.schedule(onReady);\n }\n\n /** @returns `true` when anchor and popup were found and `pos` was updated. */\n private calculatePosition(): boolean {\n return this.position.update();\n }\n\n /** Focus the selected item when present, otherwise the first enabled item. */\n private focusInitialItem() {\n if (this.hasCompositeSections) {\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>('.menu-popup [tabindex=\"0\"]')?.focus();\n });\n return;\n }\n\n const flat = this.flatItems;\n const selectedIdx = flat.findIndex(it => it.isSelected && !it.isInactive);\n const firstEnabledIdx = flat.findIndex(it => !it.isInactive);\n this.focusedIndex = selectedIdx >= 0 ? selectedIdx : firstEnabledIdx >= 0 ? firstEnabledIdx : 0;\n\n requestAnimationFrame(() => {\n const btns = this.el.querySelectorAll<HTMLElement>('.menu-item');\n btns[this.focusedIndex]?.focus();\n });\n }\n\n private setupListeners() {\n this.clickOutsideHandler = (e: MouseEvent) => {\n const t = e.target as Node;\n const popup = this.el.querySelector('.menu-popup');\n const anchorEl = this.resolvedAnchor;\n if (popup?.contains(t) || anchorEl?.contains(t)) return;\n this.close();\n };\n\n document.addEventListener('mousedown', this.clickOutsideHandler, true);\n this.position.observe();\n }\n\n private teardownListeners() {\n this.position.unobserve();\n if (this.clickOutsideHandler) {\n document.removeEventListener('mousedown', this.clickOutsideHandler, true);\n this.clickOutsideHandler = null;\n }\n if (this.closeTimer) {\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n }\n\n private close(restoreFocus = true) {\n this.captureClosingSections();\n if (restoreFocus) this.focusAnchor();\n this.dsClose.emit();\n this.open = false;\n this.onOpenChange(false);\n }\n\n @Listen('keydown')\n handleKeyDown(e: KeyboardEvent) {\n if (!this.shouldRender || this.closing) return;\n\n if (e.key === 'Escape') {\n e.preventDefault();\n this.close();\n return;\n }\n\n if (e.key === 'Tab') {\n if (this.hasCompositeSections && !this.compositeTabLeavesPopup(e)) return;\n e.preventDefault();\n this.close(false);\n this.moveFocusAfterTab(e.shiftKey);\n return;\n }\n\n if (this.hasCompositeSections) return;\n\n const flat = this.flatItems;\n const enabled = flat\n .map((it, i) => ({ it, i }))\n .filter(({ it }) => !it.isInactive)\n .map(({ i }) => i);\n if (!enabled.length) return;\n\n const cur = enabled.indexOf(this.focusedIndex);\n const safe = cur < 0 ? 0 : cur;\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[(safe + 1) % enabled.length];\n this.focusItem(this.focusedIndex);\n break;\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[(safe - 1 + enabled.length) % enabled.length];\n this.focusItem(this.focusedIndex);\n break;\n case 'Home':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[0];\n this.focusItem(this.focusedIndex);\n break;\n case 'End':\n e.preventDefault();\n e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[enabled.length - 1];\n this.focusItem(this.focusedIndex);\n break;\n }\n }\n\n private focusItem(idx: number) {\n const btns = this.el.querySelectorAll<HTMLElement>('.menu-item');\n btns[idx]?.focus();\n }\n\n private handleItemClick(item: MenuItemData) {\n if (item.isInactive) return;\n // Consumers commonly change the item source while handling selection.\n // Capture first so the exit animation never paints the next menu context.\n this.captureClosingSections();\n this.dsSelect.emit(item);\n }\n\n private handleGradientSelect(preset: ShellGradientPreset) {\n this.dsGradientSelect.emit(preset);\n }\n\n private handleSwatchSelect(value: string) {\n this.dsSwatchSelect.emit(value);\n }\n\n render() {\n if (!this.shouldRender) return <Host style={{ display: 'contents' }} />;\n\n const sections = this.closing\n ? (this.closingSections ?? this.lastRenderedSections)\n : this.activeSections;\n const hasCompositeSections = sections.some(isMenuPickerSection);\n if (!this.closing) {\n this.lastRenderedSections = snapshotMenuSections(sections);\n this.closingSections = null;\n }\n let flatIdx = 0;\n\n const popupStyle: Record<string, string> = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.pos.x)}px, ${Math.round(this.pos.y)}px)`,\n zIndex: '9998',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n\n if (this.menuWidth) popupStyle['width'] = this.menuWidth;\n if (this.minWidth) popupStyle['min-width'] = this.minWidth;\n\n return (\n <Host style={{ display: 'contents' }}>\n <div\n popover=\"manual\"\n class={{\n 'menu-popup': true,\n 'menu-popup--closing': this.closing,\n 'ds-choice-popup': true,\n 'ds-choice-popup--closing': this.closing,\n }}\n style={popupStyle}\n role={hasCompositeSections ? 'dialog' : 'menu'}\n aria-label={this.menuLabel}\n aria-orientation={hasCompositeSections ? undefined : 'vertical'}\n >\n <div class=\"ds-choice-list\">\n {sections.map((section, si) => (\n <div\n key={si}\n class={{\n 'menu-section': true,\n 'menu-section--divided': si < sections.length - 1,\n 'menu-section--gradient-picker': isMenuPickerSection(section),\n 'ds-choice-section': true,\n 'ds-chrome-column': true,\n 'ds-chrome-space--sm': true,\n 'ds-choice-section--divided': si < sections.length - 1,\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <ds-text\n class={`section-header ds-choice-section__header ds-control--${this.size}`}\n as=\"span\"\n variant={CONTROL_SUPPORTING_TEXT_VARIANT[this.size]}\n emphasis\n color=\"primary\"\n aria-hidden=\"true\"\n >\n {section.header}\n </ds-text>\n )}\n {isMenuGradientPickerSection(section) ? (\n <ds-swatch-picker\n value={section.value}\n groupLabel={section.header ?? 'Shell gradient theme'}\n sections={shellGradientPickerSections()}\n onDsChange={(e: CustomEvent<string>) => {\n e.stopPropagation();\n this.handleGradientSelect(e.detail as ShellGradientPreset);\n }}\n />\n ) : isMenuSwatchPickerSection(section) ? (\n <ds-swatch-picker\n value={section.value}\n groupLabel={section.groupLabel ?? section.header ?? 'Swatch options'}\n options={section.options ?? []}\n sections={section.sections ?? []}\n onDsChange={(e: CustomEvent<string>) => {\n e.stopPropagation();\n this.handleSwatchSelect(e.detail);\n }}\n />\n ) : (\n section.items.map(item => {\n const idx = flatIdx++;\n const isFocused = this.focusedIndex === idx;\n const isSingleSelectionItem =\n !hasCompositeSections && this.selectionMode === 'single' && !item.showSwitch;\n return (\n <button\n key={idx}\n type=\"button\"\n class={{\n 'menu-item': true,\n 'ds-choice-item': true,\n 'ds-control-frame': true,\n [`ds-control--${this.size}`]: true,\n 'ds-focus-ring-inset': true,\n 'ds-focus-ring--visible': isFocused && this.focusRingVisible,\n 'ds-interaction-fill': !item.isInactive,\n 'ds-interaction-fill--selected': !!item.isSelected && !item.isInactive,\n 'menu-item--selected': !!item.isSelected,\n 'ds-control-inactive': !!item.isInactive,\n 'menu-item--destructive': !!item.isDestructive,\n 'menu-item--focused': isFocused,\n }}\n role={\n hasCompositeSections\n ? undefined\n : item.showSwitch\n ? 'menuitemcheckbox'\n : isSingleSelectionItem\n ? 'menuitemradio'\n : 'menuitem'\n }\n aria-checked={\n !hasCompositeSections && item.showSwitch\n ? String(!!item.switchValue)\n : isSingleSelectionItem\n ? String(!!item.isSelected)\n : undefined\n }\n aria-pressed={\n hasCompositeSections\n ? String(item.showSwitch ? !!item.switchValue : !!item.isSelected)\n : undefined\n }\n aria-current={\n !hasCompositeSections &&\n !item.showSwitch &&\n !isSingleSelectionItem &&\n item.isSelected\n ? 'true'\n : undefined\n }\n disabled={item.isInactive}\n tabIndex={hasCompositeSections ? 0 : isFocused ? 0 : -1}\n onMouseDown={() => {\n this.focusRingVisible = false;\n }}\n onClick={() => this.handleItemClick(item)}\n onFocus={() => {\n this.focusedIndex = idx;\n }}\n >\n <div class=\"menu-item__content ds-choice-item__content ds-interaction-fill__content\">\n <ds-text\n class=\"menu-item__label ds-choice-item__label ds-control-label-box\"\n as=\"span\"\n variant={CONTROL_TEXT_VARIANT[this.size]}\n color={item.isSelected ? 'primary' : 'secondary'}\n >\n {item.label}\n </ds-text>\n {item.subtext && (\n <ds-text\n class=\"menu-item__subtext ds-choice-item__subtext ds-control-label-box\"\n as=\"span\"\n variant={CONTROL_SUPPORTING_TEXT_VARIANT[this.size]}\n color=\"secondary\"\n >\n {item.subtext}\n </ds-text>\n )}\n </div>\n {item.dot && (\n <span\n class=\"menu-item__dot-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-badge\n class=\"menu-item__dot\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n />\n </span>\n )}\n {item.showSwitch && (\n <ds-switch\n class=\"menu-item__switch ds-interaction-fill__content\"\n size={this.size}\n checked={!!item.switchValue}\n presentation\n />\n )}\n </button>\n );\n })\n )}\n </div>\n ))}\n </div>\n </div>\n </Host>\n );\n }\n}\n",
498
498
  "type": "registry:ui"
499
499
  },
500
500
  {
@@ -504,7 +504,7 @@
504
504
  },
505
505
  {
506
506
  "path": "src/wc/components/Menu/menu-position.ts",
507
- "content": "import {\n computeAnchoredPopupPosition,\n type AnchoredPopupAlign,\n type AnchoredPopupPositionInput,\n type AnchoredPopupSide,\n} from '../../utils/anchored-popup';\n\nexport type MenuSide = AnchoredPopupSide;\nexport type MenuAlign = AnchoredPopupAlign;\nexport type MenuPositionInput = AnchoredPopupPositionInput;\n\n/** Backward-compatible menu alias for the shared anchored-popup layout math. */\nexport const computeMenuPosition = computeAnchoredPopupPosition;\n",
507
+ "content": "import {\n computeAnchoredPosition,\n type AnchoredAlign,\n type AnchoredPositionInput,\n type AnchoredSide,\n} from '../../utils/anchored-position';\n\nexport type MenuSide = AnchoredSide;\nexport type MenuAlign = AnchoredAlign;\nexport type MenuPositionInput = AnchoredPositionInput;\n\n/** Backward-compatible menu alias for the shared anchored-position layout math. */\nexport const computeMenuPosition = computeAnchoredPosition;\n",
508
508
  "type": "registry:ui"
509
509
  },
510
510
  {
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "peerDependencies": {
99
99
  "required": [
100
- "@ds-mo/tokens ^3.1.1",
100
+ "@ds-mo/tokens ^5.0.0",
101
101
  "@ds-mo/icons ^6.4.0"
102
102
  ],
103
103
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -238,7 +238,7 @@
238
238
  },
239
239
  "peerDependencies": {
240
240
  "required": [
241
- "@ds-mo/tokens ^3.1.1",
241
+ "@ds-mo/tokens ^5.0.0",
242
242
  "@ds-mo/icons ^6.4.0"
243
243
  ],
244
244
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -191,7 +191,7 @@
191
191
  },
192
192
  "peerDependencies": {
193
193
  "required": [
194
- "@ds-mo/tokens ^3.1.1",
194
+ "@ds-mo/tokens ^5.0.0",
195
195
  "@ds-mo/icons ^6.4.0"
196
196
  ],
197
197
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -228,7 +228,7 @@
228
228
  },
229
229
  "peerDependencies": {
230
230
  "required": [
231
- "@ds-mo/tokens ^3.1.1",
231
+ "@ds-mo/tokens ^5.0.0",
232
232
  "@ds-mo/icons ^6.4.0"
233
233
  ],
234
234
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
@@ -299,7 +299,7 @@
299
299
  "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: currentArea.",
300
300
  "peerDependencies": {
301
301
  "required": [
302
- "@ds-mo/tokens ^3.1.1",
302
+ "@ds-mo/tokens ^5.0.0",
303
303
  "@ds-mo/icons ^6.4.0"
304
304
  ],
305
305
  "frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."