mobx-view-model-devtools 0.0.14 → 0.0.16

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
@@ -1,6 +1,5 @@
1
1
  import { ObservableSet } from 'mobx';
2
2
  import { AnyViewModelSimple, AnyViewModel, ViewModelStoreBase } from 'mobx-view-model';
3
- import { ChangeEventHandler } from 'react';
4
3
  import { VListHandle } from 'virtua';
5
4
  import { Ref } from 'yummies/mobx';
6
5
  import { Maybe, AnyObject } from 'yummies/types';
@@ -15,14 +14,11 @@ type VmTreeItem = {
15
14
  depth: number;
16
15
  key: string;
17
16
  properties: string[];
17
+ searchData: {
18
+ name: string;
19
+ id: string;
20
+ };
18
21
  };
19
- interface FittedInfo {
20
- isFitted: boolean;
21
- isFittedById?: boolean;
22
- isFittedByName?: boolean;
23
- isFittedByPropertyPath?: boolean;
24
- fittedProperties: string[];
25
- }
26
22
 
27
23
  declare class KeyboardHandler extends KeyboardHandler$1<KeyboardHandlerAction> {
28
24
  constructor(devtools: ViewModelDevtools);
@@ -33,6 +29,40 @@ interface FocusableRef<T extends HTMLElement = HTMLElement> extends Ref<T, {
33
29
  }> {
34
30
  }
35
31
 
32
+ interface SearchResult {
33
+ isFitted: boolean;
34
+ isFittedById?: boolean;
35
+ isFittedByName?: boolean;
36
+ isFittedByPropertyPath?: boolean;
37
+ fittedProperties: string[];
38
+ isFittedAllProperties?: boolean;
39
+ fullFittedProperty?: string;
40
+ fittedPath: string[];
41
+ }
42
+ type SearchInput = {
43
+ type: 'vm';
44
+ item: VmTreeItem;
45
+ } | {
46
+ type: 'extras';
47
+ item: AnyObject;
48
+ };
49
+ declare class SearchEngine {
50
+ searchInputRef: FocusableRef<HTMLInputElement>;
51
+ fittedVmIds: Set<string>;
52
+ private rawSearchText;
53
+ formattedSearchText: string;
54
+ private searchTextUpdateTimeout;
55
+ private segments;
56
+ private get cache();
57
+ get isActive(): boolean;
58
+ private defaultSearchResult;
59
+ getSearchResult(input: SearchInput): SearchResult;
60
+ getSearchPropertyResult(input: SearchInput, property: string): boolean;
61
+ private setSearchText;
62
+ resetSearch: () => void;
63
+ constructor();
64
+ }
65
+
36
66
  interface ViewModelDevtoolsConfig {
37
67
  containerId?: string;
38
68
  defaultIsOpened?: boolean;
@@ -54,30 +84,26 @@ declare class ViewModelDevtools {
54
84
  inputRef: FocusableRef<HTMLInputElement>;
55
85
  scrollContentRef: Ref<HTMLDivElement>;
56
86
  keyboardHandler: KeyboardHandler;
57
- search: string;
87
+ searchEngine: SearchEngine;
58
88
  private expandedVmsSet;
59
89
  scrollListRef: Ref<VListHandle>;
90
+ private autoscrollTimeout;
60
91
  get allVms(): AnyVM[];
61
92
  get rootVms(): AnyVM[];
62
- get formattedSearch(): string;
63
93
  get vmTree(): VmTreeItem[];
64
94
  get isActive(): boolean;
65
- get isInSearch(): boolean;
66
- private get searchCache();
67
- getVMFittedInfo(vmTreeItem: VmTreeItem): FittedInfo;
68
- checkIsPropertyFitted(vmItem: VmTreeItem, property: string): boolean;
69
- checkIsExtrasPropertyFitted(property: string): boolean;
95
+ private get containerId();
70
96
  isExpanded(vmItem: VmTreeItem): boolean;
71
97
  checkIsVmPathExpanded(vmItem: VmTreeItem, path: string): boolean;
72
98
  checkIsExtraPathExpanded(path: string): boolean;
73
99
  handleExpandVmPropertyClick(vmItem: VmTreeItem, path: string): void;
74
100
  handleExpandExtraPropertyClick(path: string): void;
75
101
  handleVmItemHeaderClick(vmItem: VmTreeItem): void;
76
- handleSearchChange: ChangeEventHandler<HTMLInputElement>;
77
102
  private getVmParams;
78
103
  private constructor();
79
104
  setStore(viewModels: ViewModelStoreBase<AnyViewModel> | undefined): void;
80
105
  setExtras(extras: Maybe<AnyObject>): void;
106
+ private init;
81
107
  render(): void;
82
108
  private static _instance;
83
109
  static define(config?: ViewModelDevtoolsConfig): ViewModelDevtools;