@lukekaalim/act-insight 1.1.0 → 2.0.0

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 (123) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/InsightApp.module.css +36 -0
  3. package/InsightApp2.ts +82 -0
  4. package/TreeViewer.module.css +3 -8
  5. package/TreeViewer.ts +16 -12
  6. package/Virtual.ts +29 -11
  7. package/assets/icons/ancestor_column.png +0 -0
  8. package/assets/icons/ancestor_column.svg +26 -0
  9. package/assets/icons/ancestor_skip_row_column.png +0 -0
  10. package/assets/icons/ancestor_skip_row_column.svg +52 -0
  11. package/assets/icons/breakpoint.png +0 -0
  12. package/assets/icons/breakpoint.svg +33 -0
  13. package/assets/icons/breakpoint_arrow.png +0 -0
  14. package/assets/icons/breakpoint_arrow.svg +22 -0
  15. package/assets/icons/breakpoint_arrow_paused.png +0 -0
  16. package/assets/icons/breakpoint_arrow_paused.svg +38 -0
  17. package/assets/icons/breakpoint_panel.png +0 -0
  18. package/assets/icons/breakpoint_panel.svg +121 -0
  19. package/assets/icons/breakpoint_unset.png +0 -0
  20. package/assets/icons/breakpoint_unset.svg +26 -0
  21. package/assets/icons/bug.png +0 -0
  22. package/assets/icons/bug.svg +65 -0
  23. package/assets/icons/children.png +0 -0
  24. package/assets/icons/children.svg +38 -0
  25. package/assets/icons/collapse.png +0 -0
  26. package/assets/icons/collapse.svg +38 -0
  27. package/assets/icons/commit.png +0 -0
  28. package/assets/icons/commit.svg +30 -0
  29. package/assets/icons/commit_tree.png +0 -0
  30. package/assets/icons/commit_tree.svg +44 -0
  31. package/assets/icons/effect.png +0 -0
  32. package/assets/icons/effect.svg +28 -0
  33. package/assets/icons/expand.png +0 -0
  34. package/assets/icons/expand.svg +47 -0
  35. package/assets/icons/eye.png +0 -0
  36. package/assets/icons/eye.svg +36 -0
  37. package/assets/icons/eye_closed.png +0 -0
  38. package/assets/icons/eye_closed.svg +32 -0
  39. package/assets/icons/filter.png +0 -0
  40. package/assets/icons/filter.svg +22 -0
  41. package/assets/icons/graph.png +0 -0
  42. package/assets/icons/graph.svg +129 -0
  43. package/assets/icons/history_list.png +0 -0
  44. package/assets/icons/history_list.svg +60 -0
  45. package/assets/icons/hook.png +0 -0
  46. package/assets/icons/hook.svg +22 -0
  47. package/assets/icons/index.ts +76 -0
  48. package/assets/icons/inspector_panel.png +0 -0
  49. package/assets/icons/inspector_panel.svg +135 -0
  50. package/assets/icons/magnifying_glass.png +0 -0
  51. package/assets/icons/magnifying_glass.svg +39 -0
  52. package/assets/icons/pause.png +0 -0
  53. package/assets/icons/pause.svg +34 -0
  54. package/assets/icons/play.png +0 -0
  55. package/assets/icons/play.svg +23 -0
  56. package/assets/icons/reload.png +0 -0
  57. package/assets/icons/reload.svg +39 -0
  58. package/assets/icons/selection.png +0 -0
  59. package/assets/icons/selection.svg +22 -0
  60. package/assets/icons/side_effects.png +0 -0
  61. package/assets/icons/side_effects.svg +48 -0
  62. package/assets/icons/skip.png +0 -0
  63. package/assets/icons/skip.svg +22 -0
  64. package/assets/icons/source.svg +1366 -0
  65. package/assets/icons/step.png +0 -0
  66. package/assets/icons/step.svg +51 -0
  67. package/assets/icons/step_over_children.png +0 -0
  68. package/assets/icons/step_over_children.svg +57 -0
  69. package/assets/icons/thread.png +0 -0
  70. package/assets/icons/thread.svg +32 -0
  71. package/assets/icons/tree_column.png +0 -0
  72. package/assets/icons/tree_column.svg +26 -0
  73. package/assets/icons/tree_end.png +0 -0
  74. package/assets/icons/tree_end.svg +35 -0
  75. package/assets/icons/tree_junction.png +0 -0
  76. package/assets/icons/tree_junction.svg +35 -0
  77. package/assets/icons/vertical_grab_handle.png +0 -0
  78. package/assets/icons/vertical_grab_handle.svg +36 -0
  79. package/components/BreakpointPanel.ts +110 -0
  80. package/components/BreakpointToggle.ts +14 -0
  81. package/components/Button.ts +53 -0
  82. package/components/Checkbox.ts +17 -0
  83. package/components/CommitInspector.ts +161 -0
  84. package/components/CommitTree.ts +295 -0
  85. package/components/ControlBar.ts +60 -0
  86. package/components/EffectTable.ts +125 -0
  87. package/components/FiltersPanel.ts +45 -0
  88. package/components/HistoryList.ts +0 -0
  89. package/components/InspectorPanel.ts +54 -0
  90. package/components/PlaybackBar.ts +42 -0
  91. package/components/ThreadInspector.ts +26 -0
  92. package/components/index.module.css +414 -0
  93. package/lib/controller.ts +222 -0
  94. package/lib/list.ts +82 -0
  95. package/lib/selection.ts +32 -0
  96. package/package.json +4 -4
  97. package/public/icons/icons.svg +520 -0
  98. package/public/icons/icons__breakpoint.png +0 -0
  99. package/public/icons/icons__breakpoint.svg +30 -0
  100. package/public/icons/icons__breakpoint_panel.png +0 -0
  101. package/public/icons/icons__breakpoint_panel.svg +121 -0
  102. package/public/icons/icons__children.png +0 -0
  103. package/public/icons/icons__children.svg +38 -0
  104. package/public/icons/icons__eye.png +0 -0
  105. package/public/icons/icons__eye.svg +36 -0
  106. package/public/icons/icons__inspector_panel.png +0 -0
  107. package/public/icons/icons__inspector_panel.svg +131 -0
  108. package/public/icons/icons__magnifying_glass.png +0 -0
  109. package/public/icons/icons__magnifying_glass.svg +39 -0
  110. package/public/icons/icons__pause.png +0 -0
  111. package/public/icons/icons__pause.svg +34 -0
  112. package/public/icons/icons__play.png +0 -0
  113. package/public/icons/icons__play.svg +23 -0
  114. package/public/icons/icons__skip.png +0 -0
  115. package/public/icons/icons__skip.svg +22 -0
  116. package/public/icons/icons__step.png +0 -0
  117. package/public/icons/icons__step.svg +51 -0
  118. package/utils.ts +71 -7
  119. package/InsightApp.ts +0 -404
  120. package/MenuBar.module.css +0 -18
  121. package/MenuBar.ts +0 -39
  122. package/ScheduleControls.ts +0 -61
  123. package/lookup.ts +0 -185
