mobx-view-model-devtools 0.0.38 → 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,7 @@ 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;
42
+ get closingItem(): ListItem<any> | null;
43
43
  abstract get depth(): number;
44
44
  get depthLine(): string;
45
45
  get stringifiedData(): string;
@@ -56,15 +56,17 @@ declare class PropertyListItem extends ListItem<any> {
56
56
  private parent;
57
57
  editContent: string;
58
58
  isEditMode: boolean;
59
+ get isExpanded(): boolean;
60
+ get isExpandable(): boolean;
59
61
  get data(): any;
60
62
  get descriptor(): PropertyDescriptor | null | undefined;
61
63
  get dataType(): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
62
64
  get stringifiedDataType(): string;
63
65
  get type(): "array" | "instance" | "function" | "object" | "primitive";
64
66
  get children(): PropertyListItem[];
65
- get isFitted(): boolean;
66
67
  get extraContent(): "," | null;
67
68
  private get propertyClosingTag();
69
+ get closingItem(): ListItem<any> | null;
68
70
  get expandedChildren(): ListItem<any>[];
69
71
  get depth(): number;
70
72
  get searchData(): {
@@ -76,6 +78,7 @@ declare class PropertyListItem extends ListItem<any> {
76
78
  get operations(): ListItemOperation<any>[];
77
79
  handleChangeEditContent: ChangeEventHandler<HTMLInputElement>;
78
80
  getSavedTempVarNotification(tempVarName: string): string;
81
+ get parentListItem(): ListItem<any>;
79
82
  protected constructor(devtools: ViewModelDevtools, property: Maybe<string>, path: string, order: number, parent: ListItem<any>);
80
83
  static createKey(parent: ListItem<any>, property: Maybe<string>): string;
81
84
  static create(devtools: ViewModelDevtools, property: Maybe<string>, path: string, order: number, parent: ListItem<any>): PropertyListItem;
@@ -86,17 +89,71 @@ interface FocusableRef<T extends HTMLElement = HTMLElement> extends Ref<T, {
86
89
  }> {
87
90
  }
88
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
+ }
89
99
  declare class SearchEngine {
100
+ private config;
90
101
  searchInputRef: FocusableRef<HTMLInputElement>;
91
- fittedVmIds: Set<string>;
92
- private rawSearchText;
93
- formattedSearchText: string;
94
- private searchTextUpdateTimeout;
95
- segments: string[];
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[];
111
+ get endsWithDot(): boolean;
96
112
  get isActive(): boolean;
97
- private setSearchText;
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;
98
155
  resetSearch: () => void;
99
- constructor();
156
+ constructor(config: SearchEngineConfig);
100
157
  }
101
158
 
102
159
  interface ViewModelDevtoolsConfig {
@@ -125,17 +182,17 @@ declare class ViewModelDevtools {
125
182
  scrollListRef: Ref<VirtualizerHandle>;
126
183
  private storage;
127
184
  anyCache: mobx.ObservableMap<string, any>;
128
- private autoscrollTimeout;
129
185
  get allVms(): AnyVM[];
130
186
  private get rootVmListItems();
131
187
  private get extraListItems();
188
+ private get searchRootItems();
132
189
  get listItems(): ListItem<any>[];
133
190
  get isActive(): boolean;
134
191
  private get containerId();
135
192
  isExpanded(vmItem: VMListItem): boolean;
136
193
  checkIsExtraPathExpanded(path: string): boolean;
137
194
  handleExpandVmPropertyClick(vmItem: VMListItem, path: string): void;
138
- handlePropertyClick(item: PropertyListItem, e: React.MouseEvent<HTMLElement>): void;
195
+ handlePropertyClick(item: PropertyListItem, _e: React.MouseEvent<HTMLElement>): void;
139
196
  handleVmItemHeaderClick(vmItem: VMListItem): void;
140
197
  isExpandable(vmItem: VMListItem): boolean | undefined;
141
198
  private getVmParams;
@@ -163,7 +220,6 @@ declare class VMListItem extends ListItem<AnyVM> {
163
220
  private allVms;
164
221
  private parent?;
165
222
  private get childVMListItems();
166
- get isFitted(): boolean;
167
223
  private get propertyListItems();
168
224
  get children(): ListItem<any>[];
169
225
  private getVmParams;