@itwin/appui-react 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/lib/cjs/appui-react/UiFramework.js +7 -4
  3. package/lib/cjs/appui-react/UiFramework.js.map +1 -1
  4. package/lib/cjs/appui-react/accudraw/MenuButton.d.ts +2 -2
  5. package/lib/cjs/appui-react/accudraw/MenuButton.d.ts.map +1 -1
  6. package/lib/cjs/appui-react/accudraw/MenuButton.js.map +1 -1
  7. package/lib/cjs/appui-react/backstage/BackstageComposer.d.ts.map +1 -1
  8. package/lib/cjs/appui-react/backstage/BackstageComposer.js.map +1 -1
  9. package/lib/cjs/appui-react/backstage/BackstageComposerItem.js +2 -1
  10. package/lib/cjs/appui-react/backstage/BackstageComposerItem.js.map +1 -1
  11. package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
  12. package/lib/cjs/appui-react/childwindow/CopyStyles.js +3 -1
  13. package/lib/cjs/appui-react/childwindow/CopyStyles.js.map +1 -1
  14. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
  15. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +3 -2
  16. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  17. package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
  18. package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
  19. package/lib/cjs/appui-react/configurableui/TimeTracker.js +2 -1
  20. package/lib/cjs/appui-react/configurableui/TimeTracker.js.map +1 -1
  21. package/lib/cjs/appui-react/content/ContentLayout.js +12 -9
  22. package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
  23. package/lib/cjs/appui-react/content/DefaultViewOverlay.js +4 -3
  24. package/lib/cjs/appui-react/content/DefaultViewOverlay.js.map +1 -1
  25. package/lib/cjs/appui-react/content/FloatingViewportContent.js +2 -1
  26. package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
  27. package/lib/cjs/appui-react/content/IModelViewport.js +6 -3
  28. package/lib/cjs/appui-react/content/IModelViewport.js.map +1 -1
  29. package/lib/cjs/appui-react/content/InternalContentLayoutManager.js +2 -1
  30. package/lib/cjs/appui-react/content/InternalContentLayoutManager.js.map +1 -1
  31. package/lib/cjs/appui-react/content/InternalContentViewManager.js +1 -1
  32. package/lib/cjs/appui-react/content/InternalContentViewManager.js.map +1 -1
  33. package/lib/cjs/appui-react/content/split-pane/SplitPane.js +12 -10
  34. package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -1
  35. package/lib/cjs/appui-react/cursor/CursorInformation.d.ts +6 -6
  36. package/lib/cjs/appui-react/cursor/CursorInformation.d.ts.map +1 -1
  37. package/lib/cjs/appui-react/cursor/CursorInformation.js.map +1 -1
  38. package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
  39. package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js +3 -2
  40. package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
  41. package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.d.ts +4 -4
  42. package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.d.ts.map +1 -1
  43. package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.js.map +1 -1
  44. package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts +5 -5
  45. package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts.map +1 -1
  46. package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopupManager.js.map +1 -1
  47. package/lib/cjs/appui-react/cursor/cursorprompt/CursorPrompt.d.ts +2 -2
  48. package/lib/cjs/appui-react/cursor/cursorprompt/CursorPrompt.d.ts.map +1 -1
  49. package/lib/cjs/appui-react/cursor/cursorprompt/CursorPrompt.js.map +1 -1
  50. package/lib/cjs/appui-react/dialog/ContentDialog.js +6 -3
  51. package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -1
  52. package/lib/cjs/appui-react/dialog/DialogManagerBase.js +3 -2
  53. package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
  54. package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts +1 -2
  55. package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
  56. package/lib/cjs/appui-react/feedback/ElementTooltip.js.map +1 -1
  57. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +22 -26
  58. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  59. package/lib/cjs/appui-react/frontstage/FrontstageDef.js +177 -216
  60. package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
  61. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts +3 -7
  62. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
  63. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js +2 -6
  64. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
  65. package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js +3 -2
  66. package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
  67. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +2 -1
  68. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
  69. package/lib/cjs/appui-react/hooks/useActiveIModelConnection.d.ts.map +1 -1
  70. package/lib/cjs/appui-react/hooks/useActiveIModelConnection.js.map +1 -1
  71. package/lib/cjs/appui-react/hooks/useActiveViewport.d.ts.map +1 -1
  72. package/lib/cjs/appui-react/hooks/useActiveViewport.js.map +1 -1
  73. package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js +11 -7
  74. package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
  75. package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js +11 -7
  76. package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
  77. package/lib/cjs/appui-react/hooks/useSolarDataProvider.js +13 -8
  78. package/lib/cjs/appui-react/hooks/useSolarDataProvider.js.map +1 -1
  79. package/lib/cjs/appui-react/keyboardshortcut/InternalKeyboardShortcut.d.ts.map +1 -1
  80. package/lib/cjs/appui-react/keyboardshortcut/InternalKeyboardShortcut.js.map +1 -1
  81. package/lib/cjs/appui-react/messages/ActivityMessage.js +7 -5
  82. package/lib/cjs/appui-react/messages/ActivityMessage.js.map +1 -1
  83. package/lib/cjs/appui-react/messages/MessageManager.d.ts +0 -1
  84. package/lib/cjs/appui-react/messages/MessageManager.d.ts.map +1 -1
  85. package/lib/cjs/appui-react/messages/MessageManager.js +1 -2
  86. package/lib/cjs/appui-react/messages/MessageManager.js.map +1 -1
  87. package/lib/cjs/appui-react/messages/Pointer.d.ts +1 -2
  88. package/lib/cjs/appui-react/messages/Pointer.d.ts.map +1 -1
  89. package/lib/cjs/appui-react/messages/Pointer.js +1 -1
  90. package/lib/cjs/appui-react/messages/Pointer.js.map +1 -1
  91. package/lib/cjs/appui-react/pickers/ViewSelector.js +6 -5
  92. package/lib/cjs/appui-react/pickers/ViewSelector.js.map +1 -1
  93. package/lib/cjs/appui-react/popup/KeyinPalettePanel.js +2 -1
  94. package/lib/cjs/appui-react/popup/KeyinPalettePanel.js.map +1 -1
  95. package/lib/cjs/appui-react/popup/PopupManager.js +2 -1
  96. package/lib/cjs/appui-react/popup/PopupManager.js.map +1 -1
  97. package/lib/cjs/appui-react/popup/PositionPopup.d.ts +2 -2
  98. package/lib/cjs/appui-react/popup/PositionPopup.d.ts.map +1 -1
  99. package/lib/cjs/appui-react/popup/PositionPopup.js.map +1 -1
  100. package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +2 -2
  101. package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
  102. package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js +1 -2
  103. package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
  104. package/lib/cjs/appui-react/settings/ui/UiSettingsPage.js.map +1 -1
  105. package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts +16 -20
  106. package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
  107. package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +86 -116
  108. package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
  109. package/lib/cjs/appui-react/statusbar/Indicator.js +2 -1
  110. package/lib/cjs/appui-react/statusbar/Indicator.js.map +1 -1
  111. package/lib/cjs/appui-react/statusbar/StatusBar.js +5 -3
  112. package/lib/cjs/appui-react/statusbar/StatusBar.js.map +1 -1
  113. package/lib/cjs/appui-react/statusfields/MessageCenter.d.ts.map +1 -1
  114. package/lib/cjs/appui-react/statusfields/MessageCenter.js +1 -2
  115. package/lib/cjs/appui-react/statusfields/MessageCenter.js.map +1 -1
  116. package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
  117. package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
  118. package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts +36 -0
  119. package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts.map +1 -0
  120. package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.js +134 -0
  121. package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.js.map +1 -0
  122. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts +1 -1
  123. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
  124. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js +2 -2
  125. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
  126. package/lib/cjs/appui-react/syncui/UiSyncEvent.d.ts +16 -0
  127. package/lib/cjs/appui-react/syncui/UiSyncEvent.d.ts.map +1 -0
  128. package/lib/cjs/appui-react/syncui/UiSyncEvent.js +18 -0
  129. package/lib/cjs/appui-react/syncui/UiSyncEvent.js.map +1 -0
  130. package/lib/cjs/appui-react/toolbar/ToolbarHelper.js +4 -6
  131. package/lib/cjs/appui-react/toolbar/ToolbarHelper.js.map +1 -1
  132. package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js +4 -3
  133. package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
  134. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +17 -10
  135. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  136. package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js +2 -3
  137. package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
  138. package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js +14 -12
  139. package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
  140. package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +10 -9
  141. package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
  142. package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +2 -1
  143. package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
  144. package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js +14 -8
  145. package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
  146. package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
  147. package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
  148. package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +1 -1
  149. package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
  150. package/lib/cjs/appui-react/uistate/AppUiSettings.d.ts.map +1 -1
  151. package/lib/cjs/appui-react/uistate/AppUiSettings.js.map +1 -1
  152. package/lib/cjs/appui-react/uistate/useUiStateStorage.d.ts.map +1 -1
  153. package/lib/cjs/appui-react/uistate/useUiStateStorage.js.map +1 -1
  154. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js +3 -3
  155. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
  156. package/lib/cjs/appui-react/widget-panels/Content.js +9 -8
  157. package/lib/cjs/appui-react/widget-panels/Content.js.map +1 -1
  158. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts +7 -29
  159. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  160. package/lib/cjs/appui-react/widget-panels/Frontstage.js +128 -463
  161. package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
  162. package/lib/cjs/appui-react/widget-panels/StatusBar.js +1 -1
  163. package/lib/cjs/appui-react/widget-panels/StatusBar.js.map +1 -1
  164. package/lib/cjs/appui-react/widget-panels/Tab.js +1 -1
  165. package/lib/cjs/appui-react/widget-panels/Tab.js.map +1 -1
  166. package/lib/cjs/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
  167. package/lib/cjs/appui-react/widget-panels/ToolSettings.js +34 -15
  168. package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
  169. package/lib/cjs/appui-react/widget-panels/Toolbars.js +3 -2
  170. package/lib/cjs/appui-react/widget-panels/Toolbars.js.map +1 -1
  171. package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js +2 -2
  172. package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
  173. package/lib/cjs/appui-react/widgets/Widget.d.ts +10 -4
  174. package/lib/cjs/appui-react/widgets/Widget.d.ts.map +1 -1
  175. package/lib/cjs/appui-react/widgets/Widget.js.map +1 -1
  176. package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +9 -29
  177. package/lib/cjs/appui-react/widgets/WidgetDef.d.ts.map +1 -1
  178. package/lib/cjs/appui-react/widgets/WidgetDef.js +90 -46
  179. package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
  180. package/lib/cjs/appui-react/widgets/WidgetHost.js +3 -2
  181. package/lib/cjs/appui-react/widgets/WidgetHost.js.map +1 -1
  182. package/lib/cjs/appui-react.d.ts +1 -0
  183. package/lib/cjs/appui-react.d.ts.map +1 -1
  184. package/lib/cjs/appui-react.js +1 -0
  185. package/lib/cjs/appui-react.js.map +1 -1
  186. package/lib/esm/appui-react/UiFramework.js +7 -4
  187. package/lib/esm/appui-react/UiFramework.js.map +1 -1
  188. package/lib/esm/appui-react/accudraw/MenuButton.d.ts +2 -2
  189. package/lib/esm/appui-react/accudraw/MenuButton.d.ts.map +1 -1
  190. package/lib/esm/appui-react/accudraw/MenuButton.js.map +1 -1
  191. package/lib/esm/appui-react/backstage/BackstageComposer.d.ts.map +1 -1
  192. package/lib/esm/appui-react/backstage/BackstageComposer.js.map +1 -1
  193. package/lib/esm/appui-react/backstage/BackstageComposerItem.js +2 -1
  194. package/lib/esm/appui-react/backstage/BackstageComposerItem.js.map +1 -1
  195. package/lib/esm/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
  196. package/lib/esm/appui-react/childwindow/CopyStyles.js +3 -1
  197. package/lib/esm/appui-react/childwindow/CopyStyles.js.map +1 -1
  198. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
  199. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +3 -2
  200. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  201. package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
  202. package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
  203. package/lib/esm/appui-react/configurableui/TimeTracker.js +2 -1
  204. package/lib/esm/appui-react/configurableui/TimeTracker.js.map +1 -1
  205. package/lib/esm/appui-react/content/ContentLayout.js +12 -9
  206. package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
  207. package/lib/esm/appui-react/content/DefaultViewOverlay.js +4 -3
  208. package/lib/esm/appui-react/content/DefaultViewOverlay.js.map +1 -1
  209. package/lib/esm/appui-react/content/FloatingViewportContent.js +2 -1
  210. package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
  211. package/lib/esm/appui-react/content/IModelViewport.js +6 -3
  212. package/lib/esm/appui-react/content/IModelViewport.js.map +1 -1
  213. package/lib/esm/appui-react/content/InternalContentLayoutManager.js +2 -1
  214. package/lib/esm/appui-react/content/InternalContentLayoutManager.js.map +1 -1
  215. package/lib/esm/appui-react/content/InternalContentViewManager.js +1 -1
  216. package/lib/esm/appui-react/content/InternalContentViewManager.js.map +1 -1
  217. package/lib/esm/appui-react/content/split-pane/SplitPane.js +12 -10
  218. package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -1
  219. package/lib/esm/appui-react/cursor/CursorInformation.d.ts +6 -6
  220. package/lib/esm/appui-react/cursor/CursorInformation.d.ts.map +1 -1
  221. package/lib/esm/appui-react/cursor/CursorInformation.js.map +1 -1
  222. package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
  223. package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js +3 -2
  224. package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
  225. package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.d.ts +4 -4
  226. package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.d.ts.map +1 -1
  227. package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.js.map +1 -1
  228. package/lib/esm/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts +5 -5
  229. package/lib/esm/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts.map +1 -1
  230. package/lib/esm/appui-react/cursor/cursorpopup/CursorPopupManager.js.map +1 -1
  231. package/lib/esm/appui-react/cursor/cursorprompt/CursorPrompt.d.ts +2 -2
  232. package/lib/esm/appui-react/cursor/cursorprompt/CursorPrompt.d.ts.map +1 -1
  233. package/lib/esm/appui-react/cursor/cursorprompt/CursorPrompt.js.map +1 -1
  234. package/lib/esm/appui-react/dialog/ContentDialog.js +6 -3
  235. package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -1
  236. package/lib/esm/appui-react/dialog/DialogManagerBase.js +3 -2
  237. package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
  238. package/lib/esm/appui-react/feedback/ElementTooltip.d.ts +1 -2
  239. package/lib/esm/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
  240. package/lib/esm/appui-react/feedback/ElementTooltip.js.map +1 -1
  241. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +22 -26
  242. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  243. package/lib/esm/appui-react/frontstage/FrontstageDef.js +181 -220
  244. package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
  245. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts +3 -7
  246. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
  247. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js +2 -6
  248. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
  249. package/lib/esm/appui-react/frontstage/ModalSettingsStage.js +3 -2
  250. package/lib/esm/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
  251. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +2 -1
  252. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
  253. package/lib/esm/appui-react/hooks/useActiveIModelConnection.d.ts.map +1 -1
  254. package/lib/esm/appui-react/hooks/useActiveIModelConnection.js.map +1 -1
  255. package/lib/esm/appui-react/hooks/useActiveViewport.d.ts.map +1 -1
  256. package/lib/esm/appui-react/hooks/useActiveViewport.js.map +1 -1
  257. package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js +11 -7
  258. package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
  259. package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js +11 -7
  260. package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
  261. package/lib/esm/appui-react/hooks/useSolarDataProvider.js +13 -8
  262. package/lib/esm/appui-react/hooks/useSolarDataProvider.js.map +1 -1
  263. package/lib/esm/appui-react/keyboardshortcut/InternalKeyboardShortcut.d.ts.map +1 -1
  264. package/lib/esm/appui-react/keyboardshortcut/InternalKeyboardShortcut.js.map +1 -1
  265. package/lib/esm/appui-react/messages/ActivityMessage.js +7 -5
  266. package/lib/esm/appui-react/messages/ActivityMessage.js.map +1 -1
  267. package/lib/esm/appui-react/messages/MessageManager.d.ts +0 -1
  268. package/lib/esm/appui-react/messages/MessageManager.d.ts.map +1 -1
  269. package/lib/esm/appui-react/messages/MessageManager.js +1 -2
  270. package/lib/esm/appui-react/messages/MessageManager.js.map +1 -1
  271. package/lib/esm/appui-react/messages/Pointer.d.ts +1 -2
  272. package/lib/esm/appui-react/messages/Pointer.d.ts.map +1 -1
  273. package/lib/esm/appui-react/messages/Pointer.js +1 -1
  274. package/lib/esm/appui-react/messages/Pointer.js.map +1 -1
  275. package/lib/esm/appui-react/pickers/ViewSelector.js +6 -5
  276. package/lib/esm/appui-react/pickers/ViewSelector.js.map +1 -1
  277. package/lib/esm/appui-react/popup/KeyinPalettePanel.js +2 -1
  278. package/lib/esm/appui-react/popup/KeyinPalettePanel.js.map +1 -1
  279. package/lib/esm/appui-react/popup/PopupManager.js +2 -1
  280. package/lib/esm/appui-react/popup/PopupManager.js.map +1 -1
  281. package/lib/esm/appui-react/popup/PositionPopup.d.ts +2 -2
  282. package/lib/esm/appui-react/popup/PositionPopup.d.ts.map +1 -1
  283. package/lib/esm/appui-react/popup/PositionPopup.js.map +1 -1
  284. package/lib/esm/appui-react/selection/SelectionContextItemDef.js +2 -2
  285. package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
  286. package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js +1 -2
  287. package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
  288. package/lib/esm/appui-react/settings/ui/UiSettingsPage.js.map +1 -1
  289. package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts +16 -20
  290. package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
  291. package/lib/esm/appui-react/stagepanels/StagePanelDef.js +84 -115
  292. package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
  293. package/lib/esm/appui-react/statusbar/Indicator.js +2 -1
  294. package/lib/esm/appui-react/statusbar/Indicator.js.map +1 -1
  295. package/lib/esm/appui-react/statusbar/StatusBar.js +5 -3
  296. package/lib/esm/appui-react/statusbar/StatusBar.js.map +1 -1
  297. package/lib/esm/appui-react/statusfields/MessageCenter.d.ts.map +1 -1
  298. package/lib/esm/appui-react/statusfields/MessageCenter.js +1 -2
  299. package/lib/esm/appui-react/statusfields/MessageCenter.js.map +1 -1
  300. package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
  301. package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
  302. package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts +36 -0
  303. package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts.map +1 -0
  304. package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.js +130 -0
  305. package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.js.map +1 -0
  306. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts +1 -1
  307. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
  308. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js +2 -2
  309. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
  310. package/lib/esm/appui-react/syncui/UiSyncEvent.d.ts +16 -0
  311. package/lib/esm/appui-react/syncui/UiSyncEvent.d.ts.map +1 -0
  312. package/lib/esm/appui-react/syncui/UiSyncEvent.js +14 -0
  313. package/lib/esm/appui-react/syncui/UiSyncEvent.js.map +1 -0
  314. package/lib/esm/appui-react/toolbar/ToolbarHelper.js +4 -6
  315. package/lib/esm/appui-react/toolbar/ToolbarHelper.js.map +1 -1
  316. package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js +4 -3
  317. package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
  318. package/lib/esm/appui-react/tools/CoreToolDefinitions.js +17 -10
  319. package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  320. package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js +2 -3
  321. package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
  322. package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js +14 -12
  323. package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
  324. package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +10 -9
  325. package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
  326. package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +2 -1
  327. package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
  328. package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js +14 -8
  329. package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
  330. package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
  331. package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
  332. package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +1 -1
  333. package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
  334. package/lib/esm/appui-react/uistate/AppUiSettings.d.ts.map +1 -1
  335. package/lib/esm/appui-react/uistate/AppUiSettings.js.map +1 -1
  336. package/lib/esm/appui-react/uistate/useUiStateStorage.d.ts.map +1 -1
  337. package/lib/esm/appui-react/uistate/useUiStateStorage.js.map +1 -1
  338. package/lib/esm/appui-react/utils/InternalUiShowHideManager.js +3 -3
  339. package/lib/esm/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
  340. package/lib/esm/appui-react/widget-panels/Content.js +9 -8
  341. package/lib/esm/appui-react/widget-panels/Content.js.map +1 -1
  342. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts +7 -29
  343. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  344. package/lib/esm/appui-react/widget-panels/Frontstage.js +131 -462
  345. package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
  346. package/lib/esm/appui-react/widget-panels/StatusBar.js +1 -1
  347. package/lib/esm/appui-react/widget-panels/StatusBar.js.map +1 -1
  348. package/lib/esm/appui-react/widget-panels/Tab.js +1 -1
  349. package/lib/esm/appui-react/widget-panels/Tab.js.map +1 -1
  350. package/lib/esm/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
  351. package/lib/esm/appui-react/widget-panels/ToolSettings.js +34 -15
  352. package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
  353. package/lib/esm/appui-react/widget-panels/Toolbars.js +3 -2
  354. package/lib/esm/appui-react/widget-panels/Toolbars.js.map +1 -1
  355. package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js +2 -2
  356. package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
  357. package/lib/esm/appui-react/widgets/Widget.d.ts +10 -4
  358. package/lib/esm/appui-react/widgets/Widget.d.ts.map +1 -1
  359. package/lib/esm/appui-react/widgets/Widget.js.map +1 -1
  360. package/lib/esm/appui-react/widgets/WidgetDef.d.ts +9 -29
  361. package/lib/esm/appui-react/widgets/WidgetDef.d.ts.map +1 -1
  362. package/lib/esm/appui-react/widgets/WidgetDef.js +90 -46
  363. package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
  364. package/lib/esm/appui-react/widgets/WidgetHost.js +3 -2
  365. package/lib/esm/appui-react/widgets/WidgetHost.js.map +1 -1
  366. package/lib/esm/appui-react.d.ts +1 -0
  367. package/lib/esm/appui-react.d.ts.map +1 -1
  368. package/lib/esm/appui-react.js +1 -0
  369. package/lib/esm/appui-react.js.map +1 -1
  370. package/package.json +10 -10