package/lookup.ts DELETED
@@ -1,185 +0,0 @@
1
- import { CommitReport, DeltaReport, ElementReport, ThreadReport, TreeReport, WorkTaskReport } from "@lukekaalim/act-debug";
2
- import { CommitID, CommitVersion, WorkThread2 } from "@lukekaalim/act-recon";
3
-
4
- export class MutableCommitRef {
5
- element: ElementReport;
6
- id: CommitID;
7
- version: CommitVersion;
8
- distance: number;
9
-
10
- report: CommitReport;
11
-
12
- children: MutableCommitRef[] = [];
13
- parent: null | MutableCommitRef = null;
14
-
15
- constructor(commit: CommitReport) {
16
- this.element = commit.element;
17
- this.id = commit.id;
18
- this.version = commit.version;
19
- this.distance = commit.distance;
20
-
21
- this.report = commit;
22
- }
23
-
24
- update(commit: CommitReport) {
25
- this.report = commit;
26
- this.version = commit.version;
27
- this.element = commit.element;
28
- }
29
-
30
- resolve(lookupMap: Map<CommitID, MutableCommitRef>) {
31
- if (this.report.parent !== null)
32
- this.linkParent(this.report.parent, lookupMap);
33
- this.linkChildren(this.report.children, lookupMap);
34
- }
35
-
36
- linkParent(parent: CommitID, lookupMap: Map<CommitID, MutableCommitRef>) {
37
- this.parent = lookupMap.get(parent) || null;
38
- }
39
- linkChildren(children: CommitID[], lookupMap: Map<CommitID, MutableCommitRef>) {
40
- this.children = children.map(c => lookupMap.get(c)).filter(x => !!x);
41
- }
42
- }
43
-
44
- export class CommitLookupCache {
45
- map: Map<CommitID, CommitReport> = new Map();
46
- roots: Set<CommitID> = new Set();
47
-
48
- setTree(tree: TreeReport) {
49
- this.map.clear();
50
- this.roots.clear();
51
-
52
- for (const commit of tree.commits) {
53
- this.map.set(commit.id, commit)
54
- if (!commit.parent)
55
- this.roots.add(commit.id);
56
- }
57
- }
58
-
59
- ingest(delta: DeltaReport) {
60
- for (const create of delta.created) {
61
- this.map.set(create.id, create);
62
- if (!create.parent)
63
- this.roots.add(create.id);
64
- }
65
- for (const update of delta.updated)
66
- this.map.set(update.id, update);
67
- for (const remove of delta.removed) {
68
- this.map.delete(remove.id);
69
- this.roots.delete(remove.id);
70
- }
71
- }
72
- }
73
-
74
- /**
75
- * A bunch of relevant data for a Tree in the progress of changing
76
- */
77
- export class ThreadLookupCache {
78
- canon: CommitLookupCache;
79
-
80
- report: DeltaReport | null = null;
81
- thread: ThreadReport | null = null;
82
-
83
- constructor(canon: CommitLookupCache) {
84
- this.canon = canon;
85
- }
86
-
87
- roots: Set<CommitID> = new Set();
88
-
89
- created: Set<CommitID> = new Set();
90
- updated: Set<CommitID> = new Set();
91
- removed: Set<CommitID> = new Set();
92
-
93
- /**
94
- * An up to date map of the tree, plus deleted notes in this delta
95
- */
96
- all: Map<CommitID, CommitReport> = new Map();
97
-
98
- nextTask: WorkTaskReport | null = null;
99
- prevTask: WorkTaskReport | null = null;
100
-
101
- allTasks: Map<CommitID, WorkTaskReport> = new Map();
102
-
103
- targets: Set<CommitID> = new Set();
104
- visited: Set<CommitID> = new Set();
105
-
106
- /**
107
- * Clear the delta cache
108
- */
109
- reset() {
110
- this.roots = new Set(this.canon.roots)
111
- this.all = new Map(this.canon.map);
112
- this.allTasks = new Map();
113
-
114
- this.nextTask = null;
115
- this.prevTask = null;
116
- this.report = null;
117
-
118
- this.created.clear();
119
- this.updated.clear();
120
- this.removed.clear();
121
-
122
- this.targets.clear();
123
- this.visited.clear();
124
- }
125
-
126
- ingestThread(thread: ThreadReport) {
127
- this.thread = thread;
128
-
129
- this.nextTask = thread.pendingTasks[thread.pendingTasks.length - 1];
130
- this.targets = new Set(thread.reasons.map(reason => reason.target));
131
- this.visited = new Set(thread.visited)
132
- this.allTasks = new Map(thread.pendingTasks.map(task => [task.id, task]))
133
- }
134
-
135
- ingestDelta(delta: DeltaReport) {
136
- this.report = delta;
137
- const createdIds = new Set(delta.created.map(c => c.id));
138
-
139
- for (const commit of delta.created) {
140
- this.created.add(commit.id)
141
-
142
- const children = [...new Set(commit.children.filter(c => this.all.has(c) || createdIds.has(c)))]
143
- this.all.set(commit.id, { ...commit, children });
144
-
145
- if (!commit.parent)
146
- this.roots.add(commit.id);
147
- }
148
- for (const commit of delta.updated) {
149
- const existingCommit = this.canon.map.get(commit.id) as CommitReport;
150
-
151
- const children = [...new Set([
152
- ...commit.children.filter(c => this.all.has(c)),
153
- ...existingCommit.children,
154
- ])]
155
- const mergedCommitReport = { ...commit, children };
156
-
157
- this.updated.add(commit.id)
158
- this.all.set(commit.id, mergedCommitReport)
159
- }
160
- for (const commit of delta.removed) {
161
- this.removed.add(commit.id);
162
- this.all.set(commit.id, commit);
163
- }
164
- }
165
-
166
- getFlat() {
167
- const pending: CommitReport[] = [...this.roots.values()]
168
- .map(root => this.all.get(root))
169
- .filter(x => !!x);
170
-
171
- const flat: CommitReport[] = [];
172
-
173
- while (pending.length > 0) {
174
- const commit = pending.pop() as CommitReport;
175
- flat.push(commit);
176
- for (const childId of [...commit.children].reverse()) {
177
- const child = this.all.get(childId);
178
- if (child)
179
- pending.push(child);
180
- }
181
- }
182
-
183
- return flat;
184
- }
185
- }