@forgeax/app-shell 0.29.0 → 0.30.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 +18 -1
- package/dist/dock.js +64 -0
- package/package.json +1 -1
package/dist/dock.d.ts
CHANGED
|
@@ -27,6 +27,23 @@ interface DockReadyActivation<T> {
|
|
|
27
27
|
}
|
|
28
28
|
/** Own current-value publication and reentrant replacement for dock-ready sessions. */
|
|
29
29
|
declare function createDockReadyActivation<T>(): DockReadyActivation<T>;
|
|
30
|
+
interface DockScopeTransitionAdapter<Scope, Live> {
|
|
31
|
+
/** Resolve the currently published dock value without retaining it here. */
|
|
32
|
+
getLive(): Live | null;
|
|
33
|
+
/** Persist the previous product-owned scope before it is replaced. */
|
|
34
|
+
save(live: Live, scope: Scope): void;
|
|
35
|
+
/** Apply the next product-owned scope to the live dock value. */
|
|
36
|
+
apply(live: Live, scope: Scope | null): void;
|
|
37
|
+
}
|
|
38
|
+
interface DockScopeTransition<Scope> {
|
|
39
|
+
getCurrent(): Scope | null;
|
|
40
|
+
/** Save the previous scope, publish the next scope, then apply it when live. */
|
|
41
|
+
transition(next: Scope | null): boolean;
|
|
42
|
+
/** Apply the stable current scope to a newly ready or otherwise refreshed dock. */
|
|
43
|
+
applyCurrent(): boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Own ordered, reentrant-safe scope transitions while product adapters retain policy. */
|
|
46
|
+
declare function createDockScopeTransition<Scope, Live>(adapter: DockScopeTransitionAdapter<Scope, Live>, initial?: Scope | null): DockScopeTransition<Scope>;
|
|
30
47
|
interface PanelDescriptorLite {
|
|
31
48
|
defaultRegion?: DockRegion;
|
|
32
49
|
}
|
|
@@ -198,4 +215,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
|
|
|
198
215
|
titleFor?: (panelId: string) => string | undefined;
|
|
199
216
|
}): void;
|
|
200
217
|
|
|
201
|
-
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 DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, createDockPanelCommands, createDockReadyActivation, createDockReadyCleanup, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
|
|
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 };
|
package/dist/dock.js
CHANGED
|
@@ -75,6 +75,69 @@ function createDockReadyActivation() {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
+
function createDockScopeTransition(adapter, initial = null) {
|
|
79
|
+
let current = initial;
|
|
80
|
+
let generation = 0;
|
|
81
|
+
let processing = false;
|
|
82
|
+
let pending = null;
|
|
83
|
+
const getLive = () => {
|
|
84
|
+
try {
|
|
85
|
+
return adapter.getLive();
|
|
86
|
+
} catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const enqueue = (next, savePrevious) => {
|
|
91
|
+
const request = { generation: ++generation, next, savePrevious };
|
|
92
|
+
pending = request;
|
|
93
|
+
if (processing) return true;
|
|
94
|
+
processing = true;
|
|
95
|
+
let requestedResult = true;
|
|
96
|
+
let savedPrevious = null;
|
|
97
|
+
try {
|
|
98
|
+
while (pending) {
|
|
99
|
+
const candidate = pending;
|
|
100
|
+
pending = null;
|
|
101
|
+
const previous = current;
|
|
102
|
+
const live = getLive();
|
|
103
|
+
if (pending) {
|
|
104
|
+
if (candidate === request) requestedResult = false;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (candidate.savePrevious && live && previous !== null && savedPrevious !== previous) {
|
|
108
|
+
try {
|
|
109
|
+
adapter.save(live, previous);
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
savedPrevious = previous;
|
|
113
|
+
if (pending) {
|
|
114
|
+
if (candidate === request) requestedResult = false;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
current = candidate.next;
|
|
119
|
+
if (live) {
|
|
120
|
+
try {
|
|
121
|
+
adapter.apply(live, candidate.next);
|
|
122
|
+
} catch {
|
|
123
|
+
if (candidate === request) requestedResult = false;
|
|
124
|
+
}
|
|
125
|
+
} else if (!candidate.savePrevious && candidate === request) {
|
|
126
|
+
requestedResult = false;
|
|
127
|
+
}
|
|
128
|
+
if (pending && candidate === request) requestedResult = false;
|
|
129
|
+
}
|
|
130
|
+
} finally {
|
|
131
|
+
processing = false;
|
|
132
|
+
}
|
|
133
|
+
return requestedResult;
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
getCurrent: () => current,
|
|
137
|
+
transition: (next) => enqueue(next, true),
|
|
138
|
+
applyCurrent: () => enqueue(current, false)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
78
141
|
function resolveRegion(id, descriptor, overrides) {
|
|
79
142
|
return overrides[id] ?? descriptor.defaultRegion ?? "DockShell";
|
|
80
143
|
}
|
|
@@ -420,6 +483,7 @@ export {
|
|
|
420
483
|
createDockPanelCommands,
|
|
421
484
|
createDockReadyActivation,
|
|
422
485
|
createDockReadyCleanup,
|
|
486
|
+
createDockScopeTransition,
|
|
423
487
|
designedDockPanelPosition,
|
|
424
488
|
getDockRegions,
|
|
425
489
|
getDockviewApi,
|