@itwin/appui-react 4.14.0 → 4.14.2

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 (62) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/appui-react/childwindow/ChildWindowConfig.d.ts +4 -0
  3. package/lib/cjs/appui-react/childwindow/ChildWindowConfig.d.ts.map +1 -1
  4. package/lib/cjs/appui-react/childwindow/ChildWindowConfig.js.map +1 -1
  5. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
  6. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +8 -2
  7. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  8. package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
  9. package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js +8 -8
  10. package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
  11. package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.scss +0 -25
  12. package/lib/cjs/appui-react/dialog/DialogManagerBase.d.ts +3 -2
  13. package/lib/cjs/appui-react/dialog/DialogManagerBase.d.ts.map +1 -1
  14. package/lib/cjs/appui-react/dialog/DialogManagerBase.js +16 -9
  15. package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
  16. package/lib/cjs/appui-react/dialog/DialogManagerBase.scss +11 -0
  17. package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts +4 -17
  18. package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
  19. package/lib/cjs/appui-react/feedback/ElementTooltip.js +50 -86
  20. package/lib/cjs/appui-react/feedback/ElementTooltip.js.map +1 -1
  21. package/lib/cjs/appui-react/feedback/ElementTooltip.scss +29 -0
  22. package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.d.ts +2 -2
  23. package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.d.ts.map +1 -1
  24. package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.js +6 -2
  25. package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.js.map +1 -1
  26. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  27. package/lib/cjs/appui-react/widget-panels/Frontstage.js +14 -3
  28. package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
  29. package/lib/cjs/appui-react.d.ts +2 -2
  30. package/lib/cjs/appui-react.js +2 -2
  31. package/lib/cjs/appui-react.js.map +1 -1
  32. package/lib/esm/appui-react/childwindow/ChildWindowConfig.d.ts +4 -0
  33. package/lib/esm/appui-react/childwindow/ChildWindowConfig.d.ts.map +1 -1
  34. package/lib/esm/appui-react/childwindow/ChildWindowConfig.js.map +1 -1
  35. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
  36. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +8 -2
  37. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  38. package/lib/esm/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
  39. package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js +8 -8
  40. package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
  41. package/lib/esm/appui-react/configurableui/ConfigurableUiContent.scss +0 -25
  42. package/lib/esm/appui-react/dialog/DialogManagerBase.d.ts +3 -2
  43. package/lib/esm/appui-react/dialog/DialogManagerBase.d.ts.map +1 -1
  44. package/lib/esm/appui-react/dialog/DialogManagerBase.js +16 -9
  45. package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
  46. package/lib/esm/appui-react/dialog/DialogManagerBase.scss +11 -0
  47. package/lib/esm/appui-react/feedback/ElementTooltip.d.ts +4 -17
  48. package/lib/esm/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
  49. package/lib/esm/appui-react/feedback/ElementTooltip.js +49 -85
  50. package/lib/esm/appui-react/feedback/ElementTooltip.js.map +1 -1
  51. package/lib/esm/appui-react/feedback/ElementTooltip.scss +29 -0
  52. package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.d.ts +2 -2
  53. package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.d.ts.map +1 -1
  54. package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.js +6 -2
  55. package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.js.map +1 -1
  56. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  57. package/lib/esm/appui-react/widget-panels/Frontstage.js +14 -3
  58. package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
  59. package/lib/esm/appui-react.d.ts +2 -2
  60. package/lib/esm/appui-react.js +2 -2
  61. package/lib/esm/appui-react.js.map +1 -1
  62. package/package.json +7 -7
@@ -8,17 +8,18 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ElementTooltip = exports.ElementTooltipChangedEvent = void 0;
11
- const appui_abstract_1 = require("@itwin/appui-abstract");
12
- const core_react_1 = require("@itwin/core-react");
11
+ require("./ElementTooltip.scss");
13
12
  const classnames_1 = require("classnames");
14
13
  const React = require("react");
15
- const Tooltip_1 = require("../layout/popup/Tooltip");
14
+ const ReactDOM = require("react-dom");
15
+ const appui_abstract_1 = require("@itwin/appui-abstract");
16
16
  const core_bentley_1 = require("@itwin/core-bentley");
17
+ const core_react_1 = require("@itwin/core-react");
18
+ const Tooltip_1 = require("../layout/popup/Tooltip");
17
19
  /** ElementTooltip Changed Event class.
18
20
  * @public
19
21
  * @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
20
22
  */
21
- // eslint-disable-next-line deprecation/deprecation
22
23
  class ElementTooltipChangedEvent extends appui_abstract_1.UiEvent {
23
24
  }
24
25
  exports.ElementTooltipChangedEvent = ElementTooltipChangedEvent;
@@ -26,7 +27,6 @@ exports.ElementTooltipChangedEvent = ElementTooltipChangedEvent;
26
27
  * @public
27
28
  */
