mobx-view-model-devtools 0.0.39 → 0.0.40

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/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { VirtualizerHandle } from 'virtua';
6
6
  import { Ref } from 'yummies/mobx';
7
7
  import { AnyObject, Maybe, Defined } from 'yummies/types';
8
8
  import { KeyboardHandler as KeyboardHandler$1, KeyboardHandlerAction } from 'mobx-swiss-knife';
9
- import { ComponentType, ChangeEventHandler } from 'react';
9
+ import { ComponentType, ChangeEventHandler, ChangeEvent, KeyboardEvent } from 'react';
10
10
 
11
11
  declare class KeyboardHandler extends KeyboardHandler$1<KeyboardHandlerAction> {
12
12
  constructor(devtools: ViewModelDevtools);
@@ -39,7 +39,6 @@ declare abstract class ListItem<T> {
39
39
  get expandedChildren(): ListItem<any>[];
40
40
  get expandedChildrenWithSelf(): ListItem<any>[];
41
41
  get data(): T;
42
- get isFitted(): boolean;
43
42
  get closingItem(): ListItem<any> | null;
44
43
  abstract get depth(): number;
45
44
  get depthLine(): string;
@@ -58,13 +57,13 @@ declare class PropertyListItem extends ListItem<any> {
58
57
  editContent: string;
59
58
  isEditMode: boolean;
60
59
  get isExpanded(): boolean;
60
+ get isExpandable(): boolean;
61
61
  get data(): any;
62
62
  get descriptor(): PropertyDescriptor | null | undefined;
63
63
  get dataType(): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
64
64
  get stringifiedDataType(): string;
65
65
  get type(): "array" | "instance" | "function" | "object" | "primitive";
66
66
  get children(): PropertyListItem[];
67
- get isFitted(): boolean;
68
67
  get extraContent(): "," | null;
69
68
  private get propertyClosingTag();
70
69
  get closingItem(): ListItem<any> | null;
@@ -79,6 +78,7 @@ declare class PropertyListItem extends ListItem<any> {
79
78
  get operations(): ListItemOperation<any>[];
80
79
  handleChangeEditContent: ChangeEventHandler<HTMLInputElement>;
81
80
  getSavedTempVarNotification(tempVarName: string): string;
81
+ get parentListItem(): ListItem<any>;
82
82
  protected constructor(devtools: ViewModelDevtools, property: Maybe<string>, path: string, order: number, parent: ListItem<any>);
83
83
  static createKey(parent: ListItem<any>, property: Maybe<string>): string;
84
84
  static create(devtools: ViewModelDevtools, property: Maybe<string>, path: string, order: number, parent: ListItem<any>): PropertyListItem;
@@ -89,18 +89,71 @@ interface FocusableRef<T extends HTMLElement = HTMLElement> extends Ref<T, {
89
89
  }> {
90
90
  }
91
91
 
92
+ interface SearchEngineConfig {
93
+ getContainerId: () => string;
94
+ getIsActive: () => boolean;
95
+ getItemOffset: (index: number) => number;
96
+ scrollToOffset: (offset: number) => void;
97
+ getRootItems: () => ListItem<any>[];
98
+ }
92
99
  declare class SearchEngine {
100
+ private config;
93
101
  searchInputRef: FocusableRef<HTMLInputElement>;
94
- fittedVmIds: Set<string>;
95
- private rawSearchText;
96
- formattedSearchText: string;
97
- private searchTextUpdateTimeout;
98
- segments: string[];
99
- get isActive(): boolean;
102
+ searchText: string;
103
+ searchCacheKey: string;
104
+ isSearching: boolean;
105
+ get formattedSearchText(): string;
106
+ /**
107
+ * Сегменты поиска, разбитые по точке.
108
+ * Trailing-пустой сегмент (от trailing dot) убирается — для этого есть endsWithDot.
109
+ */
110
+ get segments(): string[];
100
111
  get endsWithDot(): boolean;
101
- private setSearchText;
112
+ get isActive(): boolean;
113
+ /**
114
+ * Суффикс первого найденного свойства, которое начинается с последнего сегмента.
115
+ * Отображается как серая подсказка в инпуте.
116
+ * Например: ввод "_pay" → suggestionSuffix = "load" (от "_payload")
117
+ */
118
+ get suggestionSuffix(): string;
119
+ handleSearchInput: (e: ChangeEvent<HTMLInputElement>) => void;
120
+ handleKeyDown: (e: KeyboardEvent<HTMLInputElement>) => void;
121
+ /**
122
+ * Возвращает PropertyListItem на целевой глубине для получения подсказки.
123
+ * pathSegments — все сегменты кроме последнего (путь навигации).
124
+ */
125
+ private getCandidatePropsAtDepth;
126
+ /**
127
+ * Навигация вглубь по цепочке свойств.
128
+ * Возвращает свойства на нужной глубине.
129
+ */
130
+ private navigatePropertyPath;
131
+ getListItems(rootItems: ListItem<any>[]): ListItem<any>[];
132
+ private getFilteredItemsForSearch;
133
+ private getVMSearchItems;
134
+ /**
135
+ * Рекурсивно строит плоский список PropertyListItem для отображения.
136
+ *
137
+ * propSegments[0] — фильтр текущего уровня.
138
+ * Совпадающие свойства с propSegments[0], у которых есть ещё сегменты
139
+ * (т.е. не последний) — автоматически раскрываются (рекурсия вглубь).
140
+ * Последний сегмент только окрашивает (серый/нормальный), не раскрывает.
141
+ */
142
+ private getPropertySearchItems;
143
+ private vmMatchesSearch;
144
+ isPropertyItemExpanded(item: PropertyListItem): boolean;
145
+ isPropertyItemExpandable(item: PropertyListItem): boolean;
146
+ isVmItemExpanded(item: VMListItem): boolean;
147
+ /**
148
+ * Определяет, должен ли элемент отображаться «нормально» (true)
149
+ * или «затемнённо» (false — серым).
150
+ *
151
+ * Для PropertyListItem: проходим вверх по цепочке parentListItem,
152
+ * чтобы определить уровень вложенности и соответствующий сегмент фильтра.
153
+ */
154
+ isItemFitted(item: ListItem<any>): boolean;
102
155
  resetSearch: () => void;
103
- constructor();
156
+ constructor(config: SearchEngineConfig);
104
157
  }
105
158
 
106
159
  interface ViewModelDevtoolsConfig {
@@ -129,28 +182,17 @@ declare class ViewModelDevtools {
129
182
  scrollListRef: Ref<VirtualizerHandle>;
130
183
  private storage;
131
184
  anyCache: mobx.ObservableMap<string, any>;
132
- private autoscrollTimeout;
133
- searchResultsCache: mobx.IObservableArray<ListItem<any>>;
134
- searchCacheKey: string;
135
- private searchTaskId;
136
- isSearching: boolean;
137
- private searchInitTaskId;
138
185
  get allVms(): AnyVM[];
139
186
  private get rootVmListItems();
140
187
  private get extraListItems();
188
+ private get searchRootItems();
141
189
  get listItems(): ListItem<any>[];
142
- private startLazySearch;
143
- private performLazySearch;
144
- private filterAndCacheResults;
145
- private filterItemsWithParentsLazy;
146
- private getParentItemsWithMatchedChildren;
147
- private findParent;
148
190
  get isActive(): boolean;
149
191
  private get containerId();
150
192
  isExpanded(vmItem: VMListItem): boolean;
151
193
  checkIsExtraPathExpanded(path: string): boolean;
152
194
  handleExpandVmPropertyClick(vmItem: VMListItem, path: string): void;
153
- handlePropertyClick(item: PropertyListItem, e: React.MouseEvent<HTMLElement>): void;
195
+ handlePropertyClick(item: PropertyListItem, _e: React.MouseEvent<HTMLElement>): void;
154
196
  handleVmItemHeaderClick(vmItem: VMListItem): void;
155
197
  isExpandable(vmItem: VMListItem): boolean | undefined;
156
198
  private getVmParams;
@@ -178,7 +220,6 @@ declare class VMListItem extends ListItem<AnyVM> {
178
220
  private allVms;
179
221
  private parent?;
180
222
  private get childVMListItems();
181
- get isFitted(): boolean;
182
223
  private get propertyListItems();
183
224
  get children(): ListItem<any>[];
184
225
  private getVmParams;