@forgeax/app-shell 0.33.0 → 0.35.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 +24 -1
- package/dist/dock.js +52 -0
- package/package.json +1 -1
package/dist/dock.d.ts
CHANGED
|
@@ -236,6 +236,29 @@ 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
|
+
/** Publish a fresh snapshot after the live Dock projection changes. */
|
|
247
|
+
refresh(): void;
|
|
248
|
+
/** Toggle visibility and preserve the previous anchor when none is supplied. */
|
|
249
|
+
toggle(anchor?: Anchor): void;
|
|
250
|
+
/** Close without publishing a duplicate snapshot when already closed. */
|
|
251
|
+
close(): void;
|
|
252
|
+
}
|
|
253
|
+
/** Own stable external-store state for a product-presented Dock layout control. */
|
|
254
|
+
declare function createDockLayoutControlState<Anchor>(initialAnchor?: Anchor | null): DockLayoutControlState<Anchor>;
|
|
255
|
+
interface DockLayoutControlToggleSource<Anchor> {
|
|
256
|
+
onToggle(listener: (anchor?: Anchor) => void): {
|
|
257
|
+
dispose(): void;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/** Own one layout-control toggle subscription while product callers map events and payloads. */
|
|
261
|
+
declare function installDockLayoutControlToggle<Anchor>(source: DockLayoutControlToggleSource<Anchor>, state: Pick<DockLayoutControlState<Anchor>, 'toggle'>): () => void;
|
|
239
262
|
type SideEdge = 'left' | 'right';
|
|
240
263
|
interface RectLike {
|
|
241
264
|
left: number;
|
|
@@ -273,4 +296,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
|
|
|
273
296
|
titleFor?: (panelId: string) => string | undefined;
|
|
274
297
|
}): void;
|
|
275
298
|
|
|
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 };
|
|
299
|
+
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,56 @@ 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, force = false) => {
|
|
555
|
+
if (!force && 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
|
+
refresh: () => commit(snapshot.open, snapshot.anchor, true),
|
|
576
|
+
toggle: (anchor) => commit(
|
|
577
|
+
!snapshot.open,
|
|
578
|
+
anchor === void 0 ? snapshot.anchor : anchor
|
|
579
|
+
),
|
|
580
|
+
close: () => commit(false, snapshot.anchor)
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function installDockLayoutControlToggle(source, state) {
|
|
584
|
+
let active = true;
|
|
585
|
+
const subscription = source.onToggle((anchor) => {
|
|
586
|
+
if (!active) return;
|
|
587
|
+
try {
|
|
588
|
+
state.toggle(anchor);
|
|
589
|
+
} catch {
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
return () => {
|
|
593
|
+
if (!active) return;
|
|
594
|
+
active = false;
|
|
595
|
+
try {
|
|
596
|
+
subscription.dispose();
|
|
597
|
+
} catch {
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
}
|
|
551
601
|
function isOnSideEdge(location) {
|
|
552
602
|
return location.type === "edge" && (location.position === "left" || location.position === "right");
|
|
553
603
|
}
|
|
@@ -602,6 +652,7 @@ function handleCrossInstanceDrop(event, targetRegion, moveTo, options) {
|
|
|
602
652
|
export {
|
|
603
653
|
DOCK_REGIONS,
|
|
604
654
|
REGIONS,
|
|
655
|
+
createDockLayoutControlState,
|
|
605
656
|
createDockLayoutPersistence,
|
|
606
657
|
createDockPanelCommands,
|
|
607
658
|
createDockReadyActivation,
|
|
@@ -612,6 +663,7 @@ export {
|
|
|
612
663
|
getDockviewApi,
|
|
613
664
|
handleCrossInstanceDrop,
|
|
614
665
|
hasMountedPanelPlacement,
|
|
666
|
+
installDockLayoutControlToggle,
|
|
615
667
|
installDockLayoutObservation,
|
|
616
668
|
installDockLayoutReset,
|
|
617
669
|
installDockPanelCommandSubscriptions,
|