28
29
  class ElementTooltip extends React.Component {
29
- // eslint-disable-next-line deprecation/deprecation
30
30
  static get onElementTooltipChangedEvent() {
31
31
  return ElementTooltip._elementTooltipChangedEvent;
32
32
  }
@@ -44,7 +44,6 @@ class ElementTooltip extends React.Component {
44
44
  pt,
45
45
  options,
46
46
  });
47
- el.ownerDocument.addEventListener("mousemove", ElementTooltip._handleMouseMove);
48
47
  }
49
48
  static hideTooltip() {
50
49
  ElementTooltip._isTooltipVisible = false;
@@ -61,89 +60,54 @@ class ElementTooltip extends React.Component {
61
60
  if (halt && ElementTooltip._isTooltipVisible)
62
61
  ElementTooltip.hideTooltip();
63
62
  }
64
- constructor(props) {
65
- super(props);
66
- this._size = {
67
- height: 0,
68
- width: 0,
69
- };
70
- /** @internal */
71
- this.state = {
72
- message: "",
73
- isVisible: false,
74
- position: {
75
- x: 0,
76
- y: 0,
77
- },
78
- };
79
- this._handleElementTooltipChangedEvent = (args // eslint-disable-line deprecation/deprecation
80
- ) => {
81
- this._element = args.el;
82
- this._position = args.pt;
83
- this.setState({
84
- isVisible: args.isTooltipVisible,
85
- message: args.message,
86
- });
87
- this.updatePosition();
88
- };
89
- this._handleSizeChanged = (size) => {
90
- this._size = size;
91
- this.updatePosition();
92
- };
93
- }
94
63
  render() {
95
- if (!this.state.isVisible)
96
- return null;
97
- const className = (0, classnames_1.default)("uifw-element-tooltip", this.props.className);
98
- return (React.createElement("div", { className: "uifw-element-tooltip-container" },
99
- React.createElement(Tooltip_1.Tooltip, { className: className, style: this.props.style, position: this.state.position, onSizeChanged: this._handleSizeChanged },
100
- React.createElement(core_react_1.MessageRenderer, { message: this.state.message }))));
101
- }
102
- componentDidMount() {
103
- ElementTooltip.onElementTooltipChangedEvent.addListener(this._handleElementTooltipChangedEvent);
64
+ return React.createElement(ElementTooltipComponent, null);
104
65
  }
105
- componentWillUnmount() {
106
- ElementTooltip.onElementTooltipChangedEvent.removeListener(this._handleElementTooltipChangedEvent);
107
- }
108
- static _handleMouseMove(event) {
109
- const el = event.currentTarget;
110
- /* Only monitor mouse movement when an ElementTooltip is open. */
111
- if ((el && ElementTooltip._isTooltipHalted) ||
112
- !ElementTooltip._isTooltipVisible) {
113
- el.removeEventListener("mousemove", ElementTooltip._handleMouseMove);
66
+ }
67
+ exports.ElementTooltip = ElementTooltip;
68
+ ElementTooltip._elementTooltipChangedEvent = new core_bentley_1.BeUiEvent();
69
+ function ElementTooltipComponent(props) {
70
+ const [visible, setVisible] = React.useState(false);
71
+ const [message, setMessage] = React.useState("");
72
+ const [preferredPosition, setPreferredPosition] = React.useState(undefined);
73
+ const [position, setPosition] = React.useState({ x: 0, y: 0 });
74
+ // Use a dedicated container for the tooltip to avoid z-index issues in the main window.
75
+ const [mainContainer, setMainContainer] = React.useState(undefined);
76
+ const [container, setContainer] = React.useState(undefined);
77
+ const [popout, setPopout] = React.useState(false);
78
+ const [size, setSize] = React.useState(undefined);
79
+ React.useEffect(() => {
80
+ return ElementTooltip.onElementTooltipChangedEvent.addListener((args) => {
81
+ const isPopout = args.el?.ownerDocument.defaultView !== window;
82
+ setPopout(isPopout);
83
+ setVisible(args.isTooltipVisible);
84
+ setMessage(args.message);
85
+ setContainer(args.el);
86
+ setPreferredPosition(args.pt);
87
+ });
88
+ }, []);
89
+ const portalContainer = popout ? container : mainContainer;
90
+ React.useLayoutEffect(() => {
91
+ if (!preferredPosition)
114
92
  return;
115
- }
116
- const hoveredElement = el
117
- ? el.elementFromPoint(event.clientX, event.clientY)
118
- : undefined;
119
- /* If the mouse has moved to an element that is not the view canvas, close the ElementTooltip. */
120
- if (hoveredElement && hoveredElement.localName !== "canvas") {
121
- ElementTooltip.onElementTooltipChangedEvent.emit({
122
- isTooltipVisible: false,
123
- message: "",
124
- });
125
- el.removeEventListener("mousemove", ElementTooltip._handleMouseMove);
93
+ // Use preferred position by default.
94
+ setPosition(preferredPosition);
95
+ if (!container)
126
96
  return;
127
- }
128
- }
129
- updatePosition() {
130
- this.setState((prevState) => {
131
- if (!this._element)
132
- return null;
133
- if (!this._position)
134
- return null;
135
- const containerBounds = core_react_1.Rectangle.create(this._element.getBoundingClientRect());
136
- const relativeBounds = core_react_1.Rectangle.createFromSize(this._size).offset(this._position);
137
- const adjustedPosition = (0, Tooltip_1.offsetAndContainInContainer)(relativeBounds, containerBounds.getSize(), { x: 8, y: 8 });
138
- const position = adjustedPosition.offset(containerBounds.topLeft());
139
- if (position.equals(prevState.position))
140
- return null;
141
- return {
142
- position,
143
- };
144
- });
145
- }
97
+ if (!size)
98
+ return;
99
+ // Contain the tooltip based on the container bounds.
100
+ const containerBounds = core_react_1.Rectangle.create(container.getBoundingClientRect());
101
+ const bounds = core_react_1.Rectangle.createFromSize(size).offset(preferredPosition);
102
+ const adjustedPosition = (0, Tooltip_1.offsetAndContainInContainer)(bounds, containerBounds.getSize(), { x: 8, y: 8 });
103
+ const newPosition = adjustedPosition.offset(containerBounds.topLeft());
104
+ setPosition(newPosition);
105
+ }, [container, size, preferredPosition]);
106
+ return (React.createElement(React.Fragment, null,
107
+ React.createElement("div", { className: (0, classnames_1.default)("uifw-feedback-elementTooltip_container", props.className), ref: (el) => setMainContainer(el ?? undefined) }),
108
+ portalContainer &&
109
+ visible &&
110
+ ReactDOM.createPortal(React.createElement(Tooltip_1.Tooltip, { className: (0, classnames_1.default)("uifw-feedback-elementTooltip", props.className), style: props.style, onSizeChanged: setSize, position: position },
111
+ React.createElement(core_react_1.MessageRenderer, { message: message })), portalContainer)));
146
112
  }
