@forgeax/app-shell 0.25.0 → 0.26.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.
- package/dist/dock.d.ts +29 -1
- package/dist/dock.js +56 -0
- package/package.json +1 -1
package/dist/dock.d.ts
CHANGED
|
@@ -109,6 +109,34 @@ type DesignedDockPanelPosition = {
|
|
|
109
109
|
* Returns undefined when the panel is absent or no live sibling can anchor it.
|
|
110
110
|
*/
|
|
111
111
|
declare function designedDockPanelPosition(layout: AuthoredDockLayoutLike, panelId: string, isOpen: (id: string) => boolean): DesignedDockPanelPosition | undefined;
|
|
112
|
+
interface DockCommandPanel {
|
|
113
|
+
close(): void;
|
|
114
|
+
setActive(): void;
|
|
115
|
+
}
|
|
116
|
+
interface DockPanelCommandAdapter {
|
|
117
|
+
getPanel(id: string): DockCommandPanel | undefined;
|
|
118
|
+
addPanel(options: {
|
|
119
|
+
id: string;
|
|
120
|
+
component: string;
|
|
121
|
+
title: string;
|
|
122
|
+
position?: {
|
|
123
|
+
referencePanel?: string;
|
|
124
|
+
direction: DockReopenDirection;
|
|
125
|
+
};
|
|
126
|
+
}): void;
|
|
127
|
+
canOpen(id: string): boolean;
|
|
128
|
+
titleFor(id: string): string;
|
|
129
|
+
authoredLayout?(): AuthoredDockLayoutLike | undefined;
|
|
130
|
+
fallbackPanelId?(): string | undefined;
|
|
131
|
+
}
|
|
132
|
+
interface DockPanelCommands {
|
|
133
|
+
open(id: string): boolean;
|
|
134
|
+
close(id: string): boolean;
|
|
135
|
+
focus(id: string): boolean;
|
|
136
|
+
reveal(id: string): boolean;
|
|
137
|
+
}
|
|
138
|
+
/** Own idempotent panel commands while callers retain membership and product policy. */
|
|
139
|
+
declare function createDockPanelCommands(adapter: DockPanelCommandAdapter): DockPanelCommands;
|
|
112
140
|
type SideEdge = 'left' | 'right';
|
|
113
141
|
interface RectLike {
|
|
114
142
|
left: number;
|
|
@@ -146,4 +174,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
|
|
|
146
174
|
titleFor?: (panelId: string) => string | undefined;
|
|
147
175
|
}): void;
|
|
148
176
|
|
|
149
|
-
export { type AuthoredDockLayoutLike, type AuthoredDockNodeLike, type CrossInstanceDropEvent, DOCK_REGIONS, type DesignedDockPanelPosition, type DockLayoutOrientation, type DockLayoutPersistence, type DockLayoutPersistenceAdapter, type DockLayoutPersistenceScope, type DockPanelVisibilityEventSource, type DockPanelVisibilityHooks, type DockRegion, type DockRegionEntry, type DockReopenDirection, type DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, resolveRegion, trackDockPanelVisibility };
|
|
177
|
+
export { type AuthoredDockLayoutLike, type AuthoredDockNodeLike, type CrossInstanceDropEvent, DOCK_REGIONS, type DesignedDockPanelPosition, type DockCommandPanel, type DockLayoutOrientation, type DockLayoutPersistence, type DockLayoutPersistenceAdapter, type DockLayoutPersistenceScope, type DockPanelCommandAdapter, type DockPanelCommands, type DockPanelVisibilityEventSource, type DockPanelVisibilityHooks, type DockRegion, type DockRegionEntry, type DockReopenDirection, type DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, createDockPanelCommands, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, resolveRegion, trackDockPanelVisibility };
|
package/dist/dock.js
CHANGED
|
@@ -236,6 +236,61 @@ function designedDockPanelPosition(layout, panelId, isOpen) {
|
|
|
236
236
|
}
|
|
237
237
|
return void 0;
|
|
238
238
|
}
|
|
239
|
+
function createDockPanelCommands(adapter) {
|
|
240
|
+
const panel = (id) => {
|
|
241
|
+
try {
|
|
242
|
+
return adapter.getPanel(id);
|
|
243
|
+
} catch {
|
|
244
|
+
return void 0;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const focus = (id) => {
|
|
248
|
+
const target = panel(id);
|
|
249
|
+
if (!target) return false;
|
|
250
|
+
try {
|
|
251
|
+
target.setActive();
|
|
252
|
+
return true;
|
|
253
|
+
} catch {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const open = (id) => {
|
|
258
|
+
if (panel(id)) return false;
|
|
259
|
+
try {
|
|
260
|
+
if (!adapter.canOpen(id)) return false;
|
|
261
|
+
const layout = adapter.authoredLayout?.();
|
|
262
|
+
const designed = layout ? designedDockPanelPosition(layout, id, (candidate) => panel(candidate) !== void 0) : void 0;
|
|
263
|
+
const referencePanel = designed?.kind === "relative" ? designed.referencePanel : designed === void 0 ? adapter.fallbackPanelId?.() : void 0;
|
|
264
|
+
adapter.addPanel({
|
|
265
|
+
id,
|
|
266
|
+
component: id,
|
|
267
|
+
title: adapter.titleFor(id),
|
|
268
|
+
position: designed?.kind === "edge" ? { direction: designed.direction } : referencePanel ? { referencePanel, direction: designed?.direction ?? "right" } : void 0
|
|
269
|
+
});
|
|
270
|
+
return true;
|
|
271
|
+
} catch {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
return {
|
|
276
|
+
open,
|
|
277
|
+
close(id) {
|
|
278
|
+
const target = panel(id);
|
|
279
|
+
if (!target) return false;
|
|
280
|
+
try {
|
|
281
|
+
target.close();
|
|
282
|
+
return true;
|
|
283
|
+
} catch {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
focus,
|
|
288
|
+
reveal(id) {
|
|
289
|
+
if (!panel(id) && !open(id)) return false;
|
|
290
|
+
return focus(id);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
239
294
|
function isOnSideEdge(location) {
|
|
240
295
|
return location.type === "edge" && (location.position === "left" || location.position === "right");
|
|
241
296
|
}
|
|
@@ -291,6 +346,7 @@ export {
|
|
|
291
346
|
DOCK_REGIONS,
|
|
292
347
|
REGIONS,
|
|
293
348
|
createDockLayoutPersistence,
|
|
349
|
+
createDockPanelCommands,
|
|
294
350
|
designedDockPanelPosition,
|
|
295
351
|
getDockRegions,
|
|
296
352
|
getDockviewApi,
|