@jimka/typescript-ui 0.7.0 → 0.8.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 (296) hide show
  1. package/dist/lib/AbstractInput-Dt9ooHjo.js +2 -0
  2. package/dist/lib/AbstractInput-Dt9ooHjo.js.map +1 -0
  3. package/dist/lib/AccordionConstraints-DahZEfEp.js +2 -0
  4. package/dist/lib/AccordionConstraints-DahZEfEp.js.map +1 -0
  5. package/dist/lib/{Anchor-iZhsvMlT.js → Anchor-DdYgyn2V.js} +2 -2
  6. package/dist/lib/{Anchor-iZhsvMlT.js.map → Anchor-DdYgyn2V.js.map} +1 -1
  7. package/dist/lib/{AnimatedDropdown-D0RhVgv3.js → AnimatedDropdown-_KhHzX5D.js} +2 -2
  8. package/dist/lib/AnimatedDropdown-_KhHzX5D.js.map +1 -0
  9. package/dist/lib/Border-BELbqMDJ.js +2 -0
  10. package/dist/lib/Border-BELbqMDJ.js.map +1 -0
  11. package/dist/lib/Button-CKzjQyqA.js +2 -0
  12. package/dist/lib/Button-CKzjQyqA.js.map +1 -0
  13. package/dist/lib/{Card-C20k2YHU.js → Card-CAp7LcB5.js} +2 -2
  14. package/dist/lib/{Card-C20k2YHU.js.map → Card-CAp7LcB5.js.map} +1 -1
  15. package/dist/lib/Checkbox-CvAZJ4_T.js +2 -0
  16. package/dist/lib/Checkbox-CvAZJ4_T.js.map +1 -0
  17. package/dist/lib/CodeEditor-DoGGdL1Y.js +2 -0
  18. package/dist/lib/CodeEditor-DoGGdL1Y.js.map +1 -0
  19. package/dist/lib/ComboBox-DgjMnpdh.js +2 -0
  20. package/dist/lib/ComboBox-DgjMnpdh.js.map +1 -0
  21. package/dist/lib/Component-YrLXKJZS.js +2 -0
  22. package/dist/lib/Component-YrLXKJZS.js.map +1 -0
  23. package/dist/lib/Container-C5cxnioS.js +2 -0
  24. package/dist/lib/{Container-FWRjgF6T.js.map → Container-C5cxnioS.js.map} +1 -1
  25. package/dist/lib/DOM-DDhDN8lQ.js +2 -0
  26. package/dist/lib/DOM-DDhDN8lQ.js.map +1 -0
  27. package/dist/lib/Diagnostics-MI6Yw-3E.js +2 -0
  28. package/dist/lib/Diagnostics-MI6Yw-3E.js.map +1 -0
  29. package/dist/lib/Dialog-CXQXRQQK.js +2 -0
  30. package/dist/lib/Dialog-CXQXRQQK.js.map +1 -0
  31. package/dist/lib/DragManager-D5pBaPPg.js +2 -0
  32. package/dist/lib/DragManager-D5pBaPPg.js.map +1 -0
  33. package/dist/lib/{FieldDecorator-DyPX8CFh.js → FieldDecorator-37IgKHHm.js} +2 -2
  34. package/dist/lib/{FieldDecorator-DyPX8CFh.js.map → FieldDecorator-37IgKHHm.js.map} +1 -1
  35. package/dist/lib/{Fit-CaPMj7Up.js → Fit-amTWlJM2.js} +2 -2
  36. package/dist/lib/{Fit-CaPMj7Up.js.map → Fit-amTWlJM2.js.map} +1 -1
  37. package/dist/lib/{FloatingPanel-Dsy_vJxi.js → FloatingPanel-CwsFPYbc.js} +2 -2
  38. package/dist/lib/{FloatingPanel-Dsy_vJxi.js.map → FloatingPanel-CwsFPYbc.js.map} +1 -1
  39. package/dist/lib/Glyph-Cof7BxfJ.js +2 -0
  40. package/dist/lib/Glyph-Cof7BxfJ.js.map +1 -0
  41. package/dist/lib/{Grid-ft_UUpj8.js → Grid-BQZ4UIUH.js} +2 -2
  42. package/dist/lib/{Grid-ft_UUpj8.js.map → Grid-BQZ4UIUH.js.map} +1 -1
  43. package/dist/lib/GridConstraints-BkXa62z0.js +2 -0
  44. package/dist/lib/GridConstraints-BkXa62z0.js.map +1 -0
  45. package/dist/lib/{Header-Osm3IjDw.js → Header-Cj33ABP1.js} +2 -2
  46. package/dist/lib/{Header-Osm3IjDw.js.map → Header-Cj33ABP1.js.map} +1 -1
  47. package/dist/lib/{IconText-BBaYJ2Fx.js → IconText-Dp64iq_q.js} +2 -2
  48. package/dist/lib/{IconText-BBaYJ2Fx.js.map → IconText-Dp64iq_q.js.map} +1 -1
  49. package/dist/lib/LabeledGrid-Dpelrc1k.js +2 -0
  50. package/dist/lib/LabeledGrid-Dpelrc1k.js.map +1 -0
  51. package/dist/lib/LayoutSerialization-DgLJSuew.js +2 -0
  52. package/dist/lib/LayoutSerialization-DgLJSuew.js.map +1 -0
  53. package/dist/lib/Link-DE8tE3u3.js +2 -0
  54. package/dist/lib/Link-DE8tE3u3.js.map +1 -0
  55. package/dist/lib/List-TfgHScl3.js +2 -0
  56. package/dist/lib/List-TfgHScl3.js.map +1 -0
  57. package/dist/lib/ListenerBag-DYRl4TSb.js +2 -0
  58. package/dist/lib/ListenerBag-DYRl4TSb.js.map +1 -0
  59. package/dist/lib/{MemoryStore-DhPoU-7X.js → MemoryStore-ByGDEKYI.js} +2 -2
  60. package/dist/lib/{MemoryStore-DhPoU-7X.js.map → MemoryStore-ByGDEKYI.js.map} +1 -1
  61. package/dist/lib/Menu-BCQISKiQ.js +2 -0
  62. package/dist/lib/Menu-BCQISKiQ.js.map +1 -0
  63. package/dist/lib/{MenuButton-BqCT-1yv.js → MenuButton-BO4y3jf2.js} +2 -2
  64. package/dist/lib/{MenuButton-BqCT-1yv.js.map → MenuButton-BO4y3jf2.js.map} +1 -1
  65. package/dist/lib/{OverlayFade-CuEXgimf.js → OverlayFade-C1yQKffL.js} +2 -2
  66. package/dist/lib/{OverlayFade-CuEXgimf.js.map → OverlayFade-C1yQKffL.js.map} +1 -1
  67. package/dist/lib/{Panel-CtViePqY.js → Panel-DlsVVuvn.js} +2 -2
  68. package/dist/lib/{Panel-CtViePqY.js.map → Panel-DlsVVuvn.js.map} +1 -1
  69. package/dist/lib/{Position-BIEU1Eze.js → Position-DWR1nIpA.js} +2 -2
  70. package/dist/lib/{Position-BIEU1Eze.js.map → Position-DWR1nIpA.js.map} +1 -1
  71. package/dist/lib/ProgressSpinner-BI9tFIVm.js +2 -0
  72. package/dist/lib/ProgressSpinner-BI9tFIVm.js.map +1 -0
  73. package/dist/lib/RadioButton-BxcuFChp.js +2 -0
  74. package/dist/lib/RadioButton-BxcuFChp.js.map +1 -0
  75. package/dist/lib/RadioMenuRow-B2bthoxj.js +2 -0
  76. package/dist/lib/RadioMenuRow-B2bthoxj.js.map +1 -0
  77. package/dist/lib/{RovingTabIndex--w28AnXc.js → RovingTabIndex-BttlsARv.js} +2 -2
  78. package/dist/lib/{RovingTabIndex--w28AnXc.js.map → RovingTabIndex-BttlsARv.js.map} +1 -1
  79. package/dist/lib/Scrollbar-orAWHWap.js +2 -0
  80. package/dist/lib/Scrollbar-orAWHWap.js.map +1 -0
  81. package/dist/lib/SelectableText-BbS_lRzY.js +2 -0
  82. package/dist/lib/SelectableText-BbS_lRzY.js.map +1 -0
  83. package/dist/lib/Slider-BvXc-cx5.js +2 -0
  84. package/dist/lib/Slider-BvXc-cx5.js.map +1 -0
  85. package/dist/lib/Spacer-C6faKe1V.js +2 -0
  86. package/dist/lib/Spacer-C6faKe1V.js.map +1 -0
  87. package/dist/lib/StyleTraits-CAtzeyRR.js +2 -0
  88. package/dist/lib/StyleTraits-CAtzeyRR.js.map +1 -0
  89. package/dist/lib/TabButton-BQDaBszs.js +2 -0
  90. package/dist/lib/TabButton-BQDaBszs.js.map +1 -0
  91. package/dist/lib/TabCloseButton-B-iLVPGZ.js +2 -0
  92. package/dist/lib/TabCloseButton-B-iLVPGZ.js.map +1 -0
  93. package/dist/lib/Table-3McEw5gr.js +7 -0
  94. package/dist/lib/Table-3McEw5gr.js.map +1 -0
  95. package/dist/lib/Text-CGFXPhHD.js +2 -0
  96. package/dist/lib/Text-CGFXPhHD.js.map +1 -0
  97. package/dist/lib/Tooltip-DgRHQZhL.js +3 -0
  98. package/dist/lib/Tooltip-DgRHQZhL.js.map +1 -0
  99. package/dist/lib/Tree-Bq2pjjAz.js +2 -0
  100. package/dist/lib/Tree-Bq2pjjAz.js.map +1 -0
  101. package/dist/lib/{VBox-DVe4UXwX.js → VBox-hFIZAEpT.js} +2 -2
  102. package/dist/lib/{VBox-DVe4UXwX.js.map → VBox-hFIZAEpT.js.map} +1 -1
  103. package/dist/lib/{VirtualScroller-ggPTCQb0.js → VirtualScroller-Csa3GBSM.js} +2 -2
  104. package/dist/lib/{VirtualScroller-ggPTCQb0.js.map → VirtualScroller-Csa3GBSM.js.map} +1 -1
  105. package/dist/lib/Window-CQ14_65z.js +2 -0
  106. package/dist/lib/Window-CQ14_65z.js.map +1 -0
  107. package/dist/lib/component/button.es.js +1 -1
  108. package/dist/lib/component/button.es.js.map +1 -1
  109. package/dist/lib/component/chart.es.js +1 -1
  110. package/dist/lib/component/chart.es.js.map +1 -1
  111. package/dist/lib/component/container.es.js +1 -1
  112. package/dist/lib/component/container.es.js.map +1 -1
  113. package/dist/lib/component/diagram.es.js +1 -1
  114. package/dist/lib/component/diagram.es.js.map +1 -1
  115. package/dist/lib/component/display.es.js +1 -1
  116. package/dist/lib/component/display.es.js.map +1 -1
  117. package/dist/lib/component/editor.es.js +2 -2
  118. package/dist/lib/component/editor.es.js.map +1 -1
  119. package/dist/lib/component/input.es.js +1 -1
  120. package/dist/lib/component/input.es.js.map +1 -1
  121. package/dist/lib/component/list.es.js +1 -1
  122. package/dist/lib/component/list.es.js.map +1 -1
  123. package/dist/lib/component/menubar.es.js +1 -1
  124. package/dist/lib/component/menubar.es.js.map +1 -1
  125. package/dist/lib/component/table.es.js +1 -6
  126. package/dist/lib/component/table.es.js.map +1 -1
  127. package/dist/lib/component/tree.es.js +1 -1
  128. package/dist/lib/component/tree.es.js.map +1 -1
  129. package/dist/lib/core-DpzpKLWE.js +2 -0
  130. package/dist/lib/core-DpzpKLWE.js.map +1 -0
  131. package/dist/lib/core.es.js +1 -2
  132. package/dist/lib/data.es.js +1 -1
  133. package/dist/lib/diagnostics.es.js +24 -0
  134. package/dist/lib/diagnostics.es.js.map +1 -0
  135. package/dist/lib/glyphs/solid/index.es.js +1 -1
  136. package/dist/lib/layout.es.js +1 -1
  137. package/dist/lib/layout.es.js.map +1 -1
  138. package/dist/lib/overlay.es.js +1 -1
  139. package/dist/lib/overlay.es.js.map +1 -1
  140. package/dist/lib/primitive-8YvORgGS.js +2 -0
  141. package/dist/lib/primitive-8YvORgGS.js.map +1 -0
  142. package/dist/lib/primitive.es.js +1 -2
  143. package/dist/lib/router.es.js +1 -1
  144. package/dist/lib/selectionsEqual-DWdW5pxP.js +2 -0
  145. package/dist/lib/{selectionsEqual-C7MrKMQr.js.map → selectionsEqual-DWdW5pxP.js.map} +1 -1
  146. package/dist/lib/types/component/button/Button.d.ts +6 -14
  147. package/dist/lib/types/component/button/TabButton.d.ts +3 -5
  148. package/dist/lib/types/component/button/TabCloseButton.d.ts +3 -0
  149. package/dist/lib/types/component/button/ToggleButton.d.ts +2 -5
  150. package/dist/lib/types/component/chart/AbstractChart.d.ts +2 -2
  151. package/dist/lib/types/component/container/AccordionHeader.d.ts +6 -1
  152. package/dist/lib/types/component/container/AccordionIndicator.d.ts +2 -0
  153. package/dist/lib/types/component/container/FieldSet.d.ts +2 -0
  154. package/dist/lib/types/component/container/LabeledFieldSet.d.ts +1 -1
  155. package/dist/lib/types/component/container/LabeledGrid.d.ts +4 -1
  156. package/dist/lib/types/component/container/Legend.d.ts +2 -2
  157. package/dist/lib/types/component/container/MenuItem.d.ts +1 -0
  158. package/dist/lib/types/component/container/WindowBorder.d.ts +2 -2
  159. package/dist/lib/types/component/container/WindowHeader.d.ts +6 -0
  160. package/dist/lib/types/component/diagram/DiagramEdgeLayer.d.ts +10 -0
  161. package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +2 -0
  162. package/dist/lib/types/component/diagram/DiagramNode.d.ts +6 -2
  163. package/dist/lib/types/component/diagram/DiagramNodeLayer.d.ts +25 -0
  164. package/dist/lib/types/component/diagram/DiagramResidency.d.ts +11 -0
  165. package/dist/lib/types/component/diagram/DiagramView.d.ts +22 -0
  166. package/dist/lib/types/component/input/AbstractCalendarDropdown.d.ts +4 -4
  167. package/dist/lib/types/component/input/AbstractInput.d.ts +1 -0
  168. package/dist/lib/types/component/input/AbstractPickerField.d.ts +4 -2
  169. package/dist/lib/types/component/input/AutoCompleteDropdown.d.ts +2 -2
  170. package/dist/lib/types/component/input/AutoCompleteField.d.ts +1 -0
  171. package/dist/lib/types/component/input/ComboBox.d.ts +5 -2
  172. package/dist/lib/types/component/input/Link.d.ts +2 -2
  173. package/dist/lib/types/component/input/PasswordField.d.ts +2 -2
  174. package/dist/lib/types/component/input/PickerButton.d.ts +5 -2
  175. package/dist/lib/types/component/input/PickerInput.d.ts +2 -2
  176. package/dist/lib/types/component/input/SelectableText.d.ts +2 -2
  177. package/dist/lib/types/component/input/SpinButton.d.ts +3 -2
  178. package/dist/lib/types/component/input/Text.d.ts +3 -7
  179. package/dist/lib/types/component/input/TextArea.d.ts +2 -2
  180. package/dist/lib/types/component/input/TextField.d.ts +2 -2
  181. package/dist/lib/types/component/input/TextInput.d.ts +4 -2
  182. package/dist/lib/types/component/input/TimePickerDropdown.d.ts +2 -2
  183. package/dist/lib/types/component/input/UsernameField.d.ts +2 -2
  184. package/dist/lib/types/component/list/AbstractMarkerList.d.ts +2 -0
  185. package/dist/lib/types/component/list/AbstractSelectableList.d.ts +4 -2
  186. package/dist/lib/types/component/list/ListItem.d.ts +2 -1
  187. package/dist/lib/types/component/menubar/MenuBarButton.d.ts +3 -0
  188. package/dist/lib/types/component/menubar/ToolBar.d.ts +2 -0
  189. package/dist/lib/types/component/table/Body.d.ts +14 -6
  190. package/dist/lib/types/component/table/Column.d.ts +2 -0
  191. package/dist/lib/types/component/table/ColumnConfig.d.ts +1 -0
  192. package/dist/lib/types/component/table/Footer.d.ts +2 -0
  193. package/dist/lib/types/component/table/Header.d.ts +7 -0
  194. package/dist/lib/types/component/table/Row.d.ts +2 -0
  195. package/dist/lib/types/component/table/Table.d.ts +4 -1
  196. package/dist/lib/types/component/table/TablePanel.d.ts +5 -0
  197. package/dist/lib/types/component/table/TreeTablePanel.d.ts +5 -0
  198. package/dist/lib/types/component/table/cell/Cell.d.ts +3 -2
  199. package/dist/lib/types/component/table/cell/Header.d.ts +4 -3
  200. package/dist/lib/types/component/table/cell/ParentHeader.d.ts +4 -0
  201. package/dist/lib/types/component/tree/TreeRow.d.ts +2 -0
  202. package/dist/lib/types/core/AnimatedDropdown.d.ts +2 -2
  203. package/dist/lib/types/core/Binding.d.ts +1 -0
  204. package/dist/lib/types/core/ClassStyleRules.d.ts +44 -22
  205. package/dist/lib/types/core/Component.d.ts +55 -28
  206. package/dist/lib/types/core/DOM.d.ts +6 -0
  207. package/dist/lib/types/core/Diagnostics.d.ts +22 -0
  208. package/dist/lib/types/core/Event.d.ts +7 -0
  209. package/dist/lib/types/core/LayerManager.d.ts +2 -0
  210. package/dist/lib/types/core/ListenerBag.d.ts +1 -0
  211. package/dist/lib/types/core/StyleTarget.d.ts +12 -0
  212. package/dist/lib/types/core/StyleTraits.d.ts +4 -0
  213. package/dist/lib/types/core/Theme.d.ts +5 -2
  214. package/dist/lib/types/core/index.d.ts +5 -2
  215. package/dist/lib/types/diagnostics/DiagnosticsOverlay.d.ts +29 -0
  216. package/dist/lib/types/diagnostics/DiagnosticsSampler.d.ts +61 -0
  217. package/dist/lib/types/diagnostics/StyleAudit.d.ts +19 -0
  218. package/dist/lib/types/diagnostics/StyleAuditOverlay.d.ts +12 -0
  219. package/dist/lib/types/diagnostics/StyleAuditView.d.ts +13 -0
  220. package/dist/lib/types/diagnostics/index.d.ts +7 -0
  221. package/dist/lib/types/layout/LayoutManager.d.ts +3 -0
  222. package/dist/lib/types/layout/Table.d.ts +1 -0
  223. package/dist/lib/types/overlay/AbstractWindow.d.ts +35 -2
  224. package/dist/lib/types/overlay/ButtonGroup.d.ts +1 -0
  225. package/dist/lib/types/overlay/Dialog.d.ts +1 -0
  226. package/dist/lib/types/overlay/Menu.d.ts +2 -0
  227. package/dist/lib/types/overlay/Notification.d.ts +0 -1
  228. package/dist/lib/types/overlay/PopupPanel.d.ts +2 -2
  229. package/dist/lib/types/overlay/RailHandle.d.ts +4 -5
  230. package/dist/lib/types/overlay/TabWindow.d.ts +3 -0
  231. package/dist/lib/types/overlay/Tooltip.d.ts +1 -0
  232. package/dist/lib/types/overlay/Window.d.ts +4 -1
  233. package/dist/lib/validation.es.js +1 -1
  234. package/llms.txt +2 -0
  235. package/package.json +5 -1
  236. package/dist/lib/AbstractInput-W2PLJV5_.js +0 -2
  237. package/dist/lib/AbstractInput-W2PLJV5_.js.map +0 -1
  238. package/dist/lib/AnimatedDropdown-D0RhVgv3.js.map +0 -1
  239. package/dist/lib/Border-6GsTNV-2.js +0 -2
  240. package/dist/lib/Border-6GsTNV-2.js.map +0 -1
  241. package/dist/lib/Button-CnFAiQuV.js +0 -2
  242. package/dist/lib/Button-CnFAiQuV.js.map +0 -1
  243. package/dist/lib/Checkbox-CM1z8keM.js +0 -2
  244. package/dist/lib/Checkbox-CM1z8keM.js.map +0 -1
  245. package/dist/lib/CheckboxMenuRow-C1h4LPHR.js +0 -2
  246. package/dist/lib/CheckboxMenuRow-C1h4LPHR.js.map +0 -1
  247. package/dist/lib/CodeEditor-CTL2WjF8.js +0 -2
  248. package/dist/lib/CodeEditor-CTL2WjF8.js.map +0 -1
  249. package/dist/lib/ComboBox-PZ5YPL0X.js +0 -2
  250. package/dist/lib/ComboBox-PZ5YPL0X.js.map +0 -1
  251. package/dist/lib/Component-D99-15Zt.js +0 -2
  252. package/dist/lib/Component-D99-15Zt.js.map +0 -1
  253. package/dist/lib/Container-FWRjgF6T.js +0 -2
  254. package/dist/lib/DOM-Cjh7_7TF.js +0 -2
  255. package/dist/lib/DOM-Cjh7_7TF.js.map +0 -1
  256. package/dist/lib/Dialog-DN78RaVH.js +0 -2
  257. package/dist/lib/Dialog-DN78RaVH.js.map +0 -1
  258. package/dist/lib/Glyph-DiEpD3gy.js +0 -2
  259. package/dist/lib/Glyph-DiEpD3gy.js.map +0 -1
  260. package/dist/lib/GridConstraints-CvZ0Nzaw.js +0 -2
  261. package/dist/lib/GridConstraints-CvZ0Nzaw.js.map +0 -1
  262. package/dist/lib/LayoutSerialization-BC64__O7.js +0 -2
  263. package/dist/lib/LayoutSerialization-BC64__O7.js.map +0 -1
  264. package/dist/lib/List-CQbZK_pT.js +0 -2
  265. package/dist/lib/List-CQbZK_pT.js.map +0 -1
  266. package/dist/lib/ListenerBag-WPdKuuds.js +0 -2
  267. package/dist/lib/ListenerBag-WPdKuuds.js.map +0 -1
  268. package/dist/lib/Menu-CwHluLGT.js +0 -2
  269. package/dist/lib/Menu-CwHluLGT.js.map +0 -1
  270. package/dist/lib/ProgressSpinner-BuBvC1FY.js +0 -2
  271. package/dist/lib/ProgressSpinner-BuBvC1FY.js.map +0 -1
  272. package/dist/lib/RadioButton-Df5J-H6m.js +0 -2
  273. package/dist/lib/RadioButton-Df5J-H6m.js.map +0 -1
  274. package/dist/lib/RadioMenuRow-Cfv0x6Qj.js +0 -2
  275. package/dist/lib/RadioMenuRow-Cfv0x6Qj.js.map +0 -1
  276. package/dist/lib/Scrollbar-DcnueNJd.js +0 -2
  277. package/dist/lib/Scrollbar-DcnueNJd.js.map +0 -1
  278. package/dist/lib/SelectableText-DZNxjKXR.js +0 -2
  279. package/dist/lib/SelectableText-DZNxjKXR.js.map +0 -1
  280. package/dist/lib/Slider-DNfd8Lxz.js +0 -2
  281. package/dist/lib/Slider-DNfd8Lxz.js.map +0 -1
  282. package/dist/lib/Spacer-BznfGbwG.js +0 -2
  283. package/dist/lib/Spacer-BznfGbwG.js.map +0 -1
  284. package/dist/lib/TabButton-CAACsMov.js +0 -2
  285. package/dist/lib/TabButton-CAACsMov.js.map +0 -1
  286. package/dist/lib/TabCloseButton-CCiqsX3y.js +0 -2
  287. package/dist/lib/TabCloseButton-CCiqsX3y.js.map +0 -1
  288. package/dist/lib/Text-O-FWa5Cy.js +0 -2
  289. package/dist/lib/Text-O-FWa5Cy.js.map +0 -1
  290. package/dist/lib/Tooltip-CyICVu15.js +0 -3
  291. package/dist/lib/Tooltip-CyICVu15.js.map +0 -1
  292. package/dist/lib/Tree-CSEguhlk.js +0 -2
  293. package/dist/lib/Tree-CSEguhlk.js.map +0 -1
  294. package/dist/lib/core.es.js.map +0 -1
  295. package/dist/lib/primitive.es.js.map +0 -1
  296. package/dist/lib/selectionsEqual-C7MrKMQr.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualScroller-ggPTCQb0.js","names":[],"sources":["../../src/typescript/lib/component/container/VirtualScroller.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component } from \"~/core/Component.js\";\nimport { Util } from \"~/core/Util.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { SmoothScroller, consumeWheel } from \"~/core/SmoothScroller.js\";\nimport { Scrollbar } from \"~/component/container/Scrollbar.js\";\nimport { scrollShadowBoxShadow, scrollShadowEdgeValue, scrollShadowRamp } from \"~/core/ScrollShadow.js\";\n\n/** Per-edge scroll-shadow strength cache, quantised to a whole percent (0–100). */\ntype ScrollShadowEdges = { top: number; bottom: number; left: number; right: number };\n\n// VirtualScroller is a plain helper, not a Component: it owns and lays out raw\n// `clipBox` / `rowsContainer` `HTMLElement`s it creates directly, so the\n// Component style setters don't apply and direct `.style` writes are correct.\n\n/**\n * Callback fired by {@link VirtualScroller} whenever the scroll position\n * changes via user input (wheel, touch, momentum, scrollbar). The owner\n * should re-render its visible window in response.\n *\n * @category Components\n */\nexport type VirtualScrollerOnScroll = () => void;\n\n/**\n * Shared scroll machinery for transform-based virtual lists (e.g. table body,\n * tree). Owns the rows-container element, two custom {@link Scrollbar} overlays\n * (vertical + horizontal), and the wheel/touch handlers with 2-axis fling\n * momentum.\n *\n * The owner component:\n * 1. Constructs a VirtualScroller from its `init()` with the owner element and\n * a callback that re-renders the visible window.\n * 2. Appends pool rows into {@link getRowsContainer}.\n * 3. Reads {@link getScrollX} / {@link getScrollY} to determine the visible window.\n * 4. Calls {@link clampToContent} at the start of `renderWindow` (so scroll\n * positions are sane before being used).\n * 5. Calls {@link layoutScrollbars} at the end of `renderWindow` with the\n * current content sizes; the scroller applies the final clamp and positions\n * the scrollbars.\n *\n * @category Components\n */\nexport class VirtualScroller {\n\n private _owner : Component;\n private _onScroll : VirtualScrollerOnScroll;\n private _clipBox : Handle;\n private _rowsContainer : Handle;\n private _scrollbarV : Scrollbar;\n private _scrollbarH : Scrollbar;\n private _scrollX : number = 0;\n private _scrollY : number = 0;\n private _contentWidth : number = 0;\n private _contentHeight : number = 0;\n private _smooth : SmoothScroller;\n private _shadowOverlay : Handle;\n private _shadowEdges : ScrollShadowEdges = { top: 0, bottom: 0, left: 0, right: 0 };\n\n /**\n * Constructs a VirtualScroller and attaches it to the owner element.\n *\n * @param owner - The component being scrolled (used for `getContentBounds`).\n * @param element - The owner's root DOM element. Must already exist; call\n * this from the owner's `init()` after `super.init(element)`.\n * @param onScroll - Callback invoked when scroll position changes via\n * user input.\n */\n constructor(owner: Component, element: Handle, onScroll: VirtualScrollerOnScroll) {\n this._owner = owner;\n this._onScroll = onScroll;\n\n // Two-element wrapper: the outer `clipBox` carries `overflow:hidden`\n // sized to the effective viewport so the Scrollbar widgets — positioned\n // by `layoutScrollbars` at the far edge of the owner's content box —\n // sit in their own reserved band rather than overlaying the rightmost\n // column / bottom row. The inner `rowsContainer` carries the scroll\n // transform; the transform cannot sit on the same element as\n // `overflow:hidden` because CSS clipping happens in the element's own\n // LOCAL coordinate system before its transform applies — splitting\n // the two roles lets the transform shift the rows around inside a\n // stable clip.\n const clipBox = DOM.sink.createElement(\"div\");\n DOM.sink.apply(clipBox, { style: { position: \"absolute\", top: \"0\", left: \"0\", width: \"100%\", height: \"100%\", overflow: \"hidden\" } });\n DOM.sink.appendChild(element, clipBox);\n this._clipBox = clipBox;\n\n const container = DOM.sink.createElement(\"div\");\n DOM.sink.apply(container, { style: { position: \"absolute\", top: \"0\", left: \"0\", width: \"100%\", transform: \"translate3d(0, 0, 0)\", willChange: \"transform\" } });\n DOM.sink.appendChild(clipBox, container);\n this._rowsContainer = container;\n\n // Position-aware edge shadows, matching the native-scroll `Panel` cue.\n // The overlay is a sibling of `rowsContainer` inside the `clipBox`, so it\n // is clipped to the effective viewport and — being outside the scrolled\n // `rowsContainer` — is not shifted by the scroll transform; sizing it to\n // 100% tracks the clip box that `layoutScrollbars` resizes to the\n // effective viewport. It paints above the rows (appended last) and is\n // inert to the pointer. Each edge is a `box-shadow` layer gated by a\n // custom property; `updateShadows` flips the property per scroll/resize.\n const shadowOverlay = DOM.sink.createElement(\"div\");\n DOM.sink.apply(shadowOverlay, { style: {\n position: \"absolute\",\n top: \"0\",\n left: \"0\",\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n boxShadow: scrollShadowBoxShadow(),\n } });\n DOM.sink.appendChild(clipBox, shadowOverlay);\n this._shadowOverlay = shadowOverlay;\n\n // Drives wheel-initiated scrolling through an eased RAF loop. The seam\n // delegates to the existing setScrollX/Y (which clamp, write the\n // transform, and fire onScroll, so the virtual window re-renders every\n // frame) and clamps targets against the same effective-viewport bounds.\n this._smooth = new SmoothScroller({\n read: (axis) => axis === \"x\" ? this._scrollX : this._scrollY,\n write: (axis, value) => axis === \"x\" ? this.setScrollX(value) : this.setScrollY(value),\n clamp: (axis, value) => this.clampAxis(axis, value),\n });\n\n this._scrollbarV = new Scrollbar(\"vertical\");\n DOM.sink.appendChild(element, this._scrollbarV.getElement(true)!);\n this._scrollbarV.on(\"scroll\", (p: number) => {\n this._smooth.reset();\n this.setScrollY(p);\n });\n\n this._scrollbarH = new Scrollbar(\"horizontal\");\n DOM.sink.appendChild(element, this._scrollbarH.getElement(true)!);\n this._scrollbarH.on(\"scroll\", (p: number) => {\n this._smooth.reset();\n this.setScrollX(p);\n });\n\n this._owner.setTouchAction(\"none\");\n\n // Subtree because wheel events fire on whichever descendant of the\n // owner the pointer is over (a row, a cell, …) — not the owner root.\n // passive: false so onWheel can preventDefault the native page scroll.\n Event.addSubtreeListener(\n this._owner,\n \"wheel\",\n { passive: false, handler: (e: WheelEvent) => this.onWheel(e) },\n );\n\n this.attachTouchHandlers();\n }\n\n /**\n * Disposes the two `Scrollbar` overlays this scroller owns. They are\n * appended straight onto the owner's element rather than registered as its\n * children, so the owner's `destructor()` recursion cannot reach them and\n * their per-instance stylesheet rules would otherwise survive teardown.\n * Called from `VirtualRowView.destructor()`.\n */\n dispose(): void {\n this._scrollbarV.dispose();\n this._scrollbarH.dispose();\n }\n\n /**\n * Returns the two created container handles (clip box and rows container).\n * The owning component tracks these via `trackHandle` so they are released\n * with the owner — on its destructor or, for a discarded owner, on GC — and\n * not left pinned in the registry. The scroller is not a `Component`, so it\n * cannot track its own handles.\n *\n * @returns The scroller's owned element handles.\n */\n ownedHandles(): readonly Handle[] {\n return [this._clipBox, this._rowsContainer, this._shadowOverlay];\n }\n\n /**\n * Returns the rows-container element. Owners append pool rows here so\n * they participate in the transform-based scroll.\n *\n * @returns The rows-container DOM element.\n */\n getRowsContainer(): Handle {\n return this._rowsContainer;\n }\n\n /**\n * Returns the current vertical scroll position in pixels.\n *\n * @returns The current `scrollY`.\n */\n getScrollY(): number {\n return this._scrollY;\n }\n\n /**\n * Returns the current horizontal scroll position in pixels.\n *\n * @returns The current `scrollX`.\n */\n getScrollX(): number {\n return this._scrollX;\n }\n\n /**\n * Sets the vertical scroll position. Clamped against the last-known\n * content height and the *effective* viewport height (the owner's\n * content-box height minus the horizontal scrollbar's reservation when\n * that bar is visible),\n * so the maximum reachable scroll position matches what the vertical\n * scrollbar's thumb tops out at. Triggers the owner's `onScroll` callback\n * if the position changed.\n *\n * @param y - The new scroll position in pixels.\n */\n setScrollY(y: number): this {\n const maxScroll = Math.max(0, this._contentHeight - this.effectiveViewportH());\n const next = Util.clamp(y, 0, maxScroll);\n\n if (next === this._scrollY) {\n return this;\n }\n\n this._scrollY = next;\n this.updateTransform();\n this._onScroll();\n\n return this;\n }\n\n /**\n * Sets the horizontal scroll position. Clamped against the last-known\n * content width and the *effective* viewport width (the owner's\n * content-box width minus the vertical scrollbar's reservation when that\n * bar is visible),\n * so the maximum reachable scroll position matches what the horizontal\n * scrollbar's thumb tops out at. Triggers the owner's `onScroll` callback\n * if the position changed.\n *\n * @param x - The new scroll position in pixels.\n */\n setScrollX(x: number): this {\n const maxScroll = Math.max(0, this._contentWidth - this.effectiveViewportW());\n const next = Util.clamp(x, 0, maxScroll);\n\n if (next === this._scrollX) {\n return this;\n }\n\n this._scrollX = next;\n this.updateTransform();\n this._onScroll();\n\n return this;\n }\n\n /**\n * Clamps a requested position for one axis to its `[0, max]` range, using\n * the same effective-viewport bounds as `setScrollX/Y` so the eased wheel\n * target converges exactly where the scrollbar thumb tops out.\n *\n * @param axis - The axis to clamp (`\"x\"` or `\"y\"`).\n * @param value - The requested position in pixels.\n *\n * @returns The clamped position in pixels.\n */\n private clampAxis(axis: \"x\" | \"y\", value: number): number {\n const max = axis === \"x\"\n ? Math.max(0, this._contentWidth - this.effectiveViewportW())\n : Math.max(0, this._contentHeight - this.effectiveViewportH());\n\n return Util.clamp(value, 0, max);\n }\n\n /**\n * Aborts any in-flight eased wheel animation and re-seeds it from the live\n * position. Call before a programmatic scroll jump (e.g. `scrollToRecord`)\n * so a lingering ease can't snap the position back afterward.\n */\n resetWheelEase(): void {\n this._smooth.reset();\n }\n\n /**\n * Decides whether each scrollbar should be visible given the current\n * content size, accounting for the mutual dependency between the two\n * axes — if one bar is visible, its track-width reservation shrinks\n * the cross-axis viewport, which can in turn force the other bar to\n * become visible. Two iterations are sufficient: each pass can only\n * promote one flag from false to true.\n *\n * The effective viewport is measured in the owner's content box, not its\n * outer box, so a bordered or padded owner reports the space actually\n * visible to rows.\n */\n private computeScrollbarVisibility(contentWidth: number, contentHeight: number): { vVisible: boolean, hVisible: boolean, effW: number, effH: number } {\n const box = this._owner.getContentBounds()\n ?? { x: 0, y: 0, width: this._owner.getWidth() || 0, height: this._owner.getHeight() || 0 };\n\n // `box.{width,height}` derive from the owner's committed `_width`/\n // `_height`, which are declared `NaN` and stay so until the owner is\n // first sized. The `?? …` fallback above covers the no-element case,\n // not that one — an element-bearing but unsized owner still yields a\n // non-null box whose extents are NaN — so `|| 0` stays, the same\n // coercion the outer-box reads it replaced already used.\n const outerH = box.height || 0;\n const outerW = box.width || 0;\n const trackW = this._scrollbarV.getTrackWidth();\n\n let vVisible = false;\n let hVisible = false;\n for (let i = 0; i < 2; i++) {\n const effH: number = outerH - (hVisible ? trackW : 0);\n const effW: number = outerW - (vVisible ? trackW : 0);\n\n vVisible = contentHeight > effH;\n hVisible = contentWidth > effW;\n }\n\n const effH = outerH - (hVisible ? trackW : 0);\n const effW = outerW - (vVisible ? trackW : 0);\n\n return { vVisible, hVisible, effW, effH };\n }\n\n /**\n * Effective vertical viewport — the owner's content-box height minus the\n * horizontal scrollbar's track-width reservation when that bar would be\n * visible.\n * Single source of truth so the clamps in `setScrollY` agree with what\n * the vertical scrollbar's `setMetrics` is fed.\n */\n private effectiveViewportH(): number {\n return this.computeScrollbarVisibility(this._contentWidth, this._contentHeight).effH;\n }\n\n /**\n * Effective horizontal viewport — see {@link effectiveViewportH}.\n */\n private effectiveViewportW(): number {\n return this.computeScrollbarVisibility(this._contentWidth, this._contentHeight).effW;\n }\n\n /**\n * Effective viewport width for the last-known content metrics — the owner's\n * content-box width minus the vertical scrollbar's track reservation when\n * that bar is visible. Owners that size fill-width rows (e.g. the\n * [`Tree`](/api/component/tree/classes/Tree)) base their row width on this so\n * content does not run under the vertical bar, which would otherwise force a\n * spurious horizontal bar for the reserved band. Reads the current\n * `_contentWidth` / `_contentHeight`; callers refresh those via\n * {@link clampToContent} at the top of their render pass before querying.\n * The public face of `effectiveViewportW` (same value; that stays the\n * internal clamp helper).\n *\n * @returns The effective viewport width in pixels.\n */\n getViewportWidth(): number {\n return this.effectiveViewportW();\n }\n\n /**\n * Clamps the current `scrollX` / `scrollY` against the new content size\n * and the *effective* viewport on each axis (which subtracts the\n * cross-axis scrollbar's track-width when that bar is visible). Call at\n * the start of `renderWindow` so scrollX/Y are within range before being\n * used for window calculations — important when content has shrunk since\n * the last frame. Uses the same effective-viewport reasoning as\n * `setScrollX/Y` so the clamps agree and scrollX/Y aren't pulled back to\n * a smaller bound than the scrollbar's own `setMetrics` expects (which\n * would leave the thumb stopping short of the end-arrow). Does not fire\n * `onScroll`.\n *\n * @param contentWidth - The total scrollable content width in pixels.\n * @param contentHeight - The total scrollable content height in pixels.\n */\n clampToContent(contentWidth: number, contentHeight: number): void {\n this._contentWidth = contentWidth;\n this._contentHeight = contentHeight;\n\n const maxY = Math.max(0, contentHeight - this.effectiveViewportH());\n const maxX = Math.max(0, contentWidth - this.effectiveViewportW());\n\n let changed = false;\n if (this._scrollY > maxY) {\n this._scrollY = maxY;\n changed = true;\n }\n if (this._scrollX > maxX) {\n this._scrollX = maxX;\n changed = true;\n }\n if (changed) {\n this.updateTransform();\n }\n }\n\n /**\n * Tight clamp using effective viewports (each axis subtracts the\n * cross-axis scrollbar's track width when it is visible), then positions\n * the scrollbars and pushes metrics. Call at end of `renderWindow`.\n *\n * Both bars and the clip box are placed in the owner's content box: a\n * child's containing block is already the owner's padding box, so\n * placing them against the outer box would run the far edge past where\n * `overflow: hidden` clips, by both border sides.\n *\n * @param contentWidth - The total scrollable content width in pixels.\n * @param contentHeight - The total scrollable content height in pixels.\n */\n layoutScrollbars(contentWidth: number, contentHeight: number): void {\n this._contentWidth = contentWidth;\n this._contentHeight = contentHeight;\n\n const box = this._owner.getContentBounds()\n ?? { x: 0, y: 0, width: this._owner.getWidth() || 0, height: this._owner.getHeight() || 0 };\n\n const trackW = this._scrollbarV.getTrackWidth();\n\n const { effW, effH } = this.computeScrollbarVisibility(contentWidth, contentHeight);\n\n const maxY = Math.max(0, contentHeight - effH);\n const maxX = Math.max(0, contentWidth - effW);\n if (this._scrollY > maxY || this._scrollX > maxX) {\n if (this._scrollY > maxY) this._scrollY = maxY;\n if (this._scrollX > maxX) this._scrollX = maxX;\n this.updateTransform();\n }\n\n this._scrollbarV.setX(box.x + Math.max(0, box.width - trackW));\n this._scrollbarV.setY(box.y);\n this._scrollbarV.setHeight(effH);\n this._scrollbarV.setMetrics(effH, contentHeight, this._scrollY);\n\n this._scrollbarH.setX(box.x);\n this._scrollbarH.setY(box.y + Math.max(0, box.height - trackW));\n this._scrollbarH.setWidth(effW);\n this._scrollbarH.setMetrics(effW, contentWidth, this._scrollX);\n\n // Resize the clip box to the effective viewport so cells translated\n // by the horizontal scroll can't bleed under the vertical scrollbar\n // (and rows beyond the bottom can't bleed under the horizontal\n // scrollbar). When neither bar is visible this collapses to the\n // full owner content box, matching the previous `width/height: 100%`\n // behaviour for a borderless, unpadded owner.\n DOM.sink.apply(this._clipBox, { style: { left: box.x + \"px\", top: box.y + \"px\", width: effW + \"px\", height: effH + \"px\" } });\n\n // Content size / viewport may have changed without the scroll position\n // moving (so `updateTransform` did not run above) — refresh the shadow\n // edges against the new extremes.\n this.updateShadows();\n }\n\n /**\n * Writes the current `scrollX` / `scrollY` into the rows-container\n * transform.\n */\n private updateTransform(): void {\n DOM.sink.apply(this._rowsContainer, { style: { transform: `translate3d(${-this._scrollX}px, ${-this._scrollY}px, 0)` } });\n this.updateShadows();\n }\n\n /**\n * Recomputes each scroll-shadow edge's strength from the current scroll\n * position, content size, and effective viewport, then lights only the\n * edges that have hidden content past them. Cheap on a no-op scroll: an\n * edge whose quantised strength is unchanged skips the DOM write (see\n * {@link setShadowEdge}). Called on every scroll ({@link updateTransform})\n * and whenever the content/viewport metrics change ({@link layoutScrollbars}).\n */\n private updateShadows(): void {\n const { effW, effH } = this.computeScrollbarVisibility(this._contentWidth, this._contentHeight);\n\n const maxX = Math.max(0, this._contentWidth - effW);\n const maxY = Math.max(0, this._contentHeight - effH);\n\n this.setShadowEdge(\"top\", \"--ts-ss-top\", scrollShadowRamp(this._scrollY));\n this.setShadowEdge(\"bottom\", \"--ts-ss-bottom\", scrollShadowRamp(maxY - this._scrollY));\n this.setShadowEdge(\"left\", \"--ts-ss-left\", scrollShadowRamp(this._scrollX));\n this.setShadowEdge(\"right\", \"--ts-ss-right\", scrollShadowRamp(maxX - this._scrollX));\n }\n\n /**\n * Sets a single edge's shadow strength by scaling the theme shadow colour\n * toward transparent. Strength is quantised to a whole percent so an\n * in-ramp scroll only repaints when the visible strength actually changes;\n * at zero the property is unset so the `box-shadow` layer falls back to\n * `transparent`.\n *\n * @param edge - The edge whose cached strength this updates.\n * @param property - The overlay custom property backing that edge's shadow.\n * @param strength - The target strength in the range 0–1.\n */\n private setShadowEdge(edge: keyof ScrollShadowEdges, property: string, strength: number): void {\n const percent = Math.round(strength * 100); // quantise: 0–1 → 0–100%\n\n if (this._shadowEdges[edge] === percent) {\n return;\n }\n\n this._shadowEdges[edge] = percent;\n DOM.sink.apply(this._shadowOverlay, { style: { [property]: scrollShadowEdgeValue(percent) } });\n }\n\n /**\n * Eases wheel input into the scroll position through the {@link SmoothScroller}.\n * Shift+wheel without an explicit deltaX is treated as horizontal scroll.\n * Claims the event so an ancestor scroll container doesn't also scroll it.\n *\n * @param e - The wheel event.\n */\n private onWheel(e: WheelEvent): Event.ListenerResult {\n if (!consumeWheel(e)) {\n return;\n }\n\n if (e.shiftKey && e.deltaY !== 0 && e.deltaX === 0) {\n this._smooth.scrollBy(e.deltaY, 0);\n\n return { prevent: true };\n }\n\n this._smooth.scrollBy(e.deltaX, e.deltaY);\n\n return { prevent: true };\n }\n\n /**\n * Installs the touch handlers: 1:1 finger drag scrolls both axes, and on\n * release a 2D fling momentum decays per frame until it falls below\n * threshold or hits a scroll boundary.\n */\n private attachTouchHandlers(): void {\n let touchActive = false;\n let touchStartY = 0;\n let touchStartX = 0;\n let touchStartScrollY = 0;\n let touchStartScrollX = 0;\n let touchSamples : Array<{ time: number, x: number, y: number }> = [];\n let momentumRaf : number | null = null;\n\n const cancelMomentum = (): void => {\n if (momentumRaf !== null) {\n DOM.sink.cancelAnimationFrame(momentumRaf);\n momentumRaf = null;\n }\n };\n\n // Subtree because touch events fire on descendants of the owner\n // (rows / cells) — not the owner root.\n Event.addSubtreeListener(this._owner, \"touchstart\", (e: TouchEvent) => {\n if (e.touches.length !== 1) {\n return;\n }\n cancelMomentum();\n this._smooth.reset();\n touchActive = true;\n touchStartY = e.touches[0].clientY;\n touchStartX = e.touches[0].clientX;\n touchStartScrollY = this._scrollY;\n touchStartScrollX = this._scrollX;\n touchSamples = [{ time: performance.now(), x: touchStartX, y: touchStartY }];\n });\n\n Event.addSubtreeListener(this._owner, \"touchmove\", (e: TouchEvent) => {\n if (!touchActive || e.touches.length !== 1) {\n return;\n }\n const y = e.touches[0].clientY;\n const x = e.touches[0].clientX;\n const now = performance.now();\n\n touchSamples.push({ time: now, x: x, y: y });\n while (touchSamples.length > 1 && touchSamples[0].time < now - 150) {\n touchSamples.shift();\n }\n\n this.setScrollY(touchStartScrollY + (touchStartY - y));\n this.setScrollX(touchStartScrollX + (touchStartX - x));\n });\n\n const startMomentum = (): void => {\n if (touchSamples.length < 2) {\n return;\n }\n\n const last = touchSamples[touchSamples.length - 1];\n\n const PAUSE_THRESHOLD = 50;\n if (performance.now() - last.time > PAUSE_THRESHOLD) {\n return;\n }\n\n const VELOCITY_WINDOW = 80;\n const cutoff = last.time - VELOCITY_WINDOW;\n let firstIdx = touchSamples.length - 1;\n while (firstIdx > 0 && touchSamples[firstIdx - 1].time >= cutoff) {\n firstIdx--;\n }\n const first = touchSamples[firstIdx];\n const dt = last.time - first.time;\n if (dt <= 0) {\n return;\n }\n\n let velocityY = (first.y - last.y) / dt;\n let velocityX = (first.x - last.x) / dt;\n\n const MIN_VELOCITY = 0.1;\n const FRICTION = 0.95;\n const STOP_VELOCITY = 0.02;\n\n const initialSpeed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);\n if (initialSpeed < MIN_VELOCITY) {\n return;\n }\n\n let lastT = performance.now();\n const step = (): void => {\n const now = performance.now();\n const frame = now - lastT;\n lastT = now;\n\n const decay = Math.pow(FRICTION, frame / 16.667);\n velocityY *= decay;\n velocityX *= decay;\n\n const speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);\n if (speed < STOP_VELOCITY) {\n momentumRaf = null;\n return;\n }\n\n const beforeY = this._scrollY;\n const beforeX = this._scrollX;\n this.setScrollY(this._scrollY + velocityY * frame);\n this.setScrollX(this._scrollX + velocityX * frame);\n if (this._scrollY === beforeY) {\n velocityY = 0;\n }\n if (this._scrollX === beforeX) {\n velocityX = 0;\n }\n if (velocityY === 0 && velocityX === 0) {\n momentumRaf = null;\n return;\n }\n\n momentumRaf = DOM.sink.requestAnimationFrame(step);\n };\n\n momentumRaf = DOM.sink.requestAnimationFrame(step);\n };\n\n Event.addSubtreeListener(this._owner, \"touchend\", () => {\n if (!touchActive) {\n return;\n }\n touchActive = false;\n startMomentum();\n });\n\n Event.addSubtreeListener(this._owner, \"touchcancel\", () => {\n touchActive = false;\n cancelMomentum();\n });\n }\n}\n"],"mappings":"6LA8CA,IAAa,gBAAb,KAA6B,CAEzB,OACA,UACA,SACA,eACA,YACA,YACA,SAAmC,EACnC,SAAmC,EACnC,cAAmC,EACnC,eAAmC,EACnC,QACA,eACA,aAA+C,CAAE,IAAK,EAAG,OAAQ,EAAG,KAAM,EAAG,MAAO,CAAE,EAWtF,YAAY,EAAkB,EAAiB,EAAmC,CAC9E,KAAK,OAAY,EACjB,KAAK,UAAY,EAYjB,IAAM,EAAU,EAAI,KAAK,cAAc,KAAK,EAC5C,EAAI,KAAK,MAAM,EAAS,CAAE,MAAO,CAAE,SAAU,WAAY,IAAK,IAAK,KAAM,IAAK,MAAO,OAAQ,OAAQ,OAAQ,SAAU,QAAS,CAAE,CAAC,EACnI,EAAI,KAAK,YAAY,EAAS,CAAO,EACrC,KAAK,SAAW,EAEhB,IAAM,EAAY,EAAI,KAAK,cAAc,KAAK,EAC9C,EAAI,KAAK,MAAM,EAAW,CAAE,MAAO,CAAE,SAAU,WAAY,IAAK,IAAK,KAAM,IAAK,MAAO,OAAQ,UAAW,uBAAwB,WAAY,WAAY,CAAE,CAAC,EAC7J,EAAI,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d,cAAc,EAClB,CAAC,EAED,EAAM,mBAAmB,KAAK,OAAQ,kBAAqB,CACvD,EAAc,GACd,eAAe,CACnB,CAAC,CACL,CACJ"}
