@forgeax/app-shell 0.34.0 → 0.36.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
@@ -236,6 +236,19 @@ 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 DockLayoutPanelControlAdapter {
240
+ isOpen(panelId: string): boolean;
241
+ close(panelId: string): void;
242
+ reopen(panelId: string): void;
243
+ }
244
+ interface DockLayoutPanelControl {
245
+ /** Project whether the live Dock currently contains the panel. */
246
+ isOpen(panelId: string): boolean;
247
+ /** Close an open panel or reopen a closed panel. Returns false when the adapter fails. */
248
+ toggle(panelId: string): boolean;
249
+ }
250
+ /** Own product-neutral panel projection and close-vs-reopen selection for a layout control. */
251
+ declare function createDockLayoutPanelControl(adapter: DockLayoutPanelControlAdapter): DockLayoutPanelControl;
239
252
  interface DockLayoutControlSnapshot<Anchor> {
240
253
  readonly open: boolean;
241
254
  readonly anchor: Anchor | null;
@@ -243,6 +256,8 @@ interface DockLayoutControlSnapshot<Anchor> {
243
256
  interface DockLayoutControlState<Anchor> {
244
257
  getSnapshot(): DockLayoutControlSnapshot<Anchor>;
245
258
  subscribe(listener: () => void): () => void;
259
+ /** Publish a fresh snapshot after the live Dock projection changes. */
260
+ refresh(): void;
246
261
  /** Toggle visibility and preserve the previous anchor when none is supplied. */
247
262
  toggle(anchor?: Anchor): void;
248
263
  /** Close without publishing a duplicate snapshot when already closed. */
@@ -294,4 +309,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
294
309
  titleFor?: (panelId: string) => string | undefined;
295
310
  }): void;
296
311
 
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 };
312
+ 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 DockLayoutPanelControl, type DockLayoutPanelControlAdapter, 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, createDockLayoutPanelControl, 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,11 +548,37 @@ function installDockPanelCommandSubscriptions(source, commands) {
548
548
  }
549
549
  return cleanup;
550
550
  }
551
+ function createDockLayoutPanelControl(adapter) {
552
+ const readOpen = (panelId) => {
553
+ try {
554
+ return { ok: true, value: adapter.isOpen(panelId) };
555
+ } catch {
556
+ return { ok: false };
557
+ }
558
+ };
559
+ return {
560
+ isOpen(panelId) {
561
+ const result = readOpen(panelId);
562
+ return result.ok ? result.value : false;
563
+ },
564
+ toggle(panelId) {
565
+ const result = readOpen(panelId);
566
+ if (!result.ok) return false;
567
+ try {
568
+ if (result.value) adapter.close(panelId);
569
+ else adapter.reopen(panelId);
570
+ return true;
571
+ } catch {
572
+ return false;
573
+ }
574
+ }
575
+ };
576
+ }
551
577
  function createDockLayoutControlState(initialAnchor = null) {
552
578
  let snapshot = { open: false, anchor: initialAnchor };
553
579
  const listeners = /* @__PURE__ */ new Set();
554
- const commit = (open, anchor) => {
555
- if (snapshot.open === open && snapshot.anchor === anchor) return;
580
+ const commit = (open, anchor, force = false) => {
581
+ if (!force && snapshot.open === open && snapshot.anchor === anchor) return;
556
582
  snapshot = { open, anchor };
557
583
  for (const listener of [...listeners]) {
558
584
  try {
@@ -572,6 +598,7 @@ function createDockLayoutControlState(initialAnchor = null) {
572
598
  listeners.delete(listener);
573
599
  };
574
600
  },
601
+ refresh: () => commit(snapshot.open, snapshot.anchor, true),
575
602
  toggle: (anchor) => commit(
576
603
  !snapshot.open,
577
604
  anchor === void 0 ? snapshot.anchor : anchor
@@ -652,6 +679,7 @@ export {
652
679
  DOCK_REGIONS,
653
680
  REGIONS,
654
681
  createDockLayoutControlState,
682
+ createDockLayoutPanelControl,
655
683
  createDockLayoutPersistence,
656
684
  createDockPanelCommands,
657
685
  createDockReadyActivation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",