@@ -10,10 +10,11 @@ import "./Frontstage.scss";
10
10
  import produce from "immer";
11
11
  import * as React from "react";
12
12
  import { unstable_batchedUpdates } from "react-dom";
13
- import { assert, Logger, ProcessDetector } from "@itwin/core-bentley";
14
- import { Rectangle, Size, UiStateStorageStatus } from "@itwin/core-react";
13
+ import { Logger, ProcessDetector } from "@itwin/core-bentley";
14
+ import { Rectangle, UiStateStorageStatus } from "@itwin/core-react";
15
15
  import { ToolbarPopupAutoHideContext } from "@itwin/components-react";
16
- import { addDockedToolSettings, addFloatingWidget, addPanelWidget, addTab, addTabToWidget, addWidgetToolSettings, convertAllPopupWidgetContainersToFloating, createLayoutStore, createNineZoneState, floatingWidgetBringToFront, FloatingWidgets, getTabLocation, getUniqueId, getWidgetPanelSectionId, insertPanelWidget, insertTabToWidget, isFloatingTabLocation, isHorizontalPanelSide, isPanelTabLocation, isPopoutTabLocation, NineZone, NineZoneStateReducer, panelSides, removeTab, removeTabFromWidget, removeToolSettings, WidgetPanels, } from "@itwin/appui-layout-react";
16
+ import { addDockedToolSettings, addFloatingWidget, addPanelWidget, addRemovedTab, addTab, addTabToWidget, createLayoutStore, createNineZoneState, floatingWidgetBringToFront, FloatingWidgets, getTabLocation, getUniqueId, getWidgetPanelSectionId, isFloatingTabLocation, isPanelTabLocation, NineZone, NineZoneStateReducer, removeTab, WidgetPanels, } from "@itwin/appui-layout-react";
17
+ import { useActiveFrontstageDef, } from "../frontstage/FrontstageDef";
17
18
  import { StagePanelState, toPanelSide } from "../stagepanels/StagePanelDef";
