@weng-lab/genomebrowser-ui 0.1.7 → 0.1.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weng-lab/genomebrowser-ui",
3
3
  "private": false,
4
- "version": "0.1.7",
4
+ "version": "0.1.8",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "publishConfig": {
@@ -1,5 +1,6 @@
1
1
  import { create, StoreApi, UseBoundStore } from "zustand";
2
- import { SelectionAction, SelectionState } from "./types";
2
+ import { rowById } from "./consts";
3
+ import { RowInfo, SelectionAction, SelectionState } from "./types";
3
4
 
4
5
  export type SelectionStoreInstance = UseBoundStore<
5
6
  StoreApi<SelectionState & SelectionAction>
@@ -18,6 +19,20 @@ export function createSelectionStore(initialIds?: Set<string>) {
18
19
  const all = get().selectedIds;
19
20
  return new Set([...all].filter((id) => !isAutoGeneratedId(id)));
20
21
  },
22
+ // Returns a Map of track IDs to RowInfo (no auto-generated IDs)
23
+ getTrackMap: () => {
24
+ const all = get().selectedIds;
25
+ const map = new Map<string, RowInfo>();
26
+ all.forEach((id) => {
27
+ if (!isAutoGeneratedId(id)) {
28
+ const row = rowById.get(id);
29
+ if (row) {
30
+ map.set(id, row);
31
+ }
32
+ }
33
+ });
34
+ return map;
35
+ },
21
36
  setSelected: (ids: Set<string>) =>
22
37
  set(() => ({
23
38
  selectedIds: new Set(ids),
@@ -105,6 +105,8 @@ export type SelectionState = {
105
105
  export type SelectionAction = {
106
106
  // Returns only real track IDs (filters out auto-generated group IDs)
107
107
  getTrackIds: () => Set<string>;
108
+ // Returns a Map of track IDs to RowInfo (no auto-generated IDs)
109
+ getTrackMap: () => Map<string, RowInfo>;
108
110
  setSelected: (ids: Set<string>) => void;
109
111
  removeIds: (removedIds: Set<string>) => void;
110
112
  clear: () => void;