maplibre-gl-components 0.20.6 → 0.21.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/README.md CHANGED
@@ -1300,7 +1300,53 @@ See the [measure-control example](./examples/measure-control/) for a complete wo
1300
1300
 
1301
1301
  ### BookmarkControl
1302
1302
 
1303
- A control for saving and restoring map views with localStorage persistence.
1303
+ A control for saving and restoring map views with localStorage persistence. The
1304
+ panel is resizable by dragging its corner, bookmarks can be reordered by dragging
1305
+ their grip handle, an optional per-item checkbox lets a subset be exported, and a
1306
+ `captureState`/`restoreState` hook lets the host persist extra state (e.g. which
1307
+ layers were visible) alongside each view.
1308
+
1309
+ ```typescript
1310
+ interface BookmarkControlOptions {
1311
+ position?: ControlPosition; // Control position (default: 'top-right')
1312
+ className?: string; // Custom CSS class
1313
+ visible?: boolean; // Initial visibility (default: true)
1314
+ collapsed?: boolean; // Start collapsed (default: true)
1315
+ bookmarks?: MapBookmark[]; // Initial bookmarks
1316
+ storageKey?: string; // localStorage key for persistence
1317
+ maxBookmarks?: number; // Maximum bookmarks (default: 20)
1318
+ generateThumbnails?: boolean; // Capture a thumbnail per bookmark
1319
+ flyToDuration?: number; // Fly-to animation ms (default: 1500)
1320
+ panelWidth?: number; // Panel width in pixels (default: 260)
1321
+ maxHeight?: number; // Max panel height when not resizable
1322
+ resizable?: boolean; // Drag-resize the panel (default: true)
1323
+ reorderable?: boolean; // Drag-reorder bookmarks (default: true)
1324
+ selectable?: boolean; // Per-item export checkboxes (default: false)
1325
+ captureState?: () => Record<string, unknown> | undefined; // State to store on a new bookmark
1326
+ restoreState?: (extra: Record<string, unknown> | undefined) => void; // Restore on open
1327
+ captureStateLabel?: string; // When set, show an opt-in checkbox in the add form
1328
+ captureStateDefault?: boolean; // Initial state of that checkbox (default: true)
1329
+ backgroundColor?: string;
1330
+ borderRadius?: number;
1331
+ fontSize?: number;
1332
+ fontColor?: string;
1333
+ minzoom?: number;
1334
+ maxzoom?: number;
1335
+ }
1336
+
1337
+ // Methods
1338
+ bookmarkControl.getBookmarks() // All bookmarks
1339
+ bookmarkControl.addBookmark(name?) // Add a bookmark for the current view
1340
+ bookmarkControl.removeBookmark(id)
1341
+ bookmarkControl.goTo(id) // Fly to a bookmark (and restore its state)
1342
+ bookmarkControl.clear()
1343
+ bookmarkControl.importBookmarks(bookmarks) // Append an array of bookmarks
1344
+ bookmarkControl.exportBookmarks() // JSON string (selected subset if any)
1345
+ bookmarkControl.getSelectedIds() // IDs ticked for selective export
1346
+ bookmarkControl.setSelectedIds(ids) // Set the export selection
1347
+ bookmarkControl.on('reorder', handler) // Fired after a drag-reorder
1348
+ bookmarkControl.on('export', handler) // Fired after an export
1349
+ ```
1304
1350
 
1305
1351
  See the [bookmark-control example](./examples/bookmark-control/) for a complete working example.
1306
1352