@konitif/workbench 0.285.10 → 0.285.11
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShellRegionId, ShellRegionPresentation } from "../shell/model.js";
|
|
1
|
+
import type { ShellRegionId, ShellRegionPresentation, ShellState } from "../shell/model.js";
|
|
2
2
|
import type { JsonObject } from "../shared/json.js";
|
|
3
3
|
export type WorkbenchToolDockActionSide = 'top' | 'right' | 'bottom' | 'left';
|
|
4
4
|
export interface WorkbenchToolDockVisibilityConfig {
|
|
@@ -8,6 +8,7 @@ export interface WorkbenchToolDockVisibilityConfig {
|
|
|
8
8
|
}
|
|
9
9
|
export interface WorkbenchGroupedToolDockConfig extends WorkbenchToolDockVisibilityConfig {
|
|
10
10
|
defaultRegionId: ShellRegionId;
|
|
11
|
+
rootWidgetId?: string | null;
|
|
11
12
|
}
|
|
12
13
|
export interface WorkbenchToolDockRootConfig extends WorkbenchToolDockVisibilityConfig {
|
|
13
14
|
commandId: string;
|
|
@@ -20,6 +21,7 @@ export interface WorkbenchToolDockRootLocation {
|
|
|
20
21
|
isOpen: boolean;
|
|
21
22
|
activeWidgetId: string | null;
|
|
22
23
|
presentation?: ShellRegionPresentation;
|
|
24
|
+
size?: number;
|
|
23
25
|
}
|
|
24
26
|
export declare function resolveWorkbenchToolDockSide(regionId: ShellRegionId | null | undefined): WorkbenchToolDockActionSide;
|
|
25
27
|
export declare function readWorkbenchToolDockVisibility(state: unknown, config: WorkbenchToolDockVisibilityConfig): boolean;
|
|
@@ -28,6 +30,7 @@ export declare function resolveWorkbenchToolDockEffectiveVisibility(input: {
|
|
|
28
30
|
internalVisible: boolean;
|
|
29
31
|
widgetId: string;
|
|
30
32
|
}): boolean;
|
|
33
|
+
export declare function resolveWorkbenchToolDockRootLocation(shellState: ShellState, widgetId: string): WorkbenchToolDockRootLocation | null;
|
|
31
34
|
export declare function patchWorkbenchToolDockVisibilityState(state: unknown, input: WorkbenchToolDockVisibilityConfig & {
|
|
32
35
|
isVisible: boolean;
|
|
33
36
|
}): JsonObject;
|
|
@@ -37,3 +40,4 @@ export declare function patchWorkbenchToolDockVisibilityState(state: unknown, in
|
|
|
37
40
|
* Docks projected into a root shell region remain independently managed.
|
|
38
41
|
*/
|
|
39
42
|
export declare function normalizeGroupedWorkbenchToolDockVisibility(currentState: JsonObject, requestedState: JsonObject, docks: readonly WorkbenchGroupedToolDockConfig[], individuallyManagedDockIds?: ReadonlySet<string>): JsonObject;
|
|
43
|
+
export declare function normalizeGroupedWorkbenchToolDockVisibilityForShellState(currentState: JsonObject, requestedState: JsonObject, docks: readonly WorkbenchGroupedToolDockConfig[], shellState: ShellState): JsonObject;
|
|
@@ -27,6 +27,23 @@ export function resolveWorkbenchToolDockEffectiveVisibility(input) {
|
|
|
27
27
|
}
|
|
28
28
|
return location.isVisible && location.isOpen && (location.presentation === 'stack' || location.activeWidgetId === input.widgetId);
|
|
29
29
|
}
|
|
30
|
+
export function resolveWorkbenchToolDockRootLocation(shellState, widgetId) {
|
|
31
|
+
const regionIds = ['left', 'right', 'bottom'];
|
|
32
|
+
for (const regionId of regionIds) {
|
|
33
|
+
const region = shellState.regions[regionId];
|
|
34
|
+
if (region.widgetIds.includes(widgetId)) {
|
|
35
|
+
return {
|
|
36
|
+
regionId,
|
|
37
|
+
isVisible: region.isVisible && !(region.hiddenWidgetIds ?? []).includes(widgetId),
|
|
38
|
+
isOpen: region.isOpen,
|
|
39
|
+
activeWidgetId: region.activeWidgetId,
|
|
40
|
+
presentation: region.presentation ?? 'tabs',
|
|
41
|
+
size: region.size
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
30
47
|
export function patchWorkbenchToolDockVisibilityState(state, input) {
|
|
31
48
|
const currentState = isRecord(state) ? state : {};
|
|
32
49
|
const dockContainers = isRecord(currentState.dockContainers) ? currentState.dockContainers : {};
|
|
@@ -72,6 +89,12 @@ export function normalizeGroupedWorkbenchToolDockVisibility(currentState, reques
|
|
|
72
89
|
isVisible
|
|
73
90
|
}), requestedState);
|
|
74
91
|
}
|
|
92
|
+
export function normalizeGroupedWorkbenchToolDockVisibilityForShellState(currentState, requestedState, docks, shellState) {
|
|
93
|
+
const rootManagedDockIds = new Set(docks.flatMap((dock) => dock.rootWidgetId && resolveWorkbenchToolDockRootLocation(shellState, dock.rootWidgetId)
|
|
94
|
+
? [dock.dockId]
|
|
95
|
+
: []));
|
|
96
|
+
return normalizeGroupedWorkbenchToolDockVisibility(currentState, requestedState, docks, rootManagedDockIds);
|
|
97
|
+
}
|
|
75
98
|
function isRecord(value) {
|
|
76
99
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
77
100
|
}
|
package/package.json
CHANGED