react-dockable-desktop 7.0.1 → 7.1.1

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
@@ -1,4 +1,4 @@
1
- import React$1, { ComponentType } from 'react';
1
+ import React$1, { ComponentType, ReactNode } from 'react';
2
2
 
3
3
  /**
4
4
  * @file predefinedMessages.ts
@@ -245,6 +245,12 @@ interface ShowContextMenuOptions {
245
245
  x?: number;
246
246
  y?: number;
247
247
  items: ContextMenuItem[];
248
+ /**
249
+ * The menu's direction. By default it is the direction of the element the menu was opened from
250
+ * (the event's target); a workspace's `showContextMenu` passes its own direction for a menu
251
+ * opened without an event. The menu is portaled to `<body>`, so it can't inherit either.
252
+ */
253
+ dir?: 'ltr' | 'rtl';
248
254
  }
249
255
  interface ContextMenuHandle {
250
256
  show(options: ShowContextMenuOptions): void;
@@ -392,6 +398,10 @@ interface PanelInfo {
392
398
  * key, `openPanel` focuses that existing panel instead of creating a new one — see
393
399
  * {@link WorkspaceActions.openPanel}'s `dedupeKey` option and {@link WorkspaceActions.findPanelId}. */
394
400
  dedupeKey?: string;
401
+ /** Icon set at runtime with `usePanel().setIcon()` or {@link WorkspaceActions.setPanelIcon},
402
+ * shown instead of the registration's `defaultOptions.icon`. Never saved by `saveLayout()`;
403
+ * `loadLayout()` keeps it for a panel that is still open. */
404
+ icon?: React$1.ReactNode;
395
405
  }
396
406
  /**
397
407
  * Options accepted by {@link WorkspaceActions.openPanel}.
@@ -712,6 +722,14 @@ interface WorkspaceActions {
712
722
  * @param title - New title string or localizable message descriptor.
713
723
  */
714
724
  updatePanelTitle: (id: string, title: string | MessageDescriptor) => void;
725
+ /**
726
+ * Sets the icon shown on an open panel's tab, floating title bar and taskbar button, in place
727
+ * of its registration's `defaultOptions.icon`. `null` restores the registration's icon. The icon
728
+ * lives only in memory: `saveLayout()` never writes it.
729
+ * @param id - Panel instance ID.
730
+ * @param icon - The icon, or `null` to go back to the registration's.
731
+ */
732
+ setPanelIcon: (id: string, icon: React$1.ReactNode | null) => void;
715
733
  /**
716
734
  * Closes a panel, first running any registered close guards.
717
735
  * If the panel is dirty, shows the built-in unsaved-changes confirmation dialog.
@@ -1088,6 +1106,8 @@ declare class WorkspaceClient<TUserEvents extends object = Record<string, unknow
1088
1106
  setPanelDirty(id: string, dirty: boolean, options?: DirtyStateOptions): void;
1089
1107
  /** Updates a panel's displayed title. */
1090
1108
  updatePanelTitle(id: string, title: string | MessageDescriptor): void;
1109
+ /** Sets an open panel's tab/window/taskbar icon; `null` restores its registration's icon. Not saved by `saveLayout()`. */
1110
+ setPanelIcon(id: string, icon: ReactNode | null): void;
1091
1111
  /**
1092
1112
  * Requests that a panel close, honoring its dirty flag and any registered close guard.
1093
1113
  * Resolves once the close (or user cancellation) has been resolved.
@@ -1287,9 +1307,9 @@ interface PanelHandle {
1287
1307
  /** Changes the title shown on the tab, window or modal. */
1288
1308
  setTitle: (title: string | MessageDescriptor) => void;
1289
1309
  /**
1290
- * Changes the icon shown in a modal's or drawer's header. A docked or floating panel shows the
1291
- * icon from its registration (`defaultOptions.icon`); there this does nothing, and warns once in
1292
- * development.
1310
+ * Changes the icon on the panel's tab, floating title bar and taskbar button, or in a modal's or
1311
+ * drawer's header. In a workspace panel, `null` goes back to the registration's
1312
+ * `defaultOptions.icon`. The icon is not saved by `saveLayout()`.
1293
1313
  */
1294
1314
  setIcon: (icon: React$1.ReactNode) => void;
1295
1315
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1, { ComponentType } from 'react';
1
+ import React$1, { ComponentType, ReactNode } from 'react';
2
2
 
3
3
  /**
4
4
  * @file predefinedMessages.ts
@@ -245,6 +245,12 @@ interface ShowContextMenuOptions {
245
245
  x?: number;
246
246
  y?: number;
247
247
  items: ContextMenuItem[];
248
+ /**
249
+ * The menu's direction. By default it is the direction of the element the menu was opened from
250
+ * (the event's target); a workspace's `showContextMenu` passes its own direction for a menu
251
+ * opened without an event. The menu is portaled to `<body>`, so it can't inherit either.
252
+ */
253
+ dir?: 'ltr' | 'rtl';
248
254
  }
249
255
  interface ContextMenuHandle {
250
256
  show(options: ShowContextMenuOptions): void;
@@ -392,6 +398,10 @@ interface PanelInfo {
392
398
  * key, `openPanel` focuses that existing panel instead of creating a new one — see
393
399
  * {@link WorkspaceActions.openPanel}'s `dedupeKey` option and {@link WorkspaceActions.findPanelId}. */
394
400
  dedupeKey?: string;
401
+ /** Icon set at runtime with `usePanel().setIcon()` or {@link WorkspaceActions.setPanelIcon},
402
+ * shown instead of the registration's `defaultOptions.icon`. Never saved by `saveLayout()`;
403
+ * `loadLayout()` keeps it for a panel that is still open. */
404
+ icon?: React$1.ReactNode;
395
405
  }
396
406
  /**
397
407
  * Options accepted by {@link WorkspaceActions.openPanel}.
@@ -712,6 +722,14 @@ interface WorkspaceActions {
712
722
  * @param title - New title string or localizable message descriptor.
713
723
  */
714
724
  updatePanelTitle: (id: string, title: string | MessageDescriptor) => void;
725
+ /**
726
+ * Sets the icon shown on an open panel's tab, floating title bar and taskbar button, in place
727
+ * of its registration's `defaultOptions.icon`. `null` restores the registration's icon. The icon
728
+ * lives only in memory: `saveLayout()` never writes it.
729
+ * @param id - Panel instance ID.
730
+ * @param icon - The icon, or `null` to go back to the registration's.
731
+ */
732
+ setPanelIcon: (id: string, icon: React$1.ReactNode | null) => void;
715
733
  /**
716
734
  * Closes a panel, first running any registered close guards.
717
735
  * If the panel is dirty, shows the built-in unsaved-changes confirmation dialog.
@@ -1088,6 +1106,8 @@ declare class WorkspaceClient<TUserEvents extends object = Record<string, unknow
1088
1106
  setPanelDirty(id: string, dirty: boolean, options?: DirtyStateOptions): void;
1089
1107
  /** Updates a panel's displayed title. */
1090
1108
  updatePanelTitle(id: string, title: string | MessageDescriptor): void;
1109
+ /** Sets an open panel's tab/window/taskbar icon; `null` restores its registration's icon. Not saved by `saveLayout()`. */
1110
+ setPanelIcon(id: string, icon: ReactNode | null): void;
1091
1111
  /**
1092
1112
  * Requests that a panel close, honoring its dirty flag and any registered close guard.
1093
1113
  * Resolves once the close (or user cancellation) has been resolved.
@@ -1287,9 +1307,9 @@ interface PanelHandle {
1287
1307
  /** Changes the title shown on the tab, window or modal. */
1288
1308
  setTitle: (title: string | MessageDescriptor) => void;
1289
1309
  /**
1290
- * Changes the icon shown in a modal's or drawer's header. A docked or floating panel shows the
1291
- * icon from its registration (`defaultOptions.icon`); there this does nothing, and warns once in
1292
- * development.
1310
+ * Changes the icon on the panel's tab, floating title bar and taskbar button, or in a modal's or
1311
+ * drawer's header. In a workspace panel, `null` goes back to the registration's
1312
+ * `defaultOptions.icon`. The icon is not saved by `saveLayout()`.
1293
1313
  */
1294
1314
  setIcon: (icon: React$1.ReactNode) => void;
1295
1315
  }