@linzjs/windows 7.3.0 → 8.0.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.
@@ -37,25 +37,27 @@ export const PanelInstanceContextProvider = ({
37
37
 
38
38
  const undock = useCallback(() => setDockId(undefined), []);
39
39
 
40
+ const uniqueId = panelInstance.uniqueId;
41
+
40
42
  return (
41
43
  <PanelInstanceContext.Provider
42
44
  value={{
43
45
  title,
44
46
  setTitle,
45
- uniqueId: panelInstance.uniqueId,
47
+ uniqueId,
46
48
  bounds,
47
- panelName: panelInstance.uniqueId,
49
+ panelName: uniqueId,
48
50
  panelClose: () => {
49
51
  panelInstance.window?.close();
50
52
  panelInstance.window = null;
51
- closePanel(panelInstance.uniqueId);
53
+ closePanel(uniqueId);
52
54
  },
53
55
  panelTogglePopout: togglePopOut,
54
56
  panelPoppedOut: poppedOut,
55
57
  setPanelWindow: (w: Window) => {
56
58
  panelInstance.window = w;
57
59
  },
58
- bringPanelToFront: () => bringPanelToFront(panelInstance),
60
+ bringPanelToFront: () => bringPanelToFront(uniqueId),
59
61
  zIndex: panelInstance.zIndex,
60
62
  docked: !poppedOut && !!dockId && !!dockElements[dockId],
61
63
  dockId,
@@ -24,7 +24,7 @@ export interface PanelsContextType {
24
24
  // returns unique id of panel that was created/or arleady found, otherwise null on error.
25
25
  openPanel: (args: OpenPanelOptions) => string | null;
26
26
  closePanel: (uniqueId: string) => void;
27
- bringPanelToFront: (panelInstance: PanelInstance) => void;
27
+ bringPanelToFront: (panelUniqueId: string) => void;
28
28
  nextStackPosition: () => PanelPosition;
29
29
  dockElements: Record<string, HTMLDivElement>;
30
30
  setDockElement: (id: string, element: HTMLDivElement) => void;
@@ -50,7 +50,12 @@ export const PanelsContextProvider = ({
50
50
  );
51
51
 
52
52
  const bringPanelToFront = useCallback(
53
- (panelInstance: PanelInstance) => {
53
+ (panelUniqueId: string) => {
54
+ const panelInstance = panelInstances.find((panelInstance) => panelInstance.uniqueId === panelUniqueId);
55
+ if (!panelInstance) {
56
+ console.warn(`bringPanelToFront cannot find panel with uniqueId: ${panelUniqueId}`);
57
+ return;
58
+ }
54
59
  if (panelInstance.window) {
55
60
  panelInstance.window.focus();
56
61
  } else {
@@ -74,7 +79,7 @@ export const PanelsContextProvider = ({
74
79
  if (existingPanelInstance.window) {
75
80
  existingPanelInstance.window?.focus();
76
81
  } else {
77
- bringPanelToFront(existingPanelInstance);
82
+ bringPanelToFront(uniqueId);
78
83
  }
79
84
  return existingPanelInstance.uniqueId;
80
85
  }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "popout"
14
14
  ],
15
15
  "main": "./dist/index.ts",
16
- "version": "7.3.0",
16
+ "version": "8.0.0",
17
17
  "peerDependencies": {
18
18
  "@linzjs/lui": ">=21",
19
19
  "lodash-es": ">=4",