@forgeax/app-shell 0.26.0 → 0.28.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 CHANGED
@@ -3,6 +3,20 @@ type Region = typeof REGIONS[number];
3
3
  declare const DOCK_REGIONS: readonly ["DockShell", "AuxBar", "ChatDock"];
4
4
  type DockRegion = typeof DOCK_REGIONS[number];
5
5
  declare function isDockRegion(value: string): value is DockRegion;
6
+ interface DockReadyCleanup {
7
+ /** Register one teardown while active; late registrations are disposed immediately. */
8
+ add(dispose: () => void): boolean;
9
+ /** Dispose registered teardowns once, in reverse registration order. */
10
+ dispose(): void;
11
+ }
12
+ /** Own the best-effort teardown lifecycle of one dock-ready session. */
13
+ declare function createDockReadyCleanup(): DockReadyCleanup;
14
+ type DockReadyAdapterInstaller = () => void | (() => void);
15
+ interface DockReadyAdapterSession extends DockReadyCleanup {
16
+ readonly installed: boolean;
17
+ }
18
+ /** Replace one dock-ready adapter session with an ordered, rollback-safe transaction. */
19
+ declare function replaceDockReadyAdapters(previous: DockReadyCleanup | null | undefined, installers: readonly DockReadyAdapterInstaller[]): DockReadyAdapterSession;
6
20
  interface PanelDescriptorLite {
7
21
  defaultRegion?: DockRegion;
8
22
  }
@@ -174,4 +188,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
174
188
  titleFor?: (panelId: string) => string | undefined;
175
189
  }): void;
176
190
 
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 };
191
+ 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 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, createDockReadyCleanup, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
package/dist/dock.js CHANGED
@@ -4,6 +4,50 @@ var DOCK_REGIONS = ["DockShell", "AuxBar", "ChatDock"];
4
4
  function isDockRegion(value) {
5
5
  return DOCK_REGIONS.includes(value);
6
6
  }
7
+ function createDockReadyCleanup() {
8
+ const disposers = [];
9
+ let active = true;
10
+ return {
11
+ add(dispose) {
12
+ if (active) {
13
+ disposers.push(dispose);
14
+ return true;
15
+ }
16
+ try {
17
+ dispose();
18
+ } catch {
19
+ }
20
+ return false;
21
+ },
22
+ dispose() {
23
+ if (!active) return;
24
+ active = false;
25
+ while (disposers.length > 0) {
26
+ try {
27
+ disposers.pop()?.();
28
+ } catch {
29
+ }
30
+ }
31
+ }
32
+ };
33
+ }
34
+ function replaceDockReadyAdapters(previous, installers) {
35
+ try {
36
+ previous?.dispose();
37
+ } catch {
38
+ }
39
+ const cleanup = createDockReadyCleanup();
40
+ try {
41
+ for (const install of installers) {
42
+ const dispose = install();
43
+ if (dispose) cleanup.add(dispose);
44
+ }
45
+ return { ...cleanup, installed: true };
46
+ } catch {
47
+ cleanup.dispose();
48
+ return { ...cleanup, installed: false };
49
+ }
50
+ }
7
51
  function resolveRegion(id, descriptor, overrides) {
8
52
  return overrides[id] ?? descriptor.defaultRegion ?? "DockShell";
9
53
  }
@@ -347,6 +391,7 @@ export {
347
391
  REGIONS,
348
392
  createDockLayoutPersistence,
349
393
  createDockPanelCommands,
394
+ createDockReadyCleanup,
350
395
  designedDockPanelPosition,
351
396
  getDockRegions,
352
397
  getDockviewApi,
@@ -360,6 +405,7 @@ export {
360
405
  pruneSerializedDockLayout,
361
406
  registerDockRegion,
362
407
  registerDockviewApi,
408
+ replaceDockReadyAdapters,
363
409
  resolveRegion,
364
410
  trackDockPanelVisibility
365
411
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",