react-dockable-desktop 6.3.0 → 6.3.2

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/index.d.cts CHANGED
@@ -112,11 +112,12 @@ interface BuiltInPanelEvents {
112
112
  };
113
113
  /**
114
114
  * Fires whenever something `saveLayout()` would capture changes — open/close/minimize/restore,
115
- * and an `openPanel` `dedupeKey` redirect. Coalesces those into one signal for autosave-style
116
- * consumers, so they don't need to subscribe to four separate events. Does **not** cover a
115
+ * float/dock/re-order/dock-to-edge, closing a group, maximizing a minimized panel, and an
116
+ * `openPanel` `dedupeKey` redirect. Coalesces those into one signal for autosave-style
117
+ * consumers, so they don't need to subscribe to separate events. Does **not** cover a
117
118
  * `registerStateProvider` callback's return value changing on its own — that's a pull, there's
118
119
  * no way to observe it changing without the panel separately notifying — nor resize/split-ratio
119
- * drag/dock-rearrange, which have no hooks yet.
120
+ * drag, which has no hook yet.
120
121
  */
121
122
  'layout:changed': Record<string, never>;
122
123
  /**
@@ -212,7 +213,7 @@ interface WorkspaceClientConfig {
212
213
  * workspace.openPanel('map-1', 'map');
213
214
  * workspace.focusPanel('map-1');
214
215
  */
215
- declare class WorkspaceClient<TUserEvents extends Record<string, unknown> = Record<string, unknown>> {
216
+ declare class WorkspaceClient<TUserEvents extends object = Record<string, unknown>> {
216
217
  /** Scoped panel registry — fully independent from the global singleton. */
217
218
  readonly registry: PanelRegistryClass;
218
219
  /** Serialised layout to restore on mount, or null to start with an empty canvas. */
@@ -272,8 +273,18 @@ declare class WorkspaceClient<TUserEvents extends Record<string, unknown> = Reco
272
273
  dockPanelToGroup(id: string, targetLeafId: string, position: DropPosition): void;
273
274
  /** Reorders a panel's tab within its leaf group. */
274
275
  movePanelOrder(panelId: string, targetLeafId: string, targetIndex: number): void;
275
- /** Closes an entire leaf group (all of its tabs) at once. */
276
- closeLeafGroup(leafId: string): void;
276
+ /**
277
+ * Closes a leaf group: each of its tabs is closed through the guarded close path, then the
278
+ * group is removed once empty. A tab whose close guard refuses — or a dirty tab that
279
+ * `onConfirm` doesn't approve — stays open, and so does its group.
280
+ * Resolves once every close request has been settled.
281
+ *
282
+ * @remarks If called before the provider mounts, the request is queued and this returns an
283
+ * already-resolved promise, as `requestClosePanel` does.
284
+ */
285
+ closeLeafGroup(leafId: string, options?: {
286
+ onConfirm?: (opts?: DirtyStateOptions) => Promise<boolean>;
287
+ }): Promise<void>;
277
288
  /** Registers a guard that can veto closing the given panel. */
278
289
  registerCloseGuard(id: string, guard: () => boolean | Promise<boolean>): void;
279
290
  /** Removes a previously registered close guard. */
@@ -864,10 +875,17 @@ interface WindowActions {
864
875
  */
865
876
  movePanelOrder: (panelId: string, targetLeafId: string, targetIndex: number) => void;
866
877
  /**
867
- * Closes an empty leaf group (removes it from the grid tree).
868
- * @param leafId - Leaf node ID to remove.
878
+ * Closes a leaf group: each of its panels is closed through the guarded close path (as if by
879
+ * its own tab ×), then the group is removed once empty. A close guard that refuses, or a dirty
880
+ * panel that `onConfirm` doesn't approve, keeps that panel — and therefore the group.
881
+ * A group with `canClose: false` is left alone.
882
+ * @param leafId - Leaf node ID to close.
883
+ * @param options.onConfirm - Asked for each dirty panel; resolve `true` to discard its changes.
884
+ * @returns Resolves once every close request has been settled.
869
885
  */
870
- closeLeafGroup: (leafId: string) => void;
886
+ closeLeafGroup: (leafId: string, options?: {
887
+ onConfirm?: (opts?: DirtyStateOptions) => Promise<boolean>;
888
+ }) => Promise<void>;
871
889
  /**
872
890
  * Registers a close guard that can intercept and cancel panel close requests.
873
891
  * @param id - Panel instance ID to guard.
package/dist/index.d.ts CHANGED
@@ -112,11 +112,12 @@ interface BuiltInPanelEvents {
112
112
  };
113
113
  /**
114
114
  * Fires whenever something `saveLayout()` would capture changes — open/close/minimize/restore,
115
- * and an `openPanel` `dedupeKey` redirect. Coalesces those into one signal for autosave-style
116
- * consumers, so they don't need to subscribe to four separate events. Does **not** cover a
115
+ * float/dock/re-order/dock-to-edge, closing a group, maximizing a minimized panel, and an
116
+ * `openPanel` `dedupeKey` redirect. Coalesces those into one signal for autosave-style
117
+ * consumers, so they don't need to subscribe to separate events. Does **not** cover a
117
118
  * `registerStateProvider` callback's return value changing on its own — that's a pull, there's
118
119
  * no way to observe it changing without the panel separately notifying — nor resize/split-ratio
119
- * drag/dock-rearrange, which have no hooks yet.
120
+ * drag, which has no hook yet.
120
121
  */
121
122
  'layout:changed': Record<string, never>;
122
123
  /**
@@ -212,7 +213,7 @@ interface WorkspaceClientConfig {
212
213
  * workspace.openPanel('map-1', 'map');
213
214
  * workspace.focusPanel('map-1');
214
215
  */
215
- declare class WorkspaceClient<TUserEvents extends Record<string, unknown> = Record<string, unknown>> {
216
+ declare class WorkspaceClient<TUserEvents extends object = Record<string, unknown>> {
216
217
  /** Scoped panel registry — fully independent from the global singleton. */
217
218
  readonly registry: PanelRegistryClass;
218
219
  /** Serialised layout to restore on mount, or null to start with an empty canvas. */
@@ -272,8 +273,18 @@ declare class WorkspaceClient<TUserEvents extends Record<string, unknown> = Reco
272
273
  dockPanelToGroup(id: string, targetLeafId: string, position: DropPosition): void;
273
274
  /** Reorders a panel's tab within its leaf group. */
274
275
  movePanelOrder(panelId: string, targetLeafId: string, targetIndex: number): void;
275
- /** Closes an entire leaf group (all of its tabs) at once. */
276
- closeLeafGroup(leafId: string): void;
276
+ /**
277
+ * Closes a leaf group: each of its tabs is closed through the guarded close path, then the
278
+ * group is removed once empty. A tab whose close guard refuses — or a dirty tab that
279
+ * `onConfirm` doesn't approve — stays open, and so does its group.
280
+ * Resolves once every close request has been settled.
281
+ *
282
+ * @remarks If called before the provider mounts, the request is queued and this returns an
283
+ * already-resolved promise, as `requestClosePanel` does.
284
+ */
285
+ closeLeafGroup(leafId: string, options?: {
286
+ onConfirm?: (opts?: DirtyStateOptions) => Promise<boolean>;
287
+ }): Promise<void>;
277
288
  /** Registers a guard that can veto closing the given panel. */
278
289
  registerCloseGuard(id: string, guard: () => boolean | Promise<boolean>): void;
279
290
  /** Removes a previously registered close guard. */
@@ -864,10 +875,17 @@ interface WindowActions {
864
875
  */
865
876
  movePanelOrder: (panelId: string, targetLeafId: string, targetIndex: number) => void;
866
877
  /**
867
- * Closes an empty leaf group (removes it from the grid tree).
868
- * @param leafId - Leaf node ID to remove.
878
+ * Closes a leaf group: each of its panels is closed through the guarded close path (as if by
879
+ * its own tab ×), then the group is removed once empty. A close guard that refuses, or a dirty
880
+ * panel that `onConfirm` doesn't approve, keeps that panel — and therefore the group.
881
+ * A group with `canClose: false` is left alone.
882
+ * @param leafId - Leaf node ID to close.
883
+ * @param options.onConfirm - Asked for each dirty panel; resolve `true` to discard its changes.
884
+ * @returns Resolves once every close request has been settled.
869
885
  */
870
- closeLeafGroup: (leafId: string) => void;
886
+ closeLeafGroup: (leafId: string, options?: {
887
+ onConfirm?: (opts?: DirtyStateOptions) => Promise<boolean>;
888
+ }) => Promise<void>;
871
889
  /**
872
890
  * Registers a close guard that can intercept and cancel panel close requests.
873
891
  * @param id - Panel instance ID to guard.