18
19
  import { UiFramework } from "../UiFramework";
19
20
  import { useUiStateStorageHandler } from "../uistate/useUiStateStorage";
@@ -50,30 +51,19 @@ const widgetContent = React.createElement(WidgetContent, null);
50
51
  const toolSettingsContent = React.createElement(ToolSettingsContent, null);
51
52
  const widgetPanelsFrontstage = React.createElement(WidgetPanelsFrontstageComponent, null);
52
53
  /** @internal */
53
- export function useLayoutStore() {
54
- const [def, setDef] = React.useState(UiFramework.frontstages.activeFrontstageDef);
55
- const [layout, setLayout] = React.useState(() => createLayoutStore(def?.nineZoneState));
56
- React.useEffect(() => {
57
- return UiFramework.frontstages.onFrontstageActivatedEvent.addListener((args) => {
58
- unstable_batchedUpdates(() => {
59
- setDef(args.activatedFrontstageDef);
60
- setLayout(createLayoutStore(args.activatedFrontstageDef.nineZoneState));
61
- });
62
- });
63
- }, []);
54
+ export function useLayoutStore(frontstageDef) {
55
+ const layoutStore = React.useMemo(() => createLayoutStore(frontstageDef === null || frontstageDef === void 0 ? void 0 : frontstageDef.nineZoneState), [frontstageDef]);
64
56
  React.useEffect(() => {
65
57
  return InternalFrontstageManager.onFrontstageNineZoneStateChangedEvent.addListener((args) => {
66
- if (args.frontstageDef !== def ||
67
- def.isStageClosing ||
68
- def.isApplicationClosing)
58
+ if (args.frontstageDef !== frontstageDef)
69
59
  return;
70
60
  unstable_batchedUpdates(() => {
71
61
  // https://github.com/pmndrs/zustand/blob/main/docs/guides/event-handler-in-pre-react-18.md
72
- layout.setState(args.state || defaultNineZone);
62
+ layoutStore.setState(args.state || defaultNineZone);
73
63
  });
74
64
  });
75
- }, [def, layout]);
76
- return [layout, def];
65
+ }, [frontstageDef, layoutStore]);
66
+ return layoutStore;
77
67
  }
