react-dockable-desktop 7.2.0 → 7.4.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/index.d.cts CHANGED
@@ -187,7 +187,7 @@ interface DirtyStateOptions {
187
187
  * Custom header title text or localizable message descriptor.
188
188
  * Replaces the default "Unsaved Changes" title.
189
189
  */
190
- title?: string | MessageDescriptor;
190
+ title?: string | MessageDescriptor | (() => string);
191
191
  /**
192
192
  * Custom warning explanation text or localizable message descriptor.
193
193
  * Replaces the standard default message body templates.
@@ -363,7 +363,7 @@ interface PanelInfo {
363
363
  /** Unique panel identifier. */
364
364
  id: string;
365
365
  /** Plain text label or localizable message descriptor. */
366
- title: string | MessageDescriptor;
366
+ title: string | MessageDescriptor | (() => string);
367
367
  /** String matching the component registration ID in the workspace's {@link PanelRegistry}. */
368
368
  component: string;
369
369
  /** Current workspace placement mode. */
@@ -408,7 +408,7 @@ interface PanelInfo {
408
408
  */
409
409
  interface OpenPanelOptions<P extends object = Record<string, unknown>> {
410
410
  /** Override the panel tab/window title. Accepts a plain string or an i18n message descriptor. */
411
- title?: string | MessageDescriptor;
411
+ title?: string | MessageDescriptor | (() => string);
412
412
  /** Initial placement: `'floating'`, `'docked'` (default when a grid exists), or `'tabbed'`. */
413
413
  initialTarget?: 'floating' | 'docked' | 'tabbed';
414
414
  /** Pin the new floating window to a workspace corner on creation. Has no effect when
@@ -445,7 +445,7 @@ interface WorkspaceState {
445
445
  /** Array of minimized panels waiting in the taskbar dock. */
446
446
  minimized: {
447
447
  id: string;
448
- title: string | MessageDescriptor;
448
+ title: string | MessageDescriptor | (() => string);
449
449
  component: string;
450
450
  }[];
451
451
  /** Map indexing panel metadata descriptors. */
@@ -721,7 +721,7 @@ interface WorkspaceActions {
721
721
  * @param id - Panel instance ID.
722
722
  * @param title - New title string or localizable message descriptor.
723
723
  */
724
- updatePanelTitle: (id: string, title: string | MessageDescriptor) => void;
724
+ updatePanelTitle: (id: string, title: string | MessageDescriptor | (() => string)) => void;
725
725
  /**
726
726
  * Sets the icon shown on an open panel's tab, floating title bar and taskbar button, in place
727
727
  * of its registration's `defaultOptions.icon`. `null` restores the registration's icon. The icon
@@ -808,7 +808,7 @@ interface SerializedLayout {
808
808
  floating: FloatingWindow[];
809
809
  minimized: {
810
810
  id: string;
811
- title: string | MessageDescriptor;
811
+ title: string | MessageDescriptor | (() => string);
812
812
  component: string;
813
813
  }[];
814
814
  panels: Record<string, PanelInfo>;
@@ -833,7 +833,7 @@ declare const useFormatMessage: () => MessageFormatter;
833
833
  /**
834
834
  * Helper to resolve dynamic label strings or localizable descriptor objects into text.
835
835
  */
836
- declare const formatLabel: (label: string | MessageDescriptor | undefined, formatter: MessageFormatter) => string;
836
+ declare const formatLabel: (label: string | MessageDescriptor | (() => string) | undefined, formatter: MessageFormatter) => string;
837
837
  /**
838
838
  * React hook to fetch the localizable predefined message map catalog.
839
839
  */
@@ -873,7 +873,7 @@ interface PanelRegistryEntry {
873
873
  id: string;
874
874
  defaultMessage?: string;
875
875
  values?: Record<string, string | number>;
876
- };
876
+ } | (() => string);
877
877
  /** Icon placed next to title tags. */
878
878
  icon?: React.ReactNode;
879
879
  /** Initial mounting state inside the desktop layout grid. */
@@ -1108,7 +1108,7 @@ declare class WorkspaceClient<TUserEvents extends object = Record<string, unknow
1108
1108
  /** Sets/clears a panel's dirty (unsaved changes) flag. */
1109
1109
  setPanelDirty(id: string, dirty: boolean, options?: DirtyStateOptions): void;
1110
1110
  /** Updates a panel's displayed title. */
1111
- updatePanelTitle(id: string, title: string | MessageDescriptor): void;
1111
+ updatePanelTitle(id: string, title: string | MessageDescriptor | (() => string)): void;
1112
1112
  /** Sets an open panel's tab/window/taskbar icon; `null` restores its registration's icon. Not saved by `saveLayout()`. */
1113
1113
  setPanelIcon(id: string, icon: ReactNode | null): void;
1114
1114
  /**
@@ -1180,8 +1180,13 @@ interface PanelTitleDescriptor {
1180
1180
  /** Parameters to inject into the translated text string. */
1181
1181
  values?: Record<string, string | number>;
1182
1182
  }
1183
- /** Union type representing either a plain string or a localizable title descriptor. */
1184
- type PanelTitle = string | PanelTitleDescriptor;
1183
+ /**
1184
+ * A panel, window, drawer or modal title: a plain string, a localizable descriptor, or (7.4.0) a
1185
+ * function returning the text — called each time the title is rendered, so a title built with the
1186
+ * app's own translation function follows a language change. A function title is not saved in a
1187
+ * layout: a restored panel takes its registered default title.
1188
+ */
1189
+ type PanelTitle = string | PanelTitleDescriptor | (() => string);
1185
1190
  /** Configuration options applied when opening a SidePanel. */
1186
1191
  interface SidePanelOptions {
1187
1192
  /** Display title for the side-panel header. */
@@ -1309,7 +1314,7 @@ interface PanelHandle {
1309
1314
  /** Marks the panel as having unsaved changes. */
1310
1315
  setDirty: (dirty: boolean, options?: DirtyStateOptions) => void;
1311
1316
  /** Changes the title shown on the tab, window or modal. */
1312
- setTitle: (title: string | MessageDescriptor) => void;
1317
+ setTitle: (title: string | MessageDescriptor | (() => string)) => void;
1313
1318
  /**
1314
1319
  * Changes the icon on the panel's tab, floating title bar and taskbar button, or in a modal's or
1315
1320
  * drawer's header. In a workspace panel, `null` goes back to the registration's
@@ -1528,7 +1533,7 @@ interface RddConfirmProps {
1528
1533
  id: string;
1529
1534
  defaultMessage?: string;
1530
1535
  values?: any;
1531
- };
1536
+ } | (() => string);
1532
1537
  /** Main message text or localizable descriptor to display. */
1533
1538
  message: string | {
1534
1539
  id: string;
package/dist/index.d.ts CHANGED
@@ -187,7 +187,7 @@ interface DirtyStateOptions {
187
187
  * Custom header title text or localizable message descriptor.
188
188
  * Replaces the default "Unsaved Changes" title.
189
189
  */
190
- title?: string | MessageDescriptor;
190
+ title?: string | MessageDescriptor | (() => string);
191
191
  /**
192
192
  * Custom warning explanation text or localizable message descriptor.
193
193
  * Replaces the standard default message body templates.
@@ -363,7 +363,7 @@ interface PanelInfo {
363
363
  /** Unique panel identifier. */
364
364
  id: string;
365
365
  /** Plain text label or localizable message descriptor. */
366
- title: string | MessageDescriptor;
366
+ title: string | MessageDescriptor | (() => string);
367
367
  /** String matching the component registration ID in the workspace's {@link PanelRegistry}. */
368
368
  component: string;
369
369
  /** Current workspace placement mode. */
@@ -408,7 +408,7 @@ interface PanelInfo {
408
408
  */
409
409
  interface OpenPanelOptions<P extends object = Record<string, unknown>> {
410
410
  /** Override the panel tab/window title. Accepts a plain string or an i18n message descriptor. */
411
- title?: string | MessageDescriptor;
411
+ title?: string | MessageDescriptor | (() => string);
412
412
  /** Initial placement: `'floating'`, `'docked'` (default when a grid exists), or `'tabbed'`. */
413
413
  initialTarget?: 'floating' | 'docked' | 'tabbed';
414
414
  /** Pin the new floating window to a workspace corner on creation. Has no effect when
@@ -445,7 +445,7 @@ interface WorkspaceState {
445
445
  /** Array of minimized panels waiting in the taskbar dock. */
446
446
  minimized: {
447
447
  id: string;
448
- title: string | MessageDescriptor;
448
+ title: string | MessageDescriptor | (() => string);
449
449
  component: string;
450
450
  }[];
451
451
  /** Map indexing panel metadata descriptors. */
@@ -721,7 +721,7 @@ interface WorkspaceActions {
721
721
  * @param id - Panel instance ID.
722
722
  * @param title - New title string or localizable message descriptor.
723
723
  */
724
- updatePanelTitle: (id: string, title: string | MessageDescriptor) => void;
724
+ updatePanelTitle: (id: string, title: string | MessageDescriptor | (() => string)) => void;
725
725
  /**
726
726
  * Sets the icon shown on an open panel's tab, floating title bar and taskbar button, in place
727
727
  * of its registration's `defaultOptions.icon`. `null` restores the registration's icon. The icon
@@ -808,7 +808,7 @@ interface SerializedLayout {
808
808
  floating: FloatingWindow[];
809
809
  minimized: {
810
810
  id: string;
811
- title: string | MessageDescriptor;
811
+ title: string | MessageDescriptor | (() => string);
812
812
  component: string;
813
813
  }[];
814
814
  panels: Record<string, PanelInfo>;
@@ -833,7 +833,7 @@ declare const useFormatMessage: () => MessageFormatter;
833
833
  /**
834
834
  * Helper to resolve dynamic label strings or localizable descriptor objects into text.
835
835
  */
836
- declare const formatLabel: (label: string | MessageDescriptor | undefined, formatter: MessageFormatter) => string;
836
+ declare const formatLabel: (label: string | MessageDescriptor | (() => string) | undefined, formatter: MessageFormatter) => string;
837
837
  /**
838
838
  * React hook to fetch the localizable predefined message map catalog.
839
839
  */
@@ -873,7 +873,7 @@ interface PanelRegistryEntry {
873
873
  id: string;
874
874
  defaultMessage?: string;
875
875
  values?: Record<string, string | number>;
876
- };
876
+ } | (() => string);
877
877
  /** Icon placed next to title tags. */
878
878
  icon?: React.ReactNode;
879
879
  /** Initial mounting state inside the desktop layout grid. */
@@ -1108,7 +1108,7 @@ declare class WorkspaceClient<TUserEvents extends object = Record<string, unknow
1108
1108
  /** Sets/clears a panel's dirty (unsaved changes) flag. */
1109
1109
  setPanelDirty(id: string, dirty: boolean, options?: DirtyStateOptions): void;
1110
1110
  /** Updates a panel's displayed title. */
1111
- updatePanelTitle(id: string, title: string | MessageDescriptor): void;
1111
+ updatePanelTitle(id: string, title: string | MessageDescriptor | (() => string)): void;
1112
1112
  /** Sets an open panel's tab/window/taskbar icon; `null` restores its registration's icon. Not saved by `saveLayout()`. */
1113
1113
  setPanelIcon(id: string, icon: ReactNode | null): void;
1114
1114
  /**
@@ -1180,8 +1180,13 @@ interface PanelTitleDescriptor {
1180
1180
  /** Parameters to inject into the translated text string. */
1181
1181
  values?: Record<string, string | number>;
1182
1182
  }
1183
- /** Union type representing either a plain string or a localizable title descriptor. */
1184
- type PanelTitle = string | PanelTitleDescriptor;
1183
+ /**
1184
+ * A panel, window, drawer or modal title: a plain string, a localizable descriptor, or (7.4.0) a
1185
+ * function returning the text — called each time the title is rendered, so a title built with the
1186
+ * app's own translation function follows a language change. A function title is not saved in a
1187
+ * layout: a restored panel takes its registered default title.
1188
+ */
1189
+ type PanelTitle = string | PanelTitleDescriptor | (() => string);
1185
1190
  /** Configuration options applied when opening a SidePanel. */
1186
1191
  interface SidePanelOptions {
1187
1192
  /** Display title for the side-panel header. */
@@ -1309,7 +1314,7 @@ interface PanelHandle {
1309
1314
  /** Marks the panel as having unsaved changes. */
1310
1315
  setDirty: (dirty: boolean, options?: DirtyStateOptions) => void;
1311
1316
  /** Changes the title shown on the tab, window or modal. */
1312
- setTitle: (title: string | MessageDescriptor) => void;
1317
+ setTitle: (title: string | MessageDescriptor | (() => string)) => void;
1313
1318
  /**
1314
1319
  * Changes the icon on the panel's tab, floating title bar and taskbar button, or in a modal's or
1315
1320
  * drawer's header. In a workspace panel, `null` goes back to the registration's
@@ -1528,7 +1533,7 @@ interface RddConfirmProps {
1528
1533
  id: string;
1529
1534
  defaultMessage?: string;
1530
1535
  values?: any;
1531
- };
1536
+ } | (() => string);
1532
1537
  /** Main message text or localizable descriptor to display. */
1533
1538
  message: string | {
1534
1539
  id: string;