react-dockable-desktop 6.0.0 → 6.0.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
@@ -150,6 +150,10 @@ interface WorkspaceClientConfig {
150
150
  /**
151
151
  * Serialised layout produced by a previous saveLayout() call.
152
152
  * Pass null or omit to start with an empty canvas.
153
+ *
154
+ * Parsed synchronously before the first render. The restored `activePanelId` is the one the
155
+ * snapshot recorded, or — for layouts saved before that was persisted — the selected tab of
156
+ * the first leaf in the grid.
153
157
  */
154
158
  initialState?: string | null;
155
159
  /** Custom i18n formatter for all internal strings. */
@@ -641,7 +645,15 @@ interface WindowState {
641
645
  panels: Record<string, PanelInfo>;
642
646
  /** The ID of the panel tab currently being dragged. */
643
647
  draggedPanelId: string | null;
644
- /** The ID of the active/focused panel. */
648
+ /**
649
+ * The ID of the active/focused panel — the one contributions are read from
650
+ * (see `useActivePanelContribution`) and the one drawn with focused chrome.
651
+ *
652
+ * Always a panel the user can actually see: the selected tab of its leaf, or a floating
653
+ * window. Never a minimized panel, except when an app explicitly calls `focusPanel()` on
654
+ * one. Restored layouts resolve it from the saved snapshot's own `activePanelId`, falling
655
+ * back to the first leaf's selected tab — never to an arbitrary entry in `panels`.
656
+ */
645
657
  activePanelId: string | null;
646
658
  /** Current layout direction ('ltr' or 'rtl') */
647
659
  dir: 'ltr' | 'rtl';
@@ -793,7 +805,8 @@ interface WindowActions {
793
805
  findPanelId: (component: string, dedupeKey: string) => string | null;
794
806
  /**
795
807
  * Serializes the entire workspace state to a JSON string.
796
- * Includes grid layout, floating window positions, minimized panels, and panel metadata.
808
+ * Includes grid layout, floating window positions, minimized panels, panel metadata, and the
809
+ * globally active panel (see {@link SerializedLayout.activePanelId}).
797
810
  * @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
798
811
  * @example
799
812
  * ```ts
@@ -804,6 +817,12 @@ interface WindowActions {
804
817
  /**
805
818
  * Restores a previously serialized workspace from a JSON string.
806
819
  * Replaces the entire current layout — all panels not in the snapshot are closed.
820
+ *
821
+ * `state.activePanelId` is resolved from the snapshot's own `activePanelId` when that panel is
822
+ * still visible in it, and otherwise from the first leaf's selected tab (which is also the path
823
+ * layouts saved before that field existed take). It is never seeded from an arbitrary entry in
824
+ * `panels`.
825
+ *
807
826
  * @param layoutJson - JSON string produced by {@link saveLayout}.
808
827
  * @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
809
828
  */
@@ -948,6 +967,18 @@ declare const useRegistry: () => PanelRegistryClass;
948
967
  interface SerializedLayout {
949
968
  /** Schema version — absent on layouts saved before this field was introduced (treated as 0). */
950
969
  version?: number;
970
+ /**
971
+ * The globally active panel at save time — the one the user was actually looking at.
972
+ *
973
+ * Omitted when nothing was active, and when the active panel didn't survive this snapshot's
974
+ * serializability pruning (see {@link WindowActions.saveLayout}) — so it never names a panel
975
+ * absent from this payload's own `panels`. Absent on every layout saved before this field
976
+ * existed, in which case the restore derives it from `gridRoot`'s own per-leaf selection
977
+ * instead; a present-but-no-longer-valid value falls back to the same derivation. `version`
978
+ * is deliberately not bumped for this: the field is optional and its absence is a supported,
979
+ * fully-handled case rather than a schema a migration has to branch on.
980
+ */
981
+ activePanelId?: string | null;
951
982
  gridRoot: LayoutNode;
952
983
  floating: FloatingWindow[];
953
984
  minimized: {
package/dist/index.d.ts CHANGED
@@ -150,6 +150,10 @@ interface WorkspaceClientConfig {
150
150
  /**
151
151
  * Serialised layout produced by a previous saveLayout() call.
152
152
  * Pass null or omit to start with an empty canvas.
153
+ *
154
+ * Parsed synchronously before the first render. The restored `activePanelId` is the one the
155
+ * snapshot recorded, or — for layouts saved before that was persisted — the selected tab of
156
+ * the first leaf in the grid.
153
157
  */
154
158
  initialState?: string | null;
155
159
  /** Custom i18n formatter for all internal strings. */
@@ -641,7 +645,15 @@ interface WindowState {
641
645
  panels: Record<string, PanelInfo>;
642
646
  /** The ID of the panel tab currently being dragged. */
643
647
  draggedPanelId: string | null;
644
- /** The ID of the active/focused panel. */
648
+ /**
649
+ * The ID of the active/focused panel — the one contributions are read from
650
+ * (see `useActivePanelContribution`) and the one drawn with focused chrome.
651
+ *
652
+ * Always a panel the user can actually see: the selected tab of its leaf, or a floating
653
+ * window. Never a minimized panel, except when an app explicitly calls `focusPanel()` on
654
+ * one. Restored layouts resolve it from the saved snapshot's own `activePanelId`, falling
655
+ * back to the first leaf's selected tab — never to an arbitrary entry in `panels`.
656
+ */
645
657
  activePanelId: string | null;
646
658
  /** Current layout direction ('ltr' or 'rtl') */
647
659
  dir: 'ltr' | 'rtl';
@@ -793,7 +805,8 @@ interface WindowActions {
793
805
  findPanelId: (component: string, dedupeKey: string) => string | null;
794
806
  /**
795
807
  * Serializes the entire workspace state to a JSON string.
796
- * Includes grid layout, floating window positions, minimized panels, and panel metadata.
808
+ * Includes grid layout, floating window positions, minimized panels, panel metadata, and the
809
+ * globally active panel (see {@link SerializedLayout.activePanelId}).
797
810
  * @returns JSON string suitable for storage and later restoration via {@link loadLayout}.
798
811
  * @example
799
812
  * ```ts
@@ -804,6 +817,12 @@ interface WindowActions {
804
817
  /**
805
818
  * Restores a previously serialized workspace from a JSON string.
806
819
  * Replaces the entire current layout — all panels not in the snapshot are closed.
820
+ *
821
+ * `state.activePanelId` is resolved from the snapshot's own `activePanelId` when that panel is
822
+ * still visible in it, and otherwise from the first leaf's selected tab (which is also the path
823
+ * layouts saved before that field existed take). It is never seeded from an arbitrary entry in
824
+ * `panels`.
825
+ *
807
826
  * @param layoutJson - JSON string produced by {@link saveLayout}.
808
827
  * @returns `true` if the layout was successfully parsed and applied, `false` otherwise.
809
828
  */
@@ -948,6 +967,18 @@ declare const useRegistry: () => PanelRegistryClass;
948
967
  interface SerializedLayout {
949
968
  /** Schema version — absent on layouts saved before this field was introduced (treated as 0). */
950
969
  version?: number;
970
+ /**
971
+ * The globally active panel at save time — the one the user was actually looking at.
972
+ *
973
+ * Omitted when nothing was active, and when the active panel didn't survive this snapshot's
974
+ * serializability pruning (see {@link WindowActions.saveLayout}) — so it never names a panel
975
+ * absent from this payload's own `panels`. Absent on every layout saved before this field
976
+ * existed, in which case the restore derives it from `gridRoot`'s own per-leaf selection
977
+ * instead; a present-but-no-longer-valid value falls back to the same derivation. `version`
978
+ * is deliberately not bumped for this: the field is optional and its absence is a supported,
979
+ * fully-handled case rather than a schema a migration has to branch on.
980
+ */
981
+ activePanelId?: string | null;
951
982
  gridRoot: LayoutNode;
952
983
  floating: FloatingWindow[];
953
984
  minimized: {