mobx-view-model-devtools 0.0.20 → 0.0.22

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.
Files changed (5) hide show
  1. package/auto.global.js +2 -37515
  2. package/index.cjs +2 -2
  3. package/index.d.ts +77 -47
  4. package/index.js +2577 -1342
  5. package/package.json +6 -4
package/index.d.ts CHANGED
@@ -1,27 +1,77 @@
1
+ import * as mobx from 'mobx';
1
2
  import { ObservableSet } from 'mobx';
2
3
  import { AnyViewModelSimple, AnyViewModel, ViewModelStoreBase } from 'mobx-view-model';
3
- import { VListHandle } from 'virtua';
4
+ import { VirtualizerHandle } from 'virtua';
4
5
  import { Ref } from 'yummies/mobx';
5
- import { Maybe, AnyObject } from 'yummies/types';
6
+ import { Maybe, AnyObject, Defined } from 'yummies/types';
6
7
  import { KeyboardHandler as KeyboardHandler$1, KeyboardHandlerAction } from 'mobx-swiss-knife';
7
8
 
8
- type AnyVM = AnyViewModelSimple | AnyViewModel;
9
- type VmTreeItem = {
10
- parent: Maybe<VmTreeItem>;
11
- vm: AnyVM;
12
- displayName: string;
13
- children: VmTreeItem[];
14
- depth: number;
9
+ declare class KeyboardHandler extends KeyboardHandler$1<KeyboardHandlerAction> {
10
+ constructor(devtools: ViewModelDevtools);
11
+ }
12
+
13
+ declare abstract class ListItem<T> {
14
+ devtools: ViewModelDevtools;
15
15
  key: string;
16
- properties: string[];
16
+ private _data;
17
+ private getChildren?;
18
+ cache: Map<string, any>;
19
+ get isExpanded(): boolean;
20
+ get children(): ListItem<any>[];
21
+ get isExpandable(): boolean;
22
+ expand(): void;
23
+ collapse(): void;
24
+ toggleExpand(): void;
25
+ get expandedChildren(): ListItem<any>[];
26
+ get expandedChildrenWithSelf(): ListItem<any>[];
27
+ get data(): T;
28
+ get isFitted(): boolean;
29
+ abstract get depth(): number;
30
+ get depthLine(): string;
31
+ expandKey: string;
32
+ constructor(devtools: ViewModelDevtools, key: string, _data: T, getChildren?: ((item: ListItem<T>) => ListItem<any>[]) | undefined, cache?: Map<string, any>);
33
+ }
34
+
35
+ declare class PropertyListItem extends ListItem<any> {
36
+ property: Maybe<string>;
37
+ path: string;
38
+ order: number;
39
+ private parent;
40
+ get data(): any;
41
+ get dataType(): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
42
+ get stringifiedDataType(): string;
43
+ get type(): "array" | "instance" | "function" | "object" | "primitive";
44
+ get children(): PropertyListItem[];
45
+ get isFitted(): boolean;
46
+ get extraContent(): "," | null;
47
+ private get propertyClosingTag();
48
+ get expandedChildren(): ListItem<any>[];
49
+ get depth(): number;
50
+ get searchData(): {
51
+ property: string;
52
+ };
53
+ protected constructor(devtools: ViewModelDevtools, property: Maybe<string>, path: string, order: number, parent: ListItem<any>);
54
+ static createKey(parent: ListItem<any>, property: Maybe<string>): string;
55
+ static create(devtools: ViewModelDevtools, property: Maybe<string>, path: string, order: number, parent: ListItem<any>): PropertyListItem;
56
+ }
57
+
58
+ type AnyVM = AnyViewModelSimple | AnyViewModel;
59
+
60
+ declare class VMListItem extends ListItem<AnyVM> {
61
+ private allVms;
62
+ private parent?;
63
+ private get childVMListItems();
64
+ get isFitted(): boolean;
65
+ private get propertyListItems();
66
+ get children(): ListItem<any>[];
67
+ private getVmParams;
68
+ get depth(): number;
17
69
  searchData: {
18
70
  name: string;
19
71
  id: string;
20
72
  };
21
- };
22
-
23
- declare class KeyboardHandler extends KeyboardHandler$1<KeyboardHandlerAction> {
24
- constructor(devtools: ViewModelDevtools);
73
+ displayName: string;
74
+ constructor(devtools: ViewModelDevtools, vm: AnyVM, allVms: AnyVM[], parent?: VMListItem | undefined);
25
75
  }
26
76
 
27
77
  interface FocusableRef<T extends HTMLElement = HTMLElement> extends Ref<T, {
@@ -29,35 +79,14 @@ interface FocusableRef<T extends HTMLElement = HTMLElement> extends Ref<T, {
29
79
  }> {
30
80
  }
31
81
 
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
82
  declare class SearchEngine {
50
83
  searchInputRef: FocusableRef<HTMLInputElement>;
51
84
  fittedVmIds: Set<string>;
52
85
  private rawSearchText;
53
86
  formattedSearchText: string;
54
87
  private searchTextUpdateTimeout;
55
- private segments;
56
- private get cache();
88
+ segments: string[];
57
89
  get isActive(): boolean;
58
- private defaultSearchResult;
59
- getSearchResult(input: SearchInput): SearchResult;
60
- getSearchPropertyResult(input: SearchInput, property: string): boolean;
61
90
  private setSearchText;
62
91
  resetSearch: () => void;
63
92
  constructor();
@@ -80,27 +109,27 @@ declare class ViewModelDevtools {
80
109
  extras: Maybe<AnyObject>;
81
110
  expandedVmItemsPaths: ObservableSet<string>;
82
111
  logoUrl: string;
83
- inputRef: FocusableRef<HTMLInputElement>;
84
112
  scrollContentRef: Ref<HTMLDivElement>;
85
113
  keyboardHandler: KeyboardHandler;
86
114
  searchEngine: SearchEngine;
87
115
  presentationMode: 'tree' | 'list';
88
- private expandedVmsMap;
89
- scrollListRef: Ref<VListHandle>;
116
+ position: Defined<ViewModelDevtoolsConfig['position']>;
117
+ scrollListRef: Ref<VirtualizerHandle>;
118
+ anyCache: mobx.ObservableMap<string, any>;
90
119
  private autoscrollTimeout;
91
120
  get allVms(): AnyVM[];
92
- get rootVms(): AnyVM[];
93
- private get vmsData();
94
- get vmTree(): VmTreeItem[];
121
+ private get rootVmListItems();
122
+ private get extraListItems();
123
+ get listItems(): ListItem<any>[];
95
124
  get isActive(): boolean;
96
125
  private get containerId();
97
- isExpanded(vmItem: VmTreeItem): boolean;
98
- checkIsVmPathExpanded(vmItem: VmTreeItem, path: string): boolean;
126
+ isExpanded(vmItem: VMListItem): boolean;
99
127
  checkIsExtraPathExpanded(path: string): boolean;
100
- handleExpandVmPropertyClick(vmItem: VmTreeItem, path: string): void;
128
+ handleExpandVmPropertyClick(vmItem: VMListItem, path: string): void;
129
+ handlePropertyClick(item: PropertyListItem, e: React.MouseEvent<HTMLElement>): void;
101
130
  handleExpandExtraPropertyClick(path: string): void;
102
- handleVmItemHeaderClick(vmItem: VmTreeItem): void;
103
- isExpandable(vmItem: VmTreeItem): boolean | undefined;
131
+ handleVmItemHeaderClick(vmItem: VMListItem): void;
132
+ isExpandable(vmItem: VMListItem): boolean | undefined;
104
133
  private getVmParams;
105
134
  setStore(viewModels: ViewModelStoreBase<AnyViewModel> | undefined): void;
106
135
  setExtras(extras: Maybe<AnyObject>): void;
@@ -110,6 +139,7 @@ declare class ViewModelDevtools {
110
139
  showPopup(): void;
111
140
  hidePopup(): void;
112
141
  private init;
142
+ private isInitialized;
113
143
  render(): void;
114
144
  private static _instance;
115
145
  private constructor();