1
+ {"version":3,"file":"VirtualScroller-Csa3GBSM.js","names":[],"sources":["../../src/typescript/lib/component/container/VirtualScroller.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component } from \"~/core/Component.js\";\nimport { Util } from \"~/core/Util.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { SmoothScroller, consumeWheel } from \"~/core/SmoothScroller.js\";\nimport { Scrollbar } from \"~/component/container/Scrollbar.js\";\nimport { scrollShadowBoxShadow, scrollShadowEdgeValue, scrollShadowRamp } from \"~/core/ScrollShadow.js\";\n\n/** Per-edge scroll-shadow strength cache, quantised to a whole percent (0–100). */\ntype ScrollShadowEdges = { top: number; bottom: number; left: number; right: number };\n\n// VirtualScroller is a plain helper, not a Component: it owns and lays out raw\n// `clipBox` / `rowsContainer` `HTMLElement`s it creates directly, so the\n// Component style setters don't apply and direct `.style` writes are correct.\n\n/**\n * Callback fired by {@link VirtualScroller} whenever the scroll position\n * changes via user input (wheel, touch, momentum, scrollbar). The owner\n * should re-render its visible window in response.\n *\n * @category Components\n */\nexport type VirtualScrollerOnScroll = () => void;\n\n/**\n * Shared scroll machinery for transform-based virtual lists (e.g. table body,\n * tree). Owns the rows-container element, two custom {@link Scrollbar} overlays\n * (vertical + horizontal), and the wheel/touch handlers with 2-axis fling\n * momentum.\n *\n * The owner component:\n * 1. Constructs a VirtualScroller from its `init()` with the owner element and\n * a callback that re-renders the visible window.\n * 2. Appends pool rows into {@link getRowsContainer}.\n * 3. Reads {@link getScrollX} / {@link getScrollY} to determine the visible window.\n * 4. Calls {@link clampToContent} at the start of `renderWindow` (so scroll\n * positions are sane before being used).\n * 5. Calls {@link layoutScrollbars} at the end of `renderWindow` with the\n * current content sizes; the scroller applies the final clamp and positions\n * the scrollbars.\n *\n * @category Components\n */\nexport class VirtualScroller {\n\n private _owner : Component;\n private _onScroll : VirtualScrollerOnScroll;\n private _clipBox : Handle;\n private _rowsContainer : Handle;\n private _scrollbarV : Scrollbar;\n private _scrollbarH : Scrollbar;\n private _scrollX : number = 0;\n private _scrollY : number = 0;\n private _contentWidth : number = 0;\n private _contentHeight : number = 0;\n private _smooth : SmoothScroller;\n private _shadowOverlay : Handle;\n private _shadowEdges : ScrollShadowEdges = { top: 0, bottom: 0, left: 0, right: 0 };\n\n /**\n * Constructs a VirtualScroller and attaches it to the owner element.\n *\n * @param owner - The component being scrolled (used for `getContentBounds`).\n * @param element - The owner's root DOM element. Must already exist; call\n * this from the owner's `init()` after `super.init(element)`.\n * @param onScroll - Callback invoked when scroll position changes via\n * user input.\n */\n constructor(owner: Component, element: Handle, onScroll: VirtualScrollerOnScroll) {\n this._owner = owner;\n this._onScroll = onScroll;\n\n // Two-element wrapper: the outer `clipBox` carries `overflow:hidden`\n // sized to the effective viewport so the Scrollbar widgets — positioned\n // by `layoutScrollbars` at the far edge of the owner's content box —\n // sit in their own reserved band rather than overlaying the rightmost\n // column / bottom row. The inner `rowsContainer` carries the scroll\n // transform; the transform cannot sit on the same element as\n // `overflow:hidden` because CSS clipping happens in the element's own\n // LOCAL coordinate system before its transform applies — splitting\n // the two roles lets the transform shift the rows around inside a\n // stable clip.\n const clipBox = DOM.sink.createElement(\"div\");\n DOM.sink.apply(clipBox, { style: { position: \"absolute\", top: \"0\", left: \"0\", width: \"100%\", height: \"100%\", overflow: \"hidden\" } });\n DOM.sink.appendChild(element, clipBox);\n this._clipBox = clipBox;\n\n const container = DOM.sink.createElement(\"div\");\n DOM.sink.apply(container, { style: { position: \"absolute\", top: \"0\", left: \"0\", width: \"100%\", transform: \"translate3d(0, 0, 0)\", willChange: \"transform\" } });\n DOM.sink.appendChild(clipBox, container);\n this._rowsContainer = container;\n\n // Position-aware edge shadows, matching the native-scroll `Panel` cue.\n // The overlay is a sibling of `rowsContainer` inside the `clipBox`, so it\n // is clipped to the effective viewport and — being outside the scrolled\n // `rowsContainer` — is not shifted by the scroll transform; sizing it to\n // 100% tracks the clip box that `layoutScrollbars` resizes to the\n // effective viewport. It paints above the rows (appended last) and is\n // inert to the pointer. Each edge is a `box-shadow` layer gated by a\n // custom property; `updateShadows` flips the property per scroll/resize.\n const shadowOverlay = DOM.sink.createElement(\"div\");\n DOM.sink.apply(shadowOverlay, { style: {\n position: \"absolute\",\n top: \"0\",\n left: \"0\",\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n boxShadow: scrollShadowBoxShadow(),\n } });\n DOM.sink.appendChild(clipBox, shadowOverlay);\n this._shadowOverlay = shadowOverlay;\n\n // Drives wheel-initiated scrolling through an eased RAF loop. The seam\n // delegates to the existing setScrollX/Y (which clamp, write the\n // transform, and fire onScroll, so the virtual window re-renders every\n // frame) and clamps targets against the same effective-viewport bounds.\n this._smooth = new SmoothScroller({\n read: (axis) => axis === \"x\" ? this._scrollX : this._scrollY,\n write: (axis, value) => axis === \"x\" ? this.setScrollX(value) : this.setScrollY(value),\n clamp: (axis, value) => this.clampAxis(axis, value),\n });\n\n this._scrollbarV = new Scrollbar(\"vertical\");\n DOM.sink.appendChild(element, this._scrollbarV.getElement(true)!);\n this._scrollbarV.on(\"scroll\", (p: number) => {\n this._smooth.reset();\n this.setScrollY(p);\n });\n\n this._scrollbarH = new Scrollbar(\"horizontal\");\n DOM.sink.appendChild(element, this._scrollbarH.getElement(true)!);\n this._scrollbarH.on(\"scroll\", (p: number) => {\n this._smooth.reset();\n this.setScrollX(p);\n });\n\n this._owner.setTouchAction(\"none\");\n\n // Subtree because wheel events fire on whichever descendant of the\n // owner the pointer is over (a row, a cell, …) — not the owner root.\n // passive: false so onWheel can preventDefault the native page scroll.\n Event.addSubtreeListener(\n this._owner,\n \"wheel\",\n { passive: false, handler: (e: WheelEvent) => this.onWheel(e) },\n );\n\n this.attachTouchHandlers();\n }\n\n /**\n * Disposes the two `Scrollbar` overlays this scroller owns. They are\n * appended straight onto the owner's element rather than registered as its\n * children, so the owner's `destructor()` recursion cannot reach them and\n * their per-instance stylesheet rules would otherwise survive teardown.\n * Called from `VirtualRowView.destructor()`.\n */\n dispose(): void {\n this._scrollbarV.dispose();\n this._scrollbarH.dispose();\n }\n\n /**\n * Returns the two created container handles (clip box and rows container).\n * The owning component tracks these via `trackHandle` so they are released\n * with the owner — on its destructor or, for a discarded owner, on GC — and\n * not left pinned in the registry. The scroller is not a `Component`, so it\n * cannot track its own handles.\n *\n * @returns The scroller's owned element handles.\n */\n ownedHandles(): readonly Handle[] {\n return [this._clipBox, this._rowsContainer, this._shadowOverlay];\n }\n\n /**\n * Returns the rows-container element. Owners append pool rows here so\n * they participate in the transform-based scroll.\n *\n * @returns The rows-container DOM element.\n */\n getRowsContainer(): Handle {\n return this._rowsContainer;\n }\n\n /**\n * Returns the current vertical scroll position in pixels.\n *\n * @returns The current `scrollY`.\n */\n getScrollY(): number {\n return this._scrollY;\n }\n\n /**\n * Returns the current horizontal scroll position in pixels.\n *\n * @returns The current `scrollX`.\n */\n getScrollX(): number {\n return this._scrollX;\n }\n\n /**\n * Sets the vertical scroll position. Clamped against the last-known\n * content height and the *effective* viewport height (the owner's\n * content-box height minus the horizontal scrollbar's reservation when\n * that bar is visible),\n * so the maximum reachable scroll position matches what the vertical\n * scrollbar's thumb tops out at. Triggers the owner's `onScroll` callback\n * if the position changed.\n *\n * @param y - The new scroll position in pixels.\n */\n setScrollY(y: number): this {\n const maxScroll = Math.max(0, this._contentHeight - this.effectiveViewportH());\n const next = Util.clamp(y, 0, maxScroll);\n\n if (next === this._scrollY) {\n return this;\n }\n\n this._scrollY = next;\n this.updateTransform();\n this._onScroll();\n\n return this;\n }\n\n /**\n * Sets the horizontal scroll position. Clamped against the last-known\n * content width and the *effective* viewport width (the owner's\n * content-box width minus the vertical scrollbar's reservation when that\n * bar is visible),\n * so the maximum reachable scroll position matches what the horizontal\n * scrollbar's thumb tops out at. Triggers the owner's `onScroll` callback\n * if the position changed.\n *\n * @param x - The new scroll position in pixels.\n */\n setScrollX(x: number): this {\n const maxScroll = Math.max(0, this._contentWidth - this.effectiveViewportW());\n const next = Util.clamp(x, 0, maxScroll);\n\n if (next === this._scrollX) {\n return this;\n }\n\n this._scrollX = next;\n this.updateTransform();\n this._onScroll();\n\n return this;\n }\n\n /**\n * Clamps a requested position for one axis to its `[0, max]` range, using\n * the same effective-viewport bounds as `setScrollX/Y` so the eased wheel\n * target converges exactly where the scrollbar thumb tops out.\n *\n * @param axis - The axis to clamp (`\"x\"` or `\"y\"`).\n * @param value - The requested position in pixels.\n *\n * @returns The clamped position in pixels.\n */\n private clampAxis(axis: \"x\" | \"y\", value: number): number {\n const max = axis === \"x\"\n ? Math.max(0, this._contentWidth - this.effectiveViewportW())\n : Math.max(0, this._contentHeight - this.effectiveViewportH());\n\n return Util.clamp(value, 0, max);\n }\n\n /**\n * Aborts any in-flight eased wheel animation and re-seeds it from the live\n * position. Call before a programmatic scroll jump (e.g. `scrollToRecord`)\n * so a lingering ease can't snap the position back afterward.\n */\n resetWheelEase(): void {\n this._smooth.reset();\n }\n\n /**\n * Decides whether each scrollbar should be visible given the current\n * content size, accounting for the mutual dependency between the two\n * axes — if one bar is visible, its track-width reservation shrinks\n * the cross-axis viewport, which can in turn force the other bar to\n * become visible. Two iterations are sufficient: each pass can only\n * promote one flag from false to true.\n *\n * The effective viewport is measured in the owner's content box, not its\n * outer box, so a bordered or padded owner reports the space actually\n * visible to rows.\n */\n private computeScrollbarVisibility(contentWidth: number, contentHeight: number): { vVisible: boolean, hVisible: boolean, effW: number, effH: number } {\n const box = this._owner.getContentBounds()\n ?? { x: 0, y: 0, width: this._owner.getWidth() || 0, height: this._owner.getHeight() || 0 };\n\n // `box.{width,height}` derive from the owner's committed `_width`/\n // `_height`, which are declared `NaN` and stay so until the owner is\n // first sized. The `?? …` fallback above covers the no-element case,\n // not that one — an element-bearing but unsized owner still yields a\n // non-null box whose extents are NaN — so `|| 0` stays, the same\n // coercion the outer-box reads it replaced already used.\n const outerH = box.height || 0;\n const outerW = box.width || 0;\n const trackW = this._scrollbarV.getTrackWidth();\n\n let vVisible = false;\n let hVisible = false;\n for (let i = 0; i < 2; i++) {\n const effH: number = outerH - (hVisible ? trackW : 0);\n const effW: number = outerW - (vVisible ? trackW : 0);\n\n vVisible = contentHeight > effH;\n hVisible = contentWidth > effW;\n }\n\n const effH = outerH - (hVisible ? trackW : 0);\n const effW = outerW - (vVisible ? trackW : 0);\n\n return { vVisible, hVisible, effW, effH };\n }\n\n /**\n * Effective vertical viewport — the owner's content-box height minus the\n * horizontal scrollbar's track-width reservation when that bar would be\n * visible.\n * Single source of truth so the clamps in `setScrollY` agree with what\n * the vertical scrollbar's `setMetrics` is fed.\n */\n private effectiveViewportH(): number {\n return this.computeScrollbarVisibility(this._contentWidth, this._contentHeight).effH;\n }\n\n /**\n * Effective horizontal viewport — see {@link effectiveViewportH}.\n */\n private effectiveViewportW(): number {\n return this.computeScrollbarVisibility(this._contentWidth, this._contentHeight).effW;\n }\n\n /**\n * Effective viewport width for the last-known content metrics — the owner's\n * content-box width minus the vertical scrollbar's track reservation when\n * that bar is visible. Owners that size fill-width rows (e.g. the\n * [`Tree`](/api/component/tree/classes/Tree)) base their row width on this so\n * content does not run under the vertical bar, which would otherwise force a\n * spurious horizontal bar for the reserved band. Reads the current\n * `_contentWidth` / `_contentHeight`; callers refresh those via\n * {@link clampToContent} at the top of their render pass before querying.\n * The public face of `effectiveViewportW` (same value; that stays the\n * internal clamp helper).\n *\n * @returns The effective viewport width in pixels.\n */\n getViewportWidth(): number {\n return this.effectiveViewportW();\n }\n\n /**\n * Clamps the current `scrollX` / `scrollY` against the new content size\n * and the *effective* viewport on each axis (which subtracts the\n * cross-axis scrollbar's track-width when that bar is visible). Call at\n * the start of `renderWindow` so scrollX/Y are within range before being\n * used for window calculations — important when content has shrunk since\n * the last frame. Uses the same effective-viewport reasoning as\n * `setScrollX/Y` so the clamps agree and scrollX/Y aren't pulled back to\n * a smaller bound than the scrollbar's own `setMetrics` expects (which\n * would leave the thumb stopping short of the end-arrow). Does not fire\n * `onScroll`.\n *\n * @param contentWidth - The total scrollable content width in pixels.\n * @param contentHeight - The total scrollable content height in pixels.\n */\n clampToContent(contentWidth: number, contentHeight: number): void {\n this._contentWidth = contentWidth;\n this._contentHeight = contentHeight;\n\n const maxY = Math.max(0, contentHeight - this.effectiveViewportH());\n const maxX = Math.max(0, contentWidth - this.effectiveViewportW());\n\n let changed = false;\n if (this._scrollY > maxY) {\n this._scrollY = maxY;\n changed = true;\n }\n if (this._scrollX > maxX) {\n this._scrollX = maxX;\n changed = true;\n }\n if (changed) {\n this.updateTransform();\n }\n }\n\n /**\n * Tight clamp using effective viewports (each axis subtracts the\n * cross-axis scrollbar's track width when it is visible), then positions\n * the scrollbars and pushes metrics. Call at end of `renderWindow`.\n *\n * Both bars and the clip box are placed in the owner's content box: a\n * child's containing block is already the owner's padding box, so\n * placing them against the outer box would run the far edge past where\n * `overflow: hidden` clips, by both border sides.\n *\n * @param contentWidth - The total scrollable content width in pixels.\n * @param contentHeight - The total scrollable content height in pixels.\n */\n layoutScrollbars(contentWidth: number, contentHeight: number): void {\n this._contentWidth = contentWidth;\n this._contentHeight = contentHeight;\n\n const box = this._owner.getContentBounds()\n ?? { x: 0, y: 0, width: this._owner.getWidth() || 0, height: this._owner.getHeight() || 0 };\n\n const trackW = this._scrollbarV.getTrackWidth();\n\n const { effW, effH } = this.computeScrollbarVisibility(contentWidth, contentHeight);\n\n const maxY = Math.max(0, contentHeight - effH);\n const maxX = Math.max(0, contentWidth - effW);\n if (this._scrollY > maxY || this._scrollX > maxX) {\n if (this._scrollY > maxY) this._scrollY = maxY;\n if (this._scrollX > maxX) this._scrollX = maxX;\n this.updateTransform();\n }\n\n this._scrollbarV.setX(box.x + Math.max(0, box.width - trackW));\n this._scrollbarV.setY(box.y);\n this._scrollbarV.setHeight(effH);\n this._scrollbarV.setMetrics(effH, contentHeight, this._scrollY);\n\n this._scrollbarH.setX(box.x);\n this._scrollbarH.setY(box.y + Math.max(0, box.height - trackW));\n this._scrollbarH.setWidth(effW);\n this._scrollbarH.setMetrics(effW, contentWidth, this._scrollX);\n\n // Resize the clip box to the effective viewport so cells translated\n // by the horizontal scroll can't bleed under the vertical scrollbar\n // (and rows beyond the bottom can't bleed under the horizontal\n // scrollbar). When neither bar is visible this collapses to the\n // full owner content box, matching the previous `width/height: 100%`\n // behaviour for a borderless, unpadded owner.\n DOM.sink.apply(this._clipBox, { style: { left: box.x + \"px\", top: box.y + \"px\", width: effW + \"px\", height: effH + \"px\" } });\n\n // Content size / viewport may have changed without the scroll position\n // moving (so `updateTransform` did not run above) — refresh the shadow\n // edges against the new extremes.\n this.updateShadows();\n }\n\n /**\n * Writes the current `scrollX` / `scrollY` into the rows-container\n * transform.\n */\n private updateTransform(): void {\n DOM.sink.apply(this._rowsContainer, { style: { transform: `translate3d(${-this._scrollX}px, ${-this._scrollY}px, 0)` } });\n this.updateShadows();\n }\n\n /**\n * Recomputes each scroll-shadow edge's strength from the current scroll\n * position, content size, and effective viewport, then lights only the\n * edges that have hidden content past them. Cheap on a no-op scroll: an\n * edge whose quantised strength is unchanged skips the DOM write (see\n * {@link setShadowEdge}). Called on every scroll ({@link updateTransform})\n * and whenever the content/viewport metrics change ({@link layoutScrollbars}).\n */\n private updateShadows(): void {\n const { effW, effH } = this.computeScrollbarVisibility(this._contentWidth, this._contentHeight);\n\n const maxX = Math.max(0, this._contentWidth - effW);\n const maxY = Math.max(0, this._contentHeight - effH);\n\n this.setShadowEdge(\"top\", \"--ts-ss-top\", scrollShadowRamp(this._scrollY));\n this.setShadowEdge(\"bottom\", \"--ts-ss-bottom\", scrollShadowRamp(maxY - this._scrollY));\n this.setShadowEdge(\"left\", \"--ts-ss-left\", scrollShadowRamp(this._scrollX));\n this.setShadowEdge(\"right\", \"--ts-ss-right\", scrollShadowRamp(maxX - this._scrollX));\n }\n\n /**\n * Sets a single edge's shadow strength by scaling the theme shadow colour\n * toward transparent. Strength is quantised to a whole percent so an\n * in-ramp scroll only repaints when the visible strength actually changes;\n * at zero the property is unset so the `box-shadow` layer falls back to\n * `transparent`.\n *\n * @param edge - The edge whose cached strength this updates.\n * @param property - The overlay custom property backing that edge's shadow.\n * @param strength - The target strength in the range 0–1.\n */\n private setShadowEdge(edge: keyof ScrollShadowEdges, property: string, strength: number): void {\n const percent = Math.round(strength * 100); // quantise: 0–1 → 0–100%\n\n if (this._shadowEdges[edge] === percent) {\n return;\n }\n\n this._shadowEdges[edge] = percent;\n DOM.sink.apply(this._shadowOverlay, { style: { [property]: scrollShadowEdgeValue(percent) } });\n }\n\n /**\n * Eases wheel input into the scroll position through the {@link SmoothScroller}.\n * Shift+wheel without an explicit deltaX is treated as horizontal scroll.\n * Claims the event so an ancestor scroll container doesn't also scroll it.\n *\n * @param e - The wheel event.\n */\n private onWheel(e: WheelEvent): Event.ListenerResult {\n if (!consumeWheel(e)) {\n return;\n }\n\n if (e.shiftKey && e.deltaY !== 0 && e.deltaX === 0) {\n this._smooth.scrollBy(e.deltaY, 0);\n\n return { prevent: true };\n }\n\n this._smooth.scrollBy(e.deltaX, e.deltaY);\n\n return { prevent: true };\n }\n\n /**\n * Installs the touch handlers: 1:1 finger drag scrolls both axes, and on\n * release a 2D fling momentum decays per frame until it falls below\n * threshold or hits a scroll boundary.\n */\n private attachTouchHandlers(): void {\n let touchActive = false;\n let touchStartY = 0;\n let touchStartX = 0;\n let touchStartScrollY = 0;\n let touchStartScrollX = 0;\n let touchSamples : Array<{ time: number, x: number, y: number }> = [];\n let momentumRaf : number | null = null;\n\n const cancelMomentum = (): void => {\n if (momentumRaf !== null) {\n DOM.sink.cancelAnimationFrame(momentumRaf);\n momentumRaf = null;\n }\n };\n\n // Subtree because touch events fire on descendants of the owner\n // (rows / cells) — not the owner root.\n Event.addSubtreeListener(this._owner, \"touchstart\", (e: TouchEvent) => {\n if (e.touches.length !== 1) {\n return;\n }\n cancelMomentum();\n this._smooth.reset();\n touchActive = true;\n touchStartY = e.touches[0].clientY;\n touchStartX = e.touches[0].clientX;\n touchStartScrollY = this._scrollY;\n touchStartScrollX = this._scrollX;\n touchSamples = [{ time: performance.now(), x: touchStartX, y: touchStartY }];\n });\n\n Event.addSubtreeListener(this._owner, \"touchmove\", (e: TouchEvent) => {\n if (!touchActive || e.touches.length !== 1) {\n return;\n }\n const y = e.touches[0].clientY;\n const x = e.touches[0].clientX;\n const now = performance.now();\n\n touchSamples.push({ time: now, x: x, y: y });\n while (touchSamples.length > 1 && touchSamples[0].time < now - 150) {\n touchSamples.shift();\n }\n\n this.setScrollY(touchStartScrollY + (touchStartY - y));\n this.setScrollX(touchStartScrollX + (touchStartX - x));\n });\n\n const startMomentum = (): void => {\n if (touchSamples.length < 2) {\n return;\n }\n\n const last = touchSamples[touchSamples.length - 1];\n\n const PAUSE_THRESHOLD = 50;\n if (performance.now() - last.time > PAUSE_THRESHOLD) {\n return;\n }\n\n const VELOCITY_WINDOW = 80;\n const cutoff = last.time - VELOCITY_WINDOW;\n let firstIdx = touchSamples.length - 1;\n while (firstIdx > 0 && touchSamples[firstIdx - 1].time >= cutoff) {\n firstIdx--;\n }\n const first = touchSamples[firstIdx];\n const dt = last.time - first.time;\n if (dt <= 0) {\n return;\n }\n\n let velocityY = (first.y - last.y) / dt;\n let velocityX = (first.x - last.x) / dt;\n\n const MIN_VELOCITY = 0.1;\n const FRICTION = 0.95;\n const STOP_VELOCITY = 0.02;\n\n const initialSpeed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);\n if (initialSpeed < MIN_VELOCITY) {\n return;\n }\n\n let lastT = performance.now();\n const step = (): void => {\n const now = performance.now();\n const frame = now - lastT;\n lastT = now;\n\n const decay = Math.pow(FRICTION, frame / 16.667);\n velocityY *= decay;\n velocityX *= decay;\n\n const speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);\n if (speed < STOP_VELOCITY) {\n momentumRaf = null;\n return;\n }\n\n const beforeY = this._scrollY;\n const beforeX = this._scrollX;\n this.setScrollY(this._scrollY + velocityY * frame);\n this.setScrollX(this._scrollX + velocityX * frame);\n if (this._scrollY === beforeY) {\n velocityY = 0;\n }\n if (this._scrollX === beforeX) {\n velocityX = 0;\n }\n if (velocityY === 0 && velocityX === 0) {\n momentumRaf = null;\n return;\n }\n\n momentumRaf = DOM.sink.requestAnimationFrame(step);\n };\n\n momentumRaf = DOM.sink.requestAnimationFrame(step);\n };\n\n Event.addSubtreeListener(this._owner, \"touchend\", () => {\n if (!touchActive) {\n return;\n }\n touchActive = false;\n startMomentum();\n });\n\n Event.addSubtreeListener(this._owner, \"touchcancel\", () => {\n touchActive = false;\n cancelMomentum();\n });\n }\n}\n"],"mappings":"6LA8CA,IAAa,gBAAb,KAA6B,CAEzB,OACA,UACA,SACA,eACA,YACA,YACA,SAAmC,EACnC,SAAmC,EACnC,cAAmC,EACnC,eAAmC,EACnC,QACA,eACA,aAA+C,CAAE,IAAK,EAAG,OAAQ,EAAG,KAAM,EAAG,MAAO,CAAE,EAWtF,YAAY,EAAkB,EAAiB,EAAmC,CAC9E,KAAK,OAAY,EACjB,KAAK,UAAY,EAYjB,IAAM,EAAU,EAAI,KAAK,cAAc,KAAK,EAC5C,EAAI,KAAK,MAAM,EAAS,CAAE,MAAO,CAAE,SAAU,WAAY,IAAK,IAAK,KAAM,IAAK,MAAO,OAAQ,OAAQ,OAAQ,SAAU,QAAS,CAAE,CAAC,EACnI,EAAI,KAAK,YAAY,EAAS,CAAO,EACrC,KAAK,SAAW,EAEhB,IAAM,EAAY,EAAI,KAAK,cAAc,KAAK,EAC9C,EAAI,KAAK,MAAM,EAAW,CAAE,MAAO,CAAE,SAAU,WAAY,IAAK,IAAK,KAAM,IAAK,MAAO,OAAQ,UAAW,uBAAwB,WAAY,WAAY,CAAE,CAAC,EAC7J,EAAI,KAAK,YAAY,EAAS,CAAS,EACvC,KAAK,eAAiB,EAUtB,IA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kBAAqB,CACvD,EAAc,GACd,eAAe,CACnB,CAAC,CACL,CACJ"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./DOM-DDhDN8lQ.js";import{a as t,l as n,n as r}from"./Position-DWR1nIpA.js";import{T as i,g as a,h as o,i as s,m as c,t as l,y as u}from"./Component-YrLXKJZS.js";import{t as d}from"./ListenerBag-DYRl4TSb.js";import{i as f,r as p}from"./Scrollbar-orAWHWap.js";import{t as m}from"./Container-C5cxnioS.js";import{t as h}from"./Glyph-Cof7BxfJ.js";import{a as g}from"./Tooltip-DgRHQZhL.js";import{t as _}from"./Fit-amTWlJM2.js";import{r as v}from"./VBox-hFIZAEpT.js";import{c as y,l as ee,r as b,s as x,t as S}from"./DragManager-D5pBaPPg.js";import{t as C}from"./ProgressSpinner-BI9tFIVm.js";import{t as w}from"./Placement-7kqdaK4Z.js";import{t as T}from"./Menu-BCQISKiQ.js";import{t as te}from"./Border-BELbqMDJ.js";import{t as E}from"./Header-Cj33ABP1.js";import{t as D}from"./StyleTraits-CAtzeyRR.js";import{t as O}from"./Button-CKzjQyqA.js";import{xmark as k}from"./glyphs/solid/xmark.es.js";import{window_maximize as A}from"./glyphs/solid/window_maximize.es.js";import{window_minimize as j}from"./glyphs/solid/window_minimize.es.js";import{window_restore as M}from"./glyphs/solid/window_restore.es.js";var N=function(e){return e[e.NORTH=0]=`NORTH`,e[e.SOUTH=1]=`SOUTH`,e[e.WEST=2]=`WEST`,e[e.EAST=3]=`EAST`,e[e.NORTHWEST=4]=`NORTHWEST`,e[e.SOUTHEAST=5]=`SOUTHEAST`,e[e.SOUTHWEST=6]=`SOUTHWEST`,e[e.NORTHEAST=7]=`NORTHEAST`,e}({}),P=`snap-target`,F={tag:`div`},I=Object.freeze({boxShadow:`var(--ts-ui-window-snap-glow, 0 0 0 2px rgba(30, 100, 200, 0.7))`}),WindowBorder=class extends l{static ownStyleStates=[{selector:`.snap-target`,extract:()=>({shadow:I.boxShadow})}];_direction=0;_listeners=this.registerListenerBag(new d);_dragStartListener;_dragStopListener;_fireDragListener;_snapTarget=!1;constructor(e,t,n){super(t,{...F,...n??{}}),e&&(this._direction=e);let r=this.dragCursor();r&&this.setCursor(r),this._dragStartListener=this.onDragStart.bind(this),this._dragStopListener=this.onDragStop.bind(this),this._fireDragListener=this._dispatchDrag.bind(this),i.addListener(this,`mousedown`,this._dragStartListener),this.applyListeners(t?.listeners)}getDirection(){return this._direction}setDirection(e){return e||=0,this._direction=e,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)}_dispatchDrag(e){return this.emit(`drag`,this,e),!0}isSnapTarget(){return this._snapTarget}setSnapTarget(e){return this._snapTarget===e?this:(this._snapTarget=e,this.setStyleState(`.snap-target`,e),this)}onDragStart(e){e&&!i.isPrimaryButton(e)||(i.addViewportListener(this,`mouseup`,this._dragStopListener),i.addViewportListener(this,`touchend`,this._dragStopListener),i.addViewportListener(this,`touchcancel`,this._dragStopListener),i.addViewportListener(this,`mousemove`,this._fireDragListener),i.addViewportListener(this,`touchmove`,this._fireDragListener),p(this.dragCursor()??`default`))}onDragStop(){return i.removeViewportListener(this,`mouseup`,this._dragStopListener),i.removeViewportListener(this,`touchend`,this._dragStopListener),i.removeViewportListener(this,`touchcancel`,this._dragStopListener),i.removeViewportListener(this,`mousemove`,this._fireDragListener),i.removeViewportListener(this,`touchmove`,this._fireDragListener),f(),this.setSnapTarget(!1),!0}dragCursor(){switch(this._direction){case 0:case 1:return`ns-resize`;case 2:case 3:return`ew-resize`;case 4:case 5:return`nwse-resize`;case 6:case 7:return`nesw-resize`}}render(){let t=super.render();return this._snapTarget&&e.sink.apply(t,{addClass:[P]}),t}},L=a(WindowBorder);function createSpinnerWrap(){let e=new l;return e.setLayoutManager(new _({fill:o.NONE})),e.addComponent(new C(24)),e}var R=4,z=150,B=960,V=200,H=1e3,U=4,W=200,G=24,K=26,q=50,J={x:50,y:50,width:400,height:300,insets:new r(R,R,R,R),border:`1px solid var(--ts-ui-border-color, black)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-window-shadow, 3px 3px 2px rgba(0, 0, 0, 0.4))`,backgroundColor:`var(--ts-ui-body-bg, rgb(241, 241, 241))`,closeable:!0,minimizable:!0,maximizable:!0,resizable:!0,alwaysOnTop:!1,locked:!1,maximizeBounds:`viewport`,windowState:`normal`,snapResizeEnabled:!0,snapThreshold:12,snapModifier:`ctrl`,constrainToViewport:!0},Y=10,X=class AbstractWindow extends m{static ownClassStyleDefaults=J;static openWindows=new Set;_borderComponents;_animationFrameId=null;_pendingClientX=0;_pendingClientY=0;_pendingBorder=null;_resizeSessionActive=!1;_resizeOriginClientX=0;_resizeOriginClientY=0;_resizeOriginX=0;_resizeOriginY=0;_resizeOriginW=0;_resizeOriginH=0;_resizeFps=60;_lastFlushTime=0;_dragStartLeft=0;_dragStartTop=0;_dragOriginClientX=0;_dragOriginClientY=0;_dragDX=0;_dragDY=0;_dragReachMinX=0;_dragReachMaxX=0;_dragReachMinY=0;_dragReachMaxY=0;_contentFactory=null;_contentReadyCallback=null;_preMinimizeState=`normal`;_restoreRect=null;_normalMinSize=null;_bodyHost=null;_bodyFadeActive=!1;_rail=null;_windowMenu=null;_windowListeners=this.registerListenerBag(new d);_stateAnimHandle=null;_showAnimation=null;_materializeAnimation=null;_closeAnimation=null;_railCollapseAnimation=null;_railExpandAnimation=null;_viewportResizeBound=!1;_snapEnabled=!1;_snapKeysAttached=!1;_snapMoveAttached=!1;_snapTargetBorder=null;_boundOnDrag=e=>this.onDrag(e);_boundOnMouseUp=()=>this.onMouseUp();_boundOnResizeEnd=()=>this.onResizeEnd();_boundOnSnapKeyDown=e=>this.onSnapKeyDown(e);_boundOnSnapKeyUp=e=>this.onSnapKeyUp(e);_boundOnSnapMouseMove=e=>this.onSnapMouseMove(e);_boundOnSnapMouseDown=e=>this.onSnapMouseDown(e);_boundOnViewportResize=()=>this.onViewportResize();_boundOnSnapBlur=()=>this.clearSnapState();_boundOnBorderResize=(e,t)=>this.onResize(e,t);_boundOnBringToFront=()=>this.bringToFront();_boundToggleMinimize=()=>this.toggleMinimize();_boundToggleMaximize=()=>this.toggleMaximize();_boundRequestClose=()=>this.requestClose();_boundOnThemeReflow=()=>this.scheduleLayout();constructor(e,t){super(e,{...J,...t??{}}),this.subscribeTheme(this._boundOnThemeReflow),this._borderComponents={west:new L(N.WEST),northwest:new L(N.NORTHWEST),north:new L(N.NORTH),northeast:new L(N.NORTHEAST),east:new L(N.EAST),southeast:new L(N.SOUTHEAST),south:new L(N.SOUTH),southwest:new L(N.SOUTHWEST)},this._borderComponents.west.on(`drag`,this._boundOnBorderResize),this._borderComponents.northwest.on(`drag`,this._boundOnBorderResize),this._borderComponents.north.on(`drag`,this._boundOnBorderResize),this._borderComponents.northeast.on(`drag`,this._boundOnBorderResize),this._borderComponents.east.on(`drag`,this._boundOnBorderResize),this._borderComponents.southeast.on(`drag`,this._boundOnBorderResize),this._borderComponents.south.on(`drag`,this._boundOnBorderResize),this._borderComponents.southwest.on(`drag`,this._boundOnBorderResize);for(let e of Object.values(this._borderComponents))e.setZIndex(Y);this.setVisible(!1),this.setContain(`layout`),this.getAria().setTabIndex(-1),i.addSubtreeListener(this,`mousedown`,{button:`any`,handler:this._boundOnBringToFront})}initChrome(e){this._options.contentFactory!==void 0&&this.setContentFactory(this._options.contentFactory,this._options.onReady),this.setCloseable(this.isCloseable()),this.reflectMinimizable(this.isMinimizable()),this.reflectMaximizable(this.isMaximizable()),this.setResizable(this.isResizable()),this.setLocked(this.isLocked()),this.setMaximizeBounds(this.getMaximizeBounds()),this.setWindowState(this.getWindowState()),this.wireMoveTrigger(),e?.minSize===void 0&&this.setMinSize({width:this.minContentWidthSeed(),height:200})}applyOptions(e){return super.applyOptions(e),e.headerText!==void 0&&(this._options.headerText=e.headerText),e.glyph!==void 0&&(this._options.glyph=e.glyph),e.contentFactory!==void 0&&(this._options.contentFactory=e.contentFactory),e.onReady!==void 0&&(this._options.onReady=e.onReady),this.setX(e.x??this._defaultOptions.x),this.setY(e.y??this._defaultOptions.y),this.setWidth(e.width??this._defaultOptions.width),this.setHeight(e.height??this._defaultOptions.height),e.closeable!==void 0&&(this._options.closeable=e.closeable),e.minimizable!==void 0&&(this._options.minimizable=e.minimizable),e.maximizable!==void 0&&(this._options.maximizable=e.maximizable),e.resizable!==void 0&&(this._options.resizable=e.resizable),e.alwaysOnTop!==void 0&&(this._options.alwaysOnTop=e.alwaysOnTop),e.locked!==void 0&&(this._options.locked=e.locked),e.maximizeBounds!==void 0&&(this._options.maximizeBounds=e.maximizeBounds),e.windowState!==void 0&&(this._options.windowState=e.windowState),this.setSnapResizeEnabled(e.snapResizeEnabled??this.isSnapResizeEnabled()),this.setSnapThreshold(e.snapThreshold??this.getSnapThreshold()),this.setSnapModifier(e.snapModifier??this.getSnapModifier()),this.setConstrainToViewport(e.constrainToViewport??this.isConstrainToViewport()),this}chromeHeight(){return 0}chromeMinSize(){let e=this.getBorderSize(),t=this.getInsets(),n=(Number(e.left)||0)+(Number(e.right)||0)+t.getLeft(),r=(Number(e.top)||0)+(Number(e.bottom)||0)+t.getTop();return{width:this.minContentWidthSeed()+n,height:(this.chromeHeight()||K)+r}}isChromeComponent(e){return!1}setWidth(e){if(this.getElement()){let t=this.chromeMinSize();e<t.width&&(e=t.width)}return super.setWidth(e)}setHeight(e){if(this.getElement()){let t=this.chromeMinSize();e<t.height&&(e=t.height)}return super.setHeight(e)}show(){let e=this.getElement(!0);if(g.register(this),y(this),this.doLayout(),this.bringToFront(),AbstractWindow.openWindows.add(this),this.attachViewportResizeListener(),g.mount(e),this.setVisible(!0),this._showAnimation?.cancel(),this._showAnimation=u.play(e,{from:{opacity:`0`,transform:`scale(0.97)`},to:{opacity:`1`,transform:`scale(1)`},durationMs:z,properties:[`opacity`,`transform`]}),this._contentFactory){let e=this._contentFactory,t=this._contentReadyCallback;this._contentFactory=null,this._contentReadyCallback=null;let n=createSpinnerWrap();this._materializeAnimation?.cancel(),this._materializeAnimation=u.materialize({host:this,factory:e,spinnerComponent:n,onReady:e=>{this._bodyHost=e,t&&t(e)}})}else this._bodyHost=this.findBodyHost();return this.isSnapResizeEnabled()&&this.attachSnapKeyboardListeners(),this}setContentFactory(e,t){return this._contentFactory=e,this._contentReadyCallback=t??null,this}bringToFront(){g.bringToFront(this)}getLayerElement(){return this.getElement()??null}getDismissMode(){return`manual`}onActivate(e){this.paintActive(e),e&&(this.focusSelf(),this.emit(`activate`))}focusSelf(){let t=this.getElement();!t||e.source.contains(t,e.source.getActiveElement())||this.focus(!0)}requestClose(){this.onExitAction()}getBand(){return this.isAlwaysOnTop()?g.Band.PinnedWindow:g.Band.Window}isLayerRoot(){return!0}onZIndexChanged(e){this.setZIndex(e)}onExitAction(){this.emit(`close`),this._animationFrameId!==null&&(e.sink.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null),this._stateAnimHandle?.cancel(),this._stateAnimHandle=null,this._contentFactory=null,this._contentReadyCallback=null,this.detachSnapKeyboardListeners(),this.detachSnapMouseListeners(),this.detachViewportResizeListener(),this.clearSnapTargetBorder(),g.unregister(this),ee(this),AbstractWindow.openWindows.delete(this),AbstractWindow.relayoutMinimizedStack();let t=this.getElement(),finalize=()=>{this.setVisible(!1),this.destructor()};if(!t){finalize();return}this._closeAnimation?.cancel(),this._closeAnimation=u.play(t,{to:{opacity:`0`,transform:`scale(0.97)`},durationMs:z,properties:[`opacity`,`transform`],onComplete:finalize})}destructor(){this._stateAnimHandle?.cancel(),this._stateAnimHandle=null,this._showAnimation?.cancel(),this._showAnimation=null,this._materializeAnimation?.cancel(),this._materializeAnimation=null,this._closeAnimation?.cancel(),this._closeAnimation=null,this._railCollapseAnimation?.cancel(),this._railCollapseAnimation=null,this._railExpandAnimation?.cancel(),this._railExpandAnimation=null;for(let e of Object.values(this._borderComponents))e.dispose();this._windowMenu?.dispose(),this._windowMenu=null,super.destructor()}getWindowState(){return this._options.windowState??this._defaultOptions.windowState}static getOpenWindows(){return Array.from(AbstractWindow.openWindows)}getRect(){return this.currentRect()}applyRect(e){return this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height),this}getRestoreRect(){return this._restoreRect}setWindowState(t){let n=this.getWindowState();if(n===t)return this;if(this._animationFrameId!==null&&(e.sink.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null),this._options.windowState=t,n===`minimized`&&this._rail!==null&&(this.setDisplayed(!0),this.animateRailExpand()),t===`normal`){this.setBodyHostDisplayed(!0),this.reflectMaximizeState(`normal`);let e=this._restoreRect?this.clampRectToViewport(this._restoreRect):this.currentRect();this._restoreRect=null,this.attachViewportResizeListener(),this.animateRect(e,()=>{this.restoreNormalMinSize(),AbstractWindow.relayoutMinimizedStack()})}else if(t===`minimized`){if(n===`normal`&&(this._restoreRect=this.currentRect()),this._preMinimizeState=n===`maximized`?`maximized`:`normal`,this.reflectMaximizeState(`minimized`),this.detachViewportResizeListener(),this._rail!==null)this.animateRailCollapse(()=>{this.setDisplayed(!1),this.emit(`minimize`)});else{this._normalMinSize===null&&(this._normalMinSize=this.getMinSizeConstraint()),this.setMinSize({width:0,height:0});let e=this.computeDockRect();this.animateRect(e,()=>{this.setBodyHostDisplayed(!1),this.attachViewportResizeListener(),AbstractWindow.relayoutMinimizedStack()}),this.emit(`minimize`)}}else{n===`normal`&&(this._restoreRect=this.currentRect()),this.setBodyHostDisplayed(!0),this.reflectMaximizeState(`maximized`);let e=this.computeMaximizeRect();this.animateRect(e,()=>{this.restoreNormalMinSize(),this.attachViewportResizeListener(),AbstractWindow.relayoutMinimizedStack()})}return n===`minimized`&&t!==`minimized`&&this.emit(`restore`),this}restoreNormalMinSize(){this._normalMinSize!==null&&(this.setMinSize(this._normalMinSize),this._normalMinSize=null)}isMaximized(){return this.getWindowState()===`maximized`}isMinimized(){return this.getWindowState()===`minimized`}toggleMinimize(){this.isMinimizable()&&(this.getWindowState()===`minimized`?this.setWindowState(`normal`):this.setWindowState(`minimized`))}minimize(){return this.setWindowState(`minimized`)}restore(){return this.isMinimized()?(this.setWindowState(this._preMinimizeState),this.bringToFront(),this.focus(!0),this):this}setRail(e){return this._rail===e?this:(this._rail!==null&&this._rail.unregisterWindow(this),this._rail=e,e!==null&&e.registerWindow(this),this)}getRail(){return this._rail}getGlyph(){return this._options.glyph}on(e,t){return this._windowListeners.add(e,t),this}off(e,t){return this._windowListeners.remove(e,t),this}emit(e){this._windowListeners.fire(e)}toggleMaximize(){this.isMaximizable()&&(this.getWindowState()===`maximized`?this.setWindowState(`normal`):this.setWindowState(`maximized`))}setCloseable(e){return this._options.closeable=e,this.reflectCloseable(e),this}isCloseable(){return this._options.closeable??this._defaultOptions.closeable}setMinimizable(e){return this._options.minimizable=e,this.reflectMinimizable(this.isMinimizable()),this}isMinimizable(){return this.isResizable()&&(this._options.minimizable??this._defaultOptions.minimizable)}setMaximizable(e){return this._options.maximizable=e,this.reflectMaximizable(this.isMaximizable()),this.applyMaximizeAvailability(),this}isMaximizable(){return this.isResizable()&&(this._options.maximizable??this._defaultOptions.maximizable)}canResize(){return this.isResizable()&&!this.isLocked()}applyResizeBorderVisibility(){let e=this.canResize();for(let t of Object.values(this._borderComponents))t.setVisible(e?null:!1);e||this.clearSnapState()}canMaximize(){return this.isMaximizable()&&!this.isLocked()}applyMaximizeAvailability(){this.reflectMaximizeAvailability(this.canMaximize()),this.refreshWindowMenuMaximizeAvailability()}refreshWindowMenuMaximizeAvailability(){if(!this._windowMenu||!this.isMaximizable())return;let e=+!!this.isMinimizable();this._windowMenu.setItemEnabled(e,this.canMaximize())}setResizable(e){return this._options.resizable=e,this.applyResizeBorderVisibility(),this.reflectMinimizable(this.isMinimizable()),this.reflectMaximizable(this.isMaximizable()),this.applyMaximizeAvailability(),this}isResizable(){return this._options.resizable??this._defaultOptions.resizable}setLocked(e){return this._options.locked=e,this.applyResizeBorderVisibility(),this.applyMaximizeAvailability(),this}isLocked(){return this._options.locked??this._defaultOptions.locked}setAlwaysOnTop(e){return this._options.alwaysOnTop=e,g.setBand(this,this.getBand()),this}isAlwaysOnTop(){return this._options.alwaysOnTop??this._defaultOptions.alwaysOnTop}buildWindowMenuItems(){let e=[],t=this.getWindowState();return this.isMinimizable()&&e.push({text:t===`minimized`?`Restore`:`Minimize`,glyph:t===`minimized`?`window-restore`:`window-minimize`,action:this._boundToggleMinimize}),this.isMaximizable()&&e.push({text:t===`maximized`?`Restore`:`Maximize`,glyph:t===`maximized`?`window-restore`:`window-maximize`,enabled:this.canMaximize(),action:this._boundToggleMaximize}),e.length>0&&e.push({separator:!0}),e.push({row:()=>{let e=new x({text:`Always on top`,checked:this.isAlwaysOnTop()});return e.on(`action`,()=>{this.setAlwaysOnTop(e.isChecked())}),e}},{row:()=>{let e=new x({text:`Lock position`,checked:this.isLocked()});return e.on(`action`,()=>{this.setLocked(e.isChecked())}),e}},{separator:!0},{text:`Close`,glyph:`xmark`,enabled:this.isCloseable(),action:this._boundRequestClose}),e}openWindowMenu(t){let n=t.getElement();n&&(this._windowMenu??=new T,this._windowMenu.toggleFor(n,e.source.getViewportRect(t),this.buildWindowMenuItems()))}setMaximizeBounds(e){return this._options.maximizeBounds=e,this}getMaximizeBounds(){return this._options.maximizeBounds??this._defaultOptions.maximizeBounds}setSnapResizeEnabled(e){return this._options.snapResizeEnabled===e?this:(this._options.snapResizeEnabled=e,e?this.getElement()&&this.attachSnapKeyboardListeners():(this.clearSnapState(),this.detachSnapKeyboardListeners()),this)}isSnapResizeEnabled(){return this._options.snapResizeEnabled??this._defaultOptions.snapResizeEnabled}setConstrainToViewport(e){return this._options.constrainToViewport=e,this}isConstrainToViewport(){return this._options.constrainToViewport??this._defaultOptions.constrainToViewport}setSnapThreshold(e){return this._options.snapThreshold=e,this}getSnapThreshold(){return this._options.snapThreshold??this._defaultOptions.snapThreshold}setSnapModifier(e){return this._options.snapModifier=e,this}getSnapModifier(){return this._options.snapModifier??this._defaultOptions.snapModifier}onMouseDown(e){this.startMoveFrom(e)}startMoveFrom(e){i.isPrimaryButton(e)&&(e.shiftKey||this.getWindowState()===`normal`&&(this.isLocked()||(this._dragStartLeft=this.getX(),this._dragStartTop=this.getY(),this._dragOriginClientX=e.clientX,this._dragOriginClientY=e.clientY,this._dragDX=0,this._dragDY=0,this._dragReachMinX=this._dragStartLeft,this._dragReachMaxX=this._dragStartLeft,this._dragReachMinY=this._dragStartTop,this._dragReachMaxY=this._dragStartTop,i.addViewportListener(this,`mouseup`,this._boundOnMouseUp),i.addViewportListener(this,`mousemove`,this._boundOnDrag))))}onResize(t,n){this.canResize()&&this.getWindowState()===`normal`&&(n.preventDefault(),this._resizeSessionActive||(this._resizeSessionActive=!0,this._resizeOriginClientX=n.clientX,this._resizeOriginClientY=n.clientY,this._resizeOriginX=this.getX(),this._resizeOriginY=this.getY(),this._resizeOriginW=this.getWidth(),this._resizeOriginH=this.getHeight(),i.addViewportListener(this,`mouseup`,this._boundOnResizeEnd),i.addViewportListener(this,`touchend`,this._boundOnResizeEnd),i.addViewportListener(this,`touchcancel`,this._boundOnResizeEnd)),this._pendingClientX=n.clientX,this._pendingClientY=n.clientY,this._pendingBorder=t,this._animationFrameId===null&&(this._animationFrameId=e.sink.requestAnimationFrame(e=>this.flushResize(e))))}onResizeEnd(){return this._resizeSessionActive=!1,i.removeViewportListener(this,`mouseup`,this._boundOnResizeEnd),i.removeViewportListener(this,`touchend`,this._boundOnResizeEnd),i.removeViewportListener(this,`touchcancel`,this._boundOnResizeEnd),!0}getResizeFps(){return this._resizeFps}setResizeFps(e){return this._resizeFps=e,this}flushResize(t){if(t-this._lastFlushTime<1e3/this._resizeFps){this._animationFrameId=e.sink.requestAnimationFrame(e=>this.flushResize(e));return}this._lastFlushTime=t,this._animationFrameId=null;let n=this._pendingBorder;if(this._pendingBorder=null,!n)return;let r=this._pendingClientX-this._resizeOriginClientX,i=this._pendingClientY-this._resizeOriginClientY,a=this._resizeOriginX+this._resizeOriginW,o=this._resizeOriginY+this._resizeOriginH,s=e.source.getViewportSize(),c=s.width-this._resizeOriginX,l=a,u=s.height-this._resizeOriginY,d=o;switch(this.setAutoCommitStyle(!1),n.getDirection()){case N.NORTHWEST:this.setWidth(Math.min(this._resizeOriginW-r,l)),this.setHeight(Math.min(this._resizeOriginH-i,d)),this.setX(a-this.getWidth()),this.setY(o-this.getHeight());break;case N.NORTH:this.setHeight(Math.min(this._resizeOriginH-i,d)),this.setY(o-this.getHeight());break;case N.NORTHEAST:this.setWidth(Math.min(this._resizeOriginW+r,c)),this.setHeight(Math.min(this._resizeOriginH-i,d)),this.setY(o-this.getHeight());break;case N.EAST:this.setWidth(Math.min(this._resizeOriginW+r,c));break;case N.SOUTHEAST:this.setWidth(Math.min(this._resizeOriginW+r,c)),this.setHeight(Math.min(this._resizeOriginH+i,u));break;case N.SOUTH:this.setHeight(Math.min(this._resizeOriginH+i,u));break;case N.SOUTHWEST:this.setWidth(Math.min(this._resizeOriginW-r,l)),this.setHeight(Math.min(this._resizeOriginH+i,u)),this.setX(a-this.getWidth());break;case N.WEST:this.setWidth(Math.min(this._resizeOriginW-r,l)),this.setX(a-this.getWidth())}this.doLayout(),this.setAutoCommitStyle(!0)}viewportPositionBounds(){let t=this.getWidth(),n=e.source.getViewportSize(),r=n.width,i=n.height;if(this.isConstrainToViewport())return{minX:0,maxX:r-t,minY:0,maxY:i-this.getHeight()};let a=this.chromeHeight()||K;return{minX:G-t,maxX:r-G,minY:0,maxY:i-a}}clampDragDelta(){let{minX:e,maxX:t,minY:r,maxY:i}=this.viewportPositionBounds(),a=Math.max(t,this._dragReachMinX),o=Math.min(e,this._dragReachMaxX),s=Math.max(i,this._dragReachMinY),c=Math.min(r,this._dragReachMaxY),l=this._dragStartLeft+this._dragDX,u=this._dragStartTop+this._dragDY,d=n.clamp(l,o,a),f=n.clamp(u,c,s);this._dragReachMinX=Math.min(this._dragReachMinX,d),this._dragReachMaxX=Math.max(this._dragReachMaxX,d),this._dragReachMinY=Math.min(this._dragReachMinY,f),this._dragReachMaxY=Math.max(this._dragReachMaxY,f),this._dragDX=d-this._dragStartLeft,this._dragDY=f-this._dragStartTop}clampPositionToViewport(){let{minX:e,maxX:t,minY:n,maxY:r}=this.viewportPositionBounds();return this.setX(Math.max(Math.min(this.getX(),t),e)),this.setY(Math.max(Math.min(this.getY(),r),n)),this}onDrag(e){return this.setWillChange(`transform`),this._dragDX=e.clientX-this._dragOriginClientX,this._dragDY=e.clientY-this._dragOriginClientY,this.clampDragDelta(),this.setTranslate(this._dragDX,this._dragDY),{stop:!0,prevent:!0}}onMouseUp(){return this.setX(this._dragStartLeft+this._dragDX),this.setY(this._dragStartTop+this._dragDY),this.setTranslate(0,0),this.setWillChange(null),i.removeViewportListener(this,`mouseup`,this._boundOnMouseUp),i.removeViewportListener(this,`mousemove`,this._boundOnDrag),!0}doLayout(){super.doLayout();let e=this.getBorderSize(),t=this.getInsets(),n=(Number(e.left)||0)+(Number(e.right)||0)+t.getLeft(),r=(Number(e.top)||0)+(Number(e.bottom)||0)+t.getTop(),i=this.getSize();if(!i)throw Error(`Component doesn't seem to be rendered.`);let a=this.getInnerSize();if(!a)throw Error(`Component doesn't seem to be rendered.`);return this._borderComponents.west.setAutoCommitStyle(!1),this._borderComponents.northwest.setAutoCommitStyle(!1),this._borderComponents.north.setAutoCommitStyle(!1),this._borderComponents.northeast.setAutoCommitStyle(!1),this._borderComponents.east.setAutoCommitStyle(!1),this._borderComponents.southeast.setAutoCommitStyle(!1),this._borderComponents.south.setAutoCommitStyle(!1),this._borderComponents.southwest.setAutoCommitStyle(!1),this._borderComponents.west.setX(0),this._borderComponents.west.setY(t.getTop()),this._borderComponents.west.setWidth(t.getLeft()),this._borderComponents.west.setHeight(a.height),this._borderComponents.northwest.setX(0),this._borderComponents.northwest.setY(0),this._borderComponents.northwest.setWidth(t.getLeft()),this._borderComponents.northwest.setHeight(t.getTop()),this._borderComponents.north.setX(t.getLeft()),this._borderComponents.north.setY(0),this._borderComponents.north.setWidth(a.width),this._borderComponents.north.setHeight(t.getTop()),this._borderComponents.northeast.setX(i.width-n),this._borderComponents.northeast.setY(0),this._borderComponents.northeast.setWidth(t.getRight()),this._borderComponents.northeast.setHeight(t.getTop()),this._borderComponents.east.setX(i.width-n),this._borderComponents.east.setY(t.getTop()),this._borderComponents.east.setWidth(t.getRight()),this._borderComponents.east.setHeight(a.height),this._borderComponents.southeast.setX(i.width-n),this._borderComponents.southeast.setY(i.height-r),this._borderComponents.southeast.setWidth(t.getRight()),this._borderComponents.southeast.setHeight(t.getBottom()),this._borderComponents.south.setX(t.getLeft()),this._borderComponents.south.setY(i.height-r),this._borderComponents.south.setWidth(a.width),this._borderComponents.south.setHeight(t.getRight()),this._borderComponents.southwest.setX(0),this._borderComponents.southwest.setY(i.height-r),this._borderComponents.southwest.setWidth(t.getLeft()),this._borderComponents.southwest.setHeight(t.getBottom()),this._borderComponents.west.setAutoCommitStyle(!0),this._borderComponents.northwest.setAutoCommitStyle(!0),this._borderComponents.north.setAutoCommitStyle(!0),this._borderComponents.northeast.setAutoCommitStyle(!0),this._borderComponents.east.setAutoCommitStyle(!0),this._borderComponents.southeast.setAutoCommitStyle(!0),this._borderComponents.south.setAutoCommitStyle(!0),this._borderComponents.southwest.setAutoCommitStyle(!0),this}render(){let t=super.render();return e.sink.appendChild(t,this._borderComponents.west.getElement(!0)),e.sink.appendChild(t,this._borderComponents.northwest.getElement(!0)),e.sink.appendChild(t,this._borderComponents.north.getElement(!0)),e.sink.appendChild(t,this._borderComponents.northeast.getElement(!0)),e.sink.appendChild(t,this._borderComponents.east.getElement(!0)),e.sink.appendChild(t,this._borderComponents.southeast.getElement(!0)),e.sink.appendChild(t,this._borderComponents.south.getElement(!0)),e.sink.appendChild(t,this._borderComponents.southwest.getElement(!0)),t}currentRect(){return{x:this.getX(),y:this.getY(),width:this.getWidth(),height:this.getHeight()}}findBodyHost(){let e=this.getComponents();for(let t of e)if(!this.isChromeComponent(t))return t;return null}resolveBodyHost(){return this._bodyHost||=this.findBodyHost(),this._bodyHost}setBodyHostDisplayed(e){this.resolveBodyHost()?.setDisplayed(e)}computeMaximizeRect(){if(this.getMaximizeBounds()===`parent`){let t=this.getElement(),n=t?e.source.getParentElement(t):null;if(n&&n!==e.source.getDocumentElement()){let t=e.source.getElementRect(n);return{x:0,y:0,width:t.width,height:t.height}}}let t=e.source.getViewportSize();return{x:0,y:0,width:t.width,height:t.height}}computeDockRect(){let t=this.getMinDockWidth(),n=this.computeDockSlotIndex(),r=this.chromeHeight()||K;return{x:n*(t+U),y:e.source.getViewportSize().height-r,width:t,height:r}}railGenieTransform(){let t=this._rail,n=t.getThickness(),r=this.currentRect(),i=Math.min(.5,n/Math.max(r.width,1)),a=t.getEdge(),o=a===w.EAST||a===w.WEST,s=t.handleMainAxisOffset(this),c=t.handleMainAxisExtent(this),l=(o?r.height:r.width)*i,u=c>0?s+(c-l)/2:s,d=0,f=0;switch(a){case w.EAST:d=e.source.getViewportSize().width-n,f=u;break;case w.WEST:f=u;break;case w.SOUTH:d=u,f=e.source.getViewportSize().height-n;break;case w.NORTH:d=u;break;default:f=u}return`translate(${d-r.x}px, ${f-r.y}px) scale(${i})`}animateRailCollapse(e){let t=this.getElement();if(!t){e();return}this._railCollapseAnimation?.cancel(),this._railCollapseAnimation=u.play(t,{from:{transformOrigin:`0 0`,transform:`translate(0, 0) scale(1)`,opacity:`1`},to:{transform:this.railGenieTransform(),opacity:`0`},durationMs:z,properties:[`transform`,`opacity`],onComplete:e})}animateRailExpand(){let e=this.getElement();e&&(this._railExpandAnimation?.cancel(),this._railExpandAnimation=u.play(e,{from:{transformOrigin:`0 0`,transform:this.railGenieTransform(),opacity:`0`},to:{transform:`translate(0, 0) scale(1)`,opacity:`1`},durationMs:z,properties:[`transform`,`opacity`]}))}getMinDockWidth(){let t=e.source.getThemeVar(`--ts-ui-window-min-dock-width`);if(t){let e=parseFloat(t);if(!isNaN(e)&&e>0)return e}return W}computeDockSlotIndex(){let e=0;for(let t of AbstractWindow.openWindows){if(t===this)return e;t.getWindowState()===`minimized`&&e++}return e}static relayoutMinimizedStack(){let t=0;for(let n of AbstractWindow.openWindows){if(n.getWindowState()!==`minimized`)continue;let r=n.getMinDockWidth(),i=n.chromeHeight()||K,a=t*(r+U),o=e.source.getViewportSize().height-i;n.setAutoCommitStyle(!1),n.setX(a),n.setY(o),n.setWidth(r),n.setHeight(i),n.doLayout(),n.setAutoCommitStyle(!0),t++}}animateRect(e,t){this.beginStateAnimation(),this.isLargeRectChange(e)?this.fadeRectSwap(e,t):this.tweenRect(e,t)}isLargeRectChange(e){let t=this.currentRect();return Math.max(Math.abs(e.width-t.width),Math.abs(e.height-t.height))>B}fadeRectSwap(e,t){let n=this.resolveBodyHost(),r=n?.getElement();if(!n||!r){this.commitRect(e),t?.();return}this._bodyFadeActive=!0,this._stateAnimHandle=u.play(r,{to:{opacity:`0`},durationMs:V,properties:[`opacity`],onComplete:()=>{n.pauseLayout(),this._stateAnimHandle=u.tween({from:this.currentRect(),to:e,durationMs:z,onStep:e=>this.commitRect(e),onComplete:()=>{if(n.resumeLayout(),t?.(),!n.isDisplayed()){this._stateAnimHandle=null,this.endBodyFade();return}this.startFadeIn(r)}})}})}startFadeIn(e){this._stateAnimHandle=u.play(e,{to:{opacity:`1`},durationMs:V,properties:[`opacity`],fallbackBufferMs:H,onComplete:()=>{this._stateAnimHandle=null,this.endBodyFade()}})}beginStateAnimation(){this._stateAnimHandle?.cancel(),this._stateAnimHandle=null,this.endBodyFade();let e=this.resolveBodyHost();e?.isLayoutPaused()&&e.resumeLayout()}endBodyFade(){this._bodyFadeActive&&(this._bodyFadeActive=!1,this.resolveBodyHost()?.clearOpacity())}commitRect(e){this.setAutoCommitStyle(!1),this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height),this.doLayout(),this.setAutoCommitStyle(!0)}tweenRect(e,t){this._stateAnimHandle=u.tween({from:this.currentRect(),to:e,durationMs:z,onStep:e=>this.commitRect(e),onComplete:()=>{this._stateAnimHandle=null,t?.()}})}attachViewportResizeListener(){this._viewportResizeBound||=(i.addViewportListener(this,`resize`,this._boundOnViewportResize),!0)}detachViewportResizeListener(){this._viewportResizeBound&&=(i.removeViewportListener(this,`resize`,this._boundOnViewportResize),!1)}onViewportResize(){let e=this.getWindowState();if(e===`minimized`){AbstractWindow.relayoutMinimizedStack();return}if(e===`normal`){this.fitNormalWindowToViewport();return}let t=this.computeMaximizeRect();this.setAutoCommitStyle(!1),this.setX(t.x),this.setY(t.y),this.setWidth(t.width),this.setHeight(t.height),this.doLayout(),this.setAutoCommitStyle(!0),AbstractWindow.relayoutMinimizedStack()}fitNormalWindowToViewport(){let e=this.clampRectToViewport(this.currentRect());this.setAutoCommitStyle(!1),this.setWidth(e.width),this.setHeight(e.height),this.setX(e.x),this.setY(e.y),this.doLayout(),this.setAutoCommitStyle(!0)}clampRectToViewport(t){let n=e.source.getViewportSize(),r=Math.max(0,n.width-100),i=Math.max(0,n.height-100),a=this.getMinSize(),o=Math.max(Math.min(t.width,r),a?.width??0),s=Math.max(Math.min(t.height,i),a?.height??0),c=n.width-q-o,l=n.height-q-s;return{x:Math.max(Math.min(t.x,c),q),y:Math.max(Math.min(t.y,l),q),width:o,height:s}}attachSnapKeyboardListeners(){this._snapKeysAttached||=(i.addViewportListener(this,`keydown`,this._boundOnSnapKeyDown),i.addViewportListener(this,`keyup`,this._boundOnSnapKeyUp),i.addViewportListener(this,`blur`,this._boundOnSnapBlur),!0)}detachSnapKeyboardListeners(){this._snapKeysAttached&&=(i.removeViewportListener(this,`keydown`,this._boundOnSnapKeyDown),i.removeViewportListener(this,`keyup`,this._boundOnSnapKeyUp),i.removeViewportListener(this,`blur`,this._boundOnSnapBlur),!1)}attachSnapMouseListeners(){this._snapMoveAttached||=(i.addViewportListener(this,`mousemove`,this._boundOnSnapMouseMove),i.addViewportListener(this,`mousedown`,this._boundOnSnapMouseDown),!0)}detachSnapMouseListeners(){this._snapMoveAttached&&=(i.removeViewportListener(this,`mousemove`,this._boundOnSnapMouseMove),i.removeViewportListener(this,`mousedown`,this._boundOnSnapMouseDown),!1)}clearSnapTargetBorder(){this._snapTargetBorder&&=(this._snapTargetBorder.setSnapTarget(!1),null)}clearSnapState(){this._snapEnabled=!1,this.detachSnapMouseListeners(),this.clearSnapTargetBorder()}onSnapKeyDown(e){this.canResize()&&this.isSnapResizeEnabled()&&this.getWindowState()===`normal`&&this.modifierMatches(e)&&(this._snapEnabled||(this._snapEnabled=!0,this.attachSnapMouseListeners()))}onSnapKeyUp(e){this._snapEnabled&&(this.modifierStillHeld(e)||this.clearSnapState())}modifierMatches(e){switch(this.getSnapModifier()){case`ctrl`:return e.ctrlKey;case`meta`:return e.metaKey;case`alt`:return e.altKey;case`shift`:return e.shiftKey}}modifierStillHeld(e){return this.modifierMatches(e)}onSnapMouseMove(e){if(!this._snapEnabled)return;let t=this.pickSnapBorder(e.clientX,e.clientY);t!==this._snapTargetBorder&&(this._snapTargetBorder&&this._snapTargetBorder.setSnapTarget(!1),this._snapTargetBorder=t,t&&t.setSnapTarget(!0))}pickSnapBorder(t,n){let r=[this._borderComponents.northwest,this._borderComponents.northeast,this._borderComponents.southeast,this._borderComponents.southwest,this._borderComponents.north,this._borderComponents.east,this._borderComponents.south,this._borderComponents.west],i=null,a=this.getSnapThreshold();for(let o of r){let r=o.getElement();if(!r)continue;let s=e.source.getElementRect(r),c=Math.max(s.left-t,0,t-s.right),l=Math.max(s.top-n,0,n-s.bottom),u=Math.hypot(c,l);u<=a&&(i=o,a=u)}return i}onSnapMouseDown(t){let n=this._snapTargetBorder;if(!n)return;let r=n.getElement();if(r&&e.source.isNode(t.target)&&e.source.contains(r,e.source.intern(t.target))){this._snapTargetBorder=null;return}return n.onDragStart(t),this._snapTargetBorder=null,!0}},Z={backgroundColor:`var(--ts-ui-window-control-bg)`,backgroundImage:`var(--ts-ui-window-control-bg)`,border:`var(--ts-ui-window-control-border)`,borderRadius:void 0,shadow:`var(--ts-ui-window-control-shadow)`,pressedForegroundColor:`var(--ts-ui-text-color, black)`,pressedBackgroundColor:`var(--ts-ui-window-control-active-bg)`,pressedBackgroundImage:`var(--ts-ui-window-control-active-bg)`,pressedShadow:`var(--ts-ui-window-control-shadow)`,hoverBackgroundColor:`var(--ts-ui-window-control-hover-bg)`,hoverBackgroundImage:`var(--ts-ui-window-control-hover-bg)`,hoverShadow:`var(--ts-ui-window-control-shadow)`},WindowControlButton=class extends O{static ownClassStyleDefaults=Z;static ownStyleStates=[{selector:`.pressed`,extract:()=>({foregroundColor:Z.pressedForegroundColor,backgroundColor:Z.pressedBackgroundColor,backgroundImage:Z.pressedBackgroundImage,shadow:Z.pressedShadow})},{selector:`:hover`,extract:()=>({backgroundColor:Z.hoverBackgroundColor,backgroundImage:Z.hoverBackgroundImage,shadow:Z.hoverShadow})}];constructor(e,t){super(void 0,{glyph:e,insets:new r(2,2,2,2)},{...Z,...t??{}})}},Q={backgroundColor:`transparent`,backgroundImage:`none`,border:`1px solid transparent`,borderRadius:void 0,shadow:`none`,pressedForegroundColor:`var(--ts-ui-text-color, black)`,pressedBackgroundColor:`var(--ts-ui-window-control-active-bg)`,pressedBackgroundImage:`var(--ts-ui-window-control-active-bg)`,pressedShadow:`none`,hoverBackgroundColor:`var(--ts-ui-window-control-hover-bg)`,hoverBackgroundImage:`var(--ts-ui-window-control-hover-bg)`,hoverShadow:`none`},WindowLeadGlyphButton=class extends O{static ownClassStyleDefaults=Q;static ownStyleStates=[{selector:`.pressed`,extract:()=>({foregroundColor:Q.pressedForegroundColor,backgroundColor:Q.pressedBackgroundColor,backgroundImage:Q.pressedBackgroundImage,shadow:Q.pressedShadow})},{selector:`:hover`,extract:()=>({backgroundColor:Q.hoverBackgroundColor,backgroundImage:Q.hoverBackgroundImage,shadow:Q.hoverShadow})}];constructor(e,t){super(void 0,{glyph:e,insets:new r(2,2,2,2)},{...Q,...t??{}})}};function createWindowControlButton(e){return new WindowControlButton(e)}function createWindowLeadGlyphButton(e){let t=new WindowLeadGlyphButton(e);return t.setPointerEvents(`auto`),t}function setWindowControlsActive(e,t){let n=t?`var(--ts-ui-window-control-bg)`:`transparent`,r=t?`var(--ts-ui-window-control-bg)`:`none`;for(let t of e)t.setBackgroundColor(n),t.setBackgroundImage(r)}h.register(k,A,j,M);var ne={minSize:{width:0,height:0},maxSize:{width:t,height:t}},WindowHeaderTitleGlyph=class extends h{static ownStyleTraits=[D];constructor(e,t){super(e,void 0,{...ne,...t??{}})}},WindowHeader=class extends E{_exitButton;_minimizeButton;_maximizeButton;_trailingRow;_activeBackground;_titleGlyph=null;_titleRow;_closeable=!0;_minimizable=!0;_maximizable=!0;_titleGlyphClickListener=null;_boundOnHeaderClick=e=>this.onHeaderClick(e);constructor(e,t){super(e),this._activeBackground=`var(--ts-ui-window-header-bg, #eee)`,this.setBackgroundColor(this._activeBackground),this.setInsets(new r(0,4,0,4));let n=this.getText();this.removeComponent(n),this._titleRow=new l,this._titleRow.setLayoutManager(new v({spacing:8})),this._titleRow.setInsets(new r(0,0,0,5)),this._titleRow.setPointerEvents(`none`),this._titleRow.addComponent(n);let i=new l;i.setLayoutManager(new _({fill:o.HORIZONTAL})),i.setPointerEvents(`none`),i.addComponent(this._titleRow),this.addComponent(i,{placement:w.WEST,anchor:c.WEST,fill:o.HORIZONTAL}),this._minimizeButton=createWindowControlButton(`window-minimize`),this._maximizeButton=createWindowControlButton(`window-maximize`),this._exitButton=createWindowControlButton(`xmark`);for(let e of[this._minimizeButton,this._maximizeButton,this._exitButton])e.setInsets(new r(0,4,0,4));this._trailingRow=new l,this._trailingRow.setLayoutManager(new v({spacing:0,stretching:!0})),this._trailingRow.setInsets(new r(0,0,0,0)),this._trailingRow.addComponent(this._minimizeButton),this._trailingRow.addComponent(this._maximizeButton),this._trailingRow.addComponent(this._exitButton),this.addComponent(this._trailingRow,{placement:w.EAST}),t?.glyph===void 0&&this.setGlyph(`window-maximize`),t&&this.applyOptions(t)}updatePreferredSize(){let e=this.getText().getPreferredSize(),t=e?e.height:20;if(this.setPreferredSize({width:100,height:t+8}),this._titleGlyph){let e=this.resolveTitleGlyphInk();this._titleGlyph.setPreferredSize({width:e,height:e})}}resolveTitleGlyphInk(){return s.getResolvedScale().glyphMd}applyOptions(e){return super.applyOptions(e),e.closeable!==void 0&&this.setCloseable(e.closeable),e.minimizable!==void 0&&this.setMinimizable(e.minimizable),e.maximizable!==void 0&&this.setMaximizable(e.maximizable),e.glyph!==void 0&&this.setGlyph(e.glyph),this}setGlyph(e){this._titleGlyph&&=(this._titleRow.removeComponent(this._titleGlyph),null);let t=new WindowHeaderTitleGlyph(e),n=this.resolveTitleGlyphInk();return t.setPreferredSize({width:n,height:n}),t.setPointerEvents(`auto`),t.setCursor(`pointer`),this._titleGlyph=t,this._titleRow.insertComponent(t,0),this}clearGlyph(){return this._titleGlyph&&=(this._titleRow.removeComponent(this._titleGlyph),null),this}getGlyph(){return this._titleGlyph}setActive(e){return this.setBackgroundColor(e?this._activeBackground:`var(--ts-ui-gutter-bg, rgb(200, 200, 200))`),setWindowControlsActive([this._minimizeButton,this._maximizeButton,this._exitButton],e),this}setCloseable(e){return this._closeable=e,this._exitButton.setEnabled(e),this}isCloseable(){return this._closeable}setMinimizable(e){return this._minimizable=e,this._minimizeButton.setVisible(e),this}isMinimizable(){return this._minimizable}setMaximizable(e){return this._maximizable=e,this._maximizeButton.setVisible(e),this}isMaximizable(){return this._maximizable}setMaximizeButtonEnabled(e){return this._maximizeButton.setEnabled(e),this}isMaximizeButtonEnabled(){return this._maximizeButton.isEnabled()}setMaximizeButtonGlyph(e){return this._maximizeButton.setGlyph(e),this}setMinimizeButtonGlyph(e){return this._minimizeButton.setGlyph(e),this}addExitButtonListener(e){return this._exitButton.on(`action`,e),this}addMinimizeButtonListener(e){return this._minimizeButton.on(`action`,e),this}addMaximizeButtonListener(e){return this._maximizeButton.on(`action`,e),this}addHeaderDoubleClickListener(e){return i.addSubtreeListener(this,`dblclick`,e),this}addTitleGlyphClickListener(e){return this._titleGlyphClickListener===null&&i.addSubtreeListener(this,`click`,this._boundOnHeaderClick),this._titleGlyphClickListener=e,this}onHeaderClick(t){let n=t.target===null?null:e.source.intern(t.target),r=this._titleGlyph?.getElement();!n||!r||!e.source.contains(r,n)||this._titleGlyphClickListener?.()}getMinContentWidth(e=100){let t=this._titleGlyph?.getPreferredSize()?.width??0,n=this._trailingRow.getPreferredSize()?.width??0;return t+e+n}getMinimizeButtonElement(){return this._minimizeButton.getElement()}getMaximizeButtonElement(){return this._maximizeButton.getElement()}getExitButtonElement(){return this._exitButton.getElement()}},$=a(WindowHeader),Window=class extends X{_header;_headerDragShift=!1;_headerDragComponentId=``;_boundCaptureHeaderShift=e=>this.captureHeaderShift(e);_boundOnHeaderMouseDown=e=>this.onHeaderMouseDown(e);_boundOnTitleGlyphClick=()=>this.onTitleGlyphClick();constructor(e,t){super(t),this.setLayoutManager(new te);let n=this._options.headerText??e??`Window`;this._header=new $(n),this.addComponent(this._header,{placement:w.NORTH,ignoreParentInsets:!0}),this._header.addExitButtonListener(()=>this.onExitAction()),this._header.addMinimizeButtonListener(()=>this.toggleMinimize()),this._header.addMaximizeButtonListener(()=>this.toggleMaximize()),this._header.addHeaderDoubleClickListener(e=>this.onHeaderDoubleClick(e)),this._header.addTitleGlyphClickListener(this._boundOnTitleGlyphClick),this._options.glyph!==void 0&&this._header.setGlyph(this._options.glyph),this.initChrome(t)}getHeader(){return this._header}setHeaderText(e){if(!this._header)throw Error(`Window does not have a header.`);return this._header.getText().setText(e),this}setGlyph(e){return this._options.glyph=e,this._header.setGlyph(e),this}wireMoveTrigger(){i.addSubtreeListener(this._header,`mousedown`,this._boundOnHeaderMouseDown),i.addSubtreeListener(this._header,`mousedown`,this._boundCaptureHeaderShift),S.makeDragSource(this._header,{dragData:()=>this.buildHeaderDragData(),onDragStart:()=>this.onHeaderDragStart(),onDragEnd:(e,t)=>this.onHeaderDragEnd(t)})}reflectCloseable(e){this._header.setCloseable(e)}reflectMinimizable(e){this._header.setMinimizable(e)}reflectMaximizable(e){this._header.setMaximizable(e)}reflectMaximizeAvailability(e){this._header.setMaximizeButtonEnabled(e)}reflectMaximizeState(e){this._header.setMaximizeButtonGlyph(e===`maximized`?`window-restore`:`window-maximize`),this._header.setMinimizeButtonGlyph(e===`minimized`?`window-restore`:`window-minimize`)}paintActive(e){this._header.setActive(e)}getTitle(){return String(this._header.getText().getText())}minContentWidthSeed(){return this._header.getMinContentWidth()}chromeHeight(){return this._header.getHeight()}addContent(e){this.addComponent(e,{placement:w.CENTER})}isChromeComponent(e){return e===this._header}onHeaderMouseDown(t){let n=t.target===null?null:e.source.intern(t.target);n&&this.targetIsInHeaderControl(n)||this.onMouseDown(t)}onHeaderDoubleClick(t){let n=t.target===null?null:e.source.intern(t.target);if(!(n&&this.targetIsInHeaderControl(n))){if(this.getWindowState()===`minimized`){this.setWindowState(this._preMinimizeState);return}this.canMaximize()&&this.toggleMaximize()}}targetIsInHeaderControl(t){let n=[this._header.getMinimizeButtonElement(),this._header.getMaximizeButtonElement(),this._header.getExitButtonElement(),this._header.getGlyph()?.getElement()];for(let r of n)if(r&&e.source.contains(r,t))return!0;return!1}onTitleGlyphClick(){let e=this._header.getGlyph();e&&this.openWindowMenu(e)}captureHeaderShift(e){this._headerDragShift=e.shiftKey}buildHeaderDragData(){let e=this.findBodyHost();return{tabDrag:!0,sourceTabId:this.getId(),componentId:e?e.getId():``,label:String(this._header.getText().getText())}}onHeaderDragStart(){let e=this._headerDragShift;this._headerDragShift=!1;let t=this.findBodyHost();if(!e||!t)return!1;this._headerDragComponentId=t.getId(),b.set(t.getId(),t)}onHeaderDragEnd(e){b.delete(this._headerDragComponentId),this._headerDragComponentId=``,e&&this.findBodyHost()===null&&this.requestClose()}},re=a(Window);export{setWindowControlsActive as a,N as c,createWindowLeadGlyphButton as i,L as l,$ as n,X as o,createWindowControlButton as r,createSpinnerWrap as s,re as t};
2
+ //# sourceMappingURL=Window-CQ14_65z.js.map