147
- exports.ElementTooltip = ElementTooltip;
148
- ElementTooltip._elementTooltipChangedEvent = new core_bentley_1.BeUiEvent(); // eslint-disable-line deprecation/deprecation
149
113
  //# sourceMappingURL=ElementTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElementTooltip.js","sourceRoot":"","sources":["../../../../src/appui-react/feedback/ElementTooltip.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,0DAAgD;AAIhD,kDAA+D;AAC/D,2CAAoC;AACpC,+BAA+B;AAC/B,qDA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G,sBAAS,CAAC,MAAM,CACtC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CACtC,CAAC;YACF,MAAM,cAAc,GAAG,sBAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAChE,IAAI,CAAC,SAAS,CACf,CAAC;YACF,MAAM,gBAAgB,GAAU,IAAA,qCAA2B,EACzD,cAAc,EACd,eAAe,CAAC,OAAO,EAAE,EACzB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CACf,CAAC;YACF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YAEpE,IAAI,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAC;YAErD,OAAO;gBACL,QAAQ;aACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;;AAzKH,wCA0KC;AAtKgB,0CAA2B,GACxC,IAAI,wBAAS,EAAkC,AADP,CACQ,CAAC,8CAA8C","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Notification\n */\n\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport type { ToolTipOptions } from \"@itwin/core-frontend\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type { CommonProps, Point, SizeProps } from \"@itwin/core-react\";\nimport { MessageRenderer, Rectangle } from \"@itwin/core-react\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { offsetAndContainInContainer, Tooltip } from \"../layout/popup/Tooltip\";\nimport type { NotifyMessageType } from \"../messages/ReactNotifyMessageDetails\";\nimport { BeUiEvent } from \"@itwin/core-bentley\";\n\n/** [[ElementTooltip]] State.\n * @internal\n */\ninterface ElementTooltipState {\n isVisible: boolean;\n message: NotifyMessageType;\n position: XAndY;\n options?: ToolTipOptions;\n}\n\n/** [[ElementTooltipChangedEvent]] arguments.\n * @public\n * @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ElementTooltipChangedEventArgs {\n isTooltipVisible: boolean;\n message: NotifyMessageType;\n el?: HTMLElement;\n pt?: XAndY;\n options?: ToolTipOptions;\n}\n\n/** ElementTooltip Changed Event class.\n * @public\n * @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class ElementTooltipChangedEvent extends UiEvent<ElementTooltipChangedEventArgs> {}\n\n/** ElementTooltip React component.\n * @public\n */\nexport class ElementTooltip extends React.Component<\n CommonProps,\n ElementTooltipState\n> {\n private static _elementTooltipChangedEvent =\n new BeUiEvent<ElementTooltipChangedEventArgs>(); // eslint-disable-line deprecation/deprecation\n private static _isTooltipVisible: boolean;\n private static _isTooltipHalted: boolean;\n\n // eslint-disable-next-line deprecation/deprecation\n public static get onElementTooltipChangedEvent(): ElementTooltipChangedEvent {\n return ElementTooltip._elementTooltipChangedEvent;\n }\n public static get isTooltipVisible(): boolean {\n return ElementTooltip._isTooltipVisible;\n }\n\n public static showTooltip(\n el: HTMLElement,\n message: NotifyMessageType,\n pt?: XAndY,\n options?: ToolTipOptions\n ): void {\n if (ElementTooltip._isTooltipHalted) return;\n ElementTooltip._isTooltipVisible = true;\n ElementTooltip.onElementTooltipChangedEvent.emit({\n isTooltipVisible: true,\n el,\n message,\n pt,\n options,\n });\n el.ownerDocument.addEventListener(\n \"mousemove\",\n ElementTooltip._handleMouseMove\n );\n }\n\n public static hideTooltip(): void {\n ElementTooltip._isTooltipVisible = false;\n ElementTooltip.onElementTooltipChangedEvent.emit({\n isTooltipVisible: false,\n message: \"\",\n });\n }\n\n public static get isTooltipHalted(): boolean {\n return ElementTooltip._isTooltipHalted;\n }\n public static set isTooltipHalted(halt: boolean) {\n ElementTooltip._isTooltipHalted = halt;\n if (halt && ElementTooltip._isTooltipVisible) ElementTooltip.hideTooltip();\n }\n\n private _size: SizeProps = {\n height: 0,\n width: 0,\n };\n private _element?: HTMLElement;\n private _position?: XAndY;\n\n /** @internal */\n public override readonly state: Readonly<ElementTooltipState> = {\n message: \"\",\n isVisible: false,\n position: {\n x: 0,\n y: 0,\n },\n };\n\n constructor(props: CommonProps) {\n super(props);\n }\n\n public override render() {\n if (!this.state.isVisible) return null;\n\n const className = classnames(\"uifw-element-tooltip\", this.props.className);\n return (\n <div className=\"uifw-element-tooltip-container\">\n <Tooltip\n className={className}\n style={this.props.style}\n position={this.state.position}\n onSizeChanged={this._handleSizeChanged}\n >\n <MessageRenderer message={this.state.message} />\n </Tooltip>\n </div>\n );\n }\n\n public override componentDidMount(): void {\n ElementTooltip.onElementTooltipChangedEvent.addListener(\n this._handleElementTooltipChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n ElementTooltip.onElementTooltipChangedEvent.removeListener(\n this._handleElementTooltipChangedEvent\n );\n }\n\n private static _handleMouseMove(event: MouseEvent) {\n const el = event.currentTarget as Document;\n /* Only monitor mouse movement when an ElementTooltip is open. */\n if (\n (el && ElementTooltip._isTooltipHalted) ||\n !ElementTooltip._isTooltipVisible\n ) {\n el.removeEventListener(\"mousemove\", ElementTooltip._handleMouseMove);\n return;\n }\n const hoveredElement = el\n ? el.elementFromPoint(event.clientX, event.clientY)\n : undefined;\n /* If the mouse has moved to an element that is not the view canvas, close the ElementTooltip. */\n if (hoveredElement && hoveredElement.localName !== \"canvas\") {\n ElementTooltip.onElementTooltipChangedEvent.emit({\n isTooltipVisible: false,\n message: \"\",\n });\n el.removeEventListener(\"mousemove\", ElementTooltip._handleMouseMove);\n return;\n }\n }\n private _handleElementTooltipChangedEvent = (\n args: ElementTooltipChangedEventArgs // eslint-disable-line deprecation/deprecation\n ) => {\n this._element = args.el;\n this._position = args.pt;\n this.setState({\n isVisible: args.isTooltipVisible,\n message: args.message,\n });\n this.updatePosition();\n };\n\n private _handleSizeChanged = (size: SizeProps) => {\n this._size = size;\n this.updatePosition();\n };\n\n private updatePosition() {\n this.setState((prevState) => {\n if (!this._element) return null;\n if (!this._position) return null;\n\n const containerBounds = Rectangle.create(\n this._element.getBoundingClientRect()\n );\n const relativeBounds = Rectangle.createFromSize(this._size).offset(\n this._position\n );\n const adjustedPosition: Point = offsetAndContainInContainer(\n relativeBounds,\n containerBounds.getSize(),\n { x: 8, y: 8 }\n );\n const position = adjustedPosition.offset(containerBounds.topLeft());\n\n if (position.equals(prevState.position)) return null;\n\n return {\n position,\n };\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ElementTooltip.js","sourceRoot":"","sources":["../../../../src/appui-react/feedback/ElementTooltip.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAA+B;AAC/B,2CAAoC;AACpC,+BAA+B;AAC/B,sCAAsC;AACtC,0DAAgD;AAChD,sDAAgD;AAIhD,kDAA+D;AAE/D,qDAA+E;AAwB/E;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,wBAAuC;CAAG;AAA1F,gEAA0F;AAE1F;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,SAGzC;IAMQ,MAAM,KAAK,4BAA4B;QAC5C,OAAO,cAAc,CAAC,2BAA2B,CAAC;IACpD,CAAC;IAEM,MAAM,KAAK,gBAAgB;QAChC,OAAO,cAAc,CAAC,iBAAiB,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,WAAW,CACvB,EAAe,EACf,OAA0B,EAC1B,EAAU,EACV,OAAwB;QAExB,IAAI,cAAc,CAAC,gBAAgB;YAAE,OAAO;QAC5C,cAAc,CAAC,iBAAiB,GAAG,IAAI,CAAC;QACxC,cAAc,CAAC,4BAA4B,CAAC,IAAI,CAAC;YAC/C,gBAAgB,EAAE,IAAI;YACtB,EAAE;YACF,OAAO;YACP,EAAE;YACF,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEM,M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Ae,CAAC,OAAO,EAAE,EACzB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CACf,CAAC;QACF,MAAM,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACvE,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEzC,OAAO,CACL;QACE,6BACE,SAAS,EAAE,IAAA,oBAAU,EACnB,wCAAwC,EACxC,KAAK,CAAC,SAAS,CAChB,EACD,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,SAAS,CAAC,GAC9C;QACD,eAAe;YACd,OAAO;YACP,QAAQ,CAAC,YAAY,CACnB,oBAAC,iBAAO,IACN,SAAS,EAAE,IAAA,oBAAU,EACnB,8BAA8B,EAC9B,KAAK,CAAC,SAAS,CAChB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,aAAa,EAAE,OAAO,EACtB,QAAQ,EAAE,QAAQ;gBAElB,oBAAC,4BAAe,IAAC,OAAO,EAAE,OAAO,GAAI,CAC7B,EACV,eAAe,CAChB,CACF,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Notification\n */\n\nimport \"./ElementTooltip.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport { BeUiEvent } from \"@itwin/core-bentley\";\nimport type { ToolTipOptions } from \"@itwin/core-frontend\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type { CommonProps, SizeProps } from \"@itwin/core-react\";\nimport { MessageRenderer, Rectangle } from \"@itwin/core-react\";\nimport type { NotifyMessageType } from \"../messages/ReactNotifyMessageDetails\";\nimport { offsetAndContainInContainer, Tooltip } from \"../layout/popup/Tooltip\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** [[ElementTooltip]] state. */\ninterface ElementTooltipState {\n isVisible: boolean;\n message: NotifyMessageType;\n position: XAndY;\n options?: ToolTipOptions;\n}\n\n/** [[ElementTooltipChangedEvent]] arguments.\n * @public\n * @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ElementTooltipChangedEventArgs {\n isTooltipVisible: boolean;\n message: NotifyMessageType;\n el?: HTMLElement;\n pt?: XAndY;\n options?: ToolTipOptions;\n}\n\n/** ElementTooltip Changed Event class.\n * @public\n * @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.\n */\nexport class ElementTooltipChangedEvent extends UiEvent<ElementTooltipChangedEventArgs> {}\n\n/** ElementTooltip React component.\n * @public\n */\nexport class ElementTooltip extends React.Component<\n CommonProps,\n ElementTooltipState\n> {\n private static _elementTooltipChangedEvent =\n new BeUiEvent<ElementTooltipChangedEventArgs>();\n private static _isTooltipVisible: boolean;\n private static _isTooltipHalted: boolean;\n\n public static get onElementTooltipChangedEvent(): ElementTooltipChangedEvent {\n return ElementTooltip._elementTooltipChangedEvent;\n }\n\n public static get isTooltipVisible(): boolean {\n return ElementTooltip._isTooltipVisible;\n }\n\n public static showTooltip(\n el: HTMLElement,\n message: NotifyMessageType,\n pt?: XAndY,\n options?: ToolTipOptions\n ): void {\n if (ElementTooltip._isTooltipHalted) return;\n ElementTooltip._isTooltipVisible = true;\n ElementTooltip.onElementTooltipChangedEvent.emit({\n isTooltipVisible: true,\n el,\n message,\n pt,\n options,\n });\n }\n\n public static hideTooltip(): void {\n ElementTooltip._isTooltipVisible = false;\n ElementTooltip.onElementTooltipChangedEvent.emit({\n isTooltipVisible: false,\n message: \"\",\n });\n }\n\n public static get isTooltipHalted(): boolean {\n return ElementTooltip._isTooltipHalted;\n }\n\n public static set isTooltipHalted(halt: boolean) {\n ElementTooltip._isTooltipHalted = halt;\n if (halt && ElementTooltip._isTooltipVisible) ElementTooltip.hideTooltip();\n }\n\n public override render() {\n return <ElementTooltipComponent />;\n }\n}\n\nfunction ElementTooltipComponent(props: CommonProps) {\n const [visible, setVisible] = React.useState(false);\n const [message, setMessage] = React.useState<NotifyMessageType>(\"\");\n const [preferredPosition, setPreferredPosition] = React.useState<\n XAndY | undefined\n >(undefined);\n const [position, setPosition] = React.useState<XAndY>({ x: 0, y: 0 });\n\n // Use a dedicated container for the tooltip to avoid z-index issues in the main window.\n const [mainContainer, setMainContainer] = React.useState<\n HTMLDivElement | undefined\n >(undefined);\n const [container, setContainer] = React.useState<HTMLElement | undefined>(\n undefined\n );\n const [popout, setPopout] = React.useState(false);\n const [size, setSize] = React.useState<SizeProps | undefined>(undefined);\n\n React.useEffect(() => {\n return ElementTooltip.onElementTooltipChangedEvent.addListener((args) => {\n const isPopout = args.el?.ownerDocument.defaultView !== window;\n setPopout(isPopout);\n setVisible(args.isTooltipVisible);\n setMessage(args.message);\n setContainer(args.el);\n setPreferredPosition(args.pt);\n });\n }, []);\n\n const portalContainer = popout ? container : mainContainer;\n\n React.useLayoutEffect(() => {\n if (!preferredPosition) return;\n\n // Use preferred position by default.\n setPosition(preferredPosition);\n\n if (!container) return;\n if (!size) return;\n\n // Contain the tooltip based on the container bounds.\n const containerBounds = Rectangle.create(container.getBoundingClientRect());\n const bounds = Rectangle.createFromSize(size).offset(preferredPosition);\n const adjustedPosition = offsetAndContainInContainer(\n bounds,\n containerBounds.getSize(),\n { x: 8, y: 8 }\n );\n const newPosition = adjustedPosition.offset(containerBounds.topLeft());\n setPosition(newPosition);\n }, [container, size, preferredPosition]);\n\n return (\n <>\n <div\n className={classnames(\n \"uifw-feedback-elementTooltip_container\",\n props.className\n )}\n ref={(el) => setMainContainer(el ?? undefined)}\n />\n {portalContainer &&\n visible &&\n ReactDOM.createPortal(\n <Tooltip\n className={classnames(\n \"uifw-feedback-elementTooltip\",\n props.className\n )}\n style={props.style}\n onSizeChanged={setSize}\n position={position}\n >\n <MessageRenderer message={message} />\n </Tooltip>,\n portalContainer\n )}\n </>\n );\n}\n"]}
@@ -0,0 +1,29 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/z-index";
6
+ @import "../variables";
7
+
8
+ .uifw-feedback-elementTooltip {
9
+ pointer-events: none;
10
+ width: max-content;
11
+ font-size: var(--iui-font-size-1);
12
+ border: {
13
+ color: $uifw-popup-border-color;
14
+ radius: $uifw-popup-border-radius;
15
+ style: solid;
16
+ width: $uifw-popup-border-width;
17
+ }
18
+ }
19
+
20
+ .uifw-feedback-elementTooltip_container {
21
+ position: fixed;
22
+ left: 0;
23
+ top: 0;
24
+ width: 100%;
25
+ height: 100%;
26
+ pointer-events: none;
27
+
28
+ @include uicore-z-index(tooltip);
29
+ }
@@ -4,14 +4,14 @@
4
4
  import * as React from "react";
5
5
  import { Popover } from "@itwin/itwinui-react";
6
6
  import { ButtonExpandIndicator } from "./ExpandIndicator";
7
- import type { CommonProps } from "@itwin/core-react";
7
+ import { type CommonProps } from "@itwin/core-react";
8
8
  type StatusBarPopoverProps = CommonProps & Pick<React.ComponentProps<typeof Popover>, "content" | "children" | "visible" | "onVisibleChange" | "closeOnOutsideClick">;
9
9
  /** Popover component used in `StatusBar` component.
10
10
  * This component should wrap the element that triggers the popover.
11
11
  * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.
12
12
  * @public
13
13
  */
14
- export declare function StatusBarPopover(props: StatusBarPopoverProps): React.JSX.Element;
14
+ export declare function StatusBarPopover({ content, ...props }: StatusBarPopoverProps): React.JSX.Element;
15
15
  /** Components used in `StatusBarPopover`.
16
16
  * @public
17
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"StatusBarPopover.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/statusbar/popup/StatusBarPopover.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,KAAK,qBAAqB,GAAG,WAAW,GACtC,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,EAClC,SAAS,GACT,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,qBAAqB,CACxB,CAAC;AAEJ;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAW5D;AAED;;GAEG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;OAEG;IACI,MAAM,eAAe,8BAAwB,CAAC;CACtD"}
1
+ {"version":3,"file":"StatusBarPopover.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/statusbar/popup/StatusBarPopover.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAEnE,KAAK,qBAAqB,GAAG,WAAW,GACtC,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,EAClC,SAAS,GACT,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,qBAAqB,CACxB,CAAC;AAEJ;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAsB5E;AAED;;GAEG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;OAEG;IACI,MAAM,eAAe,8BAAwB,CAAC;CACtD"}
@@ -11,14 +11,18 @@ exports.StatusBarPopover = void 0;
11
11
  const React = require("react");
12
12
  const itwinui_react_1 = require("@itwin/itwinui-react");
13
13
  const ExpandIndicator_1 = require("./ExpandIndicator");
14
+ const core_react_1 = require("@itwin/core-react");
14
15
  /** Popover component used in `StatusBar` component.
15
16
  * This component should wrap the element that triggers the popover.
16
17
  * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.
17
18
  * @public
18
19
  */
19
- function StatusBarPopover(props) {
20
- return (React.createElement(itwinui_react_1.Popover, { ...props, placement: "top", applyBackground: true, middleware: {
20
+ function StatusBarPopover({ content, ...props }) {
21
+ const [portalTarget, setPortalTarget] = React.useState(undefined);
22
+ return (React.createElement(itwinui_react_1.Popover, { ...props, content: React.createElement(core_react_1.PopupContext.Provider, { value: portalTarget }, content), placement: "top", applyBackground: true, middleware: {
21
23
  offset: 4,
24
+ }, ref: (el) => {
25
+ setPortalTarget(el ?? undefined);
22
26
  } }));
23
27
  }
24
28
  exports.StatusBarPopover = StatusBarPopover;
@@ -1 +1 @@
1
- {"version":3,"file":"StatusBarPopover.js","sourceRoot":"","sources":["../../../../../src/appui-react/statusbar/popup/StatusBarPopover.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,wDAA+C;AAC/C,uDAA0D;AAa1D;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,OAAO,CACL,oBAAC,uBAAO,OACF,KAAK,EACT,SAAS,EAAC,KAAK,EACf,eAAe,QACf,UAAU,EAAE;YACV,MAAM,EAAE,CAAC;SACV,GACD,CACH,CAAC;AACJ,CAAC;AAXD,4CAWC;AAED;;GAEG;AACH,WAAiB,gBAAgB;IAC/B;;OAEG;IACU,gCAAe,GAAG,uCAAqB,CAAC;AACvD,CAAC,EALgB,gBAAgB,gCAAhB,gBAAgB,QAKhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport * as React from \"react\";\nimport { Popover } from \"@itwin/itwinui-react\";\nimport { ButtonExpandIndicator } from \"./ExpandIndicator\";\nimport type { CommonProps } from \"@itwin/core-react\";\n\ntype StatusBarPopoverProps = CommonProps &\n Pick<\n React.ComponentProps<typeof Popover>,\n | \"content\"\n | \"children\"\n | \"visible\"\n | \"onVisibleChange\"\n | \"closeOnOutsideClick\"\n >;\n\n/** Popover component used in `StatusBar` component.\n * This component should wrap the element that triggers the popover.\n * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.\n * @public\n */\nexport function StatusBarPopover(props: StatusBarPopoverProps) {\n return (\n <Popover\n {...props}\n placement=\"top\"\n applyBackground\n middleware={{\n offset: 4,\n }}\n />\n );\n}\n\n/** Components used in `StatusBarPopover`.\n * @public\n */\nexport namespace StatusBarPopover {\n /** Indicator to be used in popover trigger buttons to show expandable content.\n * @public\n */\n export const ExpandIndicator = ButtonExpandIndicator;\n}\n"]}
1
+ {"version":3,"file":"StatusBarPopover.js","sourceRoot":"","sources":["../../../../../src/appui-react/statusbar/popup/StatusBarPopover.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,wDAA+C;AAC/C,uDAA0D;AAC1D,kDAAmE;AAYnE;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAyB;IAC3E,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAEpD,SAAS,CAAC,CAAC;IACb,OAAO,CACL,oBAAC,uBAAO,OACF,KAAK,EACT,OAAO,EACL,oBAAC,yBAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IACvC,OAAO,CACc,EAE1B,SAAS,EAAC,KAAK,EACf,eAAe,QACf,UAAU,EAAE;YACV,MAAM,EAAE,CAAC;SACV,EACD,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;YACV,eAAe,CAAC,EAAE,IAAI,SAAS,CAAC,CAAC;QACnC,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAtBD,4CAsBC;AAED;;GAEG;AACH,WAAiB,gBAAgB;IAC/B;;OAEG;IACU,gCAAe,GAAG,uCAAqB,CAAC;AACvD,CAAC,EALgB,gBAAgB,gCAAhB,gBAAgB,QAKhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport * as React from \"react\";\nimport { Popover } from \"@itwin/itwinui-react\";\nimport { ButtonExpandIndicator } from \"./ExpandIndicator\";\nimport { type CommonProps, PopupContext } from \"@itwin/core-react\";\n\ntype StatusBarPopoverProps = CommonProps &\n Pick<\n React.ComponentProps<typeof Popover>,\n | \"content\"\n | \"children\"\n | \"visible\"\n | \"onVisibleChange\"\n | \"closeOnOutsideClick\"\n >;\n\n/** Popover component used in `StatusBar` component.\n * This component should wrap the element that triggers the popover.\n * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.\n * @public\n */\nexport function StatusBarPopover({ content, ...props }: StatusBarPopoverProps) {\n const [portalTarget, setPortalTarget] = React.useState<\n HTMLElement | undefined\n >(undefined);\n return (\n <Popover\n {...props}\n content={\n <PopupContext.Provider value={portalTarget}>\n {content}\n </PopupContext.Provider>\n }\n placement=\"top\"\n applyBackground\n middleware={{\n offset: 4,\n }}\n ref={(el) => {\n setPortalTarget(el ?? undefined);\n }}\n />\n );\n}\n\n/** Components used in `StatusBarPopover`.\n * @public\n */\nexport namespace StatusBarPopover {\n /** Indicator to be used in popover trigger buttons to show expandable content.\n * @public\n */\n export const ExpandIndicator = ButtonExpandIndicator;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Frontstage.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/widget-panels/Frontstage.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAQ,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAWnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAKrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,OAAO,mBAAmB,CAAC;AA8D3B,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,oDAiBtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,QAYjE;AAYD,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,oBAwB/D;AAED,gBAAgB;AAChB,wBAAgB,sBAAsB,6BAerC;AAMD,UAAU,gCAAgC;IACxC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,gBAAgB;AAChB,wBAAgB,2BAA2B,CAAC,EAC1C,aAAa,GACd,EAAE,gCAAgC,qBAiElC;AAED,gBAAgB;AAChB,wBAAgB,SAAS,IAAI,cAAc,CAc1C;AA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AAK,CAAC;AAE/B,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,aAAa,QAkBnE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,aAAa,QAuFtB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CASrE;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,aAAa,CAAC;IACxB,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IACxB,mHAAmH;IACnH,OAAO,EAAE,MAAM,CAAC;IAChB,+FAA+F;IAC/F,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,aAAa,QA4CnE;AAED,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,gBAAgB;AAChB,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,2BAA2B,CAAC,IAAI,CAAC,UAGhD;AAED,gBAAgB;AAChB,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,EAC5B,0BAA0B,CAAC,EAAE,OAAO,QA8DrC;AAWD,gBAAgB;AAChB,wBAAgB,eAAe,CAAC,aAAa,EAAE,aAAa,QAa3D"}
@@ -263,11 +263,10 @@ function addPanelSectionWidgetDefs(frontstageDef, location, section) {
263
263
  }
264
264
  }
265
265
  exports.addPanelSectionWidgetDefs = addPanelSectionWidgetDefs;
266
+ /** Sends back popout widgets if app is not an electron app. */
266
267
  function processPopoutWidgets(frontstageDef) {
267
- // Electron reopens popout windows w/o user interaction.
268
- if (core_bentley_1.ProcessDetector.isElectronAppFrontend) {
268
+ if (core_bentley_1.ProcessDetector.isElectronAppFrontend)
269
269
  return;
270
- }
271
270
  (0, core_bentley_1.assert)(!!frontstageDef.nineZoneState);
272
271
  const state = frontstageDef.nineZoneState;
273
272
  for (const id of state.popoutWidgets.allIds) {
@@ -277,6 +276,17 @@ function processPopoutWidgets(frontstageDef) {
277
276
  });
278
277
  }
279
278
  }
279
+ /** Opens popout widgets if app is an electron app. */
280
+ function openPopoutWidgets(frontstageDef) {
281
+ // Only electron can reopen popout windows w/o user interaction.
282
+ if (!core_bentley_1.ProcessDetector.isElectronAppFrontend)
283
+ return;
284
+ (0, core_bentley_1.assert)(!!frontstageDef.nineZoneState);
285
+ const state = frontstageDef.nineZoneState;
286
+ for (const id of state.popoutWidgets.allIds) {
287
+ frontstageDef.openPopoutWidgetContainer(id, undefined);
288
+ }
289
+ }
280
290
  /** Adds frontstageDef widgets that are missing in NineZoneState.
281
291
  * @internal
282
292
  */
@@ -534,6 +544,7 @@ function useSavedFrontstageState(frontstageDef) {
534
544
  // Switching to previously initialized frontstage.
535
545
  if (frontstageDef.nineZoneState) {
536
546
  processPopoutWidgets(frontstageDef);
547
+ openPopoutWidgets(frontstageDef);
537
548
  return;
538
549
  }
539
550
  const id = frontstageDef.id;