@forgeax/app-shell 0.33.0 → 0.34.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 +22 -1
- package/dist/dock.js +51 -0
- package/package.json +1 -1
package/dist/dock.d.ts
CHANGED
|
@@ -236,6 +236,27 @@ interface DockPanelCommandSubscriptionSource {
|
|
|
236
236
|
* payload mapping, membership, titles, layout policy, and concrete Dock APIs.
|
|
237
237
|
*/
|
|
238
238
|
declare function installDockPanelCommandSubscriptions(source: DockPanelCommandSubscriptionSource, commands: DockPanelCommands): () => void;
|
|
239
|
+
interface DockLayoutControlSnapshot<Anchor> {
|
|
240
|
+
readonly open: boolean;
|
|
241
|
+
readonly anchor: Anchor | null;
|
|
242
|
+
}
|
|
243
|
+
interface DockLayoutControlState<Anchor> {
|
|
244
|
+
getSnapshot(): DockLayoutControlSnapshot<Anchor>;
|
|
245
|
+
subscribe(listener: () => void): () => void;
|
|
246
|
+
/** Toggle visibility and preserve the previous anchor when none is supplied. */
|
|
247
|
+
toggle(anchor?: Anchor): void;
|
|
248
|
+
/** Close without publishing a duplicate snapshot when already closed. */
|
|
249
|
+
close(): void;
|
|
250
|
+
}
|
|
251
|
+
/** Own stable external-store state for a product-presented Dock layout control. */
|
|
252
|
+
declare function createDockLayoutControlState<Anchor>(initialAnchor?: Anchor | null): DockLayoutControlState<Anchor>;
|
|
253
|
+
interface DockLayoutControlToggleSource<Anchor> {
|
|
254
|
+
onToggle(listener: (anchor?: Anchor) => void): {
|
|
255
|
+
dispose(): void;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/** Own one layout-control toggle subscription while product callers map events and payloads. */
|
|
259
|
+
declare function installDockLayoutControlToggle<Anchor>(source: DockLayoutControlToggleSource<Anchor>, state: Pick<DockLayoutControlState<Anchor>, 'toggle'>): () => void;
|
|
239
260
|
type SideEdge = 'left' | 'right';
|
|
240
261
|
interface RectLike {
|
|
241
262
|
left: number;
|
|
@@ -273,4 +294,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
|
|
|
273
294
|
titleFor?: (panelId: string) => string | undefined;
|
|
274
295
|
}): void;
|
|
275
296
|
|
|
276
|
-
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 DockLayoutResetAdapter, type DockLayoutResetSource, type DockPanelCommandAdapter, type DockPanelCommandSubscriptionSource, 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, installDockLayoutReset, installDockPanelCommandSubscriptions, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
|
|
297
|
+
export { type AuthoredDockLayoutLike, type AuthoredDockNodeLike, type CrossInstanceDropEvent, DOCK_REGIONS, type DesignedDockPanelPosition, type DockCommandPanel, type DockLayoutControlSnapshot, type DockLayoutControlState, type DockLayoutControlToggleSource, type DockLayoutObservationAdapter, type DockLayoutObservationSource, type DockLayoutOrientation, type DockLayoutPersistence, type DockLayoutPersistenceAdapter, type DockLayoutPersistenceScope, type DockLayoutResetAdapter, type DockLayoutResetSource, type DockPanelCommandAdapter, type DockPanelCommandSubscriptionSource, 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, createDockLayoutControlState, createDockLayoutPersistence, createDockPanelCommands, createDockReadyActivation, createDockReadyCleanup, createDockScopeTransition, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockLayoutControlToggle, installDockLayoutObservation, installDockLayoutReset, installDockPanelCommandSubscriptions, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
|
package/dist/dock.js
CHANGED
|
@@ -548,6 +548,55 @@ function installDockPanelCommandSubscriptions(source, commands) {
|
|
|
548
548
|
}
|
|
549
549
|
return cleanup;
|
|
550
550
|
}
|
|
551
|
+
function createDockLayoutControlState(initialAnchor = null) {
|
|
552
|
+
let snapshot = { open: false, anchor: initialAnchor };
|
|
553
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
554
|
+
const commit = (open, anchor) => {
|
|
555
|
+
if (snapshot.open === open && snapshot.anchor === anchor) return;
|
|
556
|
+
snapshot = { open, anchor };
|
|
557
|
+
for (const listener of [...listeners]) {
|
|
558
|
+
try {
|
|
559
|
+
listener();
|
|
560
|
+
} catch {
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
return {
|
|
565
|
+
getSnapshot: () => snapshot,
|
|
566
|
+
subscribe(listener) {
|
|
567
|
+
listeners.add(listener);
|
|
568
|
+
let subscribed = true;
|
|
569
|
+
return () => {
|
|
570
|
+
if (!subscribed) return;
|
|
571
|
+
subscribed = false;
|
|
572
|
+
listeners.delete(listener);
|
|
573
|
+
};
|
|
574
|
+
},
|
|
575
|
+
toggle: (anchor) => commit(
|
|
576
|
+
!snapshot.open,
|
|
577
|
+
anchor === void 0 ? snapshot.anchor : anchor
|
|
578
|
+
),
|
|
579
|
+
close: () => commit(false, snapshot.anchor)
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function installDockLayoutControlToggle(source, state) {
|
|
583
|
+
let active = true;
|
|
584
|
+
const subscription = source.onToggle((anchor) => {
|
|
585
|
+
if (!active) return;
|
|
586
|
+
try {
|
|
587
|
+
state.toggle(anchor);
|
|
588
|
+
} catch {
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
return () => {
|
|
592
|
+
if (!active) return;
|
|
593
|
+
active = false;
|
|
594
|
+
try {
|
|
595
|
+
subscription.dispose();
|
|
596
|
+
} catch {
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
}
|
|
551
600
|
function isOnSideEdge(location) {
|
|
552
601
|
return location.type === "edge" && (location.position === "left" || location.position === "right");
|
|
553
602
|
}
|
|
@@ -602,6 +651,7 @@ function handleCrossInstanceDrop(event, targetRegion, moveTo, options) {
|
|
|
602
651
|
export {
|
|
603
652
|
DOCK_REGIONS,
|
|
604
653
|
REGIONS,
|
|
654
|
+
createDockLayoutControlState,
|
|
605
655
|
createDockLayoutPersistence,
|
|
606
656
|
createDockPanelCommands,
|
|
607
657
|
createDockReadyActivation,
|
|
@@ -612,6 +662,7 @@ export {
|
|
|
612
662
|
getDockviewApi,
|
|
613
663
|
handleCrossInstanceDrop,
|
|
614
664
|
hasMountedPanelPlacement,
|
|
665
|
+
installDockLayoutControlToggle,
|
|
615
666
|
installDockLayoutObservation,
|
|
616
667
|
installDockLayoutReset,
|
|
617
668
|
installDockPanelCommandSubscriptions,
|