78
68
  /** Update in-memory NineZoneState of newly activated frontstage with up to date size.
79
69
  * @internal
@@ -81,65 +71,30 @@ export function useLayoutStore() {
81
71
  export function useUpdateNineZoneSize(frontstageDef) {
82
72
  React.useEffect(() => {
83
73
  const size = InternalFrontstageManager.nineZoneSize;
84
- let state = frontstageDef.nineZoneState;
74
+ const state = frontstageDef.nineZoneState;
85
75
  if (!size || !state)
86
76
  return;
87
- state = FrameworkStateReducer(state, {
77
+ frontstageDef.dispatch({
88
78
  type: "RESIZE",
89
79
  size: {
90
80
  height: size.height,
91
81
  width: size.width,
92
82
  },
93
- }, frontstageDef);
94
- frontstageDef.nineZoneState = state;
95
- }, [frontstageDef]);
96
- }
97
- /** @internal */
98
- export function FrameworkStateReducer(state, action, frontstageDef) {
99
- state = NineZoneStateReducer(state, action);
100
- if (action.type === "RESIZE") {
101
- state = produce(state, (draft) => {
102
- for (const panelSide of panelSides) {
103
- const panel = draft.panels[panelSide];
104
- const location = toStagePanelLocation(panelSide);
105
- const panelDef = frontstageDef.getStagePanelDef(location);
106
- if (panelDef?.maxSizeSpec) {
107
- panel.maxSize = getPanelMaxSize(panelDef.maxSizeSpec, panelSide, action.size);
108
- if (panel.size) {
109
- panel.size = Math.min(Math.max(panel.size, panel.minSize), panel.maxSize);
110
- }
111
- }
112
- }
113
83
  });
114
- }
115
- return state;
84
+ }, [frontstageDef]);
116
85
  }
117
86
  /** @internal */
118
87
  export function useNineZoneDispatch(frontstageDef) {
119
- const dispatch = React.useCallback((action) => {
120
- if (action.type === "RESIZE") {
121
- InternalFrontstageManager.nineZoneSize = Size.create(action.size);
122
- }
123
- if (action.type === "WIDGET_TAB_POPOUT") {
124
- const tabId = action.id;
125
- frontstageDef.popoutWidget(tabId);
126
- return;
127
- }
128
- const state = frontstageDef.nineZoneState;
129
- if (!state)
130
- return;
131
- frontstageDef.nineZoneState = FrameworkStateReducer(state, action, frontstageDef);
132
- }, [frontstageDef]);
133
- return dispatch;
88
+ return React.useMemo(() => frontstageDef.dispatch, [frontstageDef]);
134
89
  }
135
90
  /** @internal */
136
91
  export function WidgetPanelsFrontstage() {
137
- const [layout, frontstageDef] = useLayoutStore();
92
+ const frontstageDef = useActiveFrontstageDef();
93
+ const layout = useLayoutStore(frontstageDef);
138
94
  React.useEffect(() => {
139
95
  const triggerWidowCloseProcessing = () => {
140
96
  frontstageDef && frontstageDef.setIsApplicationClosing(true);
141
97
  };
142
- frontstageDef && frontstageDef.setIsApplicationClosing(false);
143
98
  window.addEventListener("unload", triggerWidowCloseProcessing);
144
99
  return () => {
145
100
  window.removeEventListener("unload", triggerWidowCloseProcessing);
@@ -197,17 +152,19 @@ export function useLabels() {
197
152
  }), []);
198
153
  }
199
154
  function toTabArgs(widget) {
155
+ var _a;
200
156
  const label = getWidgetLabel(widget.label);
201
- return {
202
- allowedPanelTargets: widget.allowedPanelTargets?.map((location) => toPanelSide(location)),
157
+ const args = {
158
+ allowedPanelTargets: (_a = widget.allowedPanelTargets) === null || _a === void 0 ? void 0 : _a.map((location) => toPanelSide(location)),
203
159
  hideWithUiWhenFloating: !!widget.hideWithUiWhenFloating,
204
160
  canPopout: widget.canPopout,
205
161
  iconSpec: widget.iconSpec,
206
- isFloatingStateWindowResizable: widget.isFloatingStateWindowResizable,
162
+ isFloatingWidgetResizable: widget.isFloatingStateWindowResizable,
207
163
  label,
208
164
  preferredFloatingWidgetSize: widget.defaultFloatingSize,
209
165
  preferredPanelWidgetSize: widget.preferredPanelSize,
210
166
  };
167
+ return args;
211
168
  }
212
169
  /** @internal */
213
170
  export function addWidgets(state, widgets, side, widgetId) {
@@ -222,7 +179,7 @@ export function addWidgets(state, widgets, side, widgetId) {
222
179
  const activeWidget = visibleWidgets.find((widget) => widget.isActive);
223
180
  const minimized = false;
224
181
  // istanbul ignore else
225
- if (activeWidget?.defaultState !== WidgetState.Floating) {
182
+ if ((activeWidget === null || activeWidget === void 0 ? void 0 : activeWidget.defaultState) !== WidgetState.Floating) {
226
183
  state = addPanelWidget(state, side, widgetId, tabs, {
227
184
  activeTabId: activeWidget ? activeWidget.id : tabs[0],
228
185
  minimized,
@@ -255,9 +212,15 @@ export function appendWidgets(state, widgetDefs, location, section) {
255
212
  preferredPanelWidgetSize,
256
213
  userSized,
257
214
  });
258
- if (widgetDef.isFloatingStateSupported &&
215
+ const savedTab = state.savedTabs.byId[widgetDef.id];
216
+ if (savedTab) {
217
+ state = addRemovedTab(state, widgetDef.id);
218
+ }
219
+ else if (widgetDef.isFloatingStateSupported &&
259
220
  widgetDef.defaultState === WidgetState.Floating) {
260
- const floatingContainerId = widgetDef.floatingContainerId ?? getUniqueId();
221
+ const floatingContainerId = widgetDef.floatingContainerId
222
+ ? widgetDef.floatingContainerId
223
+ : getUniqueId();
261
224
  const widgetContainerId = getWidgetId(location, section);
262
225
  const home = {
263
226
  side,
@@ -275,7 +238,7 @@ export function appendWidgets(state, widgetDefs, location, section) {
275
238
  width: 300,
276
239
  ...tab.preferredFloatingWidgetSize,
277
240
  };
278
- const preferredPoint = preferredPosition ?? {
241
+ const preferredPoint = preferredPosition !== null && preferredPosition !== void 0 ? preferredPosition : {
279
242
  x: (state.size.width - size.width) / 2,
280
243
  y: (state.size.height - size.height) / 2,
281
244
  };
@@ -286,8 +249,6 @@ export function appendWidgets(state, widgetDefs, location, section) {
286
249
  bounds: containedBounds.toProps(),
287
250
  home,
288
251
  userSized,
289
- }, {
290
- isFloatingStateWindowResizable: widgetDef.isFloatingStateWindowResizable,
291
252
  });
292
253
  }
293
254
  }
@@ -311,46 +272,44 @@ export function appendWidgets(state, widgetDefs, location, section) {
311
272
  }
312
273
  }
313
274
  }
275
+ if (widgetDef.defaultState === WidgetState.Hidden) {
276
+ state = NineZoneStateReducer(state, {
277
+ type: "WIDGET_TAB_HIDE",
278
+ id: widgetDef.id,
279
+ });
280
+ }
314
281
  }
315
282
  return state;
316
283
  }
317
- function processPopoutWidgets(initialState, frontstageDef) {
318
- // istanbul ignore next
319
- if (!initialState.popoutWidgets)
320
- return initialState;
321
- // istanbul ignore next - not unit testing electron case that reopens popout windows
322
- if (initialState.popoutWidgets && ProcessDetector.isElectronAppFrontend) {
323
- if (initialState.popoutWidgets.allIds.length &&
324
- ProcessDetector.isElectronAppFrontend) {
325
- for (const widgetContainerId of initialState.popoutWidgets.allIds) {
326
- frontstageDef.openPopoutWidgetContainer(initialState, widgetContainerId);
327
- }
328
- }
329
- return initialState;
284
+ function processPopoutWidgets(state) {
285
+ // Electron reopens popout windows
286
+ if (ProcessDetector.isElectronAppFrontend) {
287
+ return state;
330
288
  }
331
- return convertAllPopupWidgetContainersToFloating(initialState);
289
+ for (const popoutWidgetId of state.popoutWidgets.allIds) {
290
+ const widget = state.widgets[popoutWidgetId];
291
+ const id = widget.tabs[0];
292
+ state = NineZoneStateReducer(state, {
293
+ type: "WIDGET_TAB_FLOAT",
294
+ id,
295
+ });
296
+ }
297
+ return state;
332
298
  }
333
299
  /** Adds frontstageDef widgets that are missing in NineZoneState.
334
300
  * @internal
335
301
  */
336
302
  export function addMissingWidgets(frontstageDef, initialState) {
303
+ var _a, _b, _c, _d, _e, _f, _g, _h;
337
304
  let state = initialState;
338
- state = appendWidgets(state, determineNewWidgets(frontstageDef.leftPanel?.getPanelSectionDef(StagePanelSection.Start)
339
- .widgetDefs, state), StagePanelLocation.Left, StagePanelSection.Start);
340
- state = appendWidgets(state, determineNewWidgets(frontstageDef.leftPanel?.getPanelSectionDef(StagePanelSection.End)
341
- .widgetDefs, state), StagePanelLocation.Left, StagePanelSection.End);
342
- state = appendWidgets(state, determineNewWidgets(frontstageDef.rightPanel?.getPanelSectionDef(StagePanelSection.Start)
343
- .widgetDefs, state), StagePanelLocation.Right, StagePanelSection.Start);
344
- state = appendWidgets(state, determineNewWidgets(frontstageDef.rightPanel?.getPanelSectionDef(StagePanelSection.End)
345
- .widgetDefs, state), StagePanelLocation.Right, StagePanelSection.End);
346
- state = appendWidgets(state, determineNewWidgets(frontstageDef.topPanel?.getPanelSectionDef(StagePanelSection.Start)
347
- .widgetDefs, state), StagePanelLocation.Top, StagePanelSection.Start);
348
- state = appendWidgets(state, determineNewWidgets(frontstageDef.topPanel?.getPanelSectionDef(StagePanelSection.End)
349
- .widgetDefs, state), StagePanelLocation.Top, StagePanelSection.End);
350
- state = appendWidgets(state, determineNewWidgets(frontstageDef.bottomPanel?.getPanelSectionDef(StagePanelSection.Start)
351
- .widgetDefs, state), StagePanelLocation.Bottom, StagePanelSection.Start);
352
- state = appendWidgets(state, determineNewWidgets(frontstageDef.bottomPanel?.getPanelSectionDef(StagePanelSection.End)
353
- .widgetDefs, state), StagePanelLocation.Bottom, StagePanelSection.End);
305
+ state = appendWidgets(state, determineNewWidgets((_a = frontstageDef.leftPanel) === null || _a === void 0 ? void 0 : _a.getPanelSectionDef(StagePanelSection.Start).widgetDefs, state), StagePanelLocation.Left, StagePanelSection.Start);
306
+ state = appendWidgets(state, determineNewWidgets((_b = frontstageDef.leftPanel) === null || _b === void 0 ? void 0 : _b.getPanelSectionDef(StagePanelSection.End).widgetDefs, state), StagePanelLocation.Left, StagePanelSection.End);
307
+ state = appendWidgets(state, determineNewWidgets((_c = frontstageDef.rightPanel) === null || _c === void 0 ? void 0 : _c.getPanelSectionDef(StagePanelSection.Start).widgetDefs, state), StagePanelLocation.Right, StagePanelSection.Start);
308
+ state = appendWidgets(state, determineNewWidgets((_d = frontstageDef.rightPanel) === null || _d === void 0 ? void 0 : _d.getPanelSectionDef(StagePanelSection.End).widgetDefs, state), StagePanelLocation.Right, StagePanelSection.End);
309
+ state = appendWidgets(state, determineNewWidgets((_e = frontstageDef.topPanel) === null || _e === void 0 ? void 0 : _e.getPanelSectionDef(StagePanelSection.Start).widgetDefs, state), StagePanelLocation.Top, StagePanelSection.Start);
310
+ state = appendWidgets(state, determineNewWidgets((_f = frontstageDef.topPanel) === null || _f === void 0 ? void 0 : _f.getPanelSectionDef(StagePanelSection.End).widgetDefs, state), StagePanelLocation.Top, StagePanelSection.End);
311
+ state = appendWidgets(state, determineNewWidgets((_g = frontstageDef.bottomPanel) === null || _g === void 0 ? void 0 : _g.getPanelSectionDef(StagePanelSection.Start).widgetDefs, state), StagePanelLocation.Bottom, StagePanelSection.Start);
312
+ state = appendWidgets(state, determineNewWidgets((_h = frontstageDef.bottomPanel) === null || _h === void 0 ? void 0 : _h.getPanelSectionDef(StagePanelSection.End).widgetDefs, state), StagePanelLocation.Bottom, StagePanelSection.End);
354
313
  if (frontstageDef.toolSettings) {
355
314
  const newToolSettingsWidgets = determineNewWidgets([frontstageDef.toolSettings], state);
356
315
  for (const newToolSettingsWidget of newToolSettingsWidgets) {
@@ -367,7 +326,10 @@ function hideWidgets(state, frontstageDef) {
367
326
  if (!widgetDef)
368
327
  continue;
369
328
  if (widgetDef.defaultState === WidgetState.Hidden) {
370
- state = hideWidget(state, widgetDef);
329
+ state = NineZoneStateReducer(state, {
330
+ type: "WIDGET_TAB_HIDE",
331
+ id: widgetDef.id,
332
+ });
371
333
  }
372
334
  }
373
335
  return state;
@@ -375,14 +337,19 @@ function hideWidgets(state, frontstageDef) {
375
337
  /** Removes NineZoneState widgets that are missing in frontstageDef.
376
338
  * @internal
377
339
  */
378
- export function removeMissingWidgets(frontstageDef, state) {
379
- const toolSettingsTabId = state.toolSettings?.tabId;
340
+ function removeMissingWidgets(frontstageDef, state) {
341
+ var _a;
342
+ const toolSettingsTabId = (_a = state.toolSettings) === null || _a === void 0 ? void 0 : _a.tabId;
380
343
  for (const [, tab] of Object.entries(state.tabs)) {
381
344
  if (tab.id === toolSettingsTabId)
382
345
  continue;
383
346
  const widgetDef = frontstageDef.findWidgetDef(tab.id);
384
347
  if (widgetDef)
385
348
  continue;
349
+ state = NineZoneStateReducer(state, {
350
+ type: "WIDGET_TAB_HIDE",
351
+ id: tab.id,
352
+ });
386
353
  state = removeTab(state, tab.id);
387
354
  }
388
355
  return state;
@@ -390,18 +357,6 @@ export function removeMissingWidgets(frontstageDef, state) {
390
357
  function getWidgetLabel(label) {
391
358
  return label === "" ? "Widget" : label;
392
359
  }
393
- function toStagePanelLocation(side) {
394
- switch (side) {
395
- case "bottom":
396
- return StagePanelLocation.Bottom;
397
- case "left":
398
- return StagePanelLocation.Left;
399
- case "right":
400
- return StagePanelLocation.Right;
401
- case "top":
402
- return StagePanelLocation.Top;
403
- }
404
- }
405
360
  /** @internal */
406
361
  export function getWidgetId(location, section) {
407
362
  switch (location) {
@@ -430,8 +385,8 @@ export function getWidgetId(location, section) {
430
385
  /** @internal */
431
386
  export function getPanelSectionWidgets(frontstageDef, location, section) {
432
387
  const stagePanel = frontstageDef.getStagePanelDef(location);
433
- const panelSection = stagePanel?.getPanelSectionDef(section);
434
- return panelSection?.widgetDefs || [];
388
+ const panelSection = stagePanel === null || stagePanel === void 0 ? void 0 : stagePanel.getPanelSectionDef(section);
389
+ return (panelSection === null || panelSection === void 0 ? void 0 : panelSection.widgetDefs) || [];
435
390
  }
436
391
  /** @internal */
437
392
  export function addPanelWidgets(state, frontstageDef, location) {
@@ -452,36 +407,28 @@ export function isFrontstageStateSettingResult(settingsResult) {
452
407
  }
453
408
  /** @internal */
454
409
  export function initializePanel(state, frontstageDef, location) {
455
- const panelSide = toPanelSide(location);
410
+ const side = toPanelSide(location);
456
411
  state = addPanelWidgets(state, frontstageDef, location);
457
412
  const panelDef = frontstageDef.getStagePanelDef(location);
458
413
  state = produce(state, (draft) => {
459
- const panel = draft.panels[panelSide];
460
- panel.minSize = panelDef?.minSize ?? panel.minSize;
461
- panel.pinned = panelDef?.pinned ?? panel.pinned;
462
- panel.resizable = panelDef?.resizable ?? panel.resizable;
463
- if (panelDef?.maxSizeSpec) {
464
- panel.maxSize = getPanelMaxSize(panelDef.maxSizeSpec, panelSide, state.size);
465
- }
466
- const size = panelDef?.size;
467
- panel.size =
468
- size === undefined
469
- ? size
470
- : Math.min(Math.max(size, panel.minSize), panel.maxSize);
414
+ var _a, _b, _c, _d, _e, _f;
415
+ const panel = draft.panels[side];
416
+ panel.minSize = (_b = (_a = panelDef === null || panelDef === void 0 ? void 0 : panelDef.initialConfig) === null || _a === void 0 ? void 0 : _a.minSize) !== null && _b !== void 0 ? _b : panel.minSize;
417
+ panel.pinned = (_c = panelDef === null || panelDef === void 0 ? void 0 : panelDef.pinned) !== null && _c !== void 0 ? _c : panel.pinned;
418
+ panel.resizable = (_d = panelDef === null || panelDef === void 0 ? void 0 : panelDef.resizable) !== null && _d !== void 0 ? _d : panel.resizable;
419
+ panel.maxSize = (_f = (_e = panelDef === null || panelDef === void 0 ? void 0 : panelDef.initialConfig) === null || _e === void 0 ? void 0 : _e.maxSize) !== null && _f !== void 0 ? _f : panel.maxSize;
471
420
  });
472
- return state;
473
- }
474
- function getPanelMaxSize(maxSizeSpec, panel, nineZoneSize) {
475
- if (typeof maxSizeSpec === "number") {
476
- return maxSizeSpec;
421
+ if ((panelDef === null || panelDef === void 0 ? void 0 : panelDef.size) !== undefined) {
422
+ state = NineZoneStateReducer(state, {
423
+ type: "PANEL_SET_SIZE",
424
+ side,
425
+ size: panelDef.size,
426
+ });
477
427
  }
478
- const size = isHorizontalPanelSide(panel)
479
- ? nineZoneSize.height
480
- : nineZoneSize.width;
481
- return (maxSizeSpec.percentage / 100) * size;
428
+ return state;
482
429
  }
483
430
  /** @internal */
484
- export const stateVersion = 14; // this needs to be bumped when NineZoneState is changed (to recreate the layout).
431
+ export const stateVersion = 16; // this needs to be bumped when NineZoneState is changed (to recreate the layout).
485
432
  /** @internal */
486
433
  export function initializeNineZoneState(frontstageDef) {
487
434
  let nineZone = defaultNineZone;
@@ -499,6 +446,7 @@ export function initializeNineZoneState(frontstageDef) {
499
446
  nineZone = initializePanel(nineZone, frontstageDef, StagePanelLocation.Top);
500
447
  nineZone = initializePanel(nineZone, frontstageDef, StagePanelLocation.Bottom);
501
448
  nineZone = produce(nineZone, (draft) => {
449
+ var _a, _b, _c, _d;
502
450
  for (const [, panel] of Object.entries(draft.panels)) {
503
451
  const expanded = panel.widgets.find((widgetId) => draft.widgets[widgetId].minimized === false);
504
452
  const firstWidget = panel.widgets.length > 0 ? draft.widgets[panel.widgets[0]] : undefined;
@@ -507,10 +455,10 @@ export function initializeNineZoneState(frontstageDef) {
507
455
  firstWidget.minimized = false;
508
456
  }
509
457
  }
510
- draft.panels.left.collapsed = isPanelCollapsed(frontstageDef.leftPanel?.panelState);
511
- draft.panels.right.collapsed = isPanelCollapsed(frontstageDef.rightPanel?.panelState);
512
- draft.panels.top.collapsed = isPanelCollapsed(frontstageDef.topPanel?.panelState);
513
- draft.panels.bottom.collapsed = isPanelCollapsed(frontstageDef.bottomPanel?.panelState);
458
+ draft.panels.left.collapsed = isPanelCollapsed((_a = frontstageDef.leftPanel) === null || _a === void 0 ? void 0 : _a.panelState);
459
+ draft.panels.right.collapsed = isPanelCollapsed((_b = frontstageDef.rightPanel) === null || _b === void 0 ? void 0 : _b.panelState);
460
+ draft.panels.top.collapsed = isPanelCollapsed((_c = frontstageDef.topPanel) === null || _c === void 0 ? void 0 : _c.panelState);
461
+ draft.panels.bottom.collapsed = isPanelCollapsed((_d = frontstageDef.bottomPanel) === null || _d === void 0 ? void 0 : _d.panelState);
514
462
  });
515
463
  nineZone = addMissingWidgets(frontstageDef, nineZone);
516
464
  const toolSettingsWidgetDef = frontstageDef.toolSettings;
@@ -519,7 +467,7 @@ export function initializeNineZoneState(frontstageDef) {
519
467
  nineZone = addDockedToolSettings(nineZone, toolSettingsTabId);
520
468
  }
521
469
  nineZone = hideWidgets(nineZone, frontstageDef);
522
- nineZone = processPopoutWidgets(nineZone, frontstageDef);
470
+ nineZone = processPopoutWidgets(nineZone);
523
471
  return nineZone;
524
472
  }
525
473
  /** Converts from saved NineZoneState to NineZoneState.
@@ -528,23 +476,23 @@ export function initializeNineZoneState(frontstageDef) {
528
476
  * @internal
529
477
  */
530
478
  export function restoreNineZoneState(frontstageDef, saved) {
531
- let restored = {
479
+ let state = {
532
480
  ...saved,
533
481
  tabs: {},
534
482
  };
535
483
  for (const [, tab] of Object.entries(saved.tabs)) {
536
484
  // Re-add the placeholder tab in order to correctly remove it from the state if WidgetDef is not found.
537
- restored = addTab(restored, tab.id);
485
+ state = addTab(state, tab.id);
538
486
  const widgetDef = frontstageDef.findWidgetDef(tab.id);
539
487
  if (!widgetDef) {
540
488
  Logger.logInfo(UiFramework.loggerCategory(restoreNineZoneState), "WidgetDef is not found for saved tab.", () => ({
541
489
  frontstageId: frontstageDef.id,
542
490
  tabId: tab.id,
543
491
  }));
544
- restored = removeTab(restored, tab.id);
492
+ state = removeTab(state, tab.id);
545
493
  continue;
546
494
  }
547
- restored = produce(restored, (draft) => {
495
+ state = produce(state, (draft) => {
548
496
  draft.tabs[tab.id] = {
549
497
  ...tab,
550
498
  ...toTabArgs(widgetDef),
@@ -553,7 +501,7 @@ export function restoreNineZoneState(frontstageDef, saved) {
553
501
  };
554
502
  });
555
503
  }
556
- restored = produce(restored, (draft) => {
504
+ state = produce(state, (draft) => {
557
505
  // remove center panel section if one is found in left or right panels
558
506
  const oldLeftMiddleIndex = saved.panels.left.widgets.findIndex((value) => value === "leftMiddle");
559
507
  // istanbul ignore next
@@ -584,15 +532,18 @@ export function restoreNineZoneState(frontstageDef, saved) {
584
532
  if (InternalFrontstageManager.nineZoneSize &&
585
533
  (0 !== InternalFrontstageManager.nineZoneSize.height ||
586
534
  0 !== InternalFrontstageManager.nineZoneSize.width)) {
587
- restored = FrameworkStateReducer(restored, {
535
+ state = NineZoneStateReducer(state, {
588
536
  type: "RESIZE",
589
537
  size: {
590
538
  height: InternalFrontstageManager.nineZoneSize.height,
591
539
  width: InternalFrontstageManager.nineZoneSize.width,
592
540
  },
593
- }, frontstageDef);
541
+ });
594
542
  }
595
- return restored;
543
+ state = addMissingWidgets(frontstageDef, state);
544
+ state = hideWidgets(state, frontstageDef);
545
+ state = processPopoutWidgets(state);
546
+ return state;
596
547
  }
597
548
  /** Prepares NineZoneState to be saved.
598
549
  * @note Removes toolSettings tab.
@@ -615,220 +566,10 @@ export function packNineZoneState(state) {
615
566
  });
616
567
  return packed;
617
568
  }
618
- // istanbul ignore next
619
- function packSavedWidgets(frontstageDef) {
620
- let savedWidgets = [];
621
- for (const widgetDef of frontstageDef.widgetDefs) {
622
- const id = widgetDef.id;
623
- const initialWidget = {
624
- id,
625
- };
626
- const widget = produce(initialWidget, (draft) => {
627
- if (widgetDef.tabLocation) {
628
- draft.tabLocation = { ...widgetDef.tabLocation };
629
- }
630
- if (widgetDef.popoutBounds) {
631
- draft.popoutBounds = widgetDef.popoutBounds.toProps();
632
- }
633
- });
634
- if (widget === initialWidget)
635
- continue;
636
- savedWidgets.push(widget);
637
- }
638
- // Add previously saved widgets.
639
- const prevSavedWidgets = frontstageDef.savedWidgetDefs || [];
640
- for (const prevWidget of prevSavedWidgets) {
641
- if (savedWidgets.find((w) => w.id === prevWidget.id))
642
- continue;
643
- savedWidgets.push(prevWidget);
644
- }
645
- // Limit number of saved widgets.
646
- const maxWidgets = 100;
647
- if (savedWidgets.length > maxWidgets)
648
- savedWidgets = savedWidgets.slice(0, maxWidgets);
649
- return savedWidgets;
650
- }
651
- // istanbul ignore next
652
- function restoreSavedWidgets(frontstage) {
653
- const savedWidgets = frontstage.savedWidgetDefs || [];
654
- for (const savedWidget of savedWidgets) {
655
- const widgetId = savedWidget.id;
656
- const widgetDef = frontstage.findWidgetDef(widgetId);
657
- if (!widgetDef)
658
- continue;
659
- if (savedWidget.tabLocation) {
660
- widgetDef.tabLocation = { ...savedWidget.tabLocation };
661
- }
662
- if (savedWidget.popoutBounds) {
663
- widgetDef.popoutBounds = Rectangle.create(savedWidget.popoutBounds);
664
- }
665
- }
666
- }
667
569
  /** @internal */
668
570
  export function isPanelCollapsed(panelState) {
669
571
  return panelState !== StagePanelState.Open;
670
572
  }
671
- function addHiddenWidget(state, widgetDef) {
672
- const tabLocation = widgetDef.tabLocation || widgetDef.defaultTabLocation;
673
- const tabId = widgetDef.id;
674
- const { widgetId, tabIndex } = tabLocation;
675
- if (widgetId in state.widgets) {
676
- // Add to an existing widget (by widget id).
677
- return insertTabToWidget(state, tabId, widgetId, tabIndex);
678
- }
679
- else if (tabLocation.floatingWidget) {
680
- const floatingWidget = tabLocation.floatingWidget;
681
- assert(widgetId === floatingWidget.id);
682
- // Add to a new floating widget.
683
- const nzBounds = Rectangle.createFromSize(state.size);
684
- const bounds = Rectangle.create(floatingWidget.bounds).containIn(nzBounds);
685
- return addFloatingWidget(state, floatingWidget.id, [tabId], {
686
- ...floatingWidget,
687
- bounds: bounds.toProps(),
688
- });
689
- }
690
- // Add to a panel section.
691
- const panel = state.panels[tabLocation.side];
692
- // Add to existing panel section.
693
- if (panel.widgets.length >= panel.maxWidgetCount) {
694
- const sectionIndex = Math.min(panel.maxWidgetCount - 1, tabLocation.widgetIndex);
695
- const sectionId = panel.widgets[sectionIndex];
696
- return insertTabToWidget(state, tabId, sectionId, tabLocation.tabIndex);
697
- }
698
- // Create a new panel section.
699
- const newSectionId = getUniqueId();
700
- return insertPanelWidget(state, panel.side, newSectionId, [tabId], tabLocation.widgetIndex);
701
- }
702
- /** @internal */
703
- export function setWidgetState(state, widgetDef, widgetState) {
704
- if (widgetState === WidgetState.Hidden) {
705
- return hideWidget(state, widgetDef);
706
- }
707
- else if (widgetState === WidgetState.Open) {
708
- const id = widgetDef.id;
709
- if (widgetDef.isToolSettings) {
710
- if (!state.toolSettings && !widgetDef.tabLocation) {
711
- state = addDockedToolSettings(state, id);
712
- }
713
- if (state.toolSettings?.type === "docked")
714
- return state;
715
- }
716
- let location = getTabLocation(state, id);
717
- if (!location) {
718
- state = addHiddenWidget(state, widgetDef);
719
- location = getTabLocation(state, id);
720
- if (widgetDef.isToolSettings) {
721
- state = addWidgetToolSettings(state, id);
722
- }
723
- }
724
- return produce(state, (draft) => {
725
- assert(!!location);
726
- const widget = draft.widgets[location.widgetId];
727
- widget.minimized = false;
728
- widget.activeTabId = id;
729
- if (isFloatingTabLocation(location)) {
730
- const floatingWidget = draft.floatingWidgets.byId[location.floatingWidgetId];
731
- floatingWidget.hidden = false;
732
- // istanbul ignore else
733
- }
734
- else if (isPanelTabLocation(location)) {
735
- const panel = draft.panels[location.side];
736
- panel.collapsed = false;
737
- if (undefined === panel.size || 0 === panel.size) {
738
- // istanbul ignore next
739
- panel.size = panel.minSize ?? 200;
740
- }
741
- }
742
- });
743
- }
744
- else if (widgetState === WidgetState.Closed) {
745
- const id = widgetDef.id;
746
- if (widgetDef.isToolSettings && state.toolSettings?.type !== "widget") {
747
- return state;
748
- }
749
- let location = getTabLocation(state, id);
750
- if (!location) {
751
- state = addHiddenWidget(state, widgetDef);
752
- location = getTabLocation(state, id);
753
- }
754
- // TODO: should change activeTabId of a widget with multiple tabs.
755
- return produce(state, (draft) => {
756
- assert(!!location);
757
- const widget = draft.widgets[location.widgetId];
758
- if (isFloatingTabLocation(location)) {
759
- if (id === widget.activeTabId) {
760
- widget.minimized = true;
761
- }
762
- }
763
- });
764
- }
765
- else if (widgetState === WidgetState.Floating) {
766
- const id = widgetDef.id;
767
- let location = getTabLocation(state, id);
768
- if (!location) {
769
- state = addHiddenWidget(state, widgetDef);
770
- location = getTabLocation(state, id);
771
- }
772
- assert(!!location);
773
- if (isFloatingTabLocation(location))
774
- return state;
775
- // Widget is not floating.
776
- state = removeTabFromWidget(state, id);
777
- const bounds = widgetDef.tabLocation?.floatingWidget?.bounds;
778
- state = addFloatingWidget(state, getUniqueId(), [id], { bounds });
779
- if (widgetDef.isToolSettings) {
780
- if (state.toolSettings?.type === "docked") {
781
- state = removeToolSettings(state);
782
- }
783
- if (!state.toolSettings) {
784
- state = addWidgetToolSettings(state, id);
785
- }
786
- }
787
- }
788
- return state;
789
- }
790
- /** Stores widget location and hides it in the UI. */
791
- function hideWidget(state, widgetDef) {
792
- const toolSettingsTabId = state.toolSettings?.tabId;
793
- if (widgetDef.id === toolSettingsTabId) {
794
- widgetDef.tabLocation = undefined;
795
- state = produce(state, (draft) => {
796
- draft.toolSettings = undefined;
797
- });
798
- if (state.toolSettings?.type === "docked")
799
- return state;
800
- }
801
- const location = getTabLocation(state, widgetDef.id);
802
- if (!location)
803
- return state;
804
- // istanbul ignore else
805
- if (isFloatingTabLocation(location)) {
806
- const floatingWidget = state.floatingWidgets.byId[location.widgetId];
807
- widgetDef.setFloatingContainerId(location.floatingWidgetId);
808
- widgetDef.tabLocation = {
809
- side: floatingWidget.home.side,
810
- tabIndex: floatingWidget.home.widgetIndex,
811
- widgetId: floatingWidget.id,
812
- widgetIndex: floatingWidget.home.widgetIndex,
813
- floatingWidget,
814
- };
815
- }
816
- else if (!isPopoutTabLocation(location)) {
817
- const widgetId = location.widgetId;
818
- const side = isPanelTabLocation(location) ? location.side : "left";
819
- const widgetIndex = isPanelTabLocation(location)
820
- ? state.panels[side].widgets.indexOf(widgetId)
821
- : 0;
822
- const tabIndex = state.widgets[location.widgetId].tabs.indexOf(widgetDef.id);
823
- widgetDef.tabLocation = {
824
- side,
825
- tabIndex,
826
- widgetId,
827
- widgetIndex,
828
- };
829
- }
830
- return removeTabFromWidget(state, widgetDef.id);
831
- }
832
573
  /** @internal */
833
574
  export function showWidget(state, id) {
834
575
  const location = getTabLocation(state, id);
@@ -866,15 +607,6 @@ export function expandWidget(state, id) {
866
607
  });
867
608
  }
868
609
  /** @internal */
869
- export function setWidgetLabel(state, id, label) {
870
- if (!(id in state.tabs))
871
- return state;
872
- return produce(state, (draft) => {
873
- const tab = draft.tabs[id];
874
- tab.label = label;
875
- });
876
- }
877
- /** @internal */
878
610
  export function useSavedFrontstageState(frontstageDef) {
879
611
  const uiStateStorage = useUiStateStorageHandler();
880
612
  const uiStateStorageRef = React.useRef(uiStateStorage);
@@ -891,7 +623,7 @@ export function useSavedFrontstageState(frontstageDef) {
891
623
  React.useEffect(() => {
892
624
  async function fetchFrontstageState() {
893
625
  if (frontstageDef.nineZoneState) {
894
- frontstageDef.nineZoneState = processPopoutWidgets(frontstageDef.nineZoneState, frontstageDef);
626
+ frontstageDef.nineZoneState = processPopoutWidgets(frontstageDef.nineZoneState);
895
627
  return;
896
628
  }
897
629
  const id = frontstageDef.id;
@@ -903,13 +635,7 @@ export function useSavedFrontstageState(frontstageDef) {
903
635
  const setting = settingResult.setting;
904
636
  if (setting.version === version &&
905
637
  setting.stateVersion === stateVersion) {
906
- const restored = restoreNineZoneState(frontstageDef, setting.nineZone);
907
- frontstageDef.savedWidgetDefs = setting.widgets;
908
- restoreSavedWidgets(frontstageDef);
909
- let state = addMissingWidgets(frontstageDef, restored);
910
- state = hideWidgets(state, frontstageDef);
911
- state = processPopoutWidgets(state, frontstageDef);
912
- frontstageDef.nineZoneState = state;
638
+ frontstageDef.nineZoneState = restoreNineZoneState(frontstageDef, setting.nineZone);
913
639
  return;
914
640
  }
915
641
  }
@@ -924,14 +650,11 @@ export function useSaveFrontstageSettings(frontstageDef, store) {
924
650
  const saveSetting = React.useMemo(() => {
925
651
  const debounced = debounce(async (frontstage, state) => {
926
652
  const id = frontstage.id;
927
- const widgets = packSavedWidgets(frontstage);
928
- frontstage.savedWidgetDefs = widgets;
929
653
  const setting = {
930
654
  id,
931
655
  version: frontstage.version,
932
656
  stateVersion,
933
657
  nineZone: packNineZoneState(state),
934
- widgets,
935
658
  };
936
659
  await uiSettingsStorage.saveSetting(FRONTSTAGE_SETTINGS_NAMESPACE, getFrontstageStateSettingName(id), setting);
937
660
  }, 1000);
@@ -979,49 +702,11 @@ function debounce(func, duration) {
979
702
  };
980
703
  return debounced;
981
704
  }
982
- const createListener = (frontstageDef, listener) => {
983
- return (...args) => {
984
- if (!frontstageDef.nineZoneState)
985
- return;
986
- listener(...args);
987
- };
988
- };
989
705
  /** @internal */
990
706
  export function useFrontstageManager(frontstageDef, useToolAsToolSettingsLabel) {
991
- React.useEffect(() => {
992
- return UiFramework.frontstages.onWidgetStateChangedEvent.addListener(({ widgetDef, widgetState }) => {
993
- if (!frontstageDef.nineZoneState)
994
- return;
995
- frontstageDef.nineZoneState = setWidgetState(frontstageDef.nineZoneState, widgetDef, widgetState);
996
- });
997
- }, [frontstageDef]);
998
- React.useEffect(() => {
999
- const listener = createListener(frontstageDef, ({ widgetDef }) => {
1000
- assert(!!frontstageDef.nineZoneState);
1001
- const nineZoneState = setWidgetState(frontstageDef.nineZoneState, widgetDef, WidgetState.Open);
1002
- frontstageDef.nineZoneState = showWidget(nineZoneState, widgetDef.id);
1003
- });
1004
- InternalFrontstageManager.onWidgetShowEvent.addListener(listener);
1005
- return () => {
1006
- InternalFrontstageManager.onWidgetShowEvent.removeListener(listener);
1007
- };
1008
- }, [frontstageDef]);
1009
- React.useEffect(() => {
1010
- const listener = createListener(frontstageDef, ({ widgetDef }) => {
1011
- assert(!!frontstageDef.nineZoneState);
1012
- let nineZoneState = setWidgetState(frontstageDef.nineZoneState, widgetDef, WidgetState.Open);
1013
- nineZoneState = showWidget(nineZoneState, widgetDef.id);
1014
- nineZoneState = expandWidget(nineZoneState, widgetDef.id);
1015
- frontstageDef.nineZoneState = nineZoneState;
1016
- });
1017
- InternalFrontstageManager.onWidgetExpandEvent.addListener(listener);
1018
- return () => {
1019
- InternalFrontstageManager.onWidgetExpandEvent.removeListener(listener);
1020
- };
1021
- }, [frontstageDef]);
1022
707
  const uiSettingsStorage = useUiStateStorageHandler();
1023
708
  React.useEffect(() => {
1024
- const listener = (args) => {
709
+ return InternalFrontstageManager.onFrontstageRestoreLayoutEvent.addListener((args) => {
1025
710
  // TODO: track restoring frontstages to support workflows: i.e. prevent loading frontstage OR saving layout when delete is pending
1026
711
  void uiSettingsStorage.deleteSetting(FRONTSTAGE_SETTINGS_NAMESPACE, getFrontstageStateSettingName(args.frontstageDef.id));
1027
712
  if (frontstageDef.id === args.frontstageDef.id) {
@@ -1031,52 +716,37 @@ export function useFrontstageManager(frontstageDef, useToolAsToolSettingsLabel)
1031
716
  else {
1032
717
  args.frontstageDef.nineZoneState = undefined;
1033
718
  }
1034
- };
1035
- InternalFrontstageManager.onFrontstageRestoreLayoutEvent.addListener(listener);
1036
- return () => {
1037
- InternalFrontstageManager.onFrontstageRestoreLayoutEvent.removeListener(listener);
1038
- };
1039
- }, [uiSettingsStorage, frontstageDef]);
1040
- React.useEffect(() => {
1041
- const listener = createListener(frontstageDef, ({ widgetDef }) => {
1042
- assert(!!frontstageDef.nineZoneState);
1043
- const label = widgetDef.label;
1044
- frontstageDef.nineZoneState = setWidgetLabel(frontstageDef.nineZoneState, widgetDef.id, label);
1045
719
  });
1046
- InternalFrontstageManager.onWidgetLabelChangedEvent.addListener(listener);
1047
- return () => {
1048
- InternalFrontstageManager.onWidgetLabelChangedEvent.removeListener(listener);
1049
- };
1050
- }, [frontstageDef]);
720
+ }, [uiSettingsStorage, frontstageDef]);
1051
721
  const defaultLabel = React.useMemo(() => UiFramework.translate("widget.labels.toolSettings"), []);
1052
722
  React.useEffect(() => {
1053
- const updateLabel = createListener(frontstageDef, () => {
723
+ const updateLabel = () => {
724
+ var _a, _b;
725
+ const state = frontstageDef.nineZoneState;
726
+ if (!state)
727
+ return;
728
+ const toolSettingsTabId = (_a = state.toolSettings) === null || _a === void 0 ? void 0 : _a.tabId;
729
+ if (!toolSettingsTabId)
730
+ return;
1054
731
  const toolId = UiFramework.frontstages.activeToolId;
1055
- assert(!!frontstageDef.nineZoneState);
1056
732
  const label = useToolAsToolSettingsLabel
1057
- ? IModelApp.tools.find(toolId)?.flyover || defaultLabel
733
+ ? ((_b = IModelApp.tools.find(toolId)) === null || _b === void 0 ? void 0 : _b.flyover) || defaultLabel
1058
734
  : defaultLabel;
1059
- const toolSettingsTabId = frontstageDef.nineZoneState.toolSettings?.tabId;
1060
- if (!toolSettingsTabId)
1061
- return;
1062
- frontstageDef.nineZoneState = setWidgetLabel(frontstageDef.nineZoneState, toolSettingsTabId, label);
1063
- });
735
+ frontstageDef.dispatch({
736
+ type: "WIDGET_TAB_SET_LABEL",
737
+ id: toolSettingsTabId,
738
+ label,
739
+ });
740
+ };
1064
741
  // Whenever the frontstageDef or the useTool... changes, keep the label up to date.
1065
742
  updateLabel();
743
+ const removeListenerFuncs = [];
1066
744
  // If useTool... is true, listen for events to keep up the label up to date.
1067
745
  if (useToolAsToolSettingsLabel) {
1068
- UiFramework.frontstages.onFrontstageReadyEvent.addListener(updateLabel);
1069
- InternalFrontstageManager.onFrontstageRestoreLayoutEvent.addListener(updateLabel);
1070
- UiFramework.frontstages.onToolActivatedEvent.addListener(updateLabel);
1071
- UiFramework.frontstages.onToolSettingsReloadEvent.addListener(updateLabel);
746
+ removeListenerFuncs.push(UiFramework.frontstages.onFrontstageReadyEvent.addListener(updateLabel), InternalFrontstageManager.onFrontstageRestoreLayoutEvent.addListener(updateLabel), UiFramework.frontstages.onToolActivatedEvent.addListener(updateLabel), UiFramework.frontstages.onToolSettingsReloadEvent.addListener(updateLabel));
1072
747
  }
1073
748
  return () => {
1074
- if (useToolAsToolSettingsLabel) {
1075
- UiFramework.frontstages.onFrontstageReadyEvent.removeListener(updateLabel);
1076
- InternalFrontstageManager.onFrontstageRestoreLayoutEvent.removeListener(updateLabel);
1077
- UiFramework.frontstages.onToolActivatedEvent.removeListener(updateLabel);
1078
- UiFramework.frontstages.onToolSettingsReloadEvent.removeListener(updateLabel);
1079
- }
749
+ removeListenerFuncs.forEach((removeListener) => removeListener());
1080
750
  };
1081
751
  }, [frontstageDef, useToolAsToolSettingsLabel, defaultLabel]);
1082
752
  }
@@ -1086,23 +756,22 @@ export function useItemsManager(frontstageDef) {
1086
756
  const refreshNineZoneState = (def) => {
1087
757
  // Fired for both registered/unregistered. Update definitions and remove/add missing widgets.
1088
758
  def.updateWidgetDefs();
1089
- restoreSavedWidgets(def);
1090
759
  let state = def.nineZoneState;
1091
760
  if (!state)
1092
761
  return;
1093
762
  state = addMissingWidgets(def, state);
1094
763
  state = removeMissingWidgets(def, state);
1095
- state = hideWidgets(state, def); // TODO: should only apply to widgets provided by registered provider in onUiProviderRegisteredEvent.
1096
764
  def.nineZoneState = state;
1097
765
  };
1098
766
  React.useEffect(() => {
1099
- const remove = UiItemsManager.onUiProviderRegisteredEvent.addListener(() => {
1100
- refreshNineZoneState(frontstageDef);
1101
- });
1102
767
  // Need to refresh anytime frontstageDef changes because uiItemsProvider may have added something to
1103
768
  // another stage before it was possibly unloaded in this stage.
1104
769
  refreshNineZoneState(frontstageDef);
1105
- return remove;
770
+ }, [frontstageDef]);
771
+ React.useEffect(() => {
772
+ return UiItemsManager.onUiProviderRegisteredEvent.addListener(() => {
773
+ refreshNineZoneState(frontstageDef);
774
+ });
1106
775
  }, [frontstageDef]);
1107
776
  }
1108
777
  // istanbul ignore next