@forgeax/app-shell 0.30.0 → 0.31.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 +19 -1
- package/dist/dock.js +34 -0
- package/package.json +1 -1
package/dist/dock.d.ts
CHANGED
|
@@ -110,6 +110,24 @@ interface DockLayoutPersistence<Layout, Identity> {
|
|
|
110
110
|
* storage, snapshot validation, and concrete Dockview mutation.
|
|
111
111
|
*/
|
|
112
112
|
declare function createDockLayoutPersistence<Layout, Identity>(adapter: DockLayoutPersistenceAdapter<Layout, Identity>): DockLayoutPersistence<Layout, Identity>;
|
|
113
|
+
interface DockLayoutObservationSource {
|
|
114
|
+
onDidLayoutChange(listener: () => void): {
|
|
115
|
+
dispose(): void;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
interface DockLayoutObservationAdapter<Scope> {
|
|
119
|
+
/** Resolve the current product-owned scope at event time. */
|
|
120
|
+
getCurrentScope(): Scope | null;
|
|
121
|
+
/** Capture and persist a scoped layout; false identifies a suppressed capture. */
|
|
122
|
+
readonly captureAndSave?: (scope: Scope) => boolean;
|
|
123
|
+
/** Publish one stable notification only after capture succeeds or is not required. */
|
|
124
|
+
onCommitted(): void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Own one layout-change subscription and its capture-before-notify sequencing.
|
|
128
|
+
* Product callers retain concrete event, scope, snapshot, persistence, and UI adapters.
|
|
129
|
+
*/
|
|
130
|
+
declare function installDockLayoutObservation<Scope>(source: DockLayoutObservationSource, adapter: DockLayoutObservationAdapter<Scope>): () => void;
|
|
113
131
|
interface SerializedDockPanelLike {
|
|
114
132
|
readonly contentComponent?: string;
|
|
115
133
|
}
|
|
@@ -215,4 +233,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
|
|
|
215
233
|
titleFor?: (panelId: string) => string | undefined;
|
|
216
234
|
}): void;
|
|
217
235
|
|
|
218
|
-
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 DockReadyActivation, type DockReadyAdapterInstaller, type DockReadyAdapterSession, type DockReadyCleanup, type DockRegion, type DockRegionEntry, type DockReopenDirection, type DockScopeTransition, type DockScopeTransitionAdapter, type DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, createDockPanelCommands, createDockReadyActivation, createDockReadyCleanup, createDockScopeTransition, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
|
|
236
|
+
export { type AuthoredDockLayoutLike, type AuthoredDockNodeLike, type CrossInstanceDropEvent, DOCK_REGIONS, type DesignedDockPanelPosition, type DockCommandPanel, type DockLayoutObservationAdapter, type DockLayoutObservationSource, type DockLayoutOrientation, type DockLayoutPersistence, type DockLayoutPersistenceAdapter, type DockLayoutPersistenceScope, type DockPanelCommandAdapter, type DockPanelCommands, type DockPanelVisibilityEventSource, type DockPanelVisibilityHooks, type DockReadyActivation, type DockReadyAdapterInstaller, type DockReadyAdapterSession, type DockReadyCleanup, type DockRegion, type DockRegionEntry, type DockReopenDirection, type DockScopeTransition, type DockScopeTransitionAdapter, type DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, createDockPanelCommands, createDockReadyActivation, createDockReadyCleanup, createDockScopeTransition, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockLayoutObservation, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
|
package/dist/dock.js
CHANGED
|
@@ -262,6 +262,39 @@ function createDockLayoutPersistence(adapter) {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
+
function installDockLayoutObservation(source, adapter) {
|
|
266
|
+
let active = true;
|
|
267
|
+
const subscription = source.onDidLayoutChange(() => {
|
|
268
|
+
if (!active) return;
|
|
269
|
+
let scope;
|
|
270
|
+
try {
|
|
271
|
+
scope = adapter.getCurrentScope();
|
|
272
|
+
} catch {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (!active) return;
|
|
276
|
+
if (scope !== null && adapter.captureAndSave) {
|
|
277
|
+
try {
|
|
278
|
+
if (!adapter.captureAndSave(scope)) return;
|
|
279
|
+
} catch {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!active) return;
|
|
283
|
+
}
|
|
284
|
+
try {
|
|
285
|
+
adapter.onCommitted();
|
|
286
|
+
} catch {
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
return () => {
|
|
290
|
+
if (!active) return;
|
|
291
|
+
active = false;
|
|
292
|
+
try {
|
|
293
|
+
subscription.dispose();
|
|
294
|
+
} catch {
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
265
298
|
function pruneSerializedDockLayout(layout, knownComponents, allowedPanelIds) {
|
|
266
299
|
if (!layout.panels) return layout;
|
|
267
300
|
const removed = new Set(Object.entries(layout.panels).filter(([id, panel]) => !knownComponents.has(panel.contentComponent ?? id) || allowedPanelIds !== void 0 && !allowedPanelIds.has(id)).map(([id]) => id));
|
|
@@ -489,6 +522,7 @@ export {
|
|
|
489
522
|
getDockviewApi,
|
|
490
523
|
handleCrossInstanceDrop,
|
|
491
524
|
hasMountedPanelPlacement,
|
|
525
|
+
installDockLayoutObservation,
|
|
492
526
|
installDockPanelVisibilityTracking,
|
|
493
527
|
isDockPanelVisible,
|
|
494
528
|
isDockRegion,
|