react-dockable-desktop 7.0.0 → 7.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
@@ -1259,7 +1259,14 @@ declare function createWorkspace<TEvents extends object = Record<string, unknown
1259
1259
  declare function useWorkspace<TEvents extends object = Record<string, unknown>>(): Workspace<TEvents>;
1260
1260
  /** The state of a workspace panel: where it is. */
1261
1261
  type PanelState = PanelInfo['state'];
1262
- /** What a panel component knows about, and can do to, its own container. See {@link usePanel}. */
1262
+ /**
1263
+ * What a panel component knows about, and can do to, its own container. See {@link usePanel}.
1264
+ *
1265
+ * **Identity.** `id` and the five functions (`close`, `minimize`, `setDirty`, `setTitle`,
1266
+ * `setIcon`) never change identity for the panel's lifetime. The handle object itself changes
1267
+ * when `containerType`, `isActive`, `isMinimized` or `isFloating` does. So don't list the handle
1268
+ * in a dependency array: depend on the function you call, or on the values you write.
1269
+ */
1263
1270
  interface PanelHandle {
1264
1271
  /** This panel's instance id. */
1265
1272
  id: string;
@@ -1279,12 +1286,24 @@ interface PanelHandle {
1279
1286
  setDirty: (dirty: boolean, options?: DirtyStateOptions) => void;
1280
1287
  /** Changes the title shown on the tab, window or modal. */
1281
1288
  setTitle: (title: string | MessageDescriptor) => void;
1282
- /** Changes the icon shown on the tab or window. */
1289
+ /**
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.
1293
+ */
1283
1294
  setIcon: (icon: React$1.ReactNode) => void;
1284
1295
  }
1285
1296
  /**
1286
1297
  * The panel's own container: its id, where it is, and what it can do. Works in docked panels,
1287
1298
  * floating windows, modals and side drawers.
1299
+ *
1300
+ * The functions on the handle are stable; the handle object is not (see {@link PanelHandle}).
1301
+ * To keep the tab title in step with a document:
1302
+ *
1303
+ * ```tsx
1304
+ * const { setTitle, setDirty } = usePanel();
1305
+ * useEffect(() => { setTitle(doc.title); setDirty(doc.dirty); }, [setTitle, setDirty, doc.title, doc.dirty]);
1306
+ * ```
1288
1307
  */
1289
1308
  declare function usePanel(): PanelHandle;
1290
1309
  /** Lifecycle callbacks for {@link usePanelEvents}. Each is called at the moment it describes. */
package/dist/index.d.ts CHANGED
@@ -1259,7 +1259,14 @@ declare function createWorkspace<TEvents extends object = Record<string, unknown
1259
1259
  declare function useWorkspace<TEvents extends object = Record<string, unknown>>(): Workspace<TEvents>;
1260
1260
  /** The state of a workspace panel: where it is. */
1261
1261
  type PanelState = PanelInfo['state'];
1262
- /** What a panel component knows about, and can do to, its own container. See {@link usePanel}. */
1262
+ /**
1263
+ * What a panel component knows about, and can do to, its own container. See {@link usePanel}.
1264
+ *
1265
+ * **Identity.** `id` and the five functions (`close`, `minimize`, `setDirty`, `setTitle`,
1266
+ * `setIcon`) never change identity for the panel's lifetime. The handle object itself changes
1267
+ * when `containerType`, `isActive`, `isMinimized` or `isFloating` does. So don't list the handle
1268
+ * in a dependency array: depend on the function you call, or on the values you write.
1269
+ */
1263
1270
  interface PanelHandle {
1264
1271
  /** This panel's instance id. */
1265
1272
  id: string;
@@ -1279,12 +1286,24 @@ interface PanelHandle {
1279
1286
  setDirty: (dirty: boolean, options?: DirtyStateOptions) => void;
1280
1287
  /** Changes the title shown on the tab, window or modal. */
1281
1288
  setTitle: (title: string | MessageDescriptor) => void;
1282
- /** Changes the icon shown on the tab or window. */
1289
+ /**
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.
1293
+ */
1283
1294
  setIcon: (icon: React$1.ReactNode) => void;
1284
1295
  }
1285
1296
  /**
1286
1297
  * The panel's own container: its id, where it is, and what it can do. Works in docked panels,
1287
1298
  * floating windows, modals and side drawers.
1299
+ *
1300
+ * The functions on the handle are stable; the handle object is not (see {@link PanelHandle}).
1301
+ * To keep the tab title in step with a document:
1302
+ *
1303
+ * ```tsx
1304
+ * const { setTitle, setDirty } = usePanel();
1305
+ * useEffect(() => { setTitle(doc.title); setDirty(doc.dirty); }, [setTitle, setDirty, doc.title, doc.dirty]);
1306
+ * ```
1288
1307
  */
1289
1308
  declare function usePanel(): PanelHandle;
1290
1309
  /** Lifecycle callbacks for {@link usePanelEvents}. Each is called at the moment it describes. */