@jimka/typescript-ui 0.4.1 → 0.6.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 (292) hide show
  1. package/dist/lib/{AbstractInput-BxfrmD2W.js → AbstractInput-sRNPzWel.js} +2 -2
  2. package/dist/lib/{AbstractInput-BxfrmD2W.js.map → AbstractInput-sRNPzWel.js.map} +1 -1
  3. package/dist/lib/Anchor-CwRhdP2J.js +2 -0
  4. package/dist/lib/Anchor-CwRhdP2J.js.map +1 -0
  5. package/dist/lib/AnchorConstraints-Bfkt8019.js +2 -0
  6. package/dist/lib/AnchorConstraints-Bfkt8019.js.map +1 -0
  7. package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js +2 -0
  8. package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js.map +1 -0
  9. package/dist/lib/Border-0DJFDiij.js +2 -0
  10. package/dist/lib/Border-0DJFDiij.js.map +1 -0
  11. package/dist/lib/Button-MpMIYBYJ.js +2 -0
  12. package/dist/lib/Button-MpMIYBYJ.js.map +1 -0
  13. package/dist/lib/{Card-a4dzYrbX.js → Card-QYo27r5b.js} +2 -2
  14. package/dist/lib/{Card-a4dzYrbX.js.map → Card-QYo27r5b.js.map} +1 -1
  15. package/dist/lib/Checkbox-D0JYK-wc.js +2 -0
  16. package/dist/lib/Checkbox-D0JYK-wc.js.map +1 -0
  17. package/dist/lib/CheckboxMenuRow-CesLhSnp.js +2 -0
  18. package/dist/lib/CheckboxMenuRow-CesLhSnp.js.map +1 -0
  19. package/dist/lib/CodeEditor-N1FQodcF.js +2 -0
  20. package/dist/lib/CodeEditor-N1FQodcF.js.map +1 -0
  21. package/dist/lib/ComboBox-Dx8Tk9yg.js +2 -0
  22. package/dist/lib/ComboBox-Dx8Tk9yg.js.map +1 -0
  23. package/dist/lib/Component-B0ShfPVi.js +2 -0
  24. package/dist/lib/Component-B0ShfPVi.js.map +1 -0
  25. package/dist/lib/Container-abY5Ww3W.js +2 -0
  26. package/dist/lib/{Container-0bsG2Q8Z.js.map → Container-abY5Ww3W.js.map} +1 -1
  27. package/dist/lib/DOM-C-Edb3tA.js +2 -0
  28. package/dist/lib/DOM-C-Edb3tA.js.map +1 -0
  29. package/dist/lib/Dialog-cbA9V17e.js +2 -0
  30. package/dist/lib/Dialog-cbA9V17e.js.map +1 -0
  31. package/dist/lib/{FieldDecorator-Bpx8J8n9.js → FieldDecorator-BlYMfZ9L.js} +2 -2
  32. package/dist/lib/{FieldDecorator-Bpx8J8n9.js.map → FieldDecorator-BlYMfZ9L.js.map} +1 -1
  33. package/dist/lib/{Fit-CL1m1nIZ.js → Fit-BhlB-HAo.js} +2 -2
  34. package/dist/lib/{Fit-CL1m1nIZ.js.map → Fit-BhlB-HAo.js.map} +1 -1
  35. package/dist/lib/FloatingPanel-DkJXsZ2D.js +2 -0
  36. package/dist/lib/FloatingPanel-DkJXsZ2D.js.map +1 -0
  37. package/dist/lib/{Glyph-wN7bk7mg.js → Glyph-_VeBacS2.js} +2 -2
  38. package/dist/lib/{Glyph-wN7bk7mg.js.map → Glyph-_VeBacS2.js.map} +1 -1
  39. package/dist/lib/{Grid-DHHmaB-Y.js → Grid-Daiz7F5d.js} +2 -2
  40. package/dist/lib/Grid-Daiz7F5d.js.map +1 -0
  41. package/dist/lib/GridConstraints-C58LuTqM.js +2 -0
  42. package/dist/lib/{GridConstraints-DVc1BmlP.js.map → GridConstraints-C58LuTqM.js.map} +1 -1
  43. package/dist/lib/{Header-2hKwQo_u.js → Header-Dql3Zxc6.js} +2 -2
  44. package/dist/lib/{Header-2hKwQo_u.js.map → Header-Dql3Zxc6.js.map} +1 -1
  45. package/dist/lib/{IconText-DC7Xe34b.js → IconText-PUjhTLlp.js} +2 -2
  46. package/dist/lib/{IconText-DC7Xe34b.js.map → IconText-PUjhTLlp.js.map} +1 -1
  47. package/dist/lib/LanguageRegistry-CcVnbKuh.js +2 -0
  48. package/dist/lib/LanguageRegistry-CcVnbKuh.js.map +1 -0
  49. package/dist/lib/LayoutSerialization-CMxunLfV.js +2 -0
  50. package/dist/lib/LayoutSerialization-CMxunLfV.js.map +1 -0
  51. package/dist/lib/List-nx8220Fi.js +2 -0
  52. package/dist/lib/{List-CG4NvwuV.js.map → List-nx8220Fi.js.map} +1 -1
  53. package/dist/lib/MemoryStore-DhPoU-7X.js +2 -0
  54. package/dist/lib/MemoryStore-DhPoU-7X.js.map +1 -0
  55. package/dist/lib/Menu-Q0bpXXze.js +2 -0
  56. package/dist/lib/Menu-Q0bpXXze.js.map +1 -0
  57. package/dist/lib/{MenuButton-wy_0RskC.js → MenuButton-DCXi0tsP.js} +2 -2
  58. package/dist/lib/{MenuButton-wy_0RskC.js.map → MenuButton-DCXi0tsP.js.map} +1 -1
  59. package/dist/lib/OverlayFade-3pof2AJH.js +2 -0
  60. package/dist/lib/OverlayFade-3pof2AJH.js.map +1 -0
  61. package/dist/lib/Panel-Cy1pdlWO.js +2 -0
  62. package/dist/lib/{Panel-Rd9zkNXx.js.map → Panel-Cy1pdlWO.js.map} +1 -1
  63. package/dist/lib/{Position-Ck_KD4cR.js → Position-BwtxouxK.js} +2 -2
  64. package/dist/lib/{Position-Ck_KD4cR.js.map → Position-BwtxouxK.js.map} +1 -1
  65. package/dist/lib/{ProgressSpinner-yt-VXyCb.js → ProgressSpinner-DK8xEQ9y.js} +2 -2
  66. package/dist/lib/{ProgressSpinner-yt-VXyCb.js.map → ProgressSpinner-DK8xEQ9y.js.map} +1 -1
  67. package/dist/lib/RadioButton-BEwpqg1k.js +2 -0
  68. package/dist/lib/RadioButton-BEwpqg1k.js.map +1 -0
  69. package/dist/lib/RadioMenuRow-DP5qPyFR.js +2 -0
  70. package/dist/lib/RadioMenuRow-DP5qPyFR.js.map +1 -0
  71. package/dist/lib/{RovingTabIndex-DFJyoveq.js → RovingTabIndex-pHEv5oLD.js} +2 -2
  72. package/dist/lib/{RovingTabIndex-DFJyoveq.js.map → RovingTabIndex-pHEv5oLD.js.map} +1 -1
  73. package/dist/lib/Scrollbar-t8fFrUVQ.js +2 -0
  74. package/dist/lib/Scrollbar-t8fFrUVQ.js.map +1 -0
  75. package/dist/lib/Slider-CTbwR6HR.js +2 -0
  76. package/dist/lib/Slider-CTbwR6HR.js.map +1 -0
  77. package/dist/lib/{Spacer-qalSEJ5i.js → Spacer-srdN2d2b.js} +2 -2
  78. package/dist/lib/{Spacer-qalSEJ5i.js.map → Spacer-srdN2d2b.js.map} +1 -1
  79. package/dist/lib/TabButton-DLoMQzky.js +2 -0
  80. package/dist/lib/TabButton-DLoMQzky.js.map +1 -0
  81. package/dist/lib/TabCloseButton-CY7BGitY.js +2 -0
  82. package/dist/lib/TabCloseButton-CY7BGitY.js.map +1 -0
  83. package/dist/lib/Text-CMKnK9uB.js +2 -0
  84. package/dist/lib/Text-CMKnK9uB.js.map +1 -0
  85. package/dist/lib/{Tooltip-Dro4DOZs.js → Tooltip-CUOJOqQi.js} +3 -3
  86. package/dist/lib/Tooltip-CUOJOqQi.js.map +1 -0
  87. package/dist/lib/Tree-C64JNPWJ.js +2 -0
  88. package/dist/lib/Tree-C64JNPWJ.js.map +1 -0
  89. package/dist/lib/VBox-DfJPWXqc.js +2 -0
  90. package/dist/lib/VBox-DfJPWXqc.js.map +1 -0
  91. package/dist/lib/{Validator-Du8PqS5i.js → Validator-Cjs1EU5Q.js} +2 -2
  92. package/dist/lib/{Validator-Du8PqS5i.js.map → Validator-Cjs1EU5Q.js.map} +1 -1
  93. package/dist/lib/VirtualScroller-DTIn19o1.js +2 -0
  94. package/dist/lib/VirtualScroller-DTIn19o1.js.map +1 -0
  95. package/dist/lib/assets/StoreWorker-B5NwRM2I.js +2 -0
  96. package/dist/lib/assets/StoreWorker-B5NwRM2I.js.map +1 -0
  97. package/dist/lib/component/button.es.js +1 -1
  98. package/dist/lib/component/button.es.js.map +1 -1
  99. package/dist/lib/component/chart.es.js +1 -1
  100. package/dist/lib/component/chart.es.js.map +1 -1
  101. package/dist/lib/component/container.es.js +1 -1
  102. package/dist/lib/component/container.es.js.map +1 -1
  103. package/dist/lib/component/diagram.es.js +1 -1
  104. package/dist/lib/component/diagram.es.js.map +1 -1
  105. package/dist/lib/component/display.es.js +1 -1
  106. package/dist/lib/component/display.es.js.map +1 -1
  107. package/dist/lib/component/editor.es.js +3 -3
  108. package/dist/lib/component/editor.es.js.map +1 -1
  109. package/dist/lib/component/input.es.js +1 -1
  110. package/dist/lib/component/input.es.js.map +1 -1
  111. package/dist/lib/component/list.es.js +1 -1
  112. package/dist/lib/component/list.es.js.map +1 -1
  113. package/dist/lib/component/menubar.es.js +1 -1
  114. package/dist/lib/component/menubar.es.js.map +1 -1
  115. package/dist/lib/component/table.es.js +6 -3
  116. package/dist/lib/component/table.es.js.map +1 -1
  117. package/dist/lib/component/tree.es.js +1 -1
  118. package/dist/lib/component/tree.es.js.map +1 -1
  119. package/dist/lib/core.es.js +1 -1
  120. package/dist/lib/core.es.js.map +1 -1
  121. package/dist/lib/data.es.js +1 -1
  122. package/dist/lib/glyphs/solid/index.es.js +1 -1
  123. package/dist/lib/languages-Dl8qdL8a.js +2 -0
  124. package/dist/lib/languages-Dl8qdL8a.js.map +1 -0
  125. package/dist/lib/layout.es.js +1 -1
  126. package/dist/lib/layout.es.js.map +1 -1
  127. package/dist/lib/overlay.es.js +1 -1
  128. package/dist/lib/overlay.es.js.map +1 -1
  129. package/dist/lib/primitive.es.js +1 -1
  130. package/dist/lib/router.es.js +1 -1
  131. package/dist/lib/router.es.js.map +1 -1
  132. package/dist/lib/selectionsEqual-gMG7gCVI.js +2 -0
  133. package/dist/lib/selectionsEqual-gMG7gCVI.js.map +1 -0
  134. package/dist/lib/types/component/button/Button.d.ts +13 -0
  135. package/dist/lib/types/component/button/MenuButton.d.ts +1 -0
  136. package/dist/lib/types/component/button/PopupButton.d.ts +22 -0
  137. package/dist/lib/types/component/button/TabButton.d.ts +5 -1
  138. package/dist/lib/types/component/button/ToggleButton.d.ts +1 -1
  139. package/dist/lib/types/component/button/index.d.ts +2 -0
  140. package/dist/lib/types/component/chart/ChartLegend.d.ts +1 -1
  141. package/dist/lib/types/component/container/CheckboxMenuRow.d.ts +33 -0
  142. package/dist/lib/types/component/container/CollapseButton.d.ts +11 -3
  143. package/dist/lib/types/component/container/FloatingPanel.d.ts +23 -0
  144. package/dist/lib/types/component/container/MenuItem.d.ts +15 -5
  145. package/dist/lib/types/component/container/MenuRow.d.ts +24 -0
  146. package/dist/lib/types/component/container/MenuSeparator.d.ts +4 -2
  147. package/dist/lib/types/component/container/RadioMenuRow.d.ts +33 -0
  148. package/dist/lib/types/component/container/ScrollStrip.d.ts +1 -1
  149. package/dist/lib/types/component/container/Scrollbar.d.ts +6 -3
  150. package/dist/lib/types/component/container/SplitGutter.d.ts +7 -2
  151. package/dist/lib/types/component/container/TabBar.d.ts +3 -1
  152. package/dist/lib/types/component/container/WindowBorder.d.ts +1 -1
  153. package/dist/lib/types/component/container/index.d.ts +8 -1
  154. package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +1 -1
  155. package/dist/lib/types/component/display/Markdown.d.ts +42 -1
  156. package/dist/lib/types/component/display/MarkdownMinimap.d.ts +38 -0
  157. package/dist/lib/types/component/display/MarkdownViewer.d.ts +60 -0
  158. package/dist/lib/types/component/display/WebGLCanvas.d.ts +1 -0
  159. package/dist/lib/types/component/display/index.d.ts +6 -0
  160. package/dist/lib/types/component/editor/CodeEditor.d.ts +13 -0
  161. package/dist/lib/types/component/editor/index.d.ts +1 -1
  162. package/dist/lib/types/component/input/AbstractCalendarDropdown.d.ts +2 -0
  163. package/dist/lib/types/component/input/AbstractPickerField.d.ts +3 -2
  164. package/dist/lib/types/component/input/Checkbox.d.ts +1 -1
  165. package/dist/lib/types/component/input/RadioButton.d.ts +1 -1
  166. package/dist/lib/types/component/input/Slider.d.ts +1 -1
  167. package/dist/lib/types/component/input/Text.d.ts +0 -2
  168. package/dist/lib/types/component/input/Toggle.d.ts +1 -1
  169. package/dist/lib/types/component/list/AbstractSelectableList.d.ts +1 -1
  170. package/dist/lib/types/component/list/MultiSelectList.d.ts +2 -1
  171. package/dist/lib/types/component/menubar/MenuBar.d.ts +1 -1
  172. package/dist/lib/types/component/menubar/ToolBar.d.ts +1 -0
  173. package/dist/lib/types/component/shared/VirtualRowView.d.ts +2 -0
  174. package/dist/lib/types/component/table/Body.d.ts +23 -1
  175. package/dist/lib/types/component/table/Column.d.ts +3 -1
  176. package/dist/lib/types/component/table/ColumnConfig.d.ts +2 -0
  177. package/dist/lib/types/component/table/ColumnFilter.d.ts +27 -0
  178. package/dist/lib/types/component/table/Header.d.ts +30 -3
  179. package/dist/lib/types/component/table/Row.d.ts +4 -0
  180. package/dist/lib/types/component/table/Table.d.ts +29 -0
  181. package/dist/lib/types/component/table/TableExporter.d.ts +4 -3
  182. package/dist/lib/types/component/table/TreeBody.d.ts +2 -1
  183. package/dist/lib/types/component/table/cell/CellText.d.ts +9 -0
  184. package/dist/lib/types/component/table/cell/Filter.d.ts +54 -0
  185. package/dist/lib/types/component/table/cell/FilterClauseBadge.d.ts +21 -0
  186. package/dist/lib/types/component/table/cell/GroupSeparator.d.ts +9 -0
  187. package/dist/lib/types/component/table/cell/Header.d.ts +1 -0
  188. package/dist/lib/types/component/table/cell/SortPriorityBadge.d.ts +1 -1
  189. package/dist/lib/types/component/table/cell/editor/CellEditor.d.ts +1 -0
  190. package/dist/lib/types/component/table/cell/editor/CellEditorPool.d.ts +1 -0
  191. package/dist/lib/types/component/table/cell/editor/Date.d.ts +1 -0
  192. package/dist/lib/types/component/table/cell/editor/DateTime.d.ts +1 -0
  193. package/dist/lib/types/component/table/cell/editor/Time.d.ts +1 -0
  194. package/dist/lib/types/component/table/cell/renderer/CellRenderer.d.ts +1 -0
  195. package/dist/lib/types/component/table/cell/renderer/Combo.d.ts +2 -0
  196. package/dist/lib/types/component/table/cell/renderer/Date.d.ts +2 -0
  197. package/dist/lib/types/component/table/cell/renderer/DateTime.d.ts +2 -0
  198. package/dist/lib/types/component/table/cell/renderer/Filter.d.ts +16 -0
  199. package/dist/lib/types/component/table/cell/renderer/Glyph.d.ts +1 -0
  200. package/dist/lib/types/component/table/cell/renderer/Link.d.ts +2 -0
  201. package/dist/lib/types/component/table/cell/renderer/Number.d.ts +3 -1
  202. package/dist/lib/types/component/table/cell/renderer/String.d.ts +2 -0
  203. package/dist/lib/types/component/table/cell/renderer/Time.d.ts +2 -0
  204. package/dist/lib/types/component/table/cell/renderer/TreeCell.d.ts +1 -0
  205. package/dist/lib/types/component/table/index.d.ts +6 -0
  206. package/dist/lib/types/component/tree/Tree.d.ts +26 -2
  207. package/dist/lib/types/component/tree/index.d.ts +1 -1
  208. package/dist/lib/types/component/tree/renderer/Label.d.ts +1 -1
  209. package/dist/lib/types/core/AnimatedDropdown.d.ts +0 -9
  210. package/dist/lib/types/core/Body.d.ts +4 -0
  211. package/dist/lib/types/core/ClassStyleRules.d.ts +1 -0
  212. package/dist/lib/types/core/Component.d.ts +5 -0
  213. package/dist/lib/types/core/DOM.d.ts +10 -0
  214. package/dist/lib/types/core/Event.d.ts +11 -2
  215. package/dist/lib/types/core/OverlayFade.d.ts +12 -0
  216. package/dist/lib/types/core/OverlayPosition.d.ts +6 -0
  217. package/dist/lib/types/core/Theme.d.ts +12 -2
  218. package/dist/lib/types/core/index.d.ts +5 -3
  219. package/dist/lib/types/data/AbstractStore.d.ts +3 -0
  220. package/dist/lib/types/data/FilterDescriptor.d.ts +13 -0
  221. package/dist/lib/types/data/index.d.ts +2 -1
  222. package/dist/lib/types/data/temporalText.d.ts +2 -0
  223. package/dist/lib/types/layout/BoxLayout.d.ts +6 -1
  224. package/dist/lib/types/layout/Grid.d.ts +1 -0
  225. package/dist/lib/types/layout/HFlow.d.ts +1 -1
  226. package/dist/lib/types/layout/LayoutManager.d.ts +8 -0
  227. package/dist/lib/types/layout/Split.d.ts +10 -1
  228. package/dist/lib/types/layout/Tab.d.ts +7 -1
  229. package/dist/lib/types/layout/VFlow.d.ts +1 -1
  230. package/dist/lib/types/layout/index.d.ts +1 -1
  231. package/dist/lib/types/overlay/Dock.d.ts +1 -0
  232. package/dist/lib/types/overlay/Menu.d.ts +1 -1
  233. package/dist/lib/types/overlay/Popover.d.ts +3 -0
  234. package/dist/lib/types/overlay/PopupPanel.d.ts +17 -0
  235. package/dist/lib/types/overlay/Window.d.ts +2 -0
  236. package/dist/lib/types/overlay/index.d.ts +2 -0
  237. package/dist/lib/types/router/RoutePattern.d.ts +7 -0
  238. package/dist/lib/types/router/Router.d.ts +6 -2
  239. package/dist/lib/types/router/index.d.ts +1 -1
  240. package/dist/lib/validation.es.js +1 -1
  241. package/llms.txt +7 -0
  242. package/package.json +15 -15
  243. package/dist/lib/AbstractBooleanInput-DE5NNJT0.js +0 -2
  244. package/dist/lib/AbstractBooleanInput-DE5NNJT0.js.map +0 -1
  245. package/dist/lib/AnchorConstraints-DdDYSDkf.js +0 -2
  246. package/dist/lib/AnchorConstraints-DdDYSDkf.js.map +0 -1
  247. package/dist/lib/AnimatedDropdown-QLNasu_Y.js +0 -2
  248. package/dist/lib/AnimatedDropdown-QLNasu_Y.js.map +0 -1
  249. package/dist/lib/Border-CKKUk5G9.js +0 -2
  250. package/dist/lib/Border-CKKUk5G9.js.map +0 -1
  251. package/dist/lib/Button-MZDYJOMC.js +0 -2
  252. package/dist/lib/Button-MZDYJOMC.js.map +0 -1
  253. package/dist/lib/ComboBox-C04SfXAR.js +0 -2
  254. package/dist/lib/ComboBox-C04SfXAR.js.map +0 -1
  255. package/dist/lib/Component-fRQvgaEY.js +0 -2
  256. package/dist/lib/Component-fRQvgaEY.js.map +0 -1
  257. package/dist/lib/Container-0bsG2Q8Z.js +0 -2
  258. package/dist/lib/DOM-67StIm5G.js +0 -2
  259. package/dist/lib/DOM-67StIm5G.js.map +0 -1
  260. package/dist/lib/DragManager-DRor_-1x.js +0 -2
  261. package/dist/lib/DragManager-DRor_-1x.js.map +0 -1
  262. package/dist/lib/Grid-DHHmaB-Y.js.map +0 -1
  263. package/dist/lib/GridConstraints-DVc1BmlP.js +0 -2
  264. package/dist/lib/LayoutSerialization-D5bBas4W.js +0 -2
  265. package/dist/lib/LayoutSerialization-D5bBas4W.js.map +0 -1
  266. package/dist/lib/LayoutSizes-qNaURyiw.js +0 -2
  267. package/dist/lib/LayoutSizes-qNaURyiw.js.map +0 -1
  268. package/dist/lib/List-CG4NvwuV.js +0 -2
  269. package/dist/lib/MemoryStore-DT6iWWco.js +0 -2
  270. package/dist/lib/MemoryStore-DT6iWWco.js.map +0 -1
  271. package/dist/lib/Menu-CrZy2u0g.js +0 -2
  272. package/dist/lib/Menu-CrZy2u0g.js.map +0 -1
  273. package/dist/lib/Panel-Rd9zkNXx.js +0 -2
  274. package/dist/lib/RadioButton-D23rId-V.js +0 -2
  275. package/dist/lib/RadioButton-D23rId-V.js.map +0 -1
  276. package/dist/lib/Scrollbar-SOj9psiP.js +0 -2
  277. package/dist/lib/Scrollbar-SOj9psiP.js.map +0 -1
  278. package/dist/lib/Slider-DBnAZ-F7.js +0 -2
  279. package/dist/lib/Slider-DBnAZ-F7.js.map +0 -1
  280. package/dist/lib/TabButton-DKECTTk1.js +0 -2
  281. package/dist/lib/TabButton-DKECTTk1.js.map +0 -1
  282. package/dist/lib/Text-KB5LksJl.js +0 -2
  283. package/dist/lib/Text-KB5LksJl.js.map +0 -1
  284. package/dist/lib/Tooltip-Dro4DOZs.js.map +0 -1
  285. package/dist/lib/VBox-P3WFGkPc.js +0 -2
  286. package/dist/lib/VBox-P3WFGkPc.js.map +0 -1
  287. package/dist/lib/VirtualScroller-Bv4KXGKW.js +0 -2
  288. package/dist/lib/VirtualScroller-Bv4KXGKW.js.map +0 -1
  289. package/dist/lib/assets/StoreWorker-CgOBYoai.js +0 -2
  290. package/dist/lib/assets/StoreWorker-CgOBYoai.js.map +0 -1
  291. package/dist/lib/selectionsEqual-Ci3_uflt.js +0 -2
  292. package/dist/lib/selectionsEqual-Ci3_uflt.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"Menu-CrZy2u0g.js","names":[],"sources":["../../src/typescript/lib/component/container/MenuItem.ts","../../src/typescript/lib/component/container/MenuSeparator.ts","../../src/typescript/lib/overlay/Menu.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { Text } from \"~/component/input/Text.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport { BorderOptions } from \"~/primitive/Border.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time component-level options for {@link MenuItem}. Use this\n * for cosmetic/layout overrides on the item row; the menu data (text, action,\n * shortcut, submenu) still comes through {@link MenuItemConfig}.\n *\n * @category Components\n */\nexport interface MenuItemOptions extends ComponentOptions {\n text?: string;\n enabled?: boolean;\n focused?: boolean;\n}\n\n/**\n * Selects which CSS-variable family a `MenuItem` reads its colours from.\n *\n * `'menu-bar'` resolves to `--ts-ui-menu-bar-item-*` tokens; `'context-menu'`\n * resolves to `--ts-ui-context-menu-item-*` tokens. The [`Menu`](/api/overlay/classes/Menu) class chooses\n * the prefix based on its mode.\n */\nexport type MenuItemCSSVarPrefix = \"menu-bar\" | \"context-menu\";\n\n/**\n * Describes a leaf action item, submenu trigger, or separator row inside a [`Menu`](/api/overlay/classes/Menu).\n *\n * @remarks When `separator` is true all other fields are ignored; the item renders as\n * a thin horizontal rule. When `submenu` is set the item opens a child [`Menu`](/api/overlay/classes/Menu)\n * instead of calling `action`.\n *\n * @category Components\n */\nexport interface MenuItemConfig {\n /** Display label shown in the menu row. */\n text?: string;\n /** Called when the item is activated (click or Enter). Ignored when `submenu` is set. */\n action?: () => void;\n /** Defaults to `true`. Disabled items are dimmed and non-interactive. */\n enabled?: boolean;\n /** Keyboard shortcut hint displayed on the right (e.g. `\"Ctrl+S\"`). */\n shortcut?: string;\n /**\n * Icon displayed on the left (e.g. a Unicode character).\n *\n * @remarks Prefer `glyph` for crisp SVG output from the framework's glyph\n * registry; `icon` remains supported for callers that want to embed a raw\n * character.\n */\n icon?: string;\n /**\n * Registry glyph name displayed on the left of the item row. Takes\n * precedence over `icon` when both are provided.\n */\n glyph?: string;\n /**\n * Optional colour for the leading `glyph`, overriding the item's default\n * foreground (e.g. a severity tint). Any CSS colour string. Ignored when the\n * row has no `glyph`.\n */\n glyphColor?: string;\n /** When present this item opens a submenu rather than calling `action`. */\n submenu?: MenuConfig;\n /** When `true` the item renders as a separator; all other fields are ignored. */\n separator?: true;\n}\n\n/**\n * Describes one top-level entry in a [`MenuBar`](/api/component/menubar/classes/MenuBar).\n *\n * @category Components\n */\nexport interface MenuConfig {\n /** Label shown in the bar button (e.g. `\"File\"`). */\n label: string;\n /**\n * The items in the dropdown panel: either a fixed array, or a provider called\n * to produce them when the panel is built. A submenu panel is (re)built each\n * time it opens, so a provider on a submenu's `items` is re-invoked on every\n * open — letting the submenu reflect current state (e.g. an export chooser\n * whose labels track the active tab) without the parent menu rebuilding.\n */\n items: MenuItemConfig[] | (() => MenuItemConfig[]);\n /**\n * Optional registry glyph name displayed to the left of the bar button's\n * label (e.g. `\"file\"`, `\"eye\"`, `\"info-circle\"`). Omit for a text-only\n * menu button.\n */\n glyph?: string;\n}\n\n/**\n * A single row inside a [`Menu`](/api/overlay/classes/Menu) panel.\n *\n * Renders a four-zone layout: icon | text | shortcut | chevron. When\n * `config.separator` is true the item renders instead as a thin horizontal\n * rule and ignores all other config fields.\n *\n * Mouse hover triggers the submenu open callback after a 150 ms delay.\n * Keyboard focus is applied programmatically via `setFocused`.\n *\n * @category Components\n */\nclass MenuItem extends Component {\n\n /** Fixed pixel height for every non-separator menu item. */\n static readonly HEIGHT: number = 24;\n\n private static readonly SEPARATOR_HEIGHT: number = 9;\n /** Title left inset when the menu reserves no icon column. */\n static readonly TEXT_INSET: number = 8;\n /** Title left offset when the menu reserves an icon column. */\n static readonly ICON_ZONE: number = 24;\n /** Width reserved for a submenu chevron in the right zone. */\n static readonly CHEVRON_ZONE: number = 16;\n /** Padding after the right zone, at the panel's inner edge. */\n static readonly RIGHT_PAD: number = 8;\n /**\n * Gap between the title column and the shortcut/chevron right zone, so a\n * content-sized menu never butts the label against them.\n */\n static readonly TEXT_GAP: number = 10;\n\n private readonly _config: MenuItemConfig;\n private readonly _onActivate: () => void;\n private readonly _onOpenSubmenu: (item: MenuItem) => void;\n private readonly _cssVarPrefix: MenuItemCSSVarPrefix;\n\n private _iconText: Text | null = null;\n private _iconGlyph: Glyph | null = null;\n private _titleText: Text | null = null;\n private _shortcutText: Text | null = null;\n private _chevronText: Text | null = null;\n\n // Column geometry applied by the parent Menu so every item lines up: the\n // title's left offset and the shared title-column width the right zone begins\n // after. Null until the menu sets them (a standalone item falls back to its\n // own natural metrics).\n private _iconStart: number | null = null;\n private _titleColumn: number | null = null;\n\n private _submenuTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly _onMouseOver: () => void;\n private readonly _onMouseOut: () => void;\n private readonly _onClick: () => void;\n\n /**\n * Constructs a MenuItem from a config descriptor.\n *\n * @param config - The item descriptor including text, action, shortcut, icon, and submenu.\n * @param onActivate - Called when this item is activated (click or Enter on a leaf item).\n * @param onOpenSubmenu - Called when this item's submenu should open (or close others when no submenu).\n * @param cssVarPrefix - Selects which CSS-variable family supplies disabled, hover, and shortcut colours. Defaults to `'menu-bar'`.\n */\n constructor(\n config: MenuItemConfig,\n onActivate: () => void,\n onOpenSubmenu: (item: MenuItem) => void,\n cssVarPrefix: MenuItemCSSVarPrefix = \"menu-bar\",\n options?: MenuItemOptions\n ) {\n // Child components are built first; options are applied via applyOptions at the constructor tail.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n this._config = config;\n this._onActivate = onActivate;\n this._onOpenSubmenu = onOpenSubmenu;\n this._cssVarPrefix = cssVarPrefix;\n\n if (config.separator) {\n this.setHeight(MenuItem.SEPARATOR_HEIGHT);\n this.setPreferredSize({ width: 0, height: MenuItem.SEPARATOR_HEIGHT });\n this.setBackgroundColor(\"transparent\");\n this.setElementCSSRule(\n \"borderTop\",\n `1px solid var(--ts-ui-${cssVarPrefix}-separator-color, rgb(220, 220, 220))`\n );\n this.setElementCSSRule(\"margin\", \"4px 0\");\n this.getAria().setRole(\"separator\");\n\n this._onMouseOver = () => {};\n this._onMouseOut = () => {};\n this._onClick = () => {};\n\n if (options) {\n this.applyOptions(options);\n }\n\n return;\n }\n\n const enabled = config.enabled !== false;\n\n this.setHeight(MenuItem.HEIGHT);\n this.setPreferredSize({ width: 0, height: MenuItem.HEIGHT });\n this.setBackgroundColor(\"transparent\");\n this.setElementCSSRule(\"fontSize\", \"var(--ts-ui-button-font-size, var(--ts-ui-font-size))\");\n this.setCursor(enabled ? \"pointer\" : \"default\");\n this.getAria().setRole(\"menuitem\");\n\n if (!enabled) {\n this.setForegroundColor(\n `var(--ts-ui-${cssVarPrefix}-item-disabled-color, rgb(170, 170, 170))`\n );\n this.getAria().setDisabled(true);\n }\n\n if (config.glyph) {\n this._iconGlyph = new Glyph(config.glyph);\n this._iconGlyph.setPointerEvents(\"none\");\n this._iconGlyph.setPreferredSize({ width: 16, height: 16 });\n\n if (config.glyphColor) {\n this._iconGlyph.setForegroundColor(config.glyphColor);\n }\n\n this.addComponent(this._iconGlyph);\n } else {\n this._iconText = new Text(config.icon ?? \"\");\n this._iconText.setPointerEvents(\"none\");\n this._iconText.setVisible(!!config.icon);\n this.addComponent(this._iconText);\n }\n\n this._titleText = new Text(config.text ?? \"\");\n this._titleText.setPointerEvents(\"none\");\n this._titleText.setWhiteSpace(\"nowrap\");\n this._titleText.setOverflow(\"hidden\");\n this._titleText.setTextOverflow(\"ellipsis\");\n this.addComponent(this._titleText);\n\n if (config.shortcut) {\n this._shortcutText = new Text(config.shortcut);\n this._shortcutText.setPointerEvents(\"none\");\n this._shortcutText.setTextAlign(\"left\");\n this._shortcutText.setForegroundColor(\n `var(--ts-ui-${cssVarPrefix}-item-shortcut-color, rgb(140, 140, 140))`\n );\n this.addComponent(this._shortcutText);\n }\n\n if (this.hasSubmenu()) {\n this._chevronText = new Text(\"▶\");\n this._chevronText.setPointerEvents(\"none\");\n this._chevronText.setTextAlign(\"center\");\n this._chevronText.setForegroundColor(\n `var(--ts-ui-${cssVarPrefix}-item-shortcut-color, rgb(140, 140, 140))`\n );\n this.addComponent(this._chevronText);\n this.getAria().setHasPopup(\"menu\");\n this.getAria().setExpanded(false);\n }\n\n this._onMouseOver = () => {\n this.setFocused(true);\n\n // A disabled item never opens its own submenu; it still signals the\n // parent (the else branch) so hovering it closes any sibling submenu.\n if (enabled && this.hasSubmenu()) {\n this._submenuTimer = setTimeout(() => {\n this._submenuTimer = null;\n this._onOpenSubmenu(this);\n }, 150);\n } else {\n this._onOpenSubmenu(this);\n }\n };\n\n this._onMouseOut = () => {\n this.setFocused(false);\n\n if (this._submenuTimer !== null) {\n clearTimeout(this._submenuTimer);\n this._submenuTimer = null;\n }\n };\n\n this._onClick = () => {\n if (enabled && !this.hasSubmenu()) {\n this._onActivate();\n }\n };\n\n Event.addListener(this, \"mouseover\", this._onMouseOver);\n Event.addListener(this, \"mouseout\", this._onMouseOut);\n Event.addListener(this, \"click\", this._onClick);\n\n if (options) {\n this.applyOptions(options);\n }\n\n this.updateLabelHeights();\n }\n\n /**\n * Applies a {@link MenuItemOptions} bag, dispatching menu item label,\n * enabled state, and focus highlight after inherited Component fields.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: MenuItemOptions): this {\n super.applyOptions(options);\n\n if (options.text !== undefined && this._titleText) {\n this._titleText.setText(options.text);\n }\n\n if (options.enabled !== undefined) {\n this.getAria().setDisabled(!options.enabled);\n this.setCursor(options.enabled ? \"pointer\" : \"default\");\n }\n\n if (options.focused !== undefined) {\n this.setFocused(options.focused);\n }\n\n return this;\n }\n\n /**\n * Returns `true` if this item has a child submenu.\n *\n * @returns Whether a `submenu` config was provided.\n */\n hasSubmenu(): boolean {\n return !!this._config.submenu;\n }\n\n /** True when the item reserves an icon column (has a glyph or icon slot). */\n hasIcon(): boolean {\n return !!this._config.icon || !!this._config.glyph;\n }\n\n /** The item's measured title width, feeding the menu's shared title column. */\n titleTextWidth(): number {\n return Math.ceil(this._titleText?.getPreferredSize()?.width ?? 0);\n }\n\n /** The item's measured shortcut width, or 0 when it has no shortcut. */\n shortcutTextWidth(): number {\n if (!this._config.shortcut || this._shortcutText === null) {\n return 0;\n }\n\n return Math.ceil(this._shortcutText.getPreferredSize()?.width ?? 0);\n }\n\n /**\n * Applies the menu-computed column geometry so every item lines up: the title\n * left offset (icon column, or the bare inset) and the shared title-column\n * width the shortcut/chevron right zone begins after.\n *\n * @param iconStart - The title's left offset in pixels.\n * @param titleColumn - The shared title-column width across the menu's items.\n */\n setColumns(iconStart: number, titleColumn: number): void {\n this._iconStart = iconStart;\n this._titleColumn = titleColumn;\n\n this.scheduleLayout();\n }\n\n /**\n * Returns the submenu config, or `null` if this item has no submenu.\n *\n * @returns The [`MenuConfig`](/api/component/container/interfaces/MenuConfig) for the child panel, or null.\n */\n getSubmenuConfig(): MenuConfig | null {\n return this._config.submenu ?? null;\n }\n\n /**\n * Applies or removes the keyboard-focus highlight background.\n *\n * @param focused - `true` to highlight, `false` to clear.\n */\n setFocused(focused: boolean): this {\n this.setBackgroundColor(\n focused\n ? `var(--ts-ui-${this._cssVarPrefix}-item-hover-bg, rgba(30, 100, 200, 0.12))`\n : \"transparent\"\n );\n\n return this;\n }\n\n /**\n * Returns `true` when this item was constructed with `separator: true`.\n *\n * @returns Whether this item is a non-interactive separator row.\n */\n isSeparator(): boolean {\n return !!this._config.separator;\n }\n\n /**\n * Returns `true` when the item is interactive (not disabled).\n *\n * @returns Whether `enabled` was not explicitly set to `false`.\n */\n isEnabled(): boolean {\n return this._config.enabled !== false;\n }\n\n /**\n * Activates this item as if the user clicked or pressed Enter.\n *\n * For submenu items, calls `onOpenSubmenu` immediately (skipping the hover delay).\n * For leaf items, calls `onActivate`. Does nothing for disabled or separator items.\n */\n activate(): void {\n if (this.isSeparator() || !this.isEnabled()) {\n return;\n }\n\n if (this.hasSubmenu()) {\n this._onOpenSubmenu(this);\n } else {\n this._onActivate();\n }\n }\n\n /**\n * Cancels any pending submenu timer, then defers to the base class for\n * the rest of teardown.\n */\n protected destructor(): void {\n if (this._submenuTimer !== null) {\n clearTimeout(this._submenuTimer);\n this._submenuTimer = null;\n }\n\n super.destructor();\n }\n\n /**\n * Returns the offset from the top of the menu item to the title text's baseline.\n *\n * @returns The baseline offset in pixels, or `null` when the title has no baseline\n * (e.g. for a separator row).\n */\n getBaseline(): number | null {\n if (this._titleText === null) {\n return null;\n }\n\n return this.wrapInnerBaseline(this._titleText.getBaseline());\n }\n\n /**\n * Re-pins the four labels' line boxes to the item's CONTENT height —\n * `MenuItem.HEIGHT` less this item's own vertical chrome. `centerInHeight`\n * pins a label's minimum height as well as its line box, so a label pinned to\n * the outer height cannot shrink into a bordered item's content box and is\n * clipped. Called from the constructor tail and whenever the border changes.\n */\n private updateLabelHeights(): void {\n const perimeter = this.getPerimeterSize();\n // Floor of 1: chrome at or past the row height leaves nothing to centre\n // in, and a zero or negative line-height is not a value CSS should see.\n // The label clips in that case either way — the floor only keeps the\n // written value sane.\n const height = Math.max(1, MenuItem.HEIGHT - perimeter.top - perimeter.bottom);\n\n // Optional chaining, not null checks: a separator has none of these, and a\n // border arriving through the options bag could in principle reach here\n // before the field initializers have run.\n this._iconText?.centerInHeight(height);\n this._titleText?.centerInHeight(height);\n this._shortcutText?.centerInHeight(height);\n this._chevronText?.centerInHeight(height);\n }\n\n /**\n * Applies a border, then re-pins the four labels' line boxes to the item's\n * new content height so a bordered item's labels shrink to fit instead of\n * overrunning the smaller content box.\n *\n * @param options - Border configuration, or a CSS `border` shorthand string.\n * @returns This component, for method chaining.\n */\n setBorder(options: BorderOptions | string): this {\n super.setBorder(options);\n this.updateLabelHeights();\n\n return this;\n }\n\n /**\n * Clears the border, then re-pins the four labels' line boxes back to the\n * item's now-larger content height.\n *\n * @returns This component, for method chaining.\n */\n clearBorder(): this {\n super.clearBorder();\n this.updateLabelHeights();\n\n return this;\n }\n\n /**\n * Positions the four label zones within the item's content box.\n *\n * @returns This component, for method chaining.\n */\n doLayout(): this {\n super.doLayout();\n\n if (this._config.separator) {\n return this;\n }\n\n const box = this.getContentBounds();\n\n if (!box) {\n return this;\n }\n\n // Heights come from the content box, not MenuItem.HEIGHT: the constant\n // is the item's outer height. With no border the two are the same\n // number. The texts' line boxes are pinned to match by\n // updateLabelHeights, so they fit this box rather than overrunning it.\n const H = box.height;\n const totalWidth = box.width;\n const hasShortcut = !!this._config.shortcut && this._shortcutText !== null;\n const hasSub = this.hasSubmenu();\n\n // The menu aligns every item into shared columns; a standalone item falls\n // back to its own icon offset and natural title width.\n const iconStart = this._iconStart ?? (this.hasIcon() ? MenuItem.ICON_ZONE : MenuItem.TEXT_INSET);\n const titleColumn = this._titleColumn ?? this.titleTextWidth();\n\n if (this._iconGlyph) {\n const size = this._iconGlyph.getPreferredSize() ?? { width: 16, height: 16 };\n const iconY = Math.max(0, Math.floor((H - size.height) / 2));\n\n this._iconGlyph.setX(box.x + 4);\n this._iconGlyph.setY(box.y + iconY);\n this._iconGlyph.setWidth(size.width);\n this._iconGlyph.setHeight(size.height);\n } else if (this._iconText) {\n this._iconText.setX(box.x + 4);\n this._iconText.setY(box.y);\n this._iconText.setWidth(20);\n this._iconText.setHeight(H);\n }\n\n // Title fills the shared title column, left-aligned from the icon offset.\n if (this._titleText) {\n this._titleText.setX(box.x + iconStart);\n this._titleText.setY(box.y);\n this._titleText.setWidth(titleColumn);\n this._titleText.setHeight(H);\n }\n\n // Chevron: right-justified at the panel's inner edge.\n if (hasSub && this._chevronText) {\n this._chevronText.setX(box.x + totalWidth - MenuItem.RIGHT_PAD - MenuItem.CHEVRON_ZONE);\n this._chevronText.setY(box.y);\n this._chevronText.setWidth(MenuItem.CHEVRON_ZONE);\n this._chevronText.setHeight(H);\n }\n\n // Shortcut: left-justified in the right zone, one gap past the title column.\n if (hasShortcut && this._shortcutText) {\n this._shortcutText.setX(box.x + iconStart + titleColumn + MenuItem.TEXT_GAP);\n this._shortcutText.setY(box.y);\n this._shortcutText.setWidth(this.shortcutTextWidth());\n this._shortcutText.setHeight(H);\n }\n\n return this;\n }\n}\n\nconst MenuItemCallable = callable(MenuItem);\ntype MenuItemCallable = MenuItem;\nexport {\n MenuItem as _MenuItem,\n MenuItemCallable as MenuItem\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport type { MenuItemCSSVarPrefix } from \"~/component/container/MenuItem.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link MenuSeparator}.\n *\n * @category Components\n */\nexport interface MenuSeparatorOptions extends ComponentOptions {\n}\n\n/**\n * Empty subclass-default const so the super call follows the framework's\n * `(options, defaults)` shape uniformly. MenuSeparator owns no class-level\n * option overrides today; the const exists so a future field has a place to\n * land without reshuffling the super call.\n */\nconst _defaultMenuSeparatorOptions: Partial<MenuSeparatorOptions> = {};\n\n/**\n * A horizontal separator rule used inside a [`Menu`](/api/overlay/classes/Menu) panel to visually group menu items.\n *\n * Renders as a thin border line. Width is set externally by `Menu.doLayout()`.\n *\n * @category Components\n */\nclass MenuSeparator extends Component<MenuSeparatorOptions> {\n\n /** Fixed pixel height of every separator. */\n static readonly HEIGHT: number = 9;\n\n /**\n * Constructs a MenuSeparator with a thin horizontal rule appearance.\n *\n * @param cssVarPrefix - Selects which CSS-variable family supplies the border colour. Defaults to `'menu-bar'`.\n * @param options - Optional construction options.\n * @param subclassDefaults - Per-subclass default bag layered over this\n * class's defaults; subclasses forward their `_defaultXxxOptions`\n * constant here.\n */\n constructor(\n cssVarPrefix: MenuItemCSSVarPrefix = \"menu-bar\",\n options?: MenuSeparatorOptions,\n subclassDefaults?: Partial<MenuSeparatorOptions>,\n ) {\n super(options, { ..._defaultMenuSeparatorOptions, ...(subclassDefaults ?? {}) });\n\n this.setHeight(MenuSeparator.HEIGHT);\n this.setPreferredSize({ width: 0, height: MenuSeparator.HEIGHT });\n this.setBackgroundColor(\"transparent\");\n this.setElementCSSRule(\n \"borderTop\",\n `1px solid var(--ts-ui-${cssVarPrefix}-separator-color, rgb(220, 220, 220))`\n );\n this.setElementCSSRule(\"margin\", \"4px 0\");\n this.getAria().setRole(\"separator\");\n }\n}\n\nconst MenuSeparatorCallable = callable(MenuSeparator);\ntype MenuSeparatorCallable = MenuSeparator;\nexport {\n MenuSeparator as _MenuSeparator,\n MenuSeparatorCallable as MenuSeparator\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component } from \"~/core/Component.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle, Rect } from \"~/core/DOM.js\";\nimport { LayerManager, DismissableLayer, LayerDismissMode } from \"~/core/LayerManager.js\";\nimport { positionAligned, positionFlexibleAnchored } from \"~/core/OverlayPosition.js\";\nimport { fadeShow, fadeHideAndDetach } from \"~/core/AnimatedDropdown.js\";\nimport type { Animation } from \"~/core/Animation.js\";\nimport { Insets } from \"~/primitive/Insets.js\";\nimport type { Size } from \"~/primitive/Size.js\";\nimport { VBox } from \"~/layout/VBox.js\";\nimport { MenuItem, MenuItemConfig } from \"~/component/container/MenuItem.js\";\nimport { MenuSeparator } from \"~/component/container/MenuSeparator.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { Util } from \"~/core/Util.js\";\n\n/**\n * Pixel bounds a content-sized menu panel clamps to. Menus size to their widest\n * item (via the layout manager's preferred width); the floor keeps a short menu\n * from looking cramped, and the ceiling stops a very long label running off-screen\n * (the item's title ellipsizes past it).\n */\nconst MIN_MENU_WIDTH = 120;\nconst MAX_MENU_WIDTH = 360;\n\n/** Duration (ms) of the fade-in / fade-out transitions on every menu panel. */\nconst MENU_ANIM_DURATION_MS = 120;\n\n/** Pixels kept between a clamped menu and the viewport edge so the panel\n * border and shadow are never flush against the screen. Mirrors the small\n * inset used by other floating panels; purely cosmetic breathing room. */\nconst VIEWPORT_MARGIN = 4;\n\n/** A resolved rebuild-mode placement: the panel's top-left plus the height room at it. */\ninterface MenuPlacement { x: number; y: number; available: number; }\n\n/**\n * A zero-size rect at a cursor point. A cursor is a degenerate anchor: with\n * `left === right` and `top === bottom`, the adjacency and alignment flips\n * collapse to the same operation — grow down-right from the point, or end at it.\n * That is native context-menu behaviour, so a pointer needs no separate path.\n */\nfunction pointRect(x: number, y: number): Rect {\n return { x, y, left: x, top: y, right: x, bottom: y, width: 0, height: 0 };\n}\n\n/**\n * Resolves a rebuild-mode panel's placement against `anchorRect` at `size`.\n * Vertically the panel is size-flexible (it caps its height and scrolls), so it\n * grows below the anchor and flips to end at the anchor's top when the room below\n * is short. Horizontally it is fixed-size (a natural width, no horizontal scroll),\n * so its left edge aligns with the anchor's left and flips to align its right edge\n * with the anchor's right when the left alignment overflows.\n *\n * @param anchorRect - The trigger rect, or a zero-size rect at the cursor.\n * @param size - The panel's current width/height to place.\n * @param vp - The viewport size to flip/clamp within.\n * @returns The resolved top-left coordinate and the vertical room available there.\n */\nfunction resolvePlacement(anchorRect: Rect, size: Size, vp: Size): MenuPlacement {\n const v = positionFlexibleAnchored(anchorRect.top, anchorRect.bottom, size.height, vp.height, VIEWPORT_MARGIN);\n const x = positionAligned(anchorRect.left, anchorRect.right, size.width, vp.width, VIEWPORT_MARGIN);\n\n // `available` is the room on the side the panel actually landed on — never\n // re-derive it from `v.start`, which measures the wrong side for a flipped\n // panel and lets an over-tall menu grow back across the cursor.\n return { x, y: v.start, available: v.available };\n}\n\n/**\n * A floating menu panel that operates in one of two modes:\n *\n * - **Rebuild mode** (`new Menu()`): a right-click context menu. Items are passed per\n * `show(x, y, items)` call and disposed on the next show or hide.\n * - **Persistent mode** (`new Menu(items, onClose)`): a [`MenuBar`](/api/component/menubar/classes/MenuBar) dropdown. Items are\n * built once in the constructor and reused across `open()` / `close()` cycles.\n *\n * The two API surfaces are disjoint by mode:\n * `show()` / `hide()` / `setMenuWidth()` are valid only in rebuild mode;\n * `open()` / `close()` / focus and submenu methods are valid only in persistent mode.\n *\n * @example\n * ```typescript\n * // Rebuild mode — right-click context menu\n * const menu = new Menu();\n * Event.addListener(myComponent, 'contextmenu', (e: MouseEvent) => {\n * e.preventDefault();\n * menu.show(e.clientX, e.clientY, [\n * { text: 'Cut', action: () => cut() },\n * { separator: true },\n * { text: 'Paste', action: () => paste() },\n * ]);\n * });\n *\n * // Persistent mode — MenuBar dropdown\n * const panel = new Menu(\n * [{ text: 'Save', shortcut: 'Ctrl+S', action: () => save() }],\n * () => bar.closeMenu()\n * );\n * panel.open(buttonElement);\n * ```\n *\n * @category Components\n */\nclass Menu extends Component implements DismissableLayer {\n\n private readonly _persistent: boolean;\n // A persistent menu's items provider, kept so each open() re-resolves it —\n // null when the items were passed as a fixed array (built once, never rebuilt).\n private readonly _itemsProvider: (() => MenuItemConfig[]) | null;\n private readonly _onClose: (() => void) | null;\n // In both modes every entry is registered via `addComponent` (see\n // `showAnchored` / `buildPersistentItems`), so the `destructor()` override\n // below has no item disposal to do — the base class's recursive teardown\n // already disposes each item; the override exists only to cancel the\n // in-flight fades. (A prior override manually\n // re-disposed them here, guarded to persistent mode only via\n // `assertPersistentMode`. That guard was never reachable through ancestor\n // teardown — no `Menu` anywhere in the library is itself registered via\n // `addComponent` (`Table._columnContextMenu` / `TabBar._contextMenu` are\n // plain fields, never added as children), so an ancestor's `destructor()`\n // recursion can never reach a `Menu` at all. The loop was removed simply\n // because it was redundant, not because the guard made it unsafe.)\n private _menuItems: Array<MenuItem | MenuSeparator> = [];\n\n // In-flight fades, cancelled on teardown so their fallback timers cannot\n // fire against this menu's released element handle.\n private _fadeShowAnimation: Animation.CancelHandle | null = null;\n private _fadeHideAnimation: Animation.CancelHandle | null = null;\n private _focusedIndex: number = -1;\n private _openSubmenuPanel: Menu | null = null;\n private _openSubmenuItem: MenuItem | null = null;\n private _excludedEl: Handle | null = null;\n // An explicit rebuild-mode width set via setMenuWidth; null means size to\n // content (the widest item, clamped to [MIN_MENU_WIDTH, MAX_MENU_WIDTH]).\n private _menuWidth: number | null = null;\n private _rebuildOnClose: (() => void) | null = null;\n private _currentOpener: Handle | null = null;\n // Rebuild-mode: when true, each show() scrolls the menu to the bottom after\n // layout so the latest (bottom-most) items are visible on open.\n private _scrollToBottomOnShow: boolean = false;\n\n /**\n * Constructs a Menu. With no arguments, a rebuild-mode (right-click context)\n * menu whose items are supplied per `show()` call. With `items` (and `onClose`),\n * a persistent-mode ([`MenuBar`](/api/component/menubar/classes/MenuBar) dropdown)\n * menu whose items are built immediately and reused across `open()` / `close()`\n * cycles.\n *\n * A single optional-parameter signature, deliberately not an overload pair: the\n * `callable()` export's construct/call type is derived via TS `ConstructorParameters`,\n * which captures only the *last* overload — an overload pair would drop the\n * no-arg form and make `Menu()` a type error for consumers.\n *\n * @param items - The menu item configurations, or a provider called once now\n * to produce them. A submenu is rebuilt on each open, so a provider passed\n * for a submenu's items is re-invoked every time that submenu opens. Omit for\n * a rebuild-mode context menu.\n * @param onClose - Callback invoked when the panel should close (item activated or outside click).\n */\n constructor(items?: MenuItemConfig[] | (() => MenuItemConfig[]), onClose?: () => void) {\n super();\n\n this._persistent = items !== undefined;\n this._itemsProvider = typeof items === \"function\" ? items : null;\n this._onClose = onClose ?? null;\n\n const vbox = new VBox();\n\n vbox.setComponentSpacing(0);\n vbox.setStretching(true);\n\n this.setLayoutManager(vbox);\n\n if (this._persistent) {\n this.applyPersistentChrome();\n // Fixed array: build once now. A provider defers to open(), which\n // re-resolves it on every open (so the sole resolution is per-open).\n if (this._itemsProvider === null) {\n this.buildPersistentItems(items as MenuItemConfig[]);\n }\n } else {\n this.applyRebuildChrome();\n }\n }\n\n /**\n * Lays the menu's items into aligned columns and returns the panel width.\n * Every title shares one column sized to the widest title; the shortcut/chevron\n * right zone is the widest of the shortcut column and a submenu chevron, so\n * shortcuts left-justify in a column and chevrons right-justify at the edge.\n * The width is clamped to `[MIN_MENU_WIDTH, MAX_MENU_WIDTH]`; when the ceiling\n * bites, the title column shrinks and its titles ellipsize. Measured from the\n * items directly so a menu reused across shows re-measures its new content.\n *\n * @returns The clamped panel width in pixels.\n */\n private layOutColumns(): number {\n const items = this._menuItems.filter(\n (i): i is MenuItem => i instanceof MenuItem && !i.isSeparator()\n );\n\n const iconStart = items.some(i => i.hasIcon()) ? MenuItem.ICON_ZONE : MenuItem.TEXT_INSET;\n const maxTitle = items.reduce((m, i) => Math.max(m, i.titleTextWidth()), 0);\n const maxShortcut = items.reduce((m, i) => Math.max(m, i.shortcutTextWidth()), 0);\n const hasChevron = items.some(i => i.hasSubmenu());\n const rightZone = Math.max(maxShortcut, hasChevron ? MenuItem.CHEVRON_ZONE : 0);\n const rightReserve = rightZone > 0 ? MenuItem.TEXT_GAP + rightZone : 0;\n\n const natural = iconStart + maxTitle + rightReserve + MenuItem.RIGHT_PAD;\n const width = Math.min(MAX_MENU_WIDTH, Math.max(MIN_MENU_WIDTH, natural));\n\n // When the ceiling bites, the title column absorbs the shortfall (titles\n // ellipsize); otherwise it is the full widest-title width.\n const titleColumn = Math.min(maxTitle, width - iconStart - rightReserve - MenuItem.RIGHT_PAD);\n\n for (const item of items) {\n item.setColumns(iconStart, titleColumn);\n }\n\n return width;\n }\n\n /**\n * Shows the menu at the given viewport coordinates, replacing any previously\n * displayed items with the new list. **Rebuild-mode only.**\n *\n * The menu grows down-right from the cursor; when there is no room it flips\n * so its bottom / right edge ends at the cursor, never covering it. A menu\n * taller than the room on the side it lands on is capped there and scrolls.\n *\n * @param x - Horizontal viewport coordinate (e.g. `MouseEvent.clientX`).\n * @param y - Vertical viewport coordinate (e.g. `MouseEvent.clientY`).\n * @param configs - Ordered list of item descriptors to render.\n * @param onClose - Optional callback invoked once when the menu next closes\n * (item activated or dismissed by an outside click), letting the opener\n * revert an open-state affordance such as a rotated dropdown chevron.\n * @param excludeEl - Optional element whose subtree is exempt from the\n * outside-click-to-close check. Pass the trigger that opened the menu (e.g.\n * a [`SplitButton`](/api/component/button/classes/SplitButton) chevron) so a\n * pointerdown on it does not self-close the menu before the trigger's own\n * click can toggle it shut — mirroring [`MenuBar`](/api/component/menubar/classes/MenuBar)'s\n * dropdown-button exclusion.\n */\n show(x: number, y: number, configs: MenuItemConfig[], onClose?: () => void, excludeEl?: Handle | null): this {\n this.assertRebuildMode(\"show\");\n\n // The placement primitives only guarantee an on-screen result for an anchor\n // inside the viewport. A cursor from a real event always is; show() is public,\n // so pin it here rather than in showAnchored, which also takes real trigger\n // rects that may legitimately extend past a viewport edge.\n const vp = DOM.source.getViewportSize();\n\n return this.showAnchored(\n pointRect(Util.clamp(x, 0, vp.width), Util.clamp(y, 0, vp.height)),\n configs, onClose ?? null, excludeEl ?? null,\n );\n }\n\n /**\n * Rebuild-mode geometry-and-content core shared by {@link show} (pointer-anchored)\n * and {@link toggleFor} (rect-anchored). Both grow down-right from `anchorRect`\n * and flip per axis when the room runs short. Tears down and rebuilds the item\n * list, then resolves `anchorRect` to a placement and applies the resulting\n * position and height clamp.\n *\n * @param anchorRect - The cursor point (as a zero-size rect) or trigger rect to\n * place the panel against.\n * @param configs - Ordered list of item descriptors to render.\n * @param onClose - Callback invoked once when the menu next closes, or `null`.\n * @param excludeEl - Element whose subtree is exempt from the outside-click\n * check, or `null`.\n */\n private showAnchored(anchorRect: Rect, configs: MenuItemConfig[], onClose: (() => void) | null, excludeEl: Handle | null): this {\n this._rebuildOnClose = onClose;\n this._excludedEl = excludeEl;\n\n this._menuItems = [];\n this.disposeAllComponents();\n\n this.pauseLayout();\n\n for (const config of configs) {\n const item: MenuItem | MenuSeparator = config.separator === true\n ? new MenuSeparator(\"context-menu\")\n : new MenuItem(\n config,\n () => {\n config.action?.();\n this.hide();\n },\n (hoveredItem) => { this.handleItemOpenSubmenu(hoveredItem); },\n \"context-menu\"\n );\n\n this.addComponent(item);\n this._menuItems.push(item);\n }\n\n this.resumeLayout();\n\n const contentWidth = this.layOutColumns();\n const naturalWidth = this._menuWidth ?? contentWidth;\n\n this.setWidth(naturalWidth);\n\n // A reused menu still carries the previous show's max-height — set by\n // `applyViewportHeightClamp` to that show's available room. Because\n // `getPreferredSize` clamps to the component's own max, leaving it in\n // place would cap the new content at the old height, so a menu that\n // grew past its previous size would neither expand nor reserve a\n // scrollbar gutter on reopen. Clear it before measuring.\n this.setMaxSize({ width: Number.MAX_VALUE, height: Number.MAX_VALUE });\n\n const totalHeight = this.getPreferredSize()?.height ?? 0;\n\n const el = this.getElement(true)!;\n\n const vp = DOM.source.getViewportSize();\n\n // First pass at the natural width resolves the vertical room. Width does not\n // affect the vertical placement, so `available` stays correct after the\n // scrollbar-gutter widening below; only `x` needs the second pass.\n const available = resolvePlacement(anchorRect, { width: naturalWidth, height: totalHeight }, vp).available;\n\n // When the content is taller than the room on the side the menu lands on,\n // `applyViewportHeightClamp` caps the height and the `overflow-y: auto`\n // scrollbar engages. Reserve its width as a right inset — and widen the\n // content-sized panel to match — so items lay out beside the native\n // scrollbar instead of beneath it. `Component.getInnerSize` subtracts the\n // inset, so the VBox stretches items to `naturalWidth`, unchanged from the\n // no-scroll case.\n const gutter = totalHeight > available ? DOM.source.getScrollBarWidth() : 0;\n\n this.setInsets(new Insets(4, gutter, 4, 0));\n this.setWidth(naturalWidth + gutter);\n\n const placement = resolvePlacement(anchorRect, { width: this.getWidth(), height: totalHeight }, vp);\n\n this.setX(placement.x);\n this.setY(placement.y);\n this.applyViewportHeightClamp(placement.available, totalHeight);\n\n this.scheduleLayout();\n\n LayerManager.mount(el);\n\n this.setVisible(true);\n this.fadeIn();\n\n // Join the central layer tree: the manager owns the outside-pointerdown /\n // window-blur / Escape dismissal and stamps the z-index. Registering while\n // whatever opened the menu is topmost links it under that layer, so a\n // context menu raised over a modal dialog inherits the dialog band and\n // paints in front of it.\n LayerManager.register(this);\n this.setZIndex(LayerManager.getZIndex(this));\n\n // Optionally reveal the bottom of the list on open (e.g. a history menu\n // whose latest entries sit at the bottom). Flush the scheduled layout\n // first so the item heights are committed and `getMaxScrollTop` is\n // accurate; when nothing overflows the offset is 0 and this is a no-op.\n if (this._scrollToBottomOnShow) {\n this.flushLayout();\n this.setScrollTop(this.getMaxScrollTop());\n }\n\n return this;\n }\n\n /**\n * Opens or closes the menu for a given opener element. **Rebuild-mode only.**\n *\n * This is the toggle form of {@link show} for a left-click dropdown trigger\n * (e.g. a [`SplitButton`](/api/component/button/classes/SplitButton) chevron\n * or a [`ToolBar`](/api/component/menubar/classes/ToolBar) overflow button):\n * the opener is excluded from the outside-click dismissal (so its own\n * pointerdown does not self-close the menu) and remembered, so a second press\n * of the *same* opener closes the menu instead of reopening it. Pressing a\n * *different* opener while the menu is open switches it to that opener. The\n * menu opens below `anchorRect` and flips above it when the room below is\n * short, right-aligning to it when the left alignment overflows. Plain\n * {@link show} stays the right call for right-click context menus, which\n * should reposition — not close — on a repeat trigger; the remaining\n * distinction from `toggleFor` is the toggle identity, the opener exclusion,\n * and the empty-list suppression below.\n *\n * An empty `configs` opens nothing: the menu is not shown, `onClose` fires once\n * so the opener can revert an open-state affordance, and no opener state is\n * recorded. A repeat press of the *same* opener still closes an open menu — the\n * toggle-shut branch runs before the empty check.\n *\n * @param openerEl - The element that triggers the menu; excluded from the\n * outside-click check and used as the toggle identity.\n * @param anchorRect - The trigger's viewport rect (e.g.\n * `DOM.source.getViewportRect(button)`); the menu opens below it and flips\n * above it when the room below is short.\n * @param configs - Ordered list of item descriptors to render. An empty list\n * opens nothing (see above).\n * @param onClose - Optional callback invoked once when the menu next closes,\n * or when an empty `configs` suppresses the open.\n *\n * @returns This menu, for method chaining.\n */\n toggleFor(openerEl: Handle, anchorRect: Rect, configs: MenuItemConfig[], onClose?: () => void): this {\n this.assertRebuildMode(\"toggleFor\");\n\n // Same opener fired again while its menu is open: close it. Its pointerdown\n // was excluded from the dismissal above, so this click is the toggle-shut.\n // MUST stay ahead of the empty check below — a provider that has since gone\n // empty must still be able to close the panel it opened.\n if (this._currentOpener === openerEl) {\n this.hide();\n\n return this;\n }\n\n // Nothing to show: an empty panel is never useful, so open nothing. `onClose`\n // still fires so the opener reverts an optimistic open-state affordance (e.g.\n // SplitButton's spun-up chevron), and `_currentOpener` stays untouched, so the\n // next press of this opener is a fresh open rather than a stale toggle-shut.\n if (configs.length === 0) {\n onClose?.();\n\n return this;\n }\n\n // Closed, or open for a different opener: (re)show anchored for this one.\n this.showAnchored(anchorRect, configs, onClose ?? null, openerEl);\n this._currentOpener = openerEl;\n\n return this;\n }\n\n /**\n * Hides the menu and detaches it from the DOM. **Rebuild-mode only.**\n *\n * The instance remains alive and can be shown again by calling `show()`.\n */\n hide(): this {\n this.assertRebuildMode(\"hide\");\n\n this.closeOpenSubmenu();\n\n LayerManager.unregister(this);\n\n this.fadeOutAndDetach();\n\n // Forget the toggle opener so the next `toggleFor` for it opens rather\n // than seeing a stale match and closing an already-closed menu.\n this._currentOpener = null;\n\n // Fire the per-show close callback exactly once, clearing it first so a\n // later bare `hide()` (or re-show) can't re-invoke a stale opener's hook.\n const onClose = this._rebuildOnClose;\n this._rebuildOnClose = null;\n onClose?.();\n\n return this;\n }\n\n /**\n * Returns the current pixel width of the rebuild-mode menu panel (the\n * content-fit width, or an explicit override set via {@link setMenuWidth}).\n *\n * @returns The current panel width in pixels.\n */\n getMenuWidth(): number {\n return this.getWidth();\n }\n\n /**\n * Pins the rebuild-mode menu panel to an explicit width, overriding the\n * default content-fit sizing. **Rebuild-mode only.**\n *\n * @param width - Width in pixels.\n */\n setMenuWidth(width: number): this {\n this.assertRebuildMode(\"setMenuWidth\");\n\n this._menuWidth = width;\n\n return this;\n }\n\n /**\n * Controls whether the menu scrolls to the bottom of its item list each time\n * it is shown. **Rebuild-mode only.**\n *\n * Use this for a menu whose latest entries sit at the bottom (e.g. a\n * chronological notification history), so the most recent items are visible\n * on open rather than the user having to scroll down. A no-op when the list\n * fits without scrolling.\n *\n * @param value - `true` to scroll to the bottom on every show.\n *\n * @returns This menu, for method chaining.\n */\n setScrollToBottomOnShow(value: boolean): this {\n this.assertRebuildMode(\"setScrollToBottomOnShow\");\n\n this._scrollToBottomOnShow = value;\n\n return this;\n }\n\n /**\n * Opens this panel positioned below the anchor element (top-level) or to the\n * right of the parent panel (submenu). Appends to `document.documentElement`.\n * **Persistent-mode only.**\n *\n * @param anchorEl - The `HTMLElement` of the triggering button or menu item.\n * @param parentPanel - When set, positions the panel as a submenu of this parent.\n */\n open(anchorEl: Handle, parentPanel?: Menu): this {\n this.assertPersistentMode(\"open\");\n\n // A provider-sourced menu re-resolves its items on every open, so labels\n // and enabled state reflect current state each time it is shown (a submenu\n // is a fresh panel per open, but a reused top-level dropdown is not).\n if (this._itemsProvider) {\n this.rebuildPersistentItems(this._itemsProvider());\n }\n\n // Clear the previous open's max-height (set by `applyViewportHeightClamp`)\n // before measuring, so a provider-sourced dropdown that grew reflects its\n // new content height rather than being capped at the old available room.\n this.setMaxSize({ width: Number.MAX_VALUE, height: Number.MAX_VALUE });\n\n const totalHeight = this.getPreferredSize()?.height ?? (this._menuItems.length * MenuItem.HEIGHT + 8);\n const width = this.getWidth();\n\n const el = this.getElement(true)!;\n LayerManager.mount(el);\n\n const vp = DOM.source.getViewportSize();\n\n if (parentPanel) {\n const parentEl = parentPanel.getElement();\n const parentRect = parentEl\n ? DOM.source.getElementRect(parentEl)\n : { left: 0, right: 0, top: 0, bottom: 0 };\n const anchorRect = DOM.source.getElementRect(anchorEl);\n\n let x = parentRect.right;\n\n if (x + width > vp.width) {\n x = parentRect.left - width;\n }\n\n // A submenu grows down from the anchor item's top, and flips up\n // against that same top edge when there is more room above.\n const y = this.placeVertically(anchorRect.top, anchorRect.top, totalHeight, vp.height);\n\n this.setAutoCommitStyle(false);\n this.setX(Math.max(0, x));\n this.setY(Math.max(0, y));\n this.setAutoCommitStyle(true);\n } else {\n const anchorRect = DOM.source.getElementRect(anchorEl);\n\n let x = anchorRect.left;\n\n if (x + width > vp.width) {\n x = vp.width - width;\n }\n\n // A top-level dropdown grows down from the anchor's bottom, and\n // flips up against the anchor's top when there is more room above.\n const y = this.placeVertically(anchorRect.bottom, anchorRect.top, totalHeight, vp.height);\n\n this.setAutoCommitStyle(false);\n this.setX(Math.max(0, x));\n this.setY(Math.max(0, y));\n this.setAutoCommitStyle(true);\n }\n\n const anchorId = DOM.source.getId(anchorEl);\n\n if (anchorId) {\n this.getAria().setLabelledBy(anchorId);\n }\n\n this.setVisible(true);\n this.doLayout();\n this.fadeIn();\n\n // Join the central layer tree so the manager owns dismissal and the\n // z-stamp. A submenu opened via `open(item, this)` registers while its\n // parent menu is topmost, so it links under the parent — a pointerdown\n // inside the submenu counts as inside the parent (cross-portal\n // containment) and keeps the whole chain open.\n LayerManager.register(this);\n this.setZIndex(LayerManager.getZIndex(this));\n\n return this;\n }\n\n /**\n * Closes this panel and any open child submenus. Detaches from the DOM.\n * **Persistent-mode only.**\n */\n close(): this {\n this.assertPersistentMode(\"close\");\n\n this.closeOpenSubmenu();\n\n this.setFocusedIndex(-1);\n this.clearItemHighlights();\n\n LayerManager.unregister(this);\n\n this.fadeOutAndDetach();\n\n return this;\n }\n\n /**\n * Clears the hover highlight from every item. A click that activates an item\n * dismisses the menu, detaching the panel from the DOM under the pointer; the\n * browser fires no `mouseout` for an element removed under a stationary\n * pointer, so the hovered item's `setFocused(true)` is never undone by\n * `_onMouseOut`. `setFocusedIndex(-1)` only resets the keyboard-tracked item,\n * not one highlighted purely by hover. Persistent-mode menus reuse these item\n * elements across open/close, so without this sweep the stale highlight\n * reappears the next time the menu opens.\n */\n private clearItemHighlights(): void {\n for (const item of this._menuItems) {\n if (item instanceof MenuItem) {\n item.setFocused(false);\n }\n }\n }\n\n /**\n * Plays the standard menu-panel entrance fade. Cancels any in-flight\n * fade-out so the deferred detach skips removing the still-visible panel.\n */\n private fadeIn(): void {\n this._fadeShowAnimation?.cancel();\n this._fadeShowAnimation = fadeShow(this, { durationMs: MENU_ANIM_DURATION_MS });\n }\n\n /**\n * Plays the standard menu-panel exit fade, then hides and detaches the\n * panel from the DOM when the transition completes. A fresh `show()` /\n * `open()` during the fade cancels the deferred detach.\n */\n private fadeOutAndDetach(): void {\n this._fadeHideAnimation?.cancel();\n this._fadeHideAnimation = fadeHideAndDetach(this, { durationMs: MENU_ANIM_DURATION_MS });\n }\n\n /**\n * Cancels any in-flight fade, then defers to the base class. Cancelling\n * first keeps a fade's fallback timer from firing after `super.destructor()`\n * has released this menu's element handle.\n */\n protected destructor(): void {\n this._fadeShowAnimation?.cancel();\n this._fadeShowAnimation = null;\n this._fadeHideAnimation?.cancel();\n this._fadeHideAnimation = null;\n\n // A still-open submenu is a raw field, not a registered child (see the\n // class comment above _menuItems: no Menu anywhere in the library is\n // registered via addComponent), so the child recursion in\n // super.destructor() below can never reach it.\n this._openSubmenuPanel?.dispose();\n this._openSubmenuPanel = null;\n\n // Cancelling the fades above suppresses whatever fade-completion callback\n // would otherwise have unregistered this menu from the layer tree\n // (mirrors AnimatedDropdown.destructor()). Idempotent, so an\n // already-closed menu costs nothing.\n LayerManager.unregister(this);\n\n super.destructor();\n }\n\n /**\n * Moves keyboard focus to the item at the given index. Pass `-1` to clear focus.\n * **Persistent-mode only.**\n *\n * @param index - Zero-based item index, or `-1` to clear.\n */\n focusItem(index: number): this {\n this.assertPersistentMode(\"focusItem\");\n\n this.setFocusedIndex(index);\n\n return this;\n }\n\n /**\n * Moves focus to the next focusable item, wrapping around and skipping separators.\n * **Persistent-mode only.**\n */\n focusNext(): this {\n this.assertPersistentMode(\"focusNext\");\n\n let next = this._focusedIndex + 1;\n\n while (next < this._menuItems.length && this.isItemSeparator(next)) {\n next++;\n }\n\n if (next >= this._menuItems.length) {\n next = 0;\n\n while (next < this._menuItems.length && this.isItemSeparator(next)) {\n next++;\n }\n }\n\n this.setFocusedIndex(next);\n\n return this;\n }\n\n /**\n * Moves focus to the previous focusable item, wrapping around and skipping separators.\n * **Persistent-mode only.**\n */\n focusPrev(): this {\n this.assertPersistentMode(\"focusPrev\");\n\n let prev = this._focusedIndex - 1;\n\n while (prev >= 0 && this.isItemSeparator(prev)) {\n prev--;\n }\n\n if (prev < 0) {\n prev = this._menuItems.length - 1;\n\n while (prev >= 0 && this.isItemSeparator(prev)) {\n prev--;\n }\n }\n\n this.setFocusedIndex(prev);\n\n return this;\n }\n\n /**\n * Activates the currently focused item. No-op when no item is focused or the item\n * is disabled or a separator. **Persistent-mode only.**\n */\n activateFocused(): void {\n this.assertPersistentMode(\"activateFocused\");\n\n if (this._focusedIndex < 0 || this._focusedIndex >= this._menuItems.length) {\n return;\n }\n\n const item = this._menuItems[this._focusedIndex];\n\n if (item instanceof MenuItem && !item.isSeparator() && item.isEnabled()) {\n item.activate();\n }\n }\n\n /**\n * Returns the index of the currently focused item, or `-1` if no item is focused.\n * **Persistent-mode only.**\n *\n * @returns The focused item index, or -1.\n */\n getFocusedIndex(): number {\n this.assertPersistentMode(\"getFocusedIndex\");\n\n return this._focusedIndex;\n }\n\n /**\n * Sets an element whose subtree is excluded from the outside-click-to-close check.\n * **Persistent-mode only.**\n *\n * Used by [`MenuBar`](/api/component/menubar/classes/MenuBar) to prevent a pointerdown on its own buttons from closing the panel\n * before the button's click handler has a chance to toggle the menu.\n *\n * @param el - The element to exclude, or `null` to clear.\n */\n setExcludedElement(el: Handle | null): this {\n this.assertPersistentMode(\"setExcludedElement\");\n\n this._excludedEl = el;\n\n return this;\n }\n\n /**\n * Returns the element whose subtree is currently excluded from the\n * outside-click-to-close check, or `null` if none is set.\n *\n * @returns The excluded element, or null.\n */\n getExcludedElement(): Handle | null {\n return this._excludedEl;\n }\n\n /**\n * Applies the persistent-mode chrome (MenuBar dropdown CSS variables, aria role).\n */\n private applyPersistentChrome(): void {\n this.setBackgroundColor(\"var(--ts-ui-menu-bar-panel-bg, rgb(255, 255, 255))\");\n this.setInsets(new Insets(4, 0, 4, 0));\n this.setBorder({ border: \"1px solid var(--ts-ui-menu-bar-panel-border, rgb(200, 200, 200))\" });\n this.setBorderRadius(\"var(--ts-ui-border-radius, 4px)\");\n this.setShadow(\"var(--ts-ui-menu-bar-panel-shadow, 2px 4px 8px rgba(0, 0, 0, 0.15))\");\n this.getAria().setRole(\"menu\");\n this.setContain(\"layout\");\n\n this.enableVerticalScroll();\n }\n\n /**\n * Applies the rebuild-mode chrome (right-click context-menu CSS variables).\n */\n private applyRebuildChrome(): void {\n this.setVisible(false);\n this.setBackgroundColor(\"var(--ts-ui-context-menu-bg, rgb(255, 255, 255))\");\n this.setInsets(new Insets(4, 0, 4, 0));\n this.setBorder({ border: \"1px solid var(--ts-ui-context-menu-border, rgb(200, 200, 200))\" });\n this.setBorderRadius(\"var(--ts-ui-border-radius, 4px)\");\n this.setShadow(\"var(--ts-ui-context-menu-shadow, 2px 4px 8px rgba(0, 0, 0, 0.15))\");\n this.setContain(\"layout\");\n\n this.enableVerticalScroll();\n }\n\n /**\n * Wires the native vertical-scroll primitives so an over-tall menu scrolls\n * its items instead of overflowing the clamped panel height. This is the\n * `\"y\"` case of [`Panel.setAutoScroll`](/api/core/classes/Panel#setautoscroll)\n * replicated directly: `overflow-x: hidden` (so a `visible` x-axis does not\n * compute to `auto` and sprout a spurious horizontal scrollbar), `overflow-y:\n * auto`, and the layout manager's vertical overflow flag so the `VBox` lays\n * items out past the clamped inner height rather than compressing them.\n */\n private enableVerticalScroll(): void {\n this.setOverflowX(\"hidden\");\n this.setOverflowY(\"auto\");\n\n (this.getLayoutManager() as VBox).setOverflowing(false, true);\n }\n\n /**\n * Caps the menu's height to the vertical room available at its anchored\n * position, then applies the content height. Because `Menu` is a\n * `clampsToContentSize()` component, `setHeight` runs `contentHeight` through\n * `clampHeight`, which caps it at `availableHeight`; when the content fits no\n * clamp fires, and when it overflows the height is capped and the\n * `overflow-y: auto` scrollbar engages. Width is left unconstrained via the\n * `Number.MAX_VALUE` \"no constraint\" sentinel — horizontal scroll is a\n * non-goal.\n *\n * @param availableHeight - Vertical room (px) the menu may occupy at its anchor.\n * @param contentHeight - The unclamped preferred height (px) of the menu's items.\n */\n private applyViewportHeightClamp(availableHeight: number, contentHeight: number): void {\n this.setMaxSize({ width: Number.MAX_VALUE, height: Math.max(0, availableHeight) });\n this.setHeight(contentHeight);\n }\n\n /**\n * Resolves the persistent-mode panel's top coordinate and applies the\n * matching height clamp. The menu grows downward from `growTop` unless the\n * content overflows the room below *and* the room above the anchor is\n * larger, in which case it flips to grow upward from `anchorTop`. Delegates\n * the room/flip arithmetic to {@link positionFlexibleAnchored}, which measures\n * the room against the side the menu actually grows toward — never re-derived\n * from a clamped top, which would let a flipped, viewport-pinned menu grow\n * back down across its anchor.\n *\n * @param growTop - The viewport edge the menu grows downward from.\n * @param anchorTop - The anchor edge the menu flips up against.\n * @param totalHeight - The unclamped preferred height (px) of the menu's items.\n * @param viewportHeight - The current viewport height (px).\n * @returns The resolved top coordinate (px) for the panel.\n */\n private placeVertically(growTop: number, anchorTop: number, totalHeight: number, viewportHeight: number): number {\n const { start, available } = positionFlexibleAnchored(anchorTop, growTop, totalHeight, viewportHeight, VIEWPORT_MARGIN);\n\n this.applyViewportHeightClamp(available, totalHeight);\n\n return start;\n }\n\n /**\n * Tear down the current persistent items and rebuild them from `configs`.\n * Used by `open()` to re-resolve a provider-sourced dropdown each time it\n * shows, so its labels / enabled state track current state. Mirrors the\n * rebuild-mode `show()` teardown, then defers to {@link buildPersistentItems}.\n *\n * @param configs - The freshly-resolved item configurations.\n */\n private rebuildPersistentItems(configs: MenuItemConfig[]): void {\n this.closeOpenSubmenu();\n\n this._menuItems = [];\n this._focusedIndex = -1;\n this.disposeAllComponents();\n\n this.buildPersistentItems(configs);\n }\n\n /**\n * Builds the item list for persistent mode and sets the panel width.\n *\n * @param items - The item configs from the constructor.\n */\n private buildPersistentItems(items: MenuItemConfig[]): void {\n this.pauseLayout();\n\n for (const config of items) {\n const item = new MenuItem(\n config,\n () => { config.action?.(); this._onClose!(); },\n (hoveredItem) => { this.handleItemOpenSubmenu(hoveredItem); }\n );\n\n this.addComponent(item);\n this._menuItems.push(item);\n }\n\n this.resumeLayout();\n\n this.setWidth(this.layOutColumns());\n }\n\n /**\n * Updates the focused-item highlight, clearing the previous item and setting the new one.\n *\n * @param index - The new focused index, or -1 to clear.\n */\n private setFocusedIndex(index: number): void {\n if (this._focusedIndex >= 0 && this._focusedIndex < this._menuItems.length) {\n const prev = this._menuItems[this._focusedIndex];\n\n if (prev instanceof MenuItem) {\n prev.setFocused(false);\n }\n }\n\n this._focusedIndex = index;\n\n if (index >= 0 && index < this._menuItems.length) {\n const next = this._menuItems[index];\n\n if (next instanceof MenuItem) {\n next.setFocused(true);\n }\n }\n }\n\n /**\n * Returns `true` if the item at the given index should be skipped during focus traversal.\n *\n * @param index - Zero-based item index.\n * @returns Whether the item is a separator (or [`MenuSeparator`](/api/component/container/classes/MenuSeparator) instance).\n */\n private isItemSeparator(index: number): boolean {\n const item = this._menuItems[index];\n\n if (item instanceof MenuSeparator) {\n return true;\n }\n\n if (item instanceof MenuItem) {\n return item.isSeparator();\n }\n\n return false;\n }\n\n /**\n * Closes and forgets this menu's open child submenu, if any. Shared by the\n * teardown paths (`hide` / `close`) and by the submenu switch in\n * `handleItemOpenSubmenu` when a different item takes the child slot.\n */\n private closeOpenSubmenu(): void {\n if (this._openSubmenuPanel) {\n this._openSubmenuPanel.close();\n this._openSubmenuItem?.getAria().setExpanded(false);\n this._openSubmenuPanel = null;\n this._openSubmenuItem = null;\n }\n }\n\n /**\n * Closes the whole menu chain through the current mode's close path: the\n * persistent-mode `onClose` callback (a menubar dropdown), or `hide()` for a\n * rebuild-mode context menu — which also tears down any open child submenu.\n * Used by an activated submenu leaf and the outside-click / window-blur\n * dismissals, so a submenu selection closes the parent context menu too.\n */\n private dismissAll(): void {\n if (this._persistent) {\n this._onClose!();\n } else {\n this.hide();\n }\n }\n\n // ----- DismissableLayer -----\n\n /**\n * Returns the menu panel's root element for the central layer tree.\n *\n * @returns The menu's element, or null when not yet rendered.\n */\n getLayerElement(): Handle | null {\n return this.getElement() ?? null;\n }\n\n /**\n * Returns the dismiss mode the document-level handlers consult. A menu is\n * `\"click-outside\"`: dismissed by a `pointerdown` outside its layer subtree\n * (and its excluded trigger) and by a window blur, but never by a focus\n * move — exactly the pointerdown + window-blur behaviour the menu owned\n * before it joined the layer tree.\n *\n * @returns The layer dismiss mode.\n */\n getDismissMode(): LayerDismissMode {\n return \"click-outside\";\n }\n\n /**\n * Advisory close request from the manager (an outside `pointerdown`, a\n * window blur, or Escape). Routes through the mode-aware close chain: a\n * persistent (MenuBar) menu fires its `onClose`, a rebuild (context) menu\n * calls `hide()`; either way any open submenu is torn down.\n */\n requestClose(): void {\n this.dismissAll();\n }\n\n /**\n * Returns the trigger element excluded from the manager's outside-pointerdown\n * test — the context-menu opener passed to {@link show} / {@link toggleFor},\n * or the [`MenuBar`](/api/component/menubar/classes/MenuBar) button set via\n * {@link setExcludedElement} — so the gesture that opened the menu does not\n * immediately re-close it.\n *\n * @returns The excluded element, or null.\n */\n getAnchorElement(): Handle | null {\n return this._excludedEl;\n }\n\n /**\n * Returns the dropdown z-index band so an unrelated top-level menu stacks in\n * the dropdown family. A submenu — or a menu opened while another layer is\n * topmost — inherits its opener's band instead, so it rises above the\n * surface it was opened from.\n *\n * @returns The dropdown band base.\n */\n getBand(): number {\n return LayerManager.Band.Dropdown;\n }\n\n /**\n * Mirrors a manager-allocated z-index onto the element when the layer this\n * menu was opened inside is raised via the manager's bring-to-front path,\n * so an open menu never falls behind the surface it belongs to.\n *\n * @param zIndex - The fresh z-index assigned by the manager.\n */\n onZIndexChanged(zIndex: number): void {\n this.setZIndex(zIndex);\n }\n\n /**\n * Handles the open-submenu signal from a hovered or activated [`MenuItem`](/api/component/container/classes/MenuItem).\n *\n * Closes any existing child submenu when the item has no submenu (or is\n * disabled); opens or switches to the child panel when it does.\n *\n * @param item - The [`MenuItem`](/api/component/container/classes/MenuItem) that triggered the signal.\n */\n private handleItemOpenSubmenu(item: MenuItem): void {\n // A disabled item opens no submenu (even though it has one); like a plain\n // item, hovering it just closes any sibling submenu that is open.\n if (!item.hasSubmenu() || !item.isEnabled()) {\n this.closeOpenSubmenu();\n\n return;\n }\n\n if (this._openSubmenuItem === item) {\n return;\n }\n\n this.closeOpenSubmenu();\n\n const submenuPanel = new Menu(\n item.getSubmenuConfig()!.items,\n () => { this.dismissAll(); }\n );\n\n this._openSubmenuPanel = submenuPanel;\n this._openSubmenuItem = item;\n item.getAria().setExpanded(true);\n\n submenuPanel.setExcludedElement(this.getElement(true)!);\n submenuPanel.open(item.getElement(true)!, this);\n }\n\n /**\n * Throws if the method called is not valid in the current mode (rebuild-only check).\n *\n * @param method - Name of the method that was invoked, used in the error message.\n */\n private assertRebuildMode(method: string): void {\n if (this._persistent) {\n throw new Error(`Menu.${method}() is only valid in rebuild mode (constructed without arguments).`);\n }\n }\n\n /**\n * Throws if the method called is not valid in the current mode (persistent-only check).\n *\n * @param method - Name of the method that was invoked, used in the error message.\n */\n private assertPersistentMode(method: string): void {\n if (!this._persistent) {\n throw new Error(`Menu.${method}() is only valid in persistent mode (constructed with items and onClose).`);\n }\n }\n}\n\nconst MenuCallable = callable(Menu);\ntype MenuCallable = Menu;\nexport {\n Menu as _Menu,\n MenuCallable as Menu\n};\n"],"mappings":"qXAykBA,IAAM,EAAmB,EAAS,MA3d5B,iBAAiB,CAAU,CAG7B,OAAgB,OAAiB,GAEjC,OAAwB,iBAA2B,EAEnD,OAAgB,WAAqB,EAErC,OAAgB,UAAoB,GAEpC,OAAgB,aAAuB,GAEvC,OAAgB,UAAoB,EAKpC,OAAgB,SAAmB,GAEnC,QACA,YACA,eACA,cAEA,UAAiC,KACjC,WAAmC,KACnC,WAAkC,KAClC,cAAqC,KACrC,aAAoC,KAMpC,WAAoC,KACpC,aAAsC,KAEtC,cAA8D,KAE9D,aACA,YACA,SAUA,YACI,EACA,EACA,EACA,EAAqC,WACrC,EACF,CAUE,GAPA,MAAM,EAEN,KAAK,QAAU,EACf,KAAK,YAAc,EACnB,KAAK,eAAiB,EACtB,KAAK,cAAgB,EAEjB,EAAO,UAAW,CAClB,KAAK,UAAU,SAAS,gBAAgB,EACxC,KAAK,iBAAiB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AAa,KAAK,EAAK,WAAW,EAAI,EAAI,IAAI,CAClD,CAOA,kBAA0B,EAAsB,CAC5C,GAAI,KAAK,YACL,MAAU,MAAM,QAAQ,EAAO,kEAAkE,CAEzG,CAOA,qBAA6B,EAAsB,CAC/C,GAAI,CAAC,KAAK,YACN,MAAU,MAAM,QAAQ,EAAO,0EAA0E,CAEjH,CACJ,CAEkC"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./DOM-67StIm5G.js";import{n as t}from"./Position-Ck_KD4cR.js";import{S as n,b as r,h as i,y as a}from"./Component-fRQvgaEY.js";import{i as o,n as s,r as c,t as l}from"./Scrollbar-SOj9psiP.js";import{t as u}from"./Container-0bsG2Q8Z.js";var d={tag:`div`,insets:new t(4,4,4,4),autoScroll:`none`,scrollShadows:!0,scrollbarStyle:`overlay`},f=`PanelOverlayScroller`,p=null;function ensureOverlayScrollerClassRule(){p||=[new r({scope:`class`,name:f,styles:{scrollbarWidth:`none`}}),new r({scope:`selector`,name:`.${f}::-webkit-scrollbar`,styles:{display:`none`}})]}var Panel=class extends u{_shadowOverlayStyle=new a;_lastChildCount=0;_overlayScrollStyle=new a;_onOverlayScrollV=e=>{this.setScrollTop(e)};_onOverlayScrollH=e=>{this.setScrollLeft(e)};constructor(e,n){let r=e?.flush?{insets:new t(0,0,0,0)}:{};super(e,{...d,...n??{},...r})}applyOptions(e){return super.applyOptions(e),this.setScrollbarGutter(0,0),this._shadowEdges={top:0,bottom:0,left:0,right:0},this._lastContentExtent={width:0,height:0},this.setAutoScroll(e.autoScroll??this.getAutoScroll()),this._shadowOverlay=null,this._shadowScrollHandler=null,this.setScrollShadows(e.scrollShadows??this.getScrollShadows()),this._overlayScrollElement=null,this._scrollbarV=null,this._scrollbarH=null,this._overlayScrollHandler=null,this.setScrollbarStyle(e.scrollbarStyle??this.getScrollbarStyle()),this}setAutoScroll(e){switch(this._autoScroll=e,e){case`none`:this.setOverflowX(`hidden`).setOverflowY(`hidden`);break;case`auto`:this.setOverflowX(`auto`).setOverflowY(`auto`);break;case`x`:this.setOverflowX(`auto`).setOverflowY(`hidden`);break;case`y`:this.setOverflowX(`hidden`).setOverflowY(`auto`);break;case`both`:this.setOverflowX(`scroll`).setOverflowY(`scroll`);break}e===`none`&&(this._scrollbarGutter.right!==0||this._scrollbarGutter.bottom!==0)&&this.setScrollbarGutter(0,0);let t=this.scrollableAxes();return this.getLayoutManager()?.setOverflowing(t.x,t.y),this.refreshOverlayScrollbars(),this.refreshScrollShadows(),this}setLayoutManager(e){return super.setLayoutManager(e),this.setAutoScroll(this._autoScroll),this}getAutoScroll(){return this._autoScroll??this._defaultOptions.autoScroll}clearAutoScroll(){return this.setAutoScroll(`none`)}setScrollShadows(e){return this._scrollShadows=e,this.refreshScrollShadows(),this}getScrollShadows(){return this._scrollShadows??this._defaultOptions.scrollShadows}setScrollbarStyle(e){return this._scrollbarStyle=e,this.refreshOverlayScrollbars(),this.refreshScrollShadows(),this}getScrollbarStyle(){return this._scrollbarStyle??this._defaultOptions.scrollbarStyle}getScrollElement(){return this._overlayScrollElement??this.getElement()}getInnerSize(){let e=super.getInnerSize();return e?{width:e.width-this._scrollbarGutter.right,height:e.height-this._scrollbarGutter.bottom}:null}doLayout(){return super.doLayout(),this.commitElementStyle(),this.resizeScrollShadowOverlay(),this.measureScrollbarGutter(),this.updateScrollShadows(),this.scheduleGutterSettleOnShrink(),this}scheduleGutterSettleOnShrink(){if(this._autoScroll===`none`)return;let e=this.getComponents().length,t=e<this._lastChildCount;this._lastChildCount=e;let n=!1;if(this.showsScrollAffordance()){let e=this.getPreferredSize(),t=e?e.width:0,r=e?e.height:0;n=t<this._lastContentExtent.width||r<this._lastContentExtent.height,this._lastContentExtent={width:t,height:r}}(t||n)&&this.scheduleLayout()}showsScrollAffordance(){return this._scrollbarGutter.right>0||this._scrollbarGutter.bottom>0||this._shadowEdges.top>0||this._shadowEdges.bottom>0||this._shadowEdges.left>0||this._shadowEdges.right>0}init(e){super.init(e);let t=e??this.getElement();return t&&this._scrollbarStyle===`overlay`&&this._autoScroll!==`none`&&(this.installOverlayScrollbars(t),this.layoutOverlayScrollbars(t)),t&&this._scrollShadows&&this._autoScroll!==`none`&&(this.installScrollShadows(t),this.updateScrollShadows(t)),this}destructor(){this.removeScrollShadows(),this.removeOverlayScrollbars(),super.destructor()}scrollableAxes(){let e=this._autoScroll;return{x:e===`x`||e===`auto`||e===`both`,y:e===`y`||e===`auto`||e===`both`}}setScrollbarGutter(e,t){this._scrollbarGutter={right:e,bottom:t}}measureScrollbarGutter(){if(this._autoScroll===`none`)return;if(this._scrollbarStyle===`overlay`){this.layoutOverlayScrollbars();return}let t=this.getElement();if(!t)return;let n=e.source.getScrollBarWidth();if(n===0)return;let r,i;if(this._autoScroll===`both`)r=!0,i=!0;else{let n=this.scrollableAxes(),a=e.source.getScrollMetrics(t);r=n.y&&a.scrollHeight>a.clientHeight,i=n.x&&a.scrollWidth>a.clientWidth}let a=r?n:0,o=i?n:0;a===this._scrollbarGutter.right&&o===this._scrollbarGutter.bottom||(this.setScrollbarGutter(a,o),this.scheduleLayout())}refreshScrollShadows(){if(!this._scrollShadows||this._autoScroll===`none`){this.removeScrollShadows();return}let e=this.getElement();e&&(this.installScrollShadows(e),this.updateScrollShadows(e))}installScrollShadows(e){if(this._shadowOverlay||this.createScrollShadowOverlay(e),!this._shadowScrollHandler){let handler=()=>{this.updateScrollShadows()};this._shadowScrollHandler=handler,n.addSubtreeListener(this,`scroll`,handler)}}createScrollShadowOverlay(t){let n=e.sink.createElement(`div`);this._shadowOverlayStyle.attach(n),this._shadowOverlayStyle.setMany({position:`sticky`,left:`0px`,top:`0px`,pointerEvents:`none`,zIndex:`1`,boxShadow:s()}),e.sink.appendChild(t,n),this.trackHandle(n),this._shadowOverlay=n}removeScrollShadows(){this._shadowScrollHandler&&=(n.removeSubtreeListener(this,`scroll`,this._shadowScrollHandler),null),this._shadowOverlay&&(e.sink.removeElement(this._shadowOverlay),this.untrackHandle(this._shadowOverlay),e.sink.release(this._shadowOverlay),this._shadowOverlay=null,this._shadowOverlayStyle=new a),this._shadowEdges={top:0,bottom:0,left:0,right:0}}resizeScrollShadowOverlay(t){let n=t??this.getElement();if(!n||!this._shadowOverlay)return;let{clientWidth:r,clientHeight:i}=e.source.getScrollMetrics(n),a=this._scrollbarStyle===`overlay`?this._scrollbarGutter.right:0,o=this._scrollbarStyle===`overlay`?this._scrollbarGutter.bottom:0;this._shadowOverlayStyle.setMany({width:r-a+`px`,height:i-o+`px`})}updateScrollShadows(t){let n=t??this.getElement();if(!n||!this._shadowOverlay)return;let{scrollTop:r,scrollLeft:i,scrollWidth:a,scrollHeight:s,clientWidth:c,clientHeight:l}=e.source.getScrollMetrics(this.getScrollElement()??n);this.resizeScrollShadowOverlay(n);let u=s-l,d=a-c,f=o,p=this.scrollableAxes();this.setShadowEdge(`top`,`--ts-ss-top`,p.y?f(r):0),this.setShadowEdge(`bottom`,`--ts-ss-bottom`,p.y?f(u-r):0),this.setShadowEdge(`left`,`--ts-ss-left`,p.x?f(i):0),this.setShadowEdge(`right`,`--ts-ss-right`,p.x?f(d-i):0)}setShadowEdge(e,t,n){let r=Math.round(n*100);this._shadowEdges[e]!==r&&(this._shadowEdges[e]=r,this._shadowOverlayStyle.set(t,c(r)))}refreshOverlayScrollbars(){if(this._scrollbarStyle!==`overlay`||this._autoScroll===`none`){this.removeOverlayScrollbars();return}let e=this.getElement();e&&(this.installOverlayScrollbars(e),this.layoutOverlayScrollbars(e))}installOverlayScrollbars(t){if(!this._overlayScrollElement){ensureOverlayScrollerClassRule();let n=e.sink.createElement(`div`);this._overlayScrollStyle.attach(n),this._overlayScrollStyle.setMany({position:`absolute`,left:`0px`,top:`0px`,width:`100%`,height:`100%`}),e.sink.apply(n,{addClass:[f]}),e.sink.appendChild(t,n),this.reparentContent(t,n),this.trackHandle(n),this._overlayScrollElement=n}let r=this.scrollableAxes();if(this._overlayScrollStyle.setMany({overflowX:r.x?`auto`:`hidden`,overflowY:r.y?`auto`:`hidden`}),this._scrollbarV||(this._scrollbarV=new l(`vertical`),this._scrollbarV.setZIndex(2),e.sink.appendChild(t,this._scrollbarV.getElement(!0)),this._scrollbarV.on(`scroll`,this._onOverlayScrollV)),this._scrollbarH||(this._scrollbarH=new l(`horizontal`),this._scrollbarH.setZIndex(2),e.sink.appendChild(t,this._scrollbarH.getElement(!0)),this._scrollbarH.on(`scroll`,this._onOverlayScrollH)),!this._overlayScrollHandler){let handler=()=>{this.syncOverlayScrollbars()};this._overlayScrollHandler=handler,n.addSubtreeListener(this,`scroll`,handler)}this.setNativeScrollbarHidden(!0)}removeOverlayScrollbars(){if(this._overlayScrollHandler&&=(n.removeSubtreeListener(this,`scroll`,this._overlayScrollHandler),null),this._scrollbarV&&=(this._scrollbarV.off(`scroll`,this._onOverlayScrollV),this._scrollbarV.dispose(),null),this._scrollbarH&&=(this._scrollbarH.off(`scroll`,this._onOverlayScrollH),this._scrollbarH.dispose(),null),this._overlayScrollElement){let t=this.getElement();t&&this.reparentContent(this._overlayScrollElement,t),e.sink.removeElement(this._overlayScrollElement),this.untrackHandle(this._overlayScrollElement),e.sink.release(this._overlayScrollElement),this._overlayScrollElement=null,this._overlayScrollStyle=new a}this.setNativeScrollbarHidden(!1),this.setScrollbarGutter(0,0)}setNativeScrollbarHidden(e){this.setElementCSSRule(`scrollbarWidth`,e?`none`:null),this.createStyleRule(`::-webkit-scrollbar`).set(`display`,e?`none`:null)}layoutOverlayScrollbars(t){let n=t??this.getElement(),r=this._overlayScrollElement;if(!n||!r||!this._scrollbarV||!this._scrollbarH)return;let i=this._scrollbarV.getTrackWidth(),a=e.source.getScrollMetrics(n),o=a.clientWidth,s=a.clientHeight,c=this._scrollbarGutter.right,l=this._scrollbarGutter.bottom;this._overlayScrollStyle.setMany({width:o-c+`px`,height:s-l+`px`});let u=e.source.getScrollMetrics(r),d=this.scrollableAxes(),f=d.y&&u.scrollHeight>u.clientHeight,p=d.x&&u.scrollWidth>u.clientWidth,m=o-(f?i:0),h=s-(p?i:0);(m!==o-c||h!==s-l)&&this._overlayScrollStyle.setMany({width:m+`px`,height:h+`px`}),this._scrollbarV.setX(m),this._scrollbarV.setY(0),this._scrollbarV.setHeight(h),this._scrollbarV.setMetrics(h,u.scrollHeight,u.scrollTop),this._scrollbarH.setX(0),this._scrollbarH.setY(h),this._scrollbarH.setWidth(m),this._scrollbarH.setMetrics(m,u.scrollWidth,u.scrollLeft);let g=f?i:0,_=p?i:0;(g!==c||_!==l)&&(this.setScrollbarGutter(g,_),this.scheduleLayout())}syncOverlayScrollbars(){let t=this._overlayScrollElement;if(!t||!this._scrollbarV||!this._scrollbarH)return;let n=e.source.getScrollMetrics(t);this._scrollbarV.setMetrics(n.clientHeight,n.scrollHeight,n.scrollTop),this._scrollbarH.setMetrics(n.clientWidth,n.scrollWidth,n.scrollLeft)}},m=i(Panel);export{m as t};
2
- //# sourceMappingURL=Panel-Rd9zkNXx.js.map
@@ -1,2 +0,0 @@
1
- import{S as e,h as t,t as n,v as r}from"./Component-fRQvgaEY.js";import{t as i}from"./Glyph-wN7bk7mg.js";import{t as a}from"./AbstractBooleanInput-DE5NNJT0.js";import{r as o}from"./VBox-P3WFGkPc.js";import{circle as s}from"./glyphs/solid/circle.es.js";i.register(s);var RadioButton=class extends a{_ring;_dot;constructor(t,a){super({...a??{}}),this.setLayoutManager(new o),this._ring=new n,this._ring.setPreferredSize({width:16,height:16}),this._ring.setMinSize({width:16,height:16}),this._ring.setMaxSize({width:16,height:16}),this._ring.setSize({width:16,height:16}),this._ring.setBackgroundColor(`var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`),this._ring.setBorder(`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._ring.setBorderRadius(`50%`),this._ring.setCursor(`pointer`),this._dot=new i(`circle`),this._dot.setForegroundColor(`var(--ts-ui-radio-dot-color, rgb(255, 255, 255))`),this._dot.setPreferredSize({width:8,height:8}),this._dot.setMaxSize({width:8,height:8}),this._dot.setX(3),this._dot.setY(3),this._dot.setOpacity(0),this._dot.setPointerEvents(`none`),r.isReducedMotion()||(this._dot.setTransition(`opacity 120ms ease-out`),this._ring.setTransition(`background-color 120ms ease-out, border-color 120ms ease-out`)),this._ring.addComponent(this._dot),super.addComponent(this._ring),this.getAria().setRole(`radio`),this.getAria().setTabIndex(0),this.getAria().setChecked(!1),this.setOutline(`none`),e.addListener(this._ring,`click`,()=>this.activateFromPointer()),this.installKeyboard(),this._options.label===void 0&&this._options.text===void 0&&t!==void 0?this._options.label=t:this._options.label===void 0&&this._options.text!==void 0&&(this._options.label=this._options.text),this._options.value!==void 0&&this._options.selected===void 0&&(this._options.selected=this._options.value),this._options.selected!==void 0&&this.applySelected(this._options.selected),this._options.label!==void 0&&this.applyLabel(this._options.label),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&(this._options.selected=e.selected),e.value!==void 0&&(this._options.value=e.value),e.label!==void 0&&(this._options.label=e.label),e.text!==void 0&&(this._options.text=e.text),e.radioName!==void 0&&(this._options.radioName=e.radioName),e.enabled!==void 0&&(this._options.enabled=e.enabled),e.readOnly!==void 0&&(this._options.readOnly=e.readOnly),this}activate(){this.isSelected()||(this.setSelected(!0),e.fireEvent(this,`change`))}getInteractiveSurface(){return this._ring}isSelected(){return this._options.selected??!1}setSelected(e){let t=!!e;return t===this.isSelected()?this:(this._options.selected=t,this.applySelected(t),this.notifyChange(t),this)}getValue(){return this.isSelected()}setValue(e){return this.setSelected(e)}setRadioName(e){return this._options.radioName=e,this}clearRadioName(){return this._options.radioName=void 0,this}getRadioName(){return this._options.radioName??null}on(t,n){return t===`action`?(e.addListener(this,`change`,n),this):super.on(t,n)}off(t,n){return t===`action`?(e.removeListener(this,`change`,n),this):super.off(t,n)}applySelected(e){this.getAria().setChecked(e),this._ring.setBackgroundColor(e?`var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))`:`var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`),this._ring.setBorder(e?`1px solid var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))`:`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._dot.setOpacity(+!!e)}},c=t(RadioButton);export{c as t};
2
- //# sourceMappingURL=RadioButton-D23rId-V.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RadioButton-D23rId-V.js","names":[],"sources":["../../src/typescript/lib/component/input/RadioButton.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Animation } from \"~/core/Animation.js\";\nimport { AbstractBooleanInput, AbstractBooleanInputOptions } from \"~/component/input/AbstractBooleanInput.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport { HBox } from \"~/layout/HBox.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { circle } from \"~/glyphs/solid/circle.js\";\n\n// Idempotent registration: makes the `\"circle\"` glyph available for the dot\n// regardless of which control imports first.\nGlyph.register(circle);\n\n/**\n * Construction-time options for {@link RadioButton}.\n *\n * @category Components\n */\nexport interface RadioButtonOptions extends AbstractBooleanInputOptions {\n selected?: boolean;\n value?: boolean;\n text?: string;\n radioName?: string;\n /**\n * Construction-time listener bag — the declarative form of `on()`. Adds the\n * radio button's `action` shorthand to the inherited `change` / `binding`.\n */\n listeners?: {\n action?: () => void;\n change?: (value: boolean) => void;\n binding?: () => void;\n };\n}\n\n/**\n * A custom-drawn radio button rendered as a focusable `<div>` with\n * `role=\"radio\"`. The ring + dot is drawn with framework primitives; the\n * native `<input type=\"radio\">` is intentionally not used. Group selection\n * is coordinated by [`ButtonGroup`](/api/overlay/classes/ButtonGroup); keyboard\n * navigation within a group is provided by\n * [`RovingTabIndex`](/api/core/classes/RovingTabIndex).\n *\n * @category Components\n */\nclass RadioButton<TOptions extends RadioButtonOptions = RadioButtonOptions>\n extends AbstractBooleanInput<TOptions>\n{\n private _ring: Component;\n private _dot: Glyph;\n\n /**\n * Constructs a RadioButton.\n *\n * @param text - Optional label text. Equivalent to `options.label`; kept\n * positional for back-compat with consumers that wrote\n * `new RadioButton(\"Hello\")`.\n * @param options - Optional construction-time options bag.\n */\n constructor(text?: string, options?: TOptions) {\n super({ ...(options ?? {}) } as TOptions);\n\n this.setLayoutManager(new HBox());\n\n this._ring = new Component();\n this._ring.setPreferredSize({ width: 16, height: 16 });\n // Min = preferred = max so the outer HBox shrink-on-overallocation\n // can't collapse the ring graphic when the radio is packed into a\n // tight container with siblings that have flexible widths.\n this._ring.setMinSize({ width: 16, height: 16 });\n this._ring.setMaxSize({ width: 16, height: 16 });\n this._ring.setSize({ width: 16, height: 16 });\n this._ring.setBackgroundColor(\"var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))\");\n this._ring.setBorder(\"1px solid var(--ts-ui-form-border, rgb(160, 160, 160))\");\n this._ring.setBorderRadius(\"50%\");\n // The ring owns the click + cursor surface so the pointer/click area\n // matches the visible graphic exactly. The root stays inert (default\n // cursor, no click listener), so clicks on a label or in any\n // stretched empty space don't select and don't show the pointer cursor.\n this._ring.setCursor(\"pointer\");\n\n this._dot = new Glyph(\"circle\");\n this._dot.setForegroundColor(\"var(--ts-ui-radio-dot-color, rgb(255, 255, 255))\");\n this._dot.setPreferredSize({ width: 8, height: 8 });\n this._dot.setMaxSize({ width: 8, height: 8 });\n this._dot.setX(3);\n this._dot.setY(3);\n this._dot.setOpacity(0);\n // Pass-through so clicks on the dot still hit the ring underneath.\n this._dot.setPointerEvents(\"none\");\n\n if (!Animation.isReducedMotion()) {\n this._dot.setTransition(\"opacity 120ms ease-out\");\n this._ring.setTransition(\"background-color 120ms ease-out, border-color 120ms ease-out\");\n }\n\n this._ring.addComponent(this._dot);\n super.addComponent(this._ring);\n\n this.getAria().setRole(\"radio\");\n this.getAria().setTabIndex(0);\n this.getAria().setChecked(false);\n\n this.setOutline(\"none\");\n\n // The ring owns the user-select click so the pointer/click + cursor\n // surface is exactly the visible 16 × 16 graphic — clicks on a label or\n // in any stretched empty area pass through to the root, which has no\n // listener of its own. This pointer line stays per-subclass (a closure\n // over the widget `this`) because a listener registered on the child\n // ring would otherwise bind `this` to the ring; only the keyboard path,\n // registered on the root, moves into the base.\n Event.addListener(this._ring, \"click\", () => this.activateFromPointer());\n this.installKeyboard();\n\n // The positional `text` arg wins only when `options.label` (or\n // `options.text`) was not provided.\n if (this._options.label === undefined && this._options.text === undefined && text !== undefined) {\n this._options.label = text;\n } else if (this._options.label === undefined && this._options.text !== undefined) {\n this._options.label = this._options.text;\n }\n\n if (this._options.value !== undefined && this._options.selected === undefined) {\n this._options.selected = this._options.value;\n }\n\n if (this._options.selected !== undefined) {\n this.applySelected(this._options.selected);\n }\n\n if (this._options.label !== undefined) {\n this.applyLabel(this._options.label);\n }\n\n if (this._options.enabled !== undefined) {\n this.applyEnabled(this._options.enabled);\n }\n\n if (this._options.readOnly !== undefined) {\n this.applyReadOnly(this._options.readOnly);\n }\n }\n\n /**\n * Applies a {@link RadioButtonOptions} bag. Inherited Component fields\n * cascade through `super.applyOptions`; radio-button-specific fields are\n * stored pure on `_options` so the constructor body can dispatch them\n * after children are built.\n *\n * @param options - The options bag carrying the values to apply.\n *\n * @returns This component, for method chaining.\n */\n protected applyOptions(options: TOptions): this {\n super.applyOptions(options);\n\n if (options.selected !== undefined) this._options.selected = options.selected;\n if (options.value !== undefined) this._options.value = options.value;\n if (options.label !== undefined) this._options.label = options.label;\n if (options.text !== undefined) this._options.text = options.text;\n if (options.radioName !== undefined) this._options.radioName = options.radioName;\n if (options.enabled !== undefined) this._options.enabled = options.enabled;\n if (options.readOnly !== undefined) this._options.readOnly = options.readOnly;\n\n return this;\n }\n\n /**\n * Activates the radio button from a click or key: radio buttons can only be\n * selected, never directly deselected by the user (the `ButtonGroup`\n * deselects siblings on change), so this selects and fires the DOM `change`\n * only on a real off→on transition. The enabled/read-only guard is applied\n * by the base before this runs.\n */\n protected activate(): void {\n if (!this.isSelected()) {\n this.setSelected(true);\n Event.fireEvent(this, \"change\");\n }\n }\n\n /**\n * Returns the inner ring graphic — the click + cursor surface.\n *\n * @returns The ring component.\n */\n protected getInteractiveSurface(): Component {\n return this._ring;\n }\n\n /**\n * Returns whether the radio button is currently selected.\n *\n * @returns `true` when selected.\n */\n isSelected(): boolean {\n return this._options.selected ?? false;\n }\n\n /**\n * Sets the selected state and updates the visual + ARIA cache. Used both\n * by user-driven selection and by `ButtonGroup` when it deselects\n * siblings.\n *\n * @param value - `true` to select, `false` to deselect.\n *\n * @returns This component, for method chaining.\n */\n setSelected(value: boolean): this {\n const next = !!value;\n if (next === this.isSelected()) {\n return this;\n }\n\n this._options.selected = next;\n this.applySelected(next);\n this.notifyChange(next);\n\n return this;\n }\n\n /**\n * Returns the current value (alias for {@link isSelected}, satisfies\n * [`Bindable`](/api/core/interfaces/Bindable)).\n *\n * @returns `true` when selected.\n */\n getValue(): boolean {\n return this.isSelected();\n }\n\n /**\n * Sets the value (alias for {@link setSelected}, satisfies [`Bindable`](/api/core/interfaces/Bindable)).\n *\n * @param value - The new selected state.\n *\n * @returns This component, for method chaining.\n */\n setValue(value: boolean): this {\n return this.setSelected(value);\n }\n\n /**\n * Back-compat shim that stores the supplied group name on `_options` but\n * does not emit a `name` attribute (the host element is no longer\n * `<input>`). Consumers that read the group name through\n * {@link getRadioName} keep working.\n *\n * @param name - Group name string.\n *\n * @returns This component, for method chaining.\n */\n setRadioName(name: string): this {\n this._options.radioName = name;\n\n return this;\n }\n\n /**\n * Clears the back-compat radio-name field.\n *\n * @returns This component, for method chaining.\n */\n clearRadioName(): this {\n this._options.radioName = undefined;\n\n return this;\n }\n\n /**\n * Returns the group name set via {@link setRadioName}, or `null`.\n *\n * @returns The group name string, or `null`.\n */\n getRadioName(): string | null {\n return this._options.radioName ?? null;\n }\n\n /**\n * Registers a listener for one of this radio button's events.\n * `\"action\"` is a typed semantic shorthand over {@link Event.addListener}\n * for the DOM change event — fired on user-driven selection and used by\n * [`ButtonGroup`](/api/overlay/classes/ButtonGroup) to enforce mutual\n * exclusivity. `\"change\"` and `\"binding\"` are the inherited\n * {@link AbstractInput} listener-bag events.\n *\n * @param event - The event name.\n * @param listener - The callback to invoke when the event fires.\n *\n * @returns This component, for method chaining.\n */\n on(event: \"action\", listener: Event.Listener): this;\n on(event: \"change\", listener: (value: boolean) => void): this;\n on(event: \"binding\", listener: () => void): this;\n on(event: \"action\" | \"change\" | \"binding\", listener: Function): this {\n if (event === \"action\") {\n Event.addListener(this, \"change\", listener as Event.Listener);\n\n return this;\n }\n\n return super.on(event as \"change\", listener as (value: boolean) => void);\n }\n\n /**\n * Removes a previously registered listener. The exact callback\n * reference must match the one passed to {@link on}.\n *\n * @param event - The event the listener was registered for.\n * @param listener - The callback to remove.\n *\n * @returns This component, for method chaining.\n */\n off(event: \"action\" | \"change\" | \"binding\", listener: Function): this {\n if (event === \"action\") {\n Event.removeListener(this, \"change\", listener as Event.Listener);\n\n return this;\n }\n\n return super.off(event, listener);\n }\n\n /**\n * Updates the visual + ARIA state for the given selected flag.\n */\n private applySelected(selected: boolean): void {\n this.getAria().setChecked(selected);\n\n this._ring.setBackgroundColor(selected\n ? \"var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))\"\n : \"var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))\");\n this._ring.setBorder(selected\n ? \"1px solid var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))\"\n : \"1px solid var(--ts-ui-form-border, rgb(160, 160, 160))\");\n\n this._dot.setOpacity(selected ? 1 : 0);\n }\n\n}\n\nconst RadioButtonCallable = callable(RadioButton);\ntype RadioButtonCallable<TOptions extends RadioButtonOptions = RadioButtonOptions> = RadioButton<TOptions>;\nexport {\n RadioButton as _RadioButton,\n RadioButtonCallable as RadioButton\n};\n"],"mappings":"4PAaA,EAAM,SAAS,CAAM,EAiCrB,IAA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O,KAAK,SAAS,UAAY,EACrC,CAWA,YAAY,EAAsB,CAC9B,IAAM,EAAO,CAAC,CAAC,EASf,OARI,IAAS,KAAK,WAAW,EAClB,MAGX,KAAK,SAAS,SAAW,EACzB,KAAK,cAAc,CAAI,EACvB,KAAK,aAAa,CAAI,EAEf,KACX,CAQA,UAAoB,CAChB,OAAO,KAAK,WAAW,CAC3B,CASA,SAAS,EAAsB,CAC3B,OAAO,KAAK,YAAY,CAAK,CACjC,CAYA,aAAa,EAAoB,CAG7B,MAFA,MAAK,SAAS,UAAY,EAEnB,IACX,CAOA,gBAAuB,CAGnB,MAFA,MAAK,SAAS,UAAY,IAAA,GAEnB,IACX,CAOA,cAA8B,CAC1B,OAAO,KAAK,SAAS,WAAa,IACtC,CAkBA,GAAG,EAAwC,EAA0B,CAOjE,OANI,IAAU,UACV,EAAM,YAAY,KAAM,SAAU,CAA0B,EAErD,MAGJ,MAAM,GAAG,EAAmB,CAAoC,CAC3E,CAWA,IAAI,EAAwC,EAA0B,CAOlE,OANI,IAAU,UACV,EAAM,eAAe,KAAM,SAAU,CAA0B,EAExD,MAGJ,MAAM,IAAI,EAAO,CAAQ,CACpC,CAKA,cAAsB,EAAyB,CAC3C,KAAK,QAAQ,CAAC,CAAC,WAAW,CAAQ,EAElC,KAAK,MAAM,mBAAmB,EACxB,oDACA,iEAAiE,EACvE,KAAK,MAAM,UAAU,EACf,8DACA,wDAAwD,EAE9D,KAAK,KAAK,WAAW,IAAgB,CACzC,CAEJ,EAEM,EAAsB,EAAS,WAAW"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./DOM-67StIm5G.js";import{S as t,h as n,t as r,v as i}from"./Component-fRQvgaEY.js";import{t as a}from"./ListenerBag-WPdKuuds.js";import{t as o}from"./Glyph-wN7bk7mg.js";var AutoRepeat=class{_initialDelay;_decay;_floor;_onTick;_handle=null;_delay;constructor(e){this._initialDelay=e.initialDelay,this._decay=e.decay,this._floor=e.floor,this._onTick=e.onTick,this._delay=e.initialDelay}start(){this._onTick(),this._delay=this._initialDelay,this.scheduleNext()}stop(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null),this._delay=this._initialDelay}isRunning(){return this._handle!==null}scheduleNext(){this._handle=setTimeout(()=>{this._onTick(),this._delay=Math.max(this._floor,this._delay*this._decay),this.scheduleNext()},this._delay)}};function scrollShadowRamp(e){return Math.max(0,Math.min(1,(e-1)/40))}function scrollShadowBoxShadow(){let e=`12px`;return`inset 0 ${e} ${e} -${e} var(--ts-ss-top, transparent),inset 0 -${e} ${e} -${e} var(--ts-ss-bottom, transparent),inset ${e} 0 ${e} -${e} var(--ts-ss-left, transparent),inset -${e} 0 ${e} -${e} var(--ts-ss-right, transparent)`}function scrollShadowEdgeValue(e){return e===0?null:`color-mix(in srgb, var(--ts-ui-scroll-shadow-color) ${e}%, transparent)`}var s=12,c=2,l=30,u=10,d=400,f=.75,p=40,m=40,ScrollArrowButton=class extends r{_glyph;_disabled=!1;_listeners=new a;_repeat;constructor(e){super(),this.setWidth(s),this.setHeight(s),this.setCursor(`default`),this.setBackgroundColor(`var(--ts-ui-scrollbar-arrow-bg, transparent)`),this.setForegroundColor(`var(--ts-ui-scrollbar-arrow-color, rgba(0, 0, 0, 0.55))`),i.isReducedMotion()||this.setTransition(`color 120ms ease-out`),this._glyph=new o(`unicode-arrow-`+e),this._glyph.setPreferredSize({width:s,height:s}),this._glyph.setFontSize(u),this._glyph.setPointerEvents(`none`),super.addComponent(this._glyph),this._repeat=new AutoRepeat({initialDelay:d,decay:f,floor:p,onTick:()=>this.emit(`tick`)}),t.addListener(this,`mousedown`,this._onMouseDown),t.addListener(this,`mouseover`,this._onMouseOver),t.addListener(this,`mouseout`,this._onMouseOut),t.addViewportListener(this,`mouseup`,this._onMouseUp),t.addViewportListener(this,`mouseleave`,this._onMouseUp)}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}isDisabledState(){return this._disabled}setDisabledState(e){this._disabled!==e&&(this._disabled=e,e?(this._repeat.stop(),this.setForegroundColor(`var(--ts-ui-scrollbar-arrow-disabled-color, rgba(0, 0, 0, 0.18))`)):this.setForegroundColor(`var(--ts-ui-scrollbar-arrow-color, rgba(0, 0, 0, 0.55))`))}_onMouseDown=e=>(this._disabled||this._repeat.start(),{stop:!0,prevent:!0});_onMouseUp=()=>{this._repeat.isRunning()&&this._repeat.stop()};_onMouseOver=()=>{this._disabled||this.setBackgroundColor(`var(--ts-ui-scrollbar-arrow-hover-bg, rgba(0, 0, 0, 0.06))`)};_onMouseOut=()=>{this.setBackgroundColor(`var(--ts-ui-scrollbar-arrow-bg, transparent)`)}},Scrollbar=class extends r{_orientation=`vertical`;_thumb;_viewportSize=0;_contentSize=0;_scrollPosition=0;_thumbSize=-1;_thumbPos=-1;_dragStartClient=0;_dragStartScroll=0;_listeners=new a;_arrowsEnabled=!0;_arrowStep=m;_arrowStart=null;_arrowEnd=null;constructor(e=`vertical`,n){super(n),this._orientation=e,n?.arrowStep!==void 0&&(this._arrowStep=n.arrowStep),n?.arrowsEnabled!==void 0&&(this._arrowsEnabled=n.arrowsEnabled),this.setBackgroundColor(`var(--ts-ui-scrollbar-track, rgba(0, 0, 0, 0.04))`),this.setUserSelect(`none`),this.getAria().setHidden(!0),this.isVertical()?this.setWidth(s):this.setHeight(s),this._thumb=new r,this._thumb.setBackgroundColor(`var(--ts-ui-scrollbar-thumb, rgba(0, 0, 0, 0.35))`),this._thumb.setCursor(`default`),this.isVertical()?(this._thumb.setX(c),this._thumb.setY(0),this._thumb.setWidth(s-2*c)):(this._thumb.setX(0),this._thumb.setY(c),this._thumb.setHeight(s-2*c)),super.addComponent(this._thumb),this._arrowsEnabled&&this.buildArrows(),t.addListener(this._thumb,`mousedown`,this._onDragStart),t.addListener(this._thumb,`touchstart`,this._onDragStart),t.addListener(this._thumb,`mouseover`,this._onThumbMouseOver),t.addListener(this._thumb,`mouseout`,this._onThumbMouseOut),t.addListener(this,`mousedown`,this._onTrackClick),t.addListener(this,`touchstart`,this._onTrackClick),this.applyListeners(n?.listeners)}buildArrows(){let e=this.isVertical()?`up`:`left`,t=this.isVertical()?`down`:`right`;this._arrowStart=new ScrollArrowButton(e),this._arrowStart.setX(0),this._arrowStart.setY(0),this._arrowStart.on(`tick`,this._onArrowStartTick),this._arrowStart.setDisabledState(!0),super.addComponent(this._arrowStart),this._arrowEnd=new ScrollArrowButton(t),this._arrowEnd.setX(0),this._arrowEnd.setY(0),this._arrowEnd.on(`tick`,this._onArrowEndTick),super.addComponent(this._arrowEnd)}_onArrowStartTick=()=>this.onArrowTick(-1);_onArrowEndTick=()=>this.onArrowTick(1);onArrowTick(e){let t=Math.max(0,this._contentSize-this._viewportSize),n=Math.max(0,Math.min(t,this._scrollPosition+e*this._arrowStep));n!==this._scrollPosition&&this.emit(`scroll`,n)}disposeArrows(){this._arrowStart&&=(super.removeComponent(this._arrowStart),null),this._arrowEnd&&=(super.removeComponent(this._arrowEnd),null)}_onThumbMouseOver=()=>{this._thumb.setBackgroundColor(`var(--ts-ui-scrollbar-thumb-hover, rgba(0, 0, 0, 0.55))`)};_onThumbMouseOut=()=>{this._thumb.setBackgroundColor(`var(--ts-ui-scrollbar-thumb, rgba(0, 0, 0, 0.35))`)};init(e){return super.init(e),this.setTouchAction(`none`),this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}setMetrics(e,t,n){this._viewportSize=e,this._contentSize=t,this._scrollPosition=n;let r=t>e;if(this.setDisplayed(r),!r)return this;let i=this.getTrackLength();if(i<=0)return this;let a=e/t,o=Math.max(l,Math.floor(i*a));this._thumbSize!==o&&(this._thumbSize=o,this.setThumbSize(o));let u=Math.max(0,t-e),d=Math.max(0,i-o),f=u>0?Math.round(n/u*d):0;this._thumbPos!==f&&(this._thumbPos=f,this.setThumbPos(f));let p=this.axisBox();if(this.isVertical()?(this._thumb.setX(p.crossOrigin+c),this._thumb.setWidth(p.crossExtent-2*c)):(this._thumb.setY(p.crossOrigin+c),this._thumb.setHeight(p.crossExtent-2*c)),this._arrowsEnabled&&this._arrowStart&&this._arrowEnd){let e=p.origin+p.extent-s;this.isVertical()?(this._arrowStart.setX(p.crossOrigin),this._arrowStart.setY(p.origin),this._arrowStart.setWidth(p.crossExtent),this._arrowEnd.setX(p.crossOrigin),this._arrowEnd.setY(e),this._arrowEnd.setWidth(p.crossExtent)):(this._arrowStart.setY(p.crossOrigin),this._arrowStart.setX(p.origin),this._arrowStart.setHeight(p.crossExtent),this._arrowEnd.setY(p.crossOrigin),this._arrowEnd.setX(e),this._arrowEnd.setHeight(p.crossExtent)),this._arrowStart.setDisabledState(n<=0),this._arrowEnd.setDisabledState(n>=u)}return this}getTrackWidth(){return s}getOrientation(){return this._orientation}isArrowsEnabled(){return this._arrowsEnabled}setArrowsEnabled(e){return this._arrowsEnabled===e?this:(this._arrowsEnabled=e,e?this.buildArrows():this.disposeArrows(),this.setMetrics(this._viewportSize,this._contentSize,this._scrollPosition),this)}getArrowStep(){return this._arrowStep}setArrowStep(e){return this._arrowStep=e,this}isVertical(){return this._orientation===`vertical`}axisBox(){let e=this.getContentBounds()??{x:0,y:0,width:this.getWidth()||0,height:this.getHeight()||0};return this.isVertical()?{origin:e.y,extent:e.height,crossOrigin:e.x,crossExtent:e.width}:{origin:e.x,extent:e.width,crossOrigin:e.y,crossExtent:e.height}}getTrackLength(){let e=this._arrowsEnabled?2*s:0;return Math.max(0,this.axisBox().extent-e)}getTrackOrigin(){return this.axisBox().origin+(this._arrowsEnabled?s:0)}setThumbSize(e){this.isVertical()?this._thumb.setHeight(e):this._thumb.setWidth(e)}setThumbPos(e){let t=this.getTrackOrigin();this.isVertical()?this._thumb.setY(t+e):this._thumb.setX(t+e)}extractClientPrimary(e){let t=this.isVertical(),n=e;if(n.touches!==void 0){let e=n.touches.length>0?n.touches[0]:n.changedTouches[0];return e?t?e.clientY:e.clientX:0}let r=e;return t?r.clientY:r.clientX}_onDragStart=n=>{n.preventDefault(),this._dragStartClient=this.extractClientPrimary(n),this._dragStartScroll=this._scrollPosition,t.addViewportListener(this,`mousemove`,this._onDragMove),t.addViewportListener(this,`mouseup`,this._onDragEnd),t.addViewportListener(this,`touchmove`,this._onDragMove),t.addViewportListener(this,`touchend`,this._onDragEnd),t.addViewportListener(this,`touchcancel`,this._onDragEnd),e.sink.apply(e.source.getBody(),{style:{pointerEvents:`none`}})};_onDragMove=e=>{let t=this.getTrackLength(),n=Math.max(0,this._contentSize-this._viewportSize),r=Math.max(0,t-this._thumbSize);if(r<=0)return!0;let i=(this.extractClientPrimary(e)-this._dragStartClient)/r*n,a=Math.max(0,Math.min(n,this._dragStartScroll+i));return this.emit(`scroll`,a),!0};_onDragEnd=n=>(t.removeViewportListener(this,`mousemove`,this._onDragMove),t.removeViewportListener(this,`mouseup`,this._onDragEnd),t.removeViewportListener(this,`touchmove`,this._onDragMove),t.removeViewportListener(this,`touchend`,this._onDragEnd),t.removeViewportListener(this,`touchcancel`,this._onDragEnd),e.sink.apply(e.source.getBody(),{style:{pointerEvents:``}}),!0);_onTrackClick=t=>{t.preventDefault();let n=this.isVertical(),r,i=t;if(i.touches!==void 0){let t=i.touches.length>0?i.touches[0]:i.changedTouches[0],a=this.getElement();if(!t||!a)return;let o=e.source.getViewportRect(this),s=this.getBorderSize();r=n?t.clientY-o.top-s.top:t.clientX-o.left-s.left}else{let e=t;r=n?e.offsetY:e.offsetX}let a=this.axisBox(),o=this.getTrackOrigin(),c=a.origin+a.extent;if(this._arrowsEnabled&&(r<o||r>=c-s))return;let l=r-o<this._thumbPos+this._thumbSize/2?-1:1,u=Math.max(0,this._contentSize-this._viewportSize),d=Math.max(0,Math.min(u,this._scrollPosition+l*this._viewportSize));this.emit(`scroll`,d)}},h=n(Scrollbar);export{AutoRepeat as a,scrollShadowRamp as i,scrollShadowBoxShadow as n,scrollShadowEdgeValue as r,h as t};
2
- //# sourceMappingURL=Scrollbar-SOj9psiP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Scrollbar-SOj9psiP.js","names":[],"sources":["../../src/typescript/lib/core/AutoRepeat.ts","../../src/typescript/lib/core/ScrollShadow.ts","../../src/typescript/lib/component/container/Scrollbar.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\n/**\n * Construction options for {@link AutoRepeat}.\n *\n * @category Core\n */\nexport interface AutoRepeatOptions {\n /** Delay before the first repeat tick, in ms. */\n initialDelay: number;\n /** Multiplier applied to the delay after each tick (`0 < decay <= 1`). */\n decay: number;\n /** Lower bound the decaying delay never drops below, in ms. */\n floor: number;\n /** Invoked once immediately on {@link AutoRepeat.start} and once per scheduled tick. */\n onTick: () => void;\n}\n\n/**\n * The press-and-hold *accelerating* auto-repeat state machine, extracted from the\n * spin button and scrollbar arrow so both drive one implementation.\n *\n * {@link start} fires `onTick` once immediately, then schedules repeats whose\n * interval starts at `initialDelay` and shrinks by `decay` after every tick,\n * never dropping below `floor`. {@link stop} cancels the schedule and resets the\n * interval, so a subsequent press begins again at `initialDelay`.\n *\n * It is a plain class (no DOM element, so not `callable()`-wrapped) and drives an\n * owner-supplied callback rather than emitting its own events — each host keeps\n * dispatching through its own event surface. `setTimeout` is a process timer, not\n * a DOM call, so it does not route through the DOM seam.\n *\n * @category Core\n */\nexport class AutoRepeat {\n\n private readonly _initialDelay: number;\n private readonly _decay: number;\n private readonly _floor: number;\n private readonly _onTick: () => void;\n private _handle: ReturnType<typeof setTimeout> | null = null;\n private _delay: number;\n\n /**\n * @param options - The repeat timing and the per-tick callback.\n */\n constructor(options: AutoRepeatOptions) {\n this._initialDelay = options.initialDelay;\n this._decay = options.decay;\n this._floor = options.floor;\n this._onTick = options.onTick;\n this._delay = options.initialDelay;\n }\n\n /**\n * Fires `onTick` immediately, then schedules accelerating repeats starting\n * at `initialDelay`.\n */\n start(): void {\n this._onTick();\n this._delay = this._initialDelay;\n this.scheduleNext();\n }\n\n /**\n * Cancels any pending schedule and resets the interval to `initialDelay`.\n */\n stop(): void {\n if (this._handle !== null) {\n clearTimeout(this._handle);\n this._handle = null;\n }\n\n this._delay = this._initialDelay;\n }\n\n /**\n * Returns whether a repeat schedule is currently armed.\n *\n * @returns `true` between {@link start} and {@link stop}.\n */\n isRunning(): boolean {\n return this._handle !== null;\n }\n\n /**\n * Schedules the next tick at the current interval, then decays the interval\n * (×`decay`, floored at `floor`) for the tick after it.\n */\n private scheduleNext(): void {\n this._handle = setTimeout(() => {\n this._onTick();\n this._delay = Math.max(this._floor, this._delay * this._decay);\n this.scheduleNext();\n }, this._delay);\n }\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\n/**\n * Shared visual recipe for the position-aware scroll-edge shadows. Both scroll\n * systems paint the same fade — {@link Panel} over native `overflow` scrolling\n * and {@link VirtualScroller} over transform-based virtual lists — so the\n * geometry constants, the box-shadow recipe, and the per-edge colour ramp live\n * here as the single source of truth. Each owner keeps its own overlay element\n * and per-edge cache; only the drift-prone visual maths is shared.\n *\n * @category Core\n */\n\n/**\n * Reach in pixels of each scroll-edge shadow — used as the inset shadow's\n * offset, blur, and (negative) spread, so each edge's fade hugs its border and\n * dies out roughly this far inward.\n *\n * Fixed framework-side rather than themed, for the same reason the keyboard\n * focus indicator fixes its `2px` width (see `Theme.indicator.focus`): the\n * colour is the only part a theme needs to vary, and a constant keeps the\n * overlay's four-shadow geometry simple. `12px` reads as a soft edge cue\n * without masking a meaningful strip of content.\n */\nexport const SCROLL_SHADOW_EXTENT_PX = 12;\n\n/**\n * Distance in pixels over which an edge's shadow ramps from none to full as the\n * scroll position moves away from that edge's extreme. The strength is\n * `clamp(distanceFromExtreme / this, 0, 1)`, so the shadow fades in smoothly\n * just after leaving an edge and fades out as the opposite edge is approached,\n * instead of popping on/off at a single-pixel threshold. `40px` gives a visible\n * fade without staying faint through a meaningful amount of overflow.\n */\nexport const SCROLL_SHADOW_RAMP_PX = 40;\n\n/**\n * Ramps an edge's shadow in by how far the scroll position sits past that\n * edge's extreme. The `- 1` folds in a sub-pixel epsilon: within 1px of an\n * extreme the strength is 0, so a fractional scrollSize/clientSize mismatch\n * can't leave a phantom fade.\n *\n * @param distance - Pixels the scroll position is past the edge's extreme.\n * @returns The edge strength in the range 0–1.\n */\nexport function scrollShadowRamp(distance: number): number {\n return Math.max(0, Math.min(1, (distance - 1) / SCROLL_SHADOW_RAMP_PX));\n}\n\n/**\n * Builds the four-layer inset `box-shadow` recipe — one blurred shadow per edge,\n * each gated by a local custom property (`--ts-ss-top` / `-bottom` / `-left` /\n * `-right`) defaulting to `transparent`, so lighting an edge is a single\n * property flip rather than a shadow rebuild. The `-extent` spread keeps each\n * shadow hugging its own edge while the equal blur fades it inward over\n * `extent`px, so the edge reads as a soft cast shadow rather than the\n * hard-terminated band a `linear-gradient` would paint.\n *\n * @returns The `box-shadow` value.\n */\nexport function scrollShadowBoxShadow(): string {\n const extent = SCROLL_SHADOW_EXTENT_PX + \"px\";\n\n return (\n `inset 0 ${extent} ${extent} -${extent} var(--ts-ss-top, transparent),` +\n `inset 0 -${extent} ${extent} -${extent} var(--ts-ss-bottom, transparent),` +\n `inset ${extent} 0 ${extent} -${extent} var(--ts-ss-left, transparent),` +\n `inset -${extent} 0 ${extent} -${extent} var(--ts-ss-right, transparent)`\n );\n}\n\n/**\n * Value for one edge's shadow custom property: the theme shadow colour scaled\n * toward transparent by `percent`, or `null` at zero so the `box-shadow` layer\n * falls back to its `transparent` default.\n *\n * @param percent - The edge strength as a whole percentage (0–100).\n * @returns The `color-mix` value, or `null` when the edge is off.\n */\nexport function scrollShadowEdgeValue(percent: number): string | null {\n return percent === 0\n ? null\n : `color-mix(in srgb, var(--ts-ui-scroll-shadow-color) ${percent}%, transparent)`;\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Animation } from \"~/core/Animation.js\";\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { ListenerBag } from \"~/core/ListenerBag.js\";\nimport { AutoRepeat } from \"~/core/AutoRepeat.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport type { HorizontalSide } from \"~/primitive/Edge.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport type { AxisOrientation } from \"~/primitive/Axis.js\";\n\n/**\n * String-literal union of the events emitted by {@link Scrollbar}.\n *\n * @category Components\n */\nexport type ScrollbarEvent = \"scroll\";\n\n/**\n * String-literal union of the events emitted by the file-local\n * `ScrollArrowButton`.\n */\ntype ScrollArrowEvent = \"tick\";\n\nconst TRACK_WIDTH = 12;\nconst THUMB_INSET = 2;\nconst THUMB_MIN_SIZE = 30;\n\n// Font size for the Unicode triangle character rendered in each arrow button.\n// The arrow box is TRACK_WIDTH (12) px square; the ambient 14 px theme font\n// produces a 16 px line-box that overflows the 12 px element and is clipped\n// at the bottom by `overflow: hidden`, leaving the visible triangle slid up\n// against the top edge. 10 px shrinks the line-box (= font-size × line-height\n// 1) below the element height so the character fits with even padding above\n// and below — matches the value [`AccordionIndicator`](./AccordionIndicator.ts)\n// uses for its `▶` chevron.\nconst ARROW_GLYPH_FONT_SIZE = 10;\n\n// Initial hold-repeat delay and acceleration parameters for ScrollArrowButton.\n// Mirrors SpinButton's scheduler so a long press on either widget produces the\n// same accelerating tick cadence — 400 ms first interval, multiplied by 0.75\n// each tick, floored at 40 ms.\nconst ARROW_REPEAT_INITIAL_MS = 400;\nconst ARROW_REPEAT_DECAY = 0.75;\nconst ARROW_REPEAT_FLOOR_MS = 40;\n\n// Default per-click scroll step in pixels for arrow buttons. Roughly two rows\n// at default font size in the Table; chosen as a fixed pixel value rather than\n// a derived fraction of viewport so the step size stays predictable as content\n// grows. Owners can override via `setArrowStep(px)`.\nconst DEFAULT_ARROW_STEP_PX = 40;\n\n// Crossfade duration for the arrow's enabled↔disabled colour swap. Matches the\n// 120 ms ease-out cadence Checkbox / Toggle / RadioButton use for their state\n// crossfades so the scrollbar's arrows read as the same UI vocabulary; short\n// enough to feel instant while softening the hard colour flip at each edge.\nconst ARROW_FADE_DURATION_MS = 120;\n\n/**\n * Callback type fired by {@link Scrollbar} when the user drags the thumb or\n * clicks the track. Receives the new scroll position in pixels.\n *\n * @category Components\n */\nexport type ScrollbarListener = (position: number) => void;\n\n/**\n * Construction-time options for {@link Scrollbar}.\n *\n * @category Components\n */\nexport interface ScrollbarOptions extends ComponentOptions {\n\n /**\n * When `true`, the scrollbar renders classic OS-style arrow buttons at\n * each end of the track (up/down for vertical, left/right for horizontal).\n * The buttons step the scroll position by {@link ScrollbarOptions.arrowStep}\n * pixels per click and accelerate while held. The matching arrow shows a\n * dimmed disabled-state colour when scroll is already at that edge.\n * Defaults to `true`; set `false` to suppress the arrows for a minimalist\n * look.\n */\n arrowsEnabled?: boolean;\n\n /**\n * Per-click scroll step in pixels for the arrow buttons. Ignored when\n * `arrowsEnabled` is `false`. Defaults to `40`.\n */\n arrowStep?: number;\n\n /**\n * Multi-event listener bag dispatched to {@link Scrollbar.on} at\n * construction time.\n */\n listeners?: {\n scroll?: ScrollbarListener;\n };\n}\n\n/**\n * Direction for a `ScrollArrowButton`. `\"up\"` / `\"down\"` go on the ends\n * of a vertical scrollbar; `\"left\"` / `\"right\"` on a horizontal one.\n */\ntype ArrowDirection = HorizontalSide | \"up\" | \"down\";\n\n/**\n * A press-and-hold arrow button rendered at one end of a {@link Scrollbar}'s\n * track when arrows are enabled. File-local — not exported from the container\n * barrel because it is a Scrollbar implementation detail.\n *\n * Mirrors the [`SpinButton`](/api/component/input/classes/SpinButton)\n * hold-repeat cadence: a click fires one tick, holding accelerates from a\n * 400 ms initial interval to a 40 ms floor, and release cancels the schedule.\n * When in the disabled state, mousedown is ignored and the glyph renders in\n * the dim colour token.\n */\nclass ScrollArrowButton extends Component {\n\n private _glyph: Glyph;\n private _disabled: boolean = false;\n private _listeners: ListenerBag<ScrollArrowEvent> = new ListenerBag<ScrollArrowEvent>();\n private _repeat: AutoRepeat;\n\n /**\n * Constructs a square TRACK_WIDTH × TRACK_WIDTH arrow button pointing in\n * the given direction.\n *\n * @param direction - One of `\"up\"`, `\"down\"`, `\"left\"`, `\"right\"`.\n */\n constructor(direction: ArrowDirection) {\n super();\n\n this.setWidth(TRACK_WIDTH);\n this.setHeight(TRACK_WIDTH);\n this.setCursor(\"default\");\n this.setBackgroundColor(\"var(--ts-ui-scrollbar-arrow-bg, transparent)\");\n this.setForegroundColor(\"var(--ts-ui-scrollbar-arrow-color, rgba(0, 0, 0, 0.55))\");\n\n // Fade the enabled↔disabled colour swap in setDisabledState instead of a hard\n // switch. Declared at construction (mirrors Checkbox's crossfade) so the initial\n // colour — the start arrow's dim state set by Scrollbar.buildArrows before first\n // paint — appears instantly, and only later at-edge toggles fade. Honours\n // prefers-reduced-motion.\n if (!Animation.isReducedMotion()) {\n this.setTransition(\"color \" + ARROW_FADE_DURATION_MS + \"ms ease-out\");\n }\n\n // Fill the full TRACK_WIDTH × TRACK_WIDTH button so `text-align: center`\n // + `line-height: 1` (Glyph char-mode defaults) centre the character\n // within that box. The explicit `fontSize` shrinks the inherited\n // 14 px size so the Unicode triangle's line-box (which scales with\n // font-size) fits inside the 12 px element box and isn't clipped at\n // the bottom by `overflow: hidden` — mirrors the same fix\n // AccordionIndicator applies to its `▶` chevron.\n this._glyph = new Glyph(\"unicode-arrow-\" + direction);\n this._glyph.setPreferredSize({ width: TRACK_WIDTH, height: TRACK_WIDTH });\n this._glyph.setFontSize(ARROW_GLYPH_FONT_SIZE);\n // The glyph fills the whole button, so without this a click's target is\n // the glyph element. The Event system routes `addListener` callbacks only\n // to the exact target id (no bubbling), so the arrow's own\n // mousedown/mouseover/mouseout handlers below would never fire. Making\n // the glyph non-interactive lets pointer events fall through to the arrow.\n this._glyph.setPointerEvents(\"none\");\n\n super.addComponent(this._glyph);\n\n this._repeat = new AutoRepeat({\n initialDelay: ARROW_REPEAT_INITIAL_MS,\n decay: ARROW_REPEAT_DECAY,\n floor: ARROW_REPEAT_FLOOR_MS,\n onTick: () => this.emit(\"tick\"),\n });\n\n Event.addListener(this, \"mousedown\", this._onMouseDown);\n Event.addListener(this, \"mouseover\", this._onMouseOver);\n Event.addListener(this, \"mouseout\", this._onMouseOut);\n Event.addViewportListener(this, \"mouseup\", this._onMouseUp);\n Event.addViewportListener(this, \"mouseleave\", this._onMouseUp);\n }\n\n /**\n * Registers a listener for one of this arrow button's events.\n *\n * @param event - `\"tick\"` fires on each logical tick (initial mousedown\n * plus every subsequent hold-repeat tick).\n * @param listener - The callback invoked when the event fires.\n *\n * @returns This arrow button, for method chaining.\n */\n on(event: \"tick\", listener: () => void): this;\n on(event: ScrollArrowEvent, listener: Function): this {\n this._listeners.add(event, listener);\n\n return this;\n }\n\n /**\n * Removes a previously registered listener. The exact callback reference\n * must match.\n *\n * @param event - The event the listener was registered for.\n * @param listener - The callback to remove.\n *\n * @returns This arrow button, for method chaining.\n */\n off(event: ScrollArrowEvent, listener: Function): this {\n this._listeners.remove(event, listener);\n\n return this;\n }\n\n /**\n * Fires every listener registered for `event` with no arguments.\n *\n * @param event - The event to emit.\n */\n protected emit(event: \"tick\"): void;\n protected emit(event: ScrollArrowEvent, ...payload: unknown[]): void {\n this._listeners.fire(event, ...payload);\n }\n\n /**\n * Returns whether this arrow is currently in the at-edge disabled state.\n *\n * @returns `true` when disabled, `false` otherwise.\n */\n isDisabledState(): boolean {\n return this._disabled;\n }\n\n /**\n * Toggles the disabled visual state and behaviour. Disabled arrows render\n * the glyph in the dim colour token and ignore mousedown events; any\n * in-flight hold-repeat schedule is cancelled.\n *\n * @param disabled - `true` to disable, `false` to enable.\n */\n setDisabledState(disabled: boolean): void {\n if (this._disabled === disabled) {\n return;\n }\n\n this._disabled = disabled;\n\n if (disabled) {\n this._repeat.stop();\n this.setForegroundColor(\"var(--ts-ui-scrollbar-arrow-disabled-color, rgba(0, 0, 0, 0.18))\");\n } else {\n this.setForegroundColor(\"var(--ts-ui-scrollbar-arrow-color, rgba(0, 0, 0, 0.55))\");\n }\n }\n\n /**\n * Handles mousedown on the button. Stops propagation so the parent\n * Scrollbar's track-click handler does not also fire, then (if not\n * disabled) fires the first tick and schedules accelerating repeats.\n *\n * @param _e - The mousedown event.\n * @returns `{ stop: true, prevent: true }`, consuming the press and suppressing the browser's default text selection.\n */\n private _onMouseDown = (_e: MouseEvent): Event.ListenerResult => {\n if (!this._disabled) {\n this._repeat.start();\n }\n\n return { stop: true, prevent: true };\n };\n\n /**\n * Cancels the hold-repeat schedule on mouseup or when the pointer leaves\n * the viewport.\n */\n private _onMouseUp = (): void => {\n if (!this._repeat.isRunning()) {\n return;\n }\n\n this._repeat.stop();\n };\n\n /**\n * Darkens the button background on hover, mirroring the thumb-hover idiom.\n */\n private _onMouseOver = (): void => {\n if (this._disabled) {\n return;\n }\n\n this.setBackgroundColor(\"var(--ts-ui-scrollbar-arrow-hover-bg, rgba(0, 0, 0, 0.06))\");\n };\n\n /**\n * Restores the resting background when the pointer leaves the button.\n */\n private _onMouseOut = (): void => {\n this.setBackgroundColor(\"var(--ts-ui-scrollbar-arrow-bg, transparent)\");\n };\n\n}\n\n/**\n * A custom virtual scrollbar overlay.\n *\n * Designed for components that own their own scroll state (e.g. transform-based\n * virtual lists) and don't expose native browser scrolling. The owner pushes\n * viewport/content metrics in via {@link Scrollbar.setMetrics} and subscribes\n * to scroll position changes via {@link Scrollbar.on}.\n *\n * The thumb is dragged with the mouse; clicking the track above/beside the\n * thumb pages by one viewport. The scrollbar hides itself when content fits in\n * the viewport. Classic OS-style arrow buttons at each end of the track are\n * controlled by {@link ScrollbarOptions.arrowsEnabled} — enabled by default;\n * set it `false` for a minimalist look.\n *\n * Available in vertical (default) and horizontal orientations; the owner is\n * responsible for sizing the primary axis (height for vertical, width for\n * horizontal) and positioning the bar on the cross axis.\n *\n * @category Components\n */\nclass Scrollbar extends Component<ScrollbarOptions> {\n\n private _orientation : AxisOrientation = \"vertical\";\n private _thumb : Component;\n private _viewportSize : number = 0;\n private _contentSize : number = 0;\n private _scrollPosition : number = 0;\n // Sentinel `-1` rather than `0` so the first `setMetrics` call always\n // writes the thumb's size/position through to the DOM, even when the\n // computed values happen to be `0` (e.g. scroll position at top with\n // arrows enabled, where the constructor-time `setY(0)` would otherwise\n // never get corrected to the arrow-region origin offset).\n private _thumbSize : number = -1;\n private _thumbPos : number = -1;\n private _dragStartClient : number = 0;\n private _dragStartScroll : number = 0;\n private _listeners : ListenerBag<ScrollbarEvent> = new ListenerBag<ScrollbarEvent>();\n\n private _arrowsEnabled : boolean = true;\n private _arrowStep : number = DEFAULT_ARROW_STEP_PX;\n private _arrowStart : ScrollArrowButton | null = null;\n private _arrowEnd : ScrollArrowButton | null = null;\n\n /**\n * Constructs a Scrollbar.\n *\n * @param orientation - `\"vertical\"` (default) or `\"horizontal\"`.\n * @param options - Optional configuration bag. ComponentOptions fields are\n * forwarded to `super` so the standard cascade applies; the\n * arrow-specific fields are read here ahead of any DOM construction.\n */\n constructor(orientation: AxisOrientation = \"vertical\", options?: ScrollbarOptions) {\n super(options);\n\n this._orientation = orientation;\n\n // Pull arrow configuration out of options ahead of any DOM work so the\n // thumb / arrow construction below sees the final flags. ComponentOptions\n // fields (visible, backgroundColor, etc.) are already applied by super.\n if (options?.arrowStep !== undefined) {\n this._arrowStep = options.arrowStep;\n }\n if (options?.arrowsEnabled !== undefined) {\n this._arrowsEnabled = options.arrowsEnabled;\n }\n\n this.setBackgroundColor(\"var(--ts-ui-scrollbar-track, rgba(0, 0, 0, 0.04))\");\n this.setUserSelect(\"none\");\n\n // Purely decorative: the real scroll semantics live on the native scroll\n // region this widget mirrors (overlay Panel, VirtualScroller), so hide the\n // track / thumb / arrow subtree from assistive tech rather than have it\n // announce a stack of non-interactive divs. Matches Spacer / Glyph.\n this.getAria().setHidden(true);\n\n if (this.isVertical()) {\n this.setWidth(TRACK_WIDTH);\n } else {\n this.setHeight(TRACK_WIDTH);\n }\n\n this._thumb = new Component();\n this._thumb.setBackgroundColor(\"var(--ts-ui-scrollbar-thumb, rgba(0, 0, 0, 0.35))\");\n this._thumb.setCursor(\"default\");\n\n if (this.isVertical()) {\n this._thumb.setX(THUMB_INSET);\n this._thumb.setY(0);\n this._thumb.setWidth(TRACK_WIDTH - 2 * THUMB_INSET);\n } else {\n this._thumb.setX(0);\n this._thumb.setY(THUMB_INSET);\n this._thumb.setHeight(TRACK_WIDTH - 2 * THUMB_INSET);\n }\n\n super.addComponent(this._thumb);\n\n if (this._arrowsEnabled) {\n this.buildArrows();\n }\n\n Event.addListener(this._thumb, \"mousedown\", this._onDragStart);\n Event.addListener(this._thumb, \"touchstart\", this._onDragStart);\n Event.addListener(this._thumb, \"mouseover\", this._onThumbMouseOver);\n Event.addListener(this._thumb, \"mouseout\", this._onThumbMouseOut);\n Event.addListener(this, \"mousedown\", this._onTrackClick);\n Event.addListener(this, \"touchstart\", this._onTrackClick);\n\n this.applyListeners(options?.listeners);\n }\n\n /**\n * Constructs and wires the two arrow buttons. Both are seeded at `(0, 0)`;\n * their real position and cross-axis extent are set in `setMetrics`, which\n * is the first point the bar's content box is known. Disabled-state for the\n * start arrow is pre-set since `_scrollPosition` defaults to 0 — without\n * this the start arrow renders enabled for one frame before `setMetrics`\n * corrects it.\n */\n private buildArrows(): void {\n const startDirection: ArrowDirection = this.isVertical() ? \"up\" : \"left\";\n const endDirection: ArrowDirection = this.isVertical() ? \"down\" : \"right\";\n\n this._arrowStart = new ScrollArrowButton(startDirection);\n this._arrowStart.setX(0);\n this._arrowStart.setY(0);\n this._arrowStart.on(\"tick\", this._onArrowStartTick);\n this._arrowStart.setDisabledState(true);\n super.addComponent(this._arrowStart);\n\n this._arrowEnd = new ScrollArrowButton(endDirection);\n // Both axes depend on the bar's content box, which is not resolved yet;\n // `setMetrics` writes the origin and the cross-axis extent.\n this._arrowEnd.setX(0);\n this._arrowEnd.setY(0);\n this._arrowEnd.on(\"tick\", this._onArrowEndTick);\n super.addComponent(this._arrowEnd);\n }\n\n /**\n * Bound forwarder for the start arrow's `\"tick\"` event. Kept as a class\n * field so {@link off}-style detachment would have a stable reference.\n */\n private _onArrowStartTick = (): void => this.onArrowTick(-1);\n\n /**\n * Bound forwarder for the end arrow's `\"tick\"` event.\n */\n private _onArrowEndTick = (): void => this.onArrowTick(+1);\n\n /**\n * Computes the next scroll position one `_arrowStep` away from the current\n * one, clamps it to the valid range, and fires scroll listeners if it\n * changed. The owner's listener call back into `setMetrics` next frame,\n * which refreshes `atStart` / `atEnd` and updates the arrow disabled state.\n *\n * @param direction - `-1` for the start arrow, `+1` for the end arrow.\n */\n private onArrowTick(direction: -1 | 1): void {\n const maxScroll = Math.max(0, this._contentSize - this._viewportSize);\n const newPosition = Math.max(0, Math.min(maxScroll, this._scrollPosition + direction * this._arrowStep));\n\n if (newPosition !== this._scrollPosition) {\n this.emit(\"scroll\", newPosition);\n }\n }\n\n /**\n * Tears down both arrow buttons. Called when arrows are toggled off at\n * runtime; safe when no arrows are currently mounted.\n */\n private disposeArrows(): void {\n if (this._arrowStart) {\n super.removeComponent(this._arrowStart);\n this._arrowStart = null;\n }\n if (this._arrowEnd) {\n super.removeComponent(this._arrowEnd);\n this._arrowEnd = null;\n }\n }\n\n /**\n * Darkens the thumb fill when the cursor moves over it.\n */\n private _onThumbMouseOver = (): void => {\n this._thumb.setBackgroundColor(\"var(--ts-ui-scrollbar-thumb-hover, rgba(0, 0, 0, 0.55))\");\n };\n\n /**\n * Restores the thumb's resting fill when the cursor leaves it.\n */\n private _onThumbMouseOut = (): void => {\n this._thumb.setBackgroundColor(\"var(--ts-ui-scrollbar-thumb, rgba(0, 0, 0, 0.35))\");\n };\n\n /**\n * Initializes the scrollbar element and sets `touch-action: none` so the\n * browser doesn't try to page-scroll when the user drags on the track.\n *\n * @param element - Optional. The HTMLElement to initialize with.\n */\n protected init(element?: Handle): this {\n super.init(element);\n\n this.setTouchAction(\"none\");\n\n return this;\n }\n\n /**\n * Registers a listener for one of this scrollbar's events.\n *\n * @param event - `\"scroll\"` fires when the user changes the scroll\n * position by dragging the thumb, clicking the track, or pressing an\n * arrow button, receiving the new scroll position in pixels.\n * @param listener - The callback to invoke when the event fires.\n *\n * @returns This scrollbar, for method chaining.\n */\n on(event: \"scroll\", listener: ScrollbarListener): this;\n on(event: ScrollbarEvent, listener: Function): this {\n this._listeners.add(event, listener);\n\n return this;\n }\n\n /**\n * Removes a previously registered listener. The exact callback reference\n * must match.\n *\n * @param event - The event the listener was registered for.\n * @param listener - The callback to remove.\n *\n * @returns This scrollbar, for method chaining.\n */\n off(event: ScrollbarEvent, listener: Function): this {\n this._listeners.remove(event, listener);\n\n return this;\n }\n\n /**\n * Fires every listener registered for `event` with `payload`, in\n * registration order.\n *\n * @param event - The event to emit.\n * @param payload - Forwarded to each listener.\n */\n protected emit(event: \"scroll\", position: number): void;\n protected emit(event: ScrollbarEvent, ...payload: unknown[]): void {\n this._listeners.fire(event, ...payload);\n }\n\n /**\n * Pushes viewport/content metrics and the current scroll position into the\n * scrollbar. Recomputes the thumb's size, position, and cross-axis extent\n * against the content box, and hides the scrollbar if the content fits in\n * the viewport. When arrows are enabled, repositions both arrows against\n * the content box and refreshes the disabled-at-edge state on both.\n *\n * @param viewportSize - The visible window size in pixels along the scroll axis.\n * @param contentSize - The total scrollable content size in pixels along the scroll axis.\n * @param scrollPosition - The current scroll offset in pixels.\n */\n setMetrics(viewportSize: number, contentSize: number, scrollPosition: number): this {\n this._viewportSize = viewportSize;\n this._contentSize = contentSize;\n this._scrollPosition = scrollPosition;\n\n const overflow = contentSize > viewportSize;\n this.setDisplayed(overflow);\n\n if (!overflow) {\n return this;\n }\n\n const trackLength = this.getTrackLength();\n if (trackLength <= 0) {\n return this;\n }\n\n const ratio = viewportSize / contentSize;\n const newThumbSize = Math.max(THUMB_MIN_SIZE, Math.floor(trackLength * ratio));\n if (this._thumbSize !== newThumbSize) {\n this._thumbSize = newThumbSize;\n this.setThumbSize(newThumbSize);\n }\n\n const maxScroll = Math.max(0, contentSize - viewportSize);\n const maxThumb = Math.max(0, trackLength - newThumbSize);\n const newThumbPos = maxScroll > 0 ? Math.round((scrollPosition / maxScroll) * maxThumb) : 0;\n if (this._thumbPos !== newThumbPos) {\n this._thumbPos = newThumbPos;\n this.setThumbPos(newThumbPos);\n }\n\n const axis = this.axisBox();\n\n // The thumb's cross-axis extent narrows with a bordered/padded content\n // box; re-derived every call, mirroring the end arrow's write below.\n if (this.isVertical()) {\n this._thumb.setX(axis.crossOrigin + THUMB_INSET);\n this._thumb.setWidth(axis.crossExtent - 2 * THUMB_INSET);\n } else {\n this._thumb.setY(axis.crossOrigin + THUMB_INSET);\n this._thumb.setHeight(axis.crossExtent - 2 * THUMB_INSET);\n }\n\n if (this._arrowsEnabled && this._arrowStart && this._arrowEnd) {\n // Position both arrows against the content box — the start arrow\n // at its origin, the end arrow at (origin + extent - TRACK_WIDTH).\n const endPos = axis.origin + axis.extent - TRACK_WIDTH;\n\n // The cross-axis extent too, not just the origin: the arrows are\n // built as a rigid TRACK_WIDTH square, so a bordered bar would keep\n // them at their full width inside a narrower box and overrun the\n // side the border is on. The main axis stays TRACK_WIDTH — that is\n // the gutter the track math reserves at each end.\n if (this.isVertical()) {\n this._arrowStart.setX(axis.crossOrigin);\n this._arrowStart.setY(axis.origin);\n this._arrowStart.setWidth(axis.crossExtent);\n this._arrowEnd.setX(axis.crossOrigin);\n this._arrowEnd.setY(endPos);\n this._arrowEnd.setWidth(axis.crossExtent);\n } else {\n this._arrowStart.setY(axis.crossOrigin);\n this._arrowStart.setX(axis.origin);\n this._arrowStart.setHeight(axis.crossExtent);\n this._arrowEnd.setY(axis.crossOrigin);\n this._arrowEnd.setX(endPos);\n this._arrowEnd.setHeight(axis.crossExtent);\n }\n\n this._arrowStart.setDisabledState(scrollPosition <= 0);\n this._arrowEnd.setDisabledState(scrollPosition >= maxScroll);\n }\n\n return this;\n }\n\n /**\n * Returns the static track width in pixels (the cross-axis dimension).\n *\n * @returns The fixed track width.\n */\n getTrackWidth(): number {\n return TRACK_WIDTH;\n }\n\n /**\n * Returns the scrollbar's orientation.\n *\n * @returns `\"vertical\"` or `\"horizontal\"`.\n */\n getOrientation(): AxisOrientation {\n return this._orientation;\n }\n\n /**\n * Returns whether the arrow buttons at each end of the track are enabled.\n *\n * @returns `true` when arrows are rendered, `false` otherwise.\n */\n isArrowsEnabled(): boolean {\n return this._arrowsEnabled;\n }\n\n /**\n * Enables or disables the end-cap arrow buttons. Intended for\n * construction-time use via {@link ScrollbarOptions.arrowsEnabled};\n * runtime toggles are supported but tear down or build the arrow\n * components on the fly and re-run `setMetrics` against the cached\n * viewport / content / scroll-position triple so the thumb size / position\n * recompute against the new track length.\n *\n * @param enabled - `true` to render arrows, `false` to remove them.\n * @returns This scrollbar, for method chaining.\n */\n setArrowsEnabled(enabled: boolean): this {\n if (this._arrowsEnabled === enabled) {\n return this;\n }\n\n this._arrowsEnabled = enabled;\n\n if (enabled) {\n this.buildArrows();\n } else {\n this.disposeArrows();\n }\n\n this.setMetrics(this._viewportSize, this._contentSize, this._scrollPosition);\n\n return this;\n }\n\n /**\n * Returns the per-click scroll step in pixels used by the arrow buttons.\n *\n * @returns The cached arrow step.\n */\n getArrowStep(): number {\n return this._arrowStep;\n }\n\n /**\n * Sets the per-click scroll step in pixels used by the arrow buttons.\n * No-op when arrows are not enabled, except that the new value is cached\n * and applies on a subsequent {@link Scrollbar.setArrowsEnabled}`(true)`.\n *\n * @param px - The new step size in pixels.\n * @returns This scrollbar, for method chaining.\n */\n setArrowStep(px: number): this {\n this._arrowStep = px;\n\n return this;\n }\n\n /**\n * Returns true if this is a vertical scrollbar.\n *\n * @returns True for vertical, false for horizontal.\n */\n private isVertical(): boolean {\n return this._orientation === \"vertical\";\n }\n\n /**\n * The content box projected onto the scroll axis: `origin` and `extent` run\n * along it, `crossOrigin` and `crossExtent` across it. Falls back to the\n * outer box while the element does not exist yet.\n */\n private axisBox(): { origin: number; extent: number; crossOrigin: number; crossExtent: number } {\n const box = this.getContentBounds()\n ?? { x: 0, y: 0, width: this.getWidth() || 0, height: this.getHeight() || 0 };\n\n return this.isVertical()\n ? { origin: box.y, extent: box.height, crossOrigin: box.x, crossExtent: box.width }\n : { origin: box.x, extent: box.width, crossOrigin: box.y, crossExtent: box.height };\n }\n\n /**\n * Returns the length of the track along the scroll axis available for the\n * thumb to travel, measured in the content box. Subtracts the two arrow\n * regions when arrows are enabled so the thumb travel range stays inside\n * the track between them.\n */\n private getTrackLength(): number {\n const inset = this._arrowsEnabled ? 2 * TRACK_WIDTH : 0;\n\n return Math.max(0, this.axisBox().extent - inset);\n }\n\n /**\n * Returns the primary-axis offset, in the content box, where the track\n * region (thumb travel area) starts. The content-box origin, plus\n * `TRACK_WIDTH` when arrows are enabled (skipping the start arrow).\n */\n private getTrackOrigin(): number {\n const axis = this.axisBox();\n\n return axis.origin + (this._arrowsEnabled ? TRACK_WIDTH : 0);\n }\n\n /**\n * Sets the thumb's size along the scroll axis.\n *\n * @param size - The new thumb size in pixels.\n */\n private setThumbSize(size: number): void {\n if (this.isVertical()) {\n this._thumb.setHeight(size);\n } else {\n this._thumb.setWidth(size);\n }\n }\n\n /**\n * Sets the thumb's position along the scroll axis, offset by the track\n * origin so the thumb sits inside the track region between the arrows\n * when those are enabled.\n *\n * @param pos - The new thumb position in pixels, relative to the track region.\n */\n private setThumbPos(pos: number): void {\n const origin = this.getTrackOrigin();\n\n if (this.isVertical()) {\n this._thumb.setY(origin + pos);\n } else {\n this._thumb.setX(origin + pos);\n }\n }\n\n\n /**\n * Reads the client coordinate along the scroll axis from a mouse or touch\n * event, preferring the active touch on touchstart/touchmove and the\n * changed touch on touchend.\n *\n * @param e - A mouse or touch event.\n * @returns The primary-axis coordinate in viewport space.\n */\n private extractClientPrimary(e: MouseEvent | TouchEvent): number {\n const vertical = this.isVertical();\n const touchEvent = e as TouchEvent;\n\n if (touchEvent.touches !== undefined) {\n const t = touchEvent.touches.length > 0\n ? touchEvent.touches[0]\n : touchEvent.changedTouches[0];\n if (!t) {\n return 0;\n }\n return vertical ? t.clientY : t.clientX;\n }\n\n const mouse = e as MouseEvent;\n return vertical ? mouse.clientY : mouse.clientX;\n }\n\n /**\n * Captures the initial client coordinate and scroll position, then attaches\n * viewport listeners so the drag continues even when the pointer or finger\n * leaves the thumb.\n *\n * @param e - The mousedown or touchstart event on the thumb.\n */\n private _onDragStart = (e: MouseEvent | TouchEvent): void => {\n e.preventDefault();\n\n this._dragStartClient = this.extractClientPrimary(e);\n this._dragStartScroll = this._scrollPosition;\n\n Event.addViewportListener(this, \"mousemove\", this._onDragMove);\n Event.addViewportListener(this, \"mouseup\", this._onDragEnd);\n Event.addViewportListener(this, \"touchmove\", this._onDragMove);\n Event.addViewportListener(this, \"touchend\", this._onDragEnd);\n Event.addViewportListener(this, \"touchcancel\", this._onDragEnd);\n\n // Suppresses pointer events on document.body (not a Component) for the\n // duration of the drag so the cursor can't snag on other elements.\n DOM.sink.apply(DOM.source.getBody(), { style: { pointerEvents: \"none\" } });\n };\n\n /**\n * Translates the client-axis delta into a scroll-position delta proportional\n * to the content/track ratio, clamps it, and fires scroll listeners.\n *\n * @param e - The viewport mousemove or touchmove event during a drag.\n * @returns `true` while a thumb drag is in progress, consuming the move so nothing else tracks the pointer.\n */\n private _onDragMove = (e: MouseEvent | TouchEvent): Event.ListenerResult => {\n const trackLength = this.getTrackLength();\n const maxScroll = Math.max(0, this._contentSize - this._viewportSize);\n const maxThumb = Math.max(0, trackLength - this._thumbSize);\n\n if (maxThumb <= 0) {\n return true;\n }\n\n const delta = this.extractClientPrimary(e) - this._dragStartClient;\n const scrollDelta = (delta / maxThumb) * maxScroll;\n const newPosition = Math.max(0, Math.min(maxScroll, this._dragStartScroll + scrollDelta));\n\n this.emit(\"scroll\", newPosition);\n\n return true;\n };\n\n /**\n * Removes viewport listeners and restores body pointer events.\n *\n * @param _e - The mouseup/touchend/touchcancel event ending the drag.\n * @returns `true`, consuming the release that ends the thumb drag.\n */\n private _onDragEnd = (_e: Event): Event.ListenerResult => {\n Event.removeViewportListener(this, \"mousemove\", this._onDragMove);\n Event.removeViewportListener(this, \"mouseup\", this._onDragEnd);\n Event.removeViewportListener(this, \"touchmove\", this._onDragMove);\n Event.removeViewportListener(this, \"touchend\", this._onDragEnd);\n Event.removeViewportListener(this, \"touchcancel\", this._onDragEnd);\n\n // Restores pointer events on document.body (not a Component) once the drag ends.\n DOM.sink.apply(DOM.source.getBody(), { style: { pointerEvents: \"\" } });\n\n return true;\n };\n\n /**\n * Pages the scroll position by one viewport size when the user clicks or\n * taps the track outside the thumb. Events on the thumb itself are caught\n * by a separate listener and don't reach here. When arrows are enabled,\n * clicks that land inside an arrow region are ignored so the arrow\n * button's own handler is the sole authority on arrow-region clicks.\n *\n * @param e - The mousedown or touchstart event on the track.\n */\n private _onTrackClick = (e: MouseEvent | TouchEvent): void => {\n e.preventDefault();\n\n const vertical = this.isVertical();\n let click: number;\n\n const touchEvent = e as TouchEvent;\n if (touchEvent.touches !== undefined) {\n const t = touchEvent.touches.length > 0\n ? touchEvent.touches[0]\n : touchEvent.changedTouches[0];\n const el = this.getElement();\n if (!t || !el) {\n return;\n }\n // getViewportRect's top-left is the border box, while the mouse\n // branch's offsetX/offsetY below is padding-box-relative; subtract\n // the leading border side so both branches agree before being\n // compared against the content-box-relative axisBox() values.\n const rect = DOM.source.getViewportRect(this);\n const border = this.getBorderSize();\n click = vertical\n ? t.clientY - rect.top - border.top\n : t.clientX - rect.left - border.left;\n } else {\n const mouse = e as MouseEvent;\n click = vertical ? mouse.offsetY : mouse.offsetX;\n }\n\n // When arrows are enabled, ignore clicks that landed inside either\n // arrow region — those are handled by the arrow's own mousedown\n // listener (which also stops propagation, but the touchstart path\n // does not, so we double-check here).\n const axis = this.axisBox();\n const origin = this.getTrackOrigin();\n const outer = axis.origin + axis.extent;\n if (this._arrowsEnabled && (click < origin || click >= outer - TRACK_WIDTH)) {\n return;\n }\n\n // Subtract origin so the thumb-position comparison stays in the\n // track-relative coordinate space (matches `_thumbPos`).\n const trackClick = click - origin;\n const thumbCenter = this._thumbPos + this._thumbSize / 2;\n const direction = trackClick < thumbCenter ? -1 : 1;\n const maxScroll = Math.max(0, this._contentSize - this._viewportSize);\n const newPosition = Math.max(0, Math.min(maxScroll, this._scrollPosition + direction * this._viewportSize));\n\n this.emit(\"scroll\", newPosition);\n };\n}\n\nconst ScrollbarCallable = callable(Scrollbar);\ntype ScrollbarCallable = Scrollbar;\nexport {\n Scrollbar as _Scrollbar,\n ScrollbarCallable as Scrollbar\n};\n"],"mappings":"6LAkCA,IAAa,WAAb,KAAwB,CAEpB,cACA,OACA,OACA,QACA,QAAwD,KACxD,OAKA,YAAY,EAA4B,CACpC,KAAK,cAAgB,EAAQ,aAC7B,KAAK,OAAgB,EAAQ,MAC7B,KAAK,OAAgB,EAAQ,MAC7B,KAAK,QAAgB,EAAQ,OAC7B,KAAK,OAAgB,EAAQ,YACjC,CAMA,OAAc,CACV,KAAK,QAAQ,EACb,KAAK,OAAS,KAAK,cACnB,KAAK,aAAa,CACtB,CAKA,MAAa,CACL,KAAK,UAAY,OACjB,aAAa,KAAK,OAAO,EACzB,KAAK,QAAU,MAGnB,KAAK,OAAS,KAAK,aACvB,CAOA,WAAqB,CACjB,OAAO,KAAK,UAAY,IAC5B,CAMA,cAA6B,CACzB,KAAK,QAAU,eAAiB,CAC5B,KAAK,QAAQ,EACb,KAAK,OAAS,KAAK,IAAI,KAAK,OAAQ,KAAK,OAAS,KAAK,MAAM,EAC7D,KAAK,aAAa,CACtB,EAAG,KAAK,MAAM,CAClB,CACJ,ECnDA,SAAgB,iBAAiB,EAA0B,CACvD,OAAO,KAAK,IAAI,EAAG,KAAK,IAAI,GAAI,EAAW,GAAA,EAA0B,CAAC,CAC1E,CAaA,SAAgB,uBAAgC,CAC5C,IAAM,EAAS,OAEf,MACI,WAAW,EAAO,GAAG,EAAO,IAAI,EAAO,0CAC3B,EAAO,GAAG,EAAO,IAAI,EAAO,0CAC/B,EAAO,KAAK,EAAO,IAAI,EAAO,yCAC7B,EAAO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,KAAK,WAAW,EAC7B,EAEE,EAAa,EACnB,GAAI,EAAW,UAAY,IAAA,GAAW,CAClC,IAAM,EAAI,EAAW,QAAQ,OAAS,EAChC,EAAW,QAAQ,GACnB,EAAW,eAAe,GAC1B,EAAK,KAAK,WAAW,EAC3B,GAAI,CAAC,GAAK,CAAC,EACP,OAMJ,IAAM,EAAS,EAAI,OAAO,gBAAgB,IAAI,EACxC,EAAS,KAAK,cAAc,EAClC,EAAQ,EACF,EAAE,QAAU,EAAK,IAAM,EAAO,IAC9B,EAAE,QAAU,EAAK,KAAO,EAAO,IACzC,KAAO,CACH,IAAM,EAAQ,EACd,EAAQ,EAAW,EAAM,QAAU,EAAM,OAC7C,CAMA,IAAM,EAAS,KAAK,QAAQ,EACtB,EAAS,KAAK,eAAe,EAC7B,EAAS,EAAK,OAAS,EAAK,OAClC,GAAI,KAAK,iBAAmB,EAAQ,GAAU,GAAS,EAAQ,GAC3D,OAOJ,IAAM,EAFc,EAAQ,EACR,KAAK,UAAY,KAAK,WAAa,EACR,GAAK,EAC9C,EAAc,KAAK,IAAI,EAAG,KAAK,aAAe,KAAK,aAAa,EAChE,EAAc,KAAK,IAAI,EAAG,KAAK,IAAI,EAAW,KAAK,gBAAkB,EAAY,KAAK,aAAa,CAAC,EAE1G,KAAK,KAAK,SAAU,CAAW,CACnC,CACJ,EAEM,EAAoB,EAAS,SAAS"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./DOM-67StIm5G.js";import{a as t,l as n}from"./Position-Ck_KD4cR.js";import{S as r,h as i,t as a}from"./Component-fRQvgaEY.js";import{t as o}from"./Text-KB5LksJl.js";import{t as s}from"./AbstractInput-BxfrmD2W.js";var Label=class extends o{_forId;constructor(e,t,n){if(!t)throw Error(`Label requires a non-empty forId. Use Text for standalone text.`);super(e,{...n??{},tag:n?.tag??`label`}),this._forId=t}getForId(){return this._forId}setForId(t){if(!t)throw Error(`Label forId must be non-empty.`);this._forId=t;let n=this.getElement();return n&&e.sink.apply(n,{setAttr:{for:t}}),this}render(){let t=super.render();return e.sink.apply(t,{setAttr:{for:this._forId}}),t}},c=i(Label),l=4,u=16,d=0,f=100,p=1,Slider=class extends s{_track;_activeTrack;_thumb;_draggingPointer=null;constructor(e){if(super({...e??{}}),this._track=new a,this._track.setBackgroundColor(`var(--ts-ui-slider-track-bg, rgb(220, 220, 220))`),this._track.setBorderRadius(`999px`),this._track.setPointerEvents(`none`),this._activeTrack=new a,this._activeTrack.setBackgroundColor(`var(--ts-ui-slider-track-active-bg, rgb(30, 100, 200))`),this._activeTrack.setBorderRadius(`999px`),this._activeTrack.setPointerEvents(`none`),this._thumb=new a,this._thumb.setBackgroundColor(`var(--ts-ui-slider-thumb-bg, rgb(255, 255, 255))`),this._thumb.setBorderRadius(`50%`),this._thumb.setBorder(`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._thumb.setShadow(`0 1px 2px rgba(0, 0, 0, 0.25)`),this._thumb.setPreferredSize({width:u,height:u}),this._thumb.setMaxSize({width:u,height:u}),this._thumb.setPointerEvents(`none`),this._track.addComponent(this._activeTrack),super.addComponent(this._track),super.addComponent(this._thumb),this.setPreferredSize({width:200,height:u}),this.setMaxSize({width:t,height:u}),this.setOutline(`none`),this.setCursor(`pointer`),this.getAria().setRole(`slider`),this.getAria().setTabIndex(0),this.getAria().setOrientation(`horizontal`),this.getAria().setValueMin(d),this.getAria().setValueMax(f),this.getAria().setValueNow(d),this.installInteraction(),this._options.minValue!==void 0&&this._options.min===void 0&&(this._options.min=this._options.minValue),this._options.maxValue!==void 0&&this._options.max===void 0&&(this._options.max=this._options.maxValue),this._options.min!==void 0&&this.applyMin(this._options.min),this._options.max!==void 0&&this.applyMax(this._options.max),this._options.orientation!==void 0&&this.applyOrientation(this._options.orientation),this._options.value!==void 0){let e=this.snap(this._options.value);this._options.value=e,this.applyValue(e)}else this.applyValue(this.getMin());this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.value!==void 0&&(this._options.value=e.value),e.min!==void 0&&(this._options.min=e.min),e.max!==void 0&&(this._options.max=e.max),e.minValue!==void 0&&(this._options.minValue=e.minValue),e.maxValue!==void 0&&(this._options.maxValue=e.maxValue),e.step!==void 0&&(this._options.step=e.step),e.largeStep!==void 0&&(this._options.largeStep=e.largeStep),e.orientation!==void 0&&(this._options.orientation=e.orientation),e.showTicks!==void 0&&(this._options.showTicks=e.showTicks),e.enabled!==void 0&&(this._options.enabled=e.enabled),e.readOnly!==void 0&&(this._options.readOnly=e.readOnly),this}getValue(){return this._options.value??this.getMin()}setValue(e){let t=this.snap(e);return t===this.getValue()?this:(this._options.value=t,this.applyValue(t),this.notifyChange(t),r.fireEvent(this,`input`),this)}getMin(){return this._options.min??d}setMin(e){return this._options.min=e,this.applyMin(e),this.applyValue(this.snap(this.getValue())),this}getMax(){return this._options.max??f}setMax(e){return this._options.max=e,this.applyMax(e),this.applyValue(this.snap(this.getValue())),this}setMinValue(e){return this.setMin(e)}getMinValue(){return this.getMin()}setMaxValue(e){return this.setMax(e)}getMaxValue(){return this.getMax()}getStep(){return this._options.step??p}setStep(e){return this._options.step=e,this}getLargeStep(){return this._options.largeStep??this.getStep()*10}setLargeStep(e){return this._options.largeStep=e,this}getOrientation(){return this._options.orientation??`horizontal`}setOrientation(e){return this._options.orientation=e,this.applyOrientation(e),this.applyValue(this.getValue()),this}isShowTicks(){return this._options.showTicks??!1}setShowTicks(e){return this._options.showTicks=e,this}on(e,t){return e===`action`?(r.addListener(this,`input`,t),this):super.on(e,t)}off(e,t){return e===`action`?(r.removeListener(this,`input`,t),this):super.off(e,t)}getBaseline(){let e=this.getPreferredSize();return e?e.height-2:null}doLayout(){let e=this.getContentBounds();if(!e)return this;let t=this.getOrientation()===`horizontal`,n=e.width,r=e.height,i=this.getMin(),a=this.getMax()-i,o=a>0?(this.getValue()-i)/a:0;if(t){let t=Math.round((r-l)/2);this._track.setX(e.x),this._track.setY(e.y+t),this._track.setSize({width:n,height:l});let i=Math.round(n*o);this._activeTrack.setX(0),this._activeTrack.setY(0),this._activeTrack.setSize({width:i,height:l});let a=Math.round((n-u)*o),s=Math.round((r-u)/2);this._thumb.setSize({width:u,height:u}),this._thumb.setX(e.x+a),this._thumb.setY(e.y+s)}else{let t=Math.round((n-l)/2);this._track.setX(e.x+t),this._track.setY(e.y),this._track.setSize({width:l,height:r});let i=Math.round(r*o);this._activeTrack.setX(0),this._activeTrack.setY(r-i),this._activeTrack.setSize({width:l,height:i});let a=Math.round((n-u)/2),s=Math.round((r-u)*(1-o));this._thumb.setSize({width:u,height:u}),this._thumb.setX(e.x+a),this._thumb.setY(e.y+s)}return this}installInteraction(){r.addListener(this,`pointerdown`,t=>{if(!this.isEnabled()||this.isReadOnly())return;t.preventDefault(),this.focus();let n=this.getElement();n&&(e.sink.setPointerCapture(n,t.pointerId),this._draggingPointer=t.pointerId),this.setValue(this.valueAtPointer(t))}),r.addListener(this,`pointermove`,e=>{this._draggingPointer===e.pointerId&&this.setValue(this.valueAtPointer(e))});let release=t=>{if(this._draggingPointer!==t.pointerId)return;let n=this.getElement();n&&e.source.hasPointerCapture(n,t.pointerId)&&e.sink.releasePointerCapture(n,t.pointerId),this._draggingPointer=null};r.addListener(this,`pointerup`,release),r.addListener(this,`pointercancel`,release),r.addListener(this,`lostpointercapture`,release),r.addListener(this,`keydown`,e=>{if(!this.isEnabled()||this.isReadOnly())return;let t=this.getStep(),n=this.getLargeStep(),r=this.getMin(),i=this.getMax();switch(e.key){case`ArrowRight`:case`ArrowUp`:e.preventDefault(),this.setValue(this.getValue()+t);break;case`ArrowLeft`:case`ArrowDown`:e.preventDefault(),this.setValue(this.getValue()-t);break;case`PageUp`:e.preventDefault(),this.setValue(this.getValue()+n);break;case`PageDown`:e.preventDefault(),this.setValue(this.getValue()-n);break;case`Home`:e.preventDefault(),this.setValue(r);break;case`End`:e.preventDefault(),this.setValue(i);break}})}valueAtPointer(t){if(!this.getElement())return this.getValue();let r=e.source.getViewportRect(this),i=this.getContentBounds()??{x:0,y:0,width:r.width,height:r.height},a=this.getBorderSize(),o=r.left+a.left+i.x,s=r.top+a.top+i.y,c=this.getOrientation()===`horizontal`?i.width>0?(t.clientX-o)/i.width:0:i.height>0?1-(t.clientY-s)/i.height:0,l=n.clamp(c,0,1),u=this.getMin();return u+(this.getMax()-u)*l}snap(e){let t=this.getMin(),r=this.getMax(),i=this.getStep(),a=n.clamp(e,t,r);if(i<=0)return a;let o=t+Math.round((a-t)/i)*i;return n.clamp(o,t,r)}applyValue(e){this._options.value=e,this.getAria().setValueNow(e),this.scheduleLayout()}applyMin(e){this.getAria().setValueMin(e)}applyMax(e){this.getAria().setValueMax(e)}applyOrientation(e){this.getAria().setOrientation(e),e===`horizontal`?(this.setPreferredSize({width:200,height:u}),this.setMaxSize({width:t,height:u})):(this.setPreferredSize({width:u,height:200}),this.setMaxSize({width:u,height:t})),this.scheduleLayout()}applyEnabled(e){this.getAria().setDisabled(!e),this.getAria().setTabIndex(e?0:-1),this.setCursor(e?`pointer`:`default`)}applyReadOnly(e){this.getAria().setReadOnly(e)}},m=i(Slider);export{c as n,m as t};
2
- //# sourceMappingURL=Slider-DBnAZ-F7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Slider-DBnAZ-F7.js","names":[],"sources":["../../src/typescript/lib/component/input/Label.ts","../../src/typescript/lib/component/input/Slider.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Text, TextOptions } from \"~/component/input/Text.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Label}.\n *\n * @category Components\n */\nexport interface LabelOptions extends TextOptions {\n}\n\n/**\n * A label component backed by a `<label>` element.\n *\n * Always associated with a form control via the HTML `for` attribute.\n * For standalone text without a form-control association, use {@link Text} instead.\n *\n * @example\n * ```typescript\n * import { Label, TextField } from '@jimka/typescript-ui/component/input';\n*\n * const field = new TextField();\n * const label = new Label('Name:', field.getId());\n * panel.addComponent(label);\n * panel.addComponent(field);\n * ```\n *\n * @category Components\n */\nclass Label extends Text<LabelOptions> {\n\n private _forId: string;\n\n constructor(text: string, forId: string, options?: LabelOptions) {\n if (!forId) {\n throw new Error(\"Label requires a non-empty forId. Use Text for standalone text.\");\n }\n\n super(text, { ...(options ?? {}), tag: options?.tag ?? \"label\" });\n\n this._forId = forId;\n }\n\n /**\n * Returns the ID of the form element this label is associated with.\n *\n * @returns The value of the HTML `for` attribute.\n */\n public getForId() : string {\n return this._forId;\n }\n\n /**\n * Sets the for/htmlFor association and updates the DOM element.\n *\n * @param id - The ID of the form control this label should be associated with. Must be non-empty.\n *\n * @returns This component, for method chaining.\n */\n public setForId(id : string): this {\n if (!id) {\n throw new Error(\"Label forId must be non-empty.\");\n }\n\n this._forId = id;\n\n let element = this.getElement();\n if (!element) {\n return this;\n }\n\n DOM.sink.apply(element, { setAttr: { for: id } });\n\n return this;\n }\n\n /**\n * Renders the label element and sets its htmlFor attribute.\n *\n * @returns The created HTMLLabelElement with htmlFor initialised.\n */\n protected render(): Handle {\n let element = super.render();\n\n DOM.sink.apply(element, { setAttr: { for: this._forId } });\n\n return element;\n }\n}\n\nconst LabelCallable = callable(Label);\ntype LabelCallable = Label;\nexport {\n Label as _Label,\n LabelCallable as Label\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { AbstractInput, AbstractInputOptions } from \"~/component/input/AbstractInput.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { Util } from \"~/core/Util.js\";\nimport { UNBOUNDED } from \"~/primitive/Size.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport type { AxisOrientation } from \"~/primitive/Axis.js\";\n\n/**\n * Construction-time options for {@link Slider}.\n *\n * @category Components\n */\nexport interface SliderOptions extends AbstractInputOptions {\n value?: number;\n min?: number;\n max?: number;\n step?: number;\n largeStep?: number;\n orientation?: AxisOrientation;\n showTicks?: boolean;\n\n /** @deprecated use {@link SliderOptions.min} */\n minValue?: number;\n /** @deprecated use {@link SliderOptions.max} */\n maxValue?: number;\n /**\n * Construction-time listener bag — the declarative form of `on()`. Adds the\n * slider's `action` shorthand to the inherited `change` / `binding`.\n */\n listeners?: {\n action?: () => void;\n change?: (value: number) => void;\n binding?: () => void;\n };\n}\n\nconst TRACK_THICKNESS = 4;\nconst THUMB_SIZE = 16;\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\nconst DEFAULT_STEP = 1;\n\n/**\n * A custom-drawn range slider rendered as a focusable `<div>` with\n * `role=\"slider\"`.\n *\n * The track + thumb are real Components; drag is implemented via\n * `pointerdown` + `setPointerCapture` so the cursor can leave the track\n * during a drag without losing the stream. Keyboard navigation follows the\n * WAI-ARIA Authoring Practices slider model (Arrow / PageUp / PageDown /\n * Home / End).\n *\n * @category Components\n */\nclass Slider<TOptions extends SliderOptions = SliderOptions>\n extends AbstractInput<number, TOptions>\n{\n private _track: Component;\n private _activeTrack: Component;\n private _thumb: Component;\n private _draggingPointer: number | null = null;\n\n /**\n * Constructs a Slider.\n *\n * @param options - Optional construction-time options.\n */\n constructor(options?: TOptions) {\n super({ ...(options ?? {}) } as TOptions);\n\n this._track = new Component();\n this._track.setBackgroundColor(\"var(--ts-ui-slider-track-bg, rgb(220, 220, 220))\");\n this._track.setBorderRadius(\"999px\");\n // Pointer-events pass through to the slider root so `addListener`\n // matches by id on every press, and the root's cursor is what shows\n // on hover anywhere over the control.\n this._track.setPointerEvents(\"none\");\n\n this._activeTrack = new Component();\n this._activeTrack.setBackgroundColor(\"var(--ts-ui-slider-track-active-bg, rgb(30, 100, 200))\");\n this._activeTrack.setBorderRadius(\"999px\");\n this._activeTrack.setPointerEvents(\"none\");\n\n this._thumb = new Component();\n this._thumb.setBackgroundColor(\"var(--ts-ui-slider-thumb-bg, rgb(255, 255, 255))\");\n this._thumb.setBorderRadius(\"50%\");\n this._thumb.setBorder(\"1px solid var(--ts-ui-form-border, rgb(160, 160, 160))\");\n this._thumb.setShadow(\"0 1px 2px rgba(0, 0, 0, 0.25)\");\n this._thumb.setPreferredSize({ width: THUMB_SIZE, height: THUMB_SIZE });\n this._thumb.setMaxSize({ width: THUMB_SIZE, height: THUMB_SIZE });\n this._thumb.setPointerEvents(\"none\");\n\n this._track.addComponent(this._activeTrack);\n super.addComponent(this._track);\n super.addComponent(this._thumb);\n\n this.setPreferredSize({ width: 200, height: THUMB_SIZE });\n this.setMaxSize({ width: UNBOUNDED, height: THUMB_SIZE });\n this.setOutline(\"none\");\n this.setCursor(\"pointer\");\n\n this.getAria().setRole(\"slider\");\n this.getAria().setTabIndex(0);\n this.getAria().setOrientation(\"horizontal\");\n this.getAria().setValueMin(DEFAULT_MIN);\n this.getAria().setValueMax(DEFAULT_MAX);\n this.getAria().setValueNow(DEFAULT_MIN);\n\n this.installInteraction();\n\n if (this._options.minValue !== undefined && this._options.min === undefined) {\n this._options.min = this._options.minValue;\n }\n\n if (this._options.maxValue !== undefined && this._options.max === undefined) {\n this._options.max = this._options.maxValue;\n }\n\n if (this._options.min !== undefined) {\n this.applyMin(this._options.min);\n }\n\n if (this._options.max !== undefined) {\n this.applyMax(this._options.max);\n }\n\n if (this._options.orientation !== undefined) {\n this.applyOrientation(this._options.orientation);\n }\n\n if (this._options.value !== undefined) {\n const snapped = this.snap(this._options.value);\n this._options.value = snapped;\n this.applyValue(snapped);\n } else {\n this.applyValue(this.getMin());\n }\n\n if (this._options.enabled !== undefined) {\n this.applyEnabled(this._options.enabled);\n }\n\n if (this._options.readOnly !== undefined) {\n this.applyReadOnly(this._options.readOnly);\n }\n }\n\n /**\n * Applies a {@link SliderOptions} bag. Inherited Component fields cascade\n * through `super.applyOptions`; slider-specific fields are stored pure on\n * `_options` so the constructor body can dispatch them after children\n * are built.\n *\n * @param options - The options bag carrying the values to apply.\n *\n * @returns This component, for method chaining.\n */\n protected applyOptions(options: TOptions): this {\n super.applyOptions(options);\n\n if (options.value !== undefined) this._options.value = options.value;\n if (options.min !== undefined) this._options.min = options.min;\n if (options.max !== undefined) this._options.max = options.max;\n if (options.minValue !== undefined) this._options.minValue = options.minValue;\n if (options.maxValue !== undefined) this._options.maxValue = options.maxValue;\n if (options.step !== undefined) this._options.step = options.step;\n if (options.largeStep !== undefined) this._options.largeStep = options.largeStep;\n if (options.orientation !== undefined) this._options.orientation = options.orientation;\n if (options.showTicks !== undefined) this._options.showTicks = options.showTicks;\n if (options.enabled !== undefined) this._options.enabled = options.enabled;\n if (options.readOnly !== undefined) this._options.readOnly = options.readOnly;\n\n return this;\n }\n\n /**\n * Returns the current slider value.\n *\n * @returns The current numeric value.\n */\n getValue(): number {\n return this._options.value ?? this.getMin();\n }\n\n /**\n * Sets the slider value, clamped to `[min, max]` and snapped to `step`.\n * Notifies change and binding listeners only on a real transition.\n *\n * @param value - The desired value.\n *\n * @returns This component, for method chaining.\n */\n setValue(value: number): this {\n const next = this.snap(value);\n if (next === this.getValue()) {\n return this;\n }\n\n this._options.value = next;\n this.applyValue(next);\n this.notifyChange(next);\n\n // Existing consumers wire to \"input\" via `on(\"action\", fn)`. Fire so\n // demos that read `slider.getValue()` from an `input` callback keep\n // working.\n Event.fireEvent(this, \"input\");\n\n return this;\n }\n\n /**\n * Returns the minimum value.\n *\n * @returns The current minimum.\n */\n getMin(): number {\n return this._options.min ?? DEFAULT_MIN;\n }\n\n /**\n * Sets the minimum value. The current value is reclamped if it falls\n * below the new minimum.\n *\n * @param value - The new minimum.\n *\n * @returns This component, for method chaining.\n */\n setMin(value: number): this {\n this._options.min = value;\n this.applyMin(value);\n this.applyValue(this.snap(this.getValue()));\n\n return this;\n }\n\n /**\n * Returns the maximum value.\n *\n * @returns The current maximum.\n */\n getMax(): number {\n return this._options.max ?? DEFAULT_MAX;\n }\n\n /**\n * Sets the maximum value. The current value is reclamped if it exceeds\n * the new maximum.\n *\n * @param value - The new maximum.\n *\n * @returns This component, for method chaining.\n */\n setMax(value: number): this {\n this._options.max = value;\n this.applyMax(value);\n this.applyValue(this.snap(this.getValue()));\n\n return this;\n }\n\n /**\n * Deprecated alias for {@link setMin}. Kept so existing demos compile;\n * remove in a follow-up cleanup once all consumers are migrated.\n *\n * @param value - The new minimum.\n *\n * @returns This component, for method chaining.\n *\n * @deprecated Use {@link setMin}.\n */\n setMinValue(value: number): this {\n return this.setMin(value);\n }\n\n /**\n * Deprecated alias for {@link getMin}.\n *\n * @returns The current minimum.\n *\n * @deprecated Use {@link getMin}.\n */\n getMinValue(): number {\n return this.getMin();\n }\n\n /**\n * Deprecated alias for {@link setMax}.\n *\n * @param value - The new maximum.\n *\n * @returns This component, for method chaining.\n *\n * @deprecated Use {@link setMax}.\n */\n setMaxValue(value: number): this {\n return this.setMax(value);\n }\n\n /**\n * Deprecated alias for {@link getMax}.\n *\n * @returns The current maximum.\n *\n * @deprecated Use {@link getMax}.\n */\n getMaxValue(): number {\n return this.getMax();\n }\n\n /**\n * Returns the step increment.\n *\n * @returns The current step.\n */\n getStep(): number {\n return this._options.step ?? DEFAULT_STEP;\n }\n\n /**\n * Sets the step increment used by keyboard navigation and value snapping.\n *\n * @param value - The new step.\n *\n * @returns This component, for method chaining.\n */\n setStep(value: number): this {\n this._options.step = value;\n\n return this;\n }\n\n /**\n * Returns the large-step increment used by PageUp / PageDown. Defaults to\n * `10 * step` when not explicitly set.\n *\n * @returns The current large-step.\n */\n getLargeStep(): number {\n return this._options.largeStep ?? this.getStep() * 10;\n }\n\n /**\n * Sets the PageUp / PageDown increment.\n *\n * @param value - The new large-step.\n *\n * @returns This component, for method chaining.\n */\n setLargeStep(value: number): this {\n this._options.largeStep = value;\n\n return this;\n }\n\n /**\n * Returns the current orientation.\n *\n * @returns `\"horizontal\"` or `\"vertical\"`.\n */\n getOrientation(): AxisOrientation {\n return this._options.orientation ?? \"horizontal\";\n }\n\n /**\n * Sets the slider orientation. Updates the ARIA attribute, the keyboard\n * model, and the track + thumb layout.\n *\n * @param orientation - `\"horizontal\"` or `\"vertical\"`.\n *\n * @returns This component, for method chaining.\n */\n setOrientation(orientation: AxisOrientation): this {\n this._options.orientation = orientation;\n this.applyOrientation(orientation);\n this.applyValue(this.getValue());\n\n return this;\n }\n\n /**\n * Returns whether tick marks are visible. (Not yet rendered visually —\n * the field is reserved for a follow-up.)\n *\n * @returns `true` when ticks should be shown.\n */\n isShowTicks(): boolean {\n return this._options.showTicks ?? false;\n }\n\n /**\n * Toggles tick mark visibility. Reserved option; no visual side effect\n * yet.\n *\n * @param value - `true` to show ticks.\n *\n * @returns This component, for method chaining.\n */\n setShowTicks(value: boolean): this {\n this._options.showTicks = value;\n\n return this;\n }\n\n /**\n * Registers a listener for one of this slider's events. `\"action\"` is a\n * typed semantic shorthand over {@link Event.addListener} for the\n * value-change event (the native `input`, fired on each drag step);\n * `\"change\"` and `\"binding\"` are the inherited {@link AbstractInput}\n * listener-bag events.\n *\n * @param event - The event name.\n * @param listener - The callback to invoke when the event fires.\n *\n * @returns This component, for method chaining.\n */\n on(event: \"action\", listener: Event.Listener): this;\n on(event: \"change\", listener: (value: number) => void): this;\n on(event: \"binding\", listener: () => void): this;\n on(event: \"action\" | \"change\" | \"binding\", listener: Function): this {\n if (event === \"action\") {\n Event.addListener(this, \"input\", listener as Event.Listener);\n\n return this;\n }\n\n return super.on(event as \"change\", listener as (value: number) => void);\n }\n\n /**\n * Removes a previously registered listener. The exact callback\n * reference must match the one passed to {@link on}.\n *\n * @param event - The event the listener was registered for.\n * @param listener - The callback to remove.\n *\n * @returns This component, for method chaining.\n */\n off(event: \"action\" | \"change\" | \"binding\", listener: Function): this {\n if (event === \"action\") {\n Event.removeListener(this, \"input\", listener as Event.Listener);\n\n return this;\n }\n\n return super.off(event, listener);\n }\n\n /**\n * Returns a baseline near the bottom edge so the slider participates in\n * baseline alignment — sitting with its bottom roughly on the surrounding\n * text baseline — instead of being vertically centred in the row. The 2px\n * lift matches the other graphical controls so it doesn't sit below the\n * text descenders.\n *\n * @returns The preferred height minus 2, or `null` before a size is set.\n */\n getBaseline(): number | null {\n const size = this.getPreferredSize();\n\n return size ? size.height - 2 : null;\n }\n\n /**\n * Lays out the track, active fill, and thumb for the current size.\n *\n * @returns This component, for method chaining.\n */\n doLayout(): this {\n // The content box, not the inner size: the inner size is the right\n // extent but carries no origin, so a padded slider would lay its track\n // out at the inner edge of its border and ignore the padding it just\n // subtracted. `_activeTrack` keeps its own zero origin — it is a child\n // of `_track`, so it is already inside the track's box.\n const box = this.getContentBounds();\n if (!box) {\n return this;\n }\n\n const horizontal = this.getOrientation() === \"horizontal\";\n\n // `Component.setWidth` / `setHeight` clamp to the component's own\n // maxSize, so `box` is already bounded by our `setMaxSize(_,\n // THUMB_SIZE)` (or `setMaxSize(THUMB_SIZE, _)` when vertical) — no\n // extra cross-axis clamp is needed here.\n const innerWidth = box.width;\n const innerHeight = box.height;\n const min = this.getMin();\n const max = this.getMax();\n const range = max - min;\n const fraction = range > 0 ? (this.getValue() - min) / range : 0;\n\n // doLayout only setX/setY/setSize on the children; their preferredSize\n // is a hint for parent layouts and never reaches their own DOM. Size\n // the thumb explicitly so it renders at THUMB_SIZE rather than\n // collapsing to its 2 × 2 border box.\n if (horizontal) {\n const trackTop = Math.round((innerHeight - TRACK_THICKNESS) / 2);\n this._track.setX(box.x);\n this._track.setY(box.y + trackTop);\n this._track.setSize({ width: innerWidth, height: TRACK_THICKNESS });\n\n const activeWidth = Math.round(innerWidth * fraction);\n this._activeTrack.setX(0);\n this._activeTrack.setY(0);\n this._activeTrack.setSize({ width: activeWidth, height: TRACK_THICKNESS });\n\n const thumbX = Math.round((innerWidth - THUMB_SIZE) * fraction);\n const thumbY = Math.round((innerHeight - THUMB_SIZE) / 2);\n this._thumb.setSize({ width: THUMB_SIZE, height: THUMB_SIZE });\n this._thumb.setX(box.x + thumbX);\n this._thumb.setY(box.y + thumbY);\n } else {\n const trackLeft = Math.round((innerWidth - TRACK_THICKNESS) / 2);\n this._track.setX(box.x + trackLeft);\n this._track.setY(box.y);\n this._track.setSize({ width: TRACK_THICKNESS, height: innerHeight });\n\n // Vertical slider: zero is at the bottom by convention.\n const activeHeight = Math.round(innerHeight * fraction);\n this._activeTrack.setX(0);\n this._activeTrack.setY(innerHeight - activeHeight);\n this._activeTrack.setSize({ width: TRACK_THICKNESS, height: activeHeight });\n\n const thumbX = Math.round((innerWidth - THUMB_SIZE) / 2);\n const thumbY = Math.round((innerHeight - THUMB_SIZE) * (1 - fraction));\n this._thumb.setSize({ width: THUMB_SIZE, height: THUMB_SIZE });\n this._thumb.setX(box.x + thumbX);\n this._thumb.setY(box.y + thumbY);\n }\n\n return this;\n }\n\n /**\n * Wires pointer drag (with setPointerCapture) and keyboard navigation.\n */\n private installInteraction(): void {\n // `pointer-events: none` on the inner visual children forwards pointer\n // hits to the root, so the exact-target `addListener` matches the\n // slider's id. `setPointerCapture` below then routes the move / up /\n // cancel stream to the same root element.\n Event.addListener(this, \"pointerdown\", (e: PointerEvent) => {\n if (!this.isEnabled() || this.isReadOnly()) {\n return;\n }\n\n e.preventDefault();\n this.focus();\n\n const element = this.getElement();\n if (element) {\n DOM.sink.setPointerCapture(element, e.pointerId);\n this._draggingPointer = e.pointerId;\n }\n\n this.setValue(this.valueAtPointer(e));\n });\n\n Event.addListener(this, \"pointermove\", (e: PointerEvent) => {\n if (this._draggingPointer !== e.pointerId) {\n return;\n }\n\n this.setValue(this.valueAtPointer(e));\n });\n\n const release = (e: PointerEvent): void => {\n if (this._draggingPointer !== e.pointerId) {\n return;\n }\n\n const element = this.getElement();\n if (element && DOM.source.hasPointerCapture(element, e.pointerId)) {\n DOM.sink.releasePointerCapture(element, e.pointerId);\n }\n\n this._draggingPointer = null;\n };\n\n Event.addListener(this, \"pointerup\", release);\n Event.addListener(this, \"pointercancel\", release);\n // Browser releases pointer capture on alt-tab / focus loss. Clear our\n // mirror so the next pointerdown starts clean and there's no stuck-drag.\n Event.addListener(this, \"lostpointercapture\", release);\n\n Event.addListener(this, \"keydown\", (e: KeyboardEvent) => {\n if (!this.isEnabled() || this.isReadOnly()) {\n return;\n }\n\n const step = this.getStep();\n const largeStep = this.getLargeStep();\n const min = this.getMin();\n const max = this.getMax();\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n e.preventDefault();\n this.setValue(this.getValue() + step);\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n e.preventDefault();\n this.setValue(this.getValue() - step);\n break;\n case \"PageUp\":\n e.preventDefault();\n this.setValue(this.getValue() + largeStep);\n break;\n case \"PageDown\":\n e.preventDefault();\n this.setValue(this.getValue() - largeStep);\n break;\n case \"Home\":\n e.preventDefault();\n this.setValue(min);\n break;\n case \"End\":\n e.preventDefault();\n this.setValue(max);\n break;\n }\n });\n }\n\n /**\n * Converts a pointer position into the corresponding slider value.\n */\n private valueAtPointer(e: PointerEvent): number {\n const element = this.getElement();\n if (!element) {\n return this.getValue();\n }\n\n // Measured against the same content box `doLayout` draws the track in,\n // not the outer rect: with padding the two disagree by that padding on\n // every pointer sample, and the thumb would trail the cursor. The\n // viewport rect is the border box, so reaching the content origin from\n // it costs the border as well as `getContentBounds`' own offset, which\n // is measured from the padding box.\n const rect = DOM.source.getViewportRect(this);\n const box = this.getContentBounds() ?? { x: 0, y: 0, width: rect.width, height: rect.height };\n const border = this.getBorderSize();\n const left = rect.left + border.left + box.x;\n const top = rect.top + border.top + box.y;\n const horizontal = this.getOrientation() === \"horizontal\";\n const fraction = horizontal\n ? (box.width > 0 ? (e.clientX - left) / box.width : 0)\n : (box.height > 0 ? 1 - (e.clientY - top) / box.height : 0);\n\n const clamped = Util.clamp(fraction, 0, 1);\n const min = this.getMin();\n const max = this.getMax();\n\n return min + (max - min) * clamped;\n }\n\n /**\n * Clamps `value` to `[min, max]` and snaps to the nearest step boundary.\n */\n private snap(value: number): number {\n const min = this.getMin();\n const max = this.getMax();\n const step = this.getStep();\n\n const clamped = Util.clamp(value, min, max);\n\n if (step <= 0) {\n return clamped;\n }\n\n const snapped = min + Math.round((clamped - min) / step) * step;\n\n return Util.clamp(snapped, min, max);\n }\n\n /**\n * Updates the value-related ARIA state and re-runs layout to move the\n * thumb.\n */\n private applyValue(value: number): void {\n this._options.value = value;\n this.getAria().setValueNow(value);\n this.scheduleLayout();\n }\n\n /**\n * Pushes the new minimum into the ARIA cache.\n */\n private applyMin(value: number): void {\n this.getAria().setValueMin(value);\n }\n\n /**\n * Pushes the new maximum into the ARIA cache.\n */\n private applyMax(value: number): void {\n this.getAria().setValueMax(value);\n }\n\n /**\n * Reflects the orientation in ARIA, swaps the preferred size between\n * landscape and portrait, and forces a layout.\n */\n private applyOrientation(orientation: AxisOrientation): void {\n this.getAria().setOrientation(orientation);\n\n if (orientation === \"horizontal\") {\n this.setPreferredSize({ width: 200, height: THUMB_SIZE });\n this.setMaxSize({ width: UNBOUNDED, height: THUMB_SIZE });\n } else {\n this.setPreferredSize({ width: THUMB_SIZE, height: 200 });\n this.setMaxSize({ width: THUMB_SIZE, height: UNBOUNDED });\n }\n\n this.scheduleLayout();\n }\n\n /**\n * Reflects the enabled flag in the ARIA tree and tabindex.\n */\n protected applyEnabled(value: boolean): void {\n this.getAria().setDisabled(!value);\n this.getAria().setTabIndex(value ? 0 : -1);\n this.setCursor(value ? \"pointer\" : \"default\");\n }\n\n /**\n * Reflects the read-only flag in the ARIA tree.\n */\n protected applyReadOnly(value: boolean): void {\n this.getAria().setReadOnly(value);\n }\n}\n\nconst SliderCallable = callable(Slider);\ntype SliderCallable<TOptions extends SliderOptions = SliderOptions> = Slider<TOptions>;\nexport {\n Slider as _Slider,\n SliderCallable as Slider\n};\n"],"mappings":"yOAiCA,IAAM,MAAN,cAAoB,CAAmB,CAEnC,OAEA,YAAY,EAAc,EAAe,EAAwB,CAC7D,GAAI,CAAC,EACD,MAAU,MAAM,iEAAiE,EAGrF,MAAM,EAAM,CAAE,GAAI,GAAW,CAAC,EAAI,IAAK,GAAS,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EAAK,MAAM,EAAO,EAAK,CAAG,EAE1C,GAAI,GAAQ,EACR,OAAO,EAGX,IAAM,EAAU,EAAM,KAAK,OAAO,EAAU,GAAO,CAAI,EAAI,EAE3D,OAAO,EAAK,MAAM,EAAS,EAAK,CAAG,CACvC,CAMA,WAAmB,EAAqB,CACpC,KAAK,SAAS,MAAQ,EACtB,KAAK,QAAQ,CAAC,CAAC,YAAY,CAAK,EAChC,KAAK,eAAe,CACxB,CAKA,SAAiB,EAAqB,CAClC,KAAK,QAAQ,CAAC,CAAC,YAAY,CAAK,CACpC,CAKA,SAAiB,EAAqB,CAClC,KAAK,QAAQ,CAAC,CAAC,YAAY,CAAK,CACpC,CAMA,iBAAyB,EAAoC,CACzD,KAAK,QAAQ,CAAC,CAAC,eAAe,CAAW,EAErC,IAAgB,cAChB,KAAK,iBAAiB,CAAE,MAAO,IAAK,OAAQ,CAAW,CAAC,EACxD,KAAK,WAAW,CAAE,MAAO,EAAW,OAAQ,CAAW,CAAC,IAExD,KAAK,iBAAiB,CAAE,MAAO,EAAY,OAAQ,GAAI,CAAC,EACxD,KAAK,WAAW,CAAE,MAAO,EAAY,OAAQ,CAAU,CAAC,GAG5D,KAAK,eAAe,CACxB,CAKA,aAAuB,EAAsB,CACzC,KAAK,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAK,EACjC,KAAK,QAAQ,CAAC,CAAC,YAAY,EAAQ,EAAI,EAAE,EACzC,KAAK,UAAU,EAAQ,UAAY,SAAS,CAChD,CAKA,cAAwB,EAAsB,CAC1C,KAAK,QAAQ,CAAC,CAAC,YAAY,CAAK,CACpC,CACJ,EAEM,EAAiB,EAAS,MAAM"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./DOM-67StIm5G.js";import{i as t,n}from"./Position-Ck_KD4cR.js";import{S as r,h as i,r as a}from"./Component-fRQvgaEY.js";import{t as o}from"./Glyph-wN7bk7mg.js";import{t as s}from"./Button-MZDYJOMC.js";import{xmark as c}from"./glyphs/solid/xmark.es.js";var ToggleButton=class extends s{get selectedStyleRule(){return this._selectedStyleRule??=this.createStyleRule(`.selected:not(:hover)`)}constructor(e,t){super(e),this.selectedStyleRule.set(`boxShadow`,`var(--ts-ui-toggle-selected-shadow, 2px 2px 1px inset grey)`),this.selectedStyleRule.set(`backgroundColor`,`var(--ts-ui-toggle-selected-bg, rgb(200, 200, 200))`),this.selectedStyleRule.set(`backgroundImage`,`var(--ts-ui-toggle-selected-bg, none)`),r.addListener(this,`click`,()=>this.onAction()),t&&this.applyOptions(t),this.applyListeners(t?.listeners)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&this.setSelected(e.selected),this.isFlat()&&(this.setSelectedShadow(`var(--ts-ui-button-flat-pressed-shadow, inset 1px 1px 3px rgba(0, 0, 0, 0.25))`),this.setSelectedBackgroundColor(`var(--ts-ui-button-flat-pressed-bg, rgba(0, 0, 0, 0.10))`)),this}on(e,t){return r.addListener(this,`change`,t),this}off(e,t){return r.removeListener(this,`change`,t),this}isSelected(){return this._options.selected??!1}setSelected(t){this._options.selected=t,this.getAria().setPressed(t);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{selected:t}}),this}setSelectedBackgroundColor(e){return this.selectedStyleRule.set(`backgroundColor`,e),this}setSelectedBackgroundImage(e){return this.selectedStyleRule.set(`backgroundImage`,e),this}setSelectedShadow(e){return this.selectedStyleRule.set(`boxShadow`,e),this}setSelectedBorder(e){let n=typeof e==`string`?{border:e}:e;return this.selectedStyleRule.setMany(t(n)),this}setFlat(e){return super.setFlat(e),this.isFlat()?(this.setSelectedShadow(`var(--ts-ui-button-flat-pressed-shadow, inset 1px 1px 3px rgba(0, 0, 0, 0.25))`),this.setSelectedBackgroundColor(`var(--ts-ui-button-flat-pressed-bg, rgba(0, 0, 0, 0.10))`)):(this.setSelectedShadow(`var(--ts-ui-toggle-selected-shadow, 2px 2px 1px inset grey)`),this.setSelectedBackgroundColor(`var(--ts-ui-toggle-selected-bg, rgb(200, 200, 200))`)),this}onAction(){this.setSelected(!this.isSelected()),r.fireEvent(this,`change`)}render(){let t=super.render();return e.sink.apply(t,{toggleClass:{selected:this.isSelected()}}),t}},l=i(ToggleButton);o.register(c);var u={preferredSize:{width:16,height:16},insets:new n(0,0,0,0),foregroundColor:`var(--ts-ui-close-button-fg, #555)`},TabCloseButton=class extends s{constructor(e,t){super(void 0,e,{...u,glyph:`xmark`,...t??{}})}},d=i(TabCloseButton),TabButton=class extends l{_closeable=!1;_closeButton=null;constructor(e,t){super(e),this._closeable=t?.closeable??!1,t&&this.applyOptions(t),this.applyTabStyling(),t?.glyph!==void 0&&this.setGlyph(t.glyph),this._closeable&&this.buildCloseButton(),this.applyListeners(t?.listeners)}destructor(){this._closeButton?.dispose(),super.destructor()}applyTabStyling(){this.setBackgroundColor(`var(--ts-ui-tab-button-bg, #b8b8c3)`),this.setBackgroundImage(`var(--ts-ui-tab-button-bg, #b8b8c3)`),this.setBorder({borderTop:`var(--ts-ui-tab-button-border-top, var(--ts-ui-tab-button-border, none))`,borderRight:`var(--ts-ui-tab-button-border-right, var(--ts-ui-tab-button-border, none))`,borderBottom:`var(--ts-ui-tab-button-border-bottom, var(--ts-ui-tab-button-border, none))`,borderLeft:`var(--ts-ui-tab-button-border-left, var(--ts-ui-tab-button-border, none))`}),this.clearBorderRadius(),this.clearShadow(),this.setHoverBackgroundColor(`var(--ts-ui-tab-button-hover-bg, #c4c4cf)`),this.setHoverBackgroundImage(`var(--ts-ui-tab-button-hover-bg, #c4c4cf)`),this.setHoverShadow(`none`),this.setHoverBorder({borderTop:`var(--ts-ui-tab-button-hover-border-top, var(--ts-ui-tab-button-hover-border, none))`,borderRight:`var(--ts-ui-tab-button-hover-border-right, var(--ts-ui-tab-button-hover-border, none))`,borderBottom:`var(--ts-ui-tab-button-hover-border-bottom, var(--ts-ui-tab-button-hover-border, none))`,borderLeft:`var(--ts-ui-tab-button-hover-border-left, var(--ts-ui-tab-button-hover-border, none))`}),this.setSelectedBackgroundColor(`var(--ts-ui-tab-button-selected-bg, rgb(255, 255, 255))`),this.setSelectedBackgroundImage(`var(--ts-ui-tab-button-selected-bg, rgb(255, 255, 255))`),this.setSelectedShadow(`none`),this.setSelectedBorder({borderTop:`var(--ts-ui-tab-button-selected-border-top, var(--ts-ui-tab-button-selected-border, none))`,borderRight:`var(--ts-ui-tab-button-selected-border-right, var(--ts-ui-tab-button-selected-border, none))`,borderBottom:`var(--ts-ui-tab-button-selected-border-bottom, var(--ts-ui-tab-button-selected-border, none))`,borderLeft:`var(--ts-ui-tab-button-selected-border-left, var(--ts-ui-tab-button-selected-border, none))`})}buildCloseButton(){let t=new d;t.setBackgroundColor(`transparent`),t.setBackgroundImage(`none`),t.setHoverBackgroundColor(`var(--ts-ui-tab-close-hover-bg, rgba(0, 0, 0, 0.12))`),t.setHoverBackgroundImage(`none`),t.setHoverShadow(`none`),t.setBorderRadius(`3px`),t.clearBorder(),t.clearShadow(),t.setZIndex(1);let n=a.getResolvedScale();t.setWidth(n.tabClose),t.setHeight(n.tabClose),t.pinGlyphSize(n.tabCloseGlyph),e.sink.appendChild(this.getElement(!0),t.getElement(!0)),this._closeButton=t}getCloseButton(){return this._closeButton}isCloseable(){return this._closeable}},f=i(TabButton);export{d as n,l as r,f as t};
2
- //# sourceMappingURL=TabButton-DKECTTk1.js.map