squeze-cli 2.2.1 → 3.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.
- package/CHANGELOG.md +24 -0
- package/README.md +81 -21
- package/dist/cli.cjs +185 -62
- package/dist/extension.cjs +825 -113
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/GRAPH.md +1 -1
- package/docs/SCALE_EVALUATION.md +19 -1
- package/docs/STANDARD.md +27 -0
- package/media/explorer.css +317 -0
- package/media/explorer.js +869 -0
- package/package.json +23 -2
|
@@ -0,0 +1,869 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Squeze Code Explorer client. A plain script with no dependencies: the host inlines it under a nonce-based
|
|
3
|
+
* Content Security Policy. The model arrives as JSON in #squeze-model and in later 'model' messages.
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const PAD = 24;
|
|
9
|
+
const MIN_SCALE = 0.02;
|
|
10
|
+
const MAX_SCALE = 8;
|
|
11
|
+
const FIT_MAX_SCALE = 4;
|
|
12
|
+
const PAN_STEP = 40;
|
|
13
|
+
const DRAG_THRESHOLD = 4;
|
|
14
|
+
const HIT_SLOP = 4;
|
|
15
|
+
const DIM_ALPHA = 0.18;
|
|
16
|
+
const LABEL_FONT_PX = 11;
|
|
17
|
+
const LABEL_HEIGHT = 14;
|
|
18
|
+
const LABEL_BUDGET = 60;
|
|
19
|
+
const LABEL_SCAN = 400;
|
|
20
|
+
const MAX_RESULTS = 20;
|
|
21
|
+
const MAX_NEIGHBOURS = 12;
|
|
22
|
+
|
|
23
|
+
const EDGE_IMPORT = 0;
|
|
24
|
+
const EDGE_REFERENCE = 1;
|
|
25
|
+
const EDGE_FOCUS_IMPORT = 2;
|
|
26
|
+
const EDGE_FOCUS_REFERENCE = 3;
|
|
27
|
+
const EDGE_FAINT = 4;
|
|
28
|
+
const EDGE_HIDDEN = 5;
|
|
29
|
+
|
|
30
|
+
const EDGE_PASSES = [
|
|
31
|
+
{ cls: EDGE_FAINT, alpha: 0.08, width: 0.6, dash: [], color: 'muted' },
|
|
32
|
+
{ cls: EDGE_IMPORT, alpha: 0.35, width: 0.8, dash: [], color: 'muted' },
|
|
33
|
+
{ cls: EDGE_REFERENCE, alpha: 0.3, width: 0.8, dash: [4, 3], color: 'muted' },
|
|
34
|
+
{ cls: EDGE_FOCUS_IMPORT, alpha: 0.9, width: 1.6, dash: [], color: 'fg' },
|
|
35
|
+
{ cls: EDGE_FOCUS_REFERENCE, alpha: 0.9, width: 1.6, dash: [4, 3], color: 'fg' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const EMPTY_MODEL = {
|
|
39
|
+
version: 0,
|
|
40
|
+
title: 'Squeze Explorer',
|
|
41
|
+
revision: '',
|
|
42
|
+
partial: false,
|
|
43
|
+
notes: [],
|
|
44
|
+
totals: { files: 0, links: 0, definitions: 0, importEdges: 0, referenceEdges: 0, subsystems: 0, cycles: 0 },
|
|
45
|
+
shown: { nodes: 0, edges: 0 },
|
|
46
|
+
bounds: { minX: 0, minY: 0, maxX: 0, maxY: 0 },
|
|
47
|
+
nodes: [],
|
|
48
|
+
edges: [],
|
|
49
|
+
communities: [],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const byId = id => document.getElementById(id);
|
|
53
|
+
const el = {
|
|
54
|
+
canvas: byId('canvas'),
|
|
55
|
+
stage: byId('stage'),
|
|
56
|
+
tip: byId('tip'),
|
|
57
|
+
empty: byId('empty'),
|
|
58
|
+
emptyText: byId('empty-text'),
|
|
59
|
+
title: byId('title'),
|
|
60
|
+
summary: byId('summary'),
|
|
61
|
+
fit: byId('fit'),
|
|
62
|
+
showAll: byId('show-all'),
|
|
63
|
+
search: byId('search'),
|
|
64
|
+
results: byId('results'),
|
|
65
|
+
legend: byId('legend'),
|
|
66
|
+
infoEmpty: byId('info-empty'),
|
|
67
|
+
infoBody: byId('info-body'),
|
|
68
|
+
infoPath: byId('info-path'),
|
|
69
|
+
infoSwatch: byId('info-swatch'),
|
|
70
|
+
infoSub: byId('info-sub'),
|
|
71
|
+
infoRank: byId('info-rank'),
|
|
72
|
+
infoIn: byId('info-in'),
|
|
73
|
+
infoOut: byId('info-out'),
|
|
74
|
+
neighbours: byId('neighbours'),
|
|
75
|
+
neighbourCount: byId('neighbour-count'),
|
|
76
|
+
open: byId('open-btn'),
|
|
77
|
+
notesSection: byId('notes-section'),
|
|
78
|
+
notes: byId('notes'),
|
|
79
|
+
status: byId('status'),
|
|
80
|
+
};
|
|
81
|
+
const ctx = el.canvas.getContext('2d');
|
|
82
|
+
const vscode = typeof acquireVsCodeApi === 'function' ? acquireVsCodeApi() : null;
|
|
83
|
+
|
|
84
|
+
let model = EMPTY_MODEL;
|
|
85
|
+
let nodeCount = 0;
|
|
86
|
+
let edgeCount = 0;
|
|
87
|
+
let colorOf = [];
|
|
88
|
+
let radiusOf = [];
|
|
89
|
+
let lowerName = [];
|
|
90
|
+
let lowerPath = [];
|
|
91
|
+
let adjacency = [];
|
|
92
|
+
let communityById = new Map();
|
|
93
|
+
let pathIndex = new Map();
|
|
94
|
+
let legendButtons = new Map();
|
|
95
|
+
let sx = new Float64Array(0);
|
|
96
|
+
let sy = new Float64Array(0);
|
|
97
|
+
let visibleMask = new Uint8Array(0);
|
|
98
|
+
let dimMask = new Uint8Array(0);
|
|
99
|
+
let neighbourMask = new Uint8Array(0);
|
|
100
|
+
let edgeClass = new Uint8Array(0);
|
|
101
|
+
let resultIds = [];
|
|
102
|
+
const hidden = new Set();
|
|
103
|
+
let colors = { bg: '#1e1e1e', fg: '#cccccc', muted: '#9d9d9d', accent: '#007fd4', font: 'sans-serif' };
|
|
104
|
+
const view = { scale: 1, tx: 0, ty: 0 };
|
|
105
|
+
const size = { width: 0, height: 0, dpr: 1 };
|
|
106
|
+
let selected = -1;
|
|
107
|
+
let hovered = -1;
|
|
108
|
+
let query = '';
|
|
109
|
+
let autoFit = true;
|
|
110
|
+
let drag = null;
|
|
111
|
+
let frameQueued = false;
|
|
112
|
+
let announceTimer = 0;
|
|
113
|
+
const counters = { drawnNodes: 0, drawnEdges: 0, labels: 0, frameMs: 0, visible: 0, opened: null };
|
|
114
|
+
|
|
115
|
+
const clamp = (value, low, high) => Math.min(high, Math.max(low, value));
|
|
116
|
+
const fmt = value => Number(value).toLocaleString('en-US');
|
|
117
|
+
|
|
118
|
+
function isModel(value) {
|
|
119
|
+
return !!value && Array.isArray(value.nodes) && Array.isArray(value.edges) && Array.isArray(value.communities)
|
|
120
|
+
&& !!value.totals && !!value.shown && !!value.bounds;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function describeModel(m) {
|
|
124
|
+
const t = m.totals;
|
|
125
|
+
const s = m.shown;
|
|
126
|
+
let text = fmt(s.nodes) + ' of ' + fmt(t.files) + ' files \u00b7 ' + fmt(s.edges) + ' of ' + fmt(t.links)
|
|
127
|
+
+ ' links \u00b7 ' + fmt(t.subsystems) + ' subsystems';
|
|
128
|
+
if (m.partial) text += ' \u00b7 partial graph';
|
|
129
|
+
return text;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function announce(text) {
|
|
133
|
+
el.status.textContent = '';
|
|
134
|
+
clearTimeout(announceTimer);
|
|
135
|
+
announceTimer = setTimeout(() => { el.status.textContent = text; }, 30);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function readColors() {
|
|
139
|
+
const style = getComputedStyle(document.body);
|
|
140
|
+
const read = (name, fallback) => style.getPropertyValue(name).trim() || fallback;
|
|
141
|
+
colors = {
|
|
142
|
+
bg: read('--bg', '#1e1e1e'),
|
|
143
|
+
fg: read('--fg', '#cccccc'),
|
|
144
|
+
muted: read('--muted', '#9d9d9d'),
|
|
145
|
+
accent: read('--accent', '#007fd4'),
|
|
146
|
+
font: style.fontFamily || 'sans-serif',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function setModel(next) {
|
|
151
|
+
const previous = selected >= 0 && model.nodes[selected] ? model.nodes[selected].path : null;
|
|
152
|
+
model = next;
|
|
153
|
+
nodeCount = next.nodes.length;
|
|
154
|
+
edgeCount = next.edges.length;
|
|
155
|
+
communityById = new Map(next.communities.map(c => [c.id, c]));
|
|
156
|
+
colorOf = next.nodes.map(node => {
|
|
157
|
+
const community = communityById.get(node.community);
|
|
158
|
+
return community ? community.color : '#888888';
|
|
159
|
+
});
|
|
160
|
+
radiusOf = next.nodes.map(node => 2.5 + 10 * Math.sqrt(clamp(node.rank, 0, 1)));
|
|
161
|
+
lowerName = next.nodes.map(node => node.name.toLowerCase());
|
|
162
|
+
lowerPath = next.nodes.map(node => node.path.toLowerCase());
|
|
163
|
+
pathIndex = new Map(next.nodes.map((node, i) => [node.path, i]));
|
|
164
|
+
adjacency = next.nodes.map(() => []);
|
|
165
|
+
next.edges.forEach((edge, e) => {
|
|
166
|
+
adjacency[edge.from].push(e);
|
|
167
|
+
adjacency[edge.to].push(e);
|
|
168
|
+
});
|
|
169
|
+
sx = new Float64Array(nodeCount);
|
|
170
|
+
sy = new Float64Array(nodeCount);
|
|
171
|
+
visibleMask = new Uint8Array(nodeCount);
|
|
172
|
+
dimMask = new Uint8Array(nodeCount);
|
|
173
|
+
neighbourMask = new Uint8Array(nodeCount);
|
|
174
|
+
edgeClass = new Uint8Array(edgeCount);
|
|
175
|
+
|
|
176
|
+
selected = previous !== null && pathIndex.has(previous) ? pathIndex.get(previous) : -1;
|
|
177
|
+
if (selected >= 0 && hidden.has(next.nodes[selected].community)) selected = -1;
|
|
178
|
+
hovered = -1;
|
|
179
|
+
hideTip();
|
|
180
|
+
|
|
181
|
+
document.title = next.title;
|
|
182
|
+
el.title.textContent = next.title;
|
|
183
|
+
el.emptyText.textContent = nodeCount === 0 ? 'No indexed files to show yet.' : '';
|
|
184
|
+
el.empty.hidden = nodeCount > 0;
|
|
185
|
+
buildLegend();
|
|
186
|
+
renderNotes();
|
|
187
|
+
refreshMasks();
|
|
188
|
+
renderResults();
|
|
189
|
+
refreshInfo();
|
|
190
|
+
if (autoFit && size.width > 0) fit();
|
|
191
|
+
request();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function renderNotes() {
|
|
195
|
+
el.notes.textContent = '';
|
|
196
|
+
const list = Array.isArray(model.notes) ? model.notes : [];
|
|
197
|
+
el.notesSection.hidden = list.length === 0;
|
|
198
|
+
list.forEach(note => {
|
|
199
|
+
const li = document.createElement('li');
|
|
200
|
+
li.textContent = note;
|
|
201
|
+
el.notes.appendChild(li);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function buildLegend() {
|
|
206
|
+
el.legend.textContent = '';
|
|
207
|
+
legendButtons = new Map();
|
|
208
|
+
model.communities.forEach(community => {
|
|
209
|
+
const li = document.createElement('li');
|
|
210
|
+
const button = document.createElement('button');
|
|
211
|
+
button.type = 'button';
|
|
212
|
+
button.title = community.name + ' (' + fmt(community.files) + ' files in the repository)';
|
|
213
|
+
const swatch = document.createElement('span');
|
|
214
|
+
swatch.className = 'swatch';
|
|
215
|
+
swatch.style.background = community.color;
|
|
216
|
+
const name = document.createElement('span');
|
|
217
|
+
name.className = 'path';
|
|
218
|
+
name.textContent = community.name;
|
|
219
|
+
const count = document.createElement('span');
|
|
220
|
+
count.className = 'count';
|
|
221
|
+
count.textContent = fmt(community.files);
|
|
222
|
+
button.append(swatch, name, count);
|
|
223
|
+
button.addEventListener('click', () => toggleCommunity(community.id));
|
|
224
|
+
li.appendChild(button);
|
|
225
|
+
el.legend.appendChild(li);
|
|
226
|
+
legendButtons.set(community.id, button);
|
|
227
|
+
});
|
|
228
|
+
syncLegend();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function syncLegend() {
|
|
232
|
+
legendButtons.forEach((button, id) => {
|
|
233
|
+
button.setAttribute('aria-pressed', hidden.has(id) ? 'false' : 'true');
|
|
234
|
+
});
|
|
235
|
+
el.showAll.disabled = hidden.size === 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function toggleCommunity(id) {
|
|
239
|
+
const community = communityById.get(id);
|
|
240
|
+
if (hidden.has(id)) hidden.delete(id);
|
|
241
|
+
else hidden.add(id);
|
|
242
|
+
if (selected >= 0 && hidden.has(model.nodes[selected].community)) selected = -1;
|
|
243
|
+
hovered = -1;
|
|
244
|
+
hideTip();
|
|
245
|
+
syncLegend();
|
|
246
|
+
refreshMasks();
|
|
247
|
+
renderResults();
|
|
248
|
+
refreshInfo();
|
|
249
|
+
if (community) announce(community.name + (hidden.has(id) ? ' hidden' : ' shown'));
|
|
250
|
+
request();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function showAll() {
|
|
254
|
+
if (hidden.size === 0) return;
|
|
255
|
+
hidden.clear();
|
|
256
|
+
syncLegend();
|
|
257
|
+
refreshMasks();
|
|
258
|
+
renderResults();
|
|
259
|
+
refreshInfo();
|
|
260
|
+
announce('All subsystems shown');
|
|
261
|
+
request();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function refreshMasks() {
|
|
265
|
+
const nodes = model.nodes;
|
|
266
|
+
const edges = model.edges;
|
|
267
|
+
let visible = 0;
|
|
268
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
269
|
+
visibleMask[i] = hidden.has(nodes[i].community) ? 0 : 1;
|
|
270
|
+
visible += visibleMask[i];
|
|
271
|
+
neighbourMask[i] = 0;
|
|
272
|
+
}
|
|
273
|
+
if (selected >= 0) {
|
|
274
|
+
adjacency[selected].forEach(e => {
|
|
275
|
+
const edge = edges[e];
|
|
276
|
+
neighbourMask[edge.from === selected ? edge.to : edge.from] = 1;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
resultIds = [];
|
|
281
|
+
if (query) {
|
|
282
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
283
|
+
if (visibleMask[i] && lowerPath[i].indexOf(query) !== -1) resultIds.push(i);
|
|
284
|
+
}
|
|
285
|
+
resultIds.sort((a, b) => {
|
|
286
|
+
const nameA = lowerName[a].indexOf(query) === -1 ? 1 : 0;
|
|
287
|
+
const nameB = lowerName[b].indexOf(query) === -1 ? 1 : 0;
|
|
288
|
+
return nameA - nameB || a - b;
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
293
|
+
const outsideFocus = selected >= 0 && i !== selected && !neighbourMask[i];
|
|
294
|
+
const outsideQuery = query !== '' && lowerPath[i].indexOf(query) === -1;
|
|
295
|
+
dimMask[i] = outsideFocus || outsideQuery ? 1 : 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
for (let e = 0; e < edges.length; e++) {
|
|
299
|
+
const edge = edges[e];
|
|
300
|
+
const kind = edge.imports ? EDGE_IMPORT : EDGE_REFERENCE;
|
|
301
|
+
let cls;
|
|
302
|
+
if (!visibleMask[edge.from] || !visibleMask[edge.to]) cls = EDGE_HIDDEN;
|
|
303
|
+
else if (selected >= 0) cls = edge.from === selected || edge.to === selected ? kind + 2 : EDGE_FAINT;
|
|
304
|
+
else if (query && (dimMask[edge.from] || dimMask[edge.to])) cls = EDGE_FAINT;
|
|
305
|
+
else cls = kind;
|
|
306
|
+
edgeClass[e] = cls;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
counters.visible = visible;
|
|
310
|
+
el.summary.textContent = describeModel(model) + ' \u00b7 ' + fmt(visible) + ' visible';
|
|
311
|
+
markResults();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function renderResults() {
|
|
315
|
+
el.results.textContent = '';
|
|
316
|
+
resultIds.slice(0, MAX_RESULTS).forEach(i => {
|
|
317
|
+
const li = document.createElement('li');
|
|
318
|
+
const button = document.createElement('button');
|
|
319
|
+
button.type = 'button';
|
|
320
|
+
button.dataset.id = String(i);
|
|
321
|
+
button.title = model.nodes[i].path;
|
|
322
|
+
button.textContent = model.nodes[i].path;
|
|
323
|
+
button.addEventListener('click', () => select(i, true));
|
|
324
|
+
li.appendChild(button);
|
|
325
|
+
el.results.appendChild(li);
|
|
326
|
+
});
|
|
327
|
+
if (resultIds.length > MAX_RESULTS) {
|
|
328
|
+
const more = document.createElement('li');
|
|
329
|
+
more.className = 'keys';
|
|
330
|
+
more.textContent = fmt(resultIds.length - MAX_RESULTS) + ' more; refine the search';
|
|
331
|
+
el.results.appendChild(more);
|
|
332
|
+
}
|
|
333
|
+
markResults();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function markResults() {
|
|
337
|
+
el.results.querySelectorAll('button').forEach(button => {
|
|
338
|
+
button.setAttribute('aria-current', button.dataset.id === String(selected) ? 'true' : 'false');
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function refreshInfo() {
|
|
343
|
+
const has = selected >= 0;
|
|
344
|
+
el.infoEmpty.hidden = has;
|
|
345
|
+
el.infoBody.hidden = !has;
|
|
346
|
+
el.open.disabled = !has;
|
|
347
|
+
if (has) {
|
|
348
|
+
const node = model.nodes[selected];
|
|
349
|
+
const community = communityById.get(node.community);
|
|
350
|
+
el.infoPath.textContent = node.path;
|
|
351
|
+
el.infoSub.textContent = community ? community.name : 'Unassigned';
|
|
352
|
+
el.infoSwatch.style.background = colorOf[selected];
|
|
353
|
+
el.infoRank.textContent = Math.round(node.rank * 100) + '% of the top file';
|
|
354
|
+
el.infoIn.textContent = fmt(node.inDegree);
|
|
355
|
+
el.infoOut.textContent = fmt(node.outDegree);
|
|
356
|
+
renderNeighbours();
|
|
357
|
+
} else {
|
|
358
|
+
el.neighbours.textContent = '';
|
|
359
|
+
el.neighbourCount.textContent = '';
|
|
360
|
+
}
|
|
361
|
+
markResults();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function renderNeighbours() {
|
|
365
|
+
const best = new Map();
|
|
366
|
+
adjacency[selected].forEach(e => {
|
|
367
|
+
const edge = model.edges[e];
|
|
368
|
+
const other = edge.from === selected ? edge.to : edge.from;
|
|
369
|
+
if (!visibleMask[other]) return;
|
|
370
|
+
const prior = best.get(other);
|
|
371
|
+
if (!prior) best.set(other, { id: other, weight: edge.weight, imports: edge.imports });
|
|
372
|
+
else {
|
|
373
|
+
prior.weight = Math.max(prior.weight, edge.weight);
|
|
374
|
+
prior.imports = prior.imports || edge.imports;
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
const links = Array.from(best.values()).sort((a, b) => b.weight - a.weight || a.id - b.id);
|
|
378
|
+
el.neighbours.textContent = '';
|
|
379
|
+
links.slice(0, MAX_NEIGHBOURS).forEach(link => {
|
|
380
|
+
const li = document.createElement('li');
|
|
381
|
+
const button = document.createElement('button');
|
|
382
|
+
button.type = 'button';
|
|
383
|
+
button.title = model.nodes[link.id].path;
|
|
384
|
+
const name = document.createElement('span');
|
|
385
|
+
name.className = 'path';
|
|
386
|
+
name.textContent = model.nodes[link.id].name;
|
|
387
|
+
const kind = document.createElement('span');
|
|
388
|
+
kind.className = 'count';
|
|
389
|
+
kind.textContent = link.imports ? 'import' : 'reference';
|
|
390
|
+
button.append(name, kind);
|
|
391
|
+
button.addEventListener('click', () => select(link.id, true));
|
|
392
|
+
li.appendChild(button);
|
|
393
|
+
el.neighbours.appendChild(li);
|
|
394
|
+
});
|
|
395
|
+
el.neighbourCount.textContent = fmt(links.length) + ' linked' + (links.length > MAX_NEIGHBOURS ? ' (top ' + MAX_NEIGHBOURS + ' shown)' : '');
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function select(i, center) {
|
|
399
|
+
selected = i;
|
|
400
|
+
refreshMasks();
|
|
401
|
+
if (i >= 0 && center) centreOn(i);
|
|
402
|
+
refreshInfo();
|
|
403
|
+
if (i >= 0) announce(model.nodes[i].path + ' selected');
|
|
404
|
+
request();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function step(direction) {
|
|
408
|
+
if (nodeCount === 0) return;
|
|
409
|
+
const start = selected >= 0 ? selected : (direction > 0 ? -1 : 0);
|
|
410
|
+
for (let k = 1; k <= nodeCount; k++) {
|
|
411
|
+
const i = (((start + direction * k) % nodeCount) + nodeCount) % nodeCount;
|
|
412
|
+
if (visibleMask[i]) {
|
|
413
|
+
select(i, true);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function openPath(path) {
|
|
420
|
+
counters.opened = path;
|
|
421
|
+
if (vscode) vscode.postMessage({ type: 'open', path });
|
|
422
|
+
announce('Opening ' + path);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function openSelected() {
|
|
426
|
+
if (selected >= 0) openPath(model.nodes[selected].path);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function fit() {
|
|
430
|
+
const b = model.bounds;
|
|
431
|
+
const bw = Math.max(b.maxX - b.minX, 1);
|
|
432
|
+
const bh = Math.max(b.maxY - b.minY, 1);
|
|
433
|
+
const availW = Math.max(size.width - 2 * PAD, 1);
|
|
434
|
+
const availH = Math.max(size.height - 2 * PAD, 1);
|
|
435
|
+
const scale = clamp(Math.min(availW / bw, availH / bh, FIT_MAX_SCALE), MIN_SCALE, MAX_SCALE);
|
|
436
|
+
view.scale = scale;
|
|
437
|
+
view.tx = PAD + (availW - bw * scale) / 2 - b.minX * scale;
|
|
438
|
+
view.ty = PAD + (availH - bh * scale) / 2 - b.minY * scale;
|
|
439
|
+
request();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function fitView() {
|
|
443
|
+
autoFit = true;
|
|
444
|
+
fit();
|
|
445
|
+
announce('Fit to view');
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function centreOn(i) {
|
|
449
|
+
const node = model.nodes[i];
|
|
450
|
+
view.scale = clamp(Math.max(view.scale, 1), MIN_SCALE, MAX_SCALE);
|
|
451
|
+
view.tx = size.width / 2 - node.x * view.scale;
|
|
452
|
+
view.ty = size.height / 2 - node.y * view.scale;
|
|
453
|
+
autoFit = false;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function zoomAt(px, py, factor) {
|
|
457
|
+
const next = clamp(view.scale * factor, MIN_SCALE, MAX_SCALE);
|
|
458
|
+
const k = next / view.scale;
|
|
459
|
+
view.tx = px - (px - view.tx) * k;
|
|
460
|
+
view.ty = py - (py - view.ty) * k;
|
|
461
|
+
view.scale = next;
|
|
462
|
+
autoFit = false;
|
|
463
|
+
request();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function pan(dx, dy) {
|
|
467
|
+
view.tx += dx;
|
|
468
|
+
view.ty += dy;
|
|
469
|
+
autoFit = false;
|
|
470
|
+
request();
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function measure() {
|
|
474
|
+
const rect = el.stage.getBoundingClientRect();
|
|
475
|
+
size.width = rect.width;
|
|
476
|
+
size.height = rect.height;
|
|
477
|
+
size.dpr = window.devicePixelRatio || 1;
|
|
478
|
+
el.canvas.width = Math.max(1, Math.round(rect.width * size.dpr));
|
|
479
|
+
el.canvas.height = Math.max(1, Math.round(rect.height * size.dpr));
|
|
480
|
+
if (autoFit) fit();
|
|
481
|
+
else request();
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function request() {
|
|
485
|
+
if (frameQueued) return;
|
|
486
|
+
frameQueued = true;
|
|
487
|
+
requestAnimationFrame(() => {
|
|
488
|
+
frameQueued = false;
|
|
489
|
+
draw();
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function draw() {
|
|
494
|
+
const started = performance.now();
|
|
495
|
+
const width = size.width;
|
|
496
|
+
const height = size.height;
|
|
497
|
+
ctx.setTransform(size.dpr, 0, 0, size.dpr, 0, 0);
|
|
498
|
+
ctx.clearRect(0, 0, width, height);
|
|
499
|
+
counters.drawnNodes = 0;
|
|
500
|
+
counters.drawnEdges = 0;
|
|
501
|
+
counters.labels = 0;
|
|
502
|
+
if (nodeCount > 0 && width > 0 && height > 0) {
|
|
503
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
504
|
+
sx[i] = model.nodes[i].x * view.scale + view.tx;
|
|
505
|
+
sy[i] = model.nodes[i].y * view.scale + view.ty;
|
|
506
|
+
}
|
|
507
|
+
drawEdges(width, height);
|
|
508
|
+
drawNodes(width, height);
|
|
509
|
+
drawRings();
|
|
510
|
+
drawLabels(width, height);
|
|
511
|
+
}
|
|
512
|
+
counters.frameMs = performance.now() - started;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function drawEdges(width, height) {
|
|
516
|
+
const edges = model.edges;
|
|
517
|
+
for (const pass of EDGE_PASSES) {
|
|
518
|
+
ctx.globalAlpha = pass.alpha;
|
|
519
|
+
ctx.strokeStyle = colors[pass.color];
|
|
520
|
+
ctx.lineWidth = pass.width;
|
|
521
|
+
ctx.setLineDash(pass.dash);
|
|
522
|
+
ctx.beginPath();
|
|
523
|
+
let count = 0;
|
|
524
|
+
for (let e = 0; e < edges.length; e++) {
|
|
525
|
+
if (edgeClass[e] !== pass.cls) continue;
|
|
526
|
+
const edge = edges[e];
|
|
527
|
+
const x1 = sx[edge.from];
|
|
528
|
+
const y1 = sy[edge.from];
|
|
529
|
+
const x2 = sx[edge.to];
|
|
530
|
+
const y2 = sy[edge.to];
|
|
531
|
+
if ((x1 < 0 && x2 < 0) || (x1 > width && x2 > width) || (y1 < 0 && y2 < 0) || (y1 > height && y2 > height)) continue;
|
|
532
|
+
ctx.moveTo(x1, y1);
|
|
533
|
+
ctx.lineTo(x2, y2);
|
|
534
|
+
count++;
|
|
535
|
+
}
|
|
536
|
+
ctx.stroke();
|
|
537
|
+
counters.drawnEdges += count;
|
|
538
|
+
}
|
|
539
|
+
ctx.setLineDash([]);
|
|
540
|
+
ctx.globalAlpha = 1;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function drawNodes(width, height) {
|
|
544
|
+
ctx.lineWidth = 1;
|
|
545
|
+
ctx.strokeStyle = colors.bg;
|
|
546
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
547
|
+
if (!visibleMask[i]) continue;
|
|
548
|
+
const r = radiusOf[i];
|
|
549
|
+
const x = sx[i];
|
|
550
|
+
const y = sy[i];
|
|
551
|
+
if (x + r < 0 || y + r < 0 || x - r > width || y - r > height) continue;
|
|
552
|
+
ctx.globalAlpha = dimMask[i] ? DIM_ALPHA : 1;
|
|
553
|
+
ctx.fillStyle = colorOf[i];
|
|
554
|
+
ctx.beginPath();
|
|
555
|
+
ctx.arc(x, y, r, 0, Math.PI * 2);
|
|
556
|
+
ctx.fill();
|
|
557
|
+
ctx.stroke();
|
|
558
|
+
counters.drawnNodes++;
|
|
559
|
+
}
|
|
560
|
+
ctx.globalAlpha = 1;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function ringAround(i, color, lineWidth, gap) {
|
|
564
|
+
ctx.strokeStyle = color;
|
|
565
|
+
ctx.lineWidth = lineWidth;
|
|
566
|
+
ctx.beginPath();
|
|
567
|
+
ctx.arc(sx[i], sy[i], radiusOf[i] + gap, 0, Math.PI * 2);
|
|
568
|
+
ctx.stroke();
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function drawRings() {
|
|
572
|
+
ctx.globalAlpha = 1;
|
|
573
|
+
if (hovered >= 0 && hovered !== selected && visibleMask[hovered]) ringAround(hovered, colors.fg, 1.5, 3);
|
|
574
|
+
if (selected >= 0 && visibleMask[selected]) ringAround(selected, colors.accent, 2.5, 4);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function overlaps(a, b) {
|
|
578
|
+
return a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function placeLabel(i, placed, width, height, force) {
|
|
582
|
+
const x = sx[i];
|
|
583
|
+
const y = sy[i];
|
|
584
|
+
if (x < 0 || y < 0 || x > width || y > height) return false;
|
|
585
|
+
const text = model.nodes[i].name;
|
|
586
|
+
const textWidth = ctx.measureText(text).width;
|
|
587
|
+
const flip = x + radiusOf[i] + 4 + textWidth > width;
|
|
588
|
+
const left = flip ? x - radiusOf[i] - 4 - textWidth : x + radiusOf[i] + 4;
|
|
589
|
+
const box = { x: left - 2, y: y - LABEL_HEIGHT / 2, w: textWidth + 4, h: LABEL_HEIGHT };
|
|
590
|
+
if (!force && placed.some(other => overlaps(box, other))) return false;
|
|
591
|
+
placed.push(box);
|
|
592
|
+
ctx.globalAlpha = 1;
|
|
593
|
+
ctx.lineWidth = 3;
|
|
594
|
+
ctx.strokeStyle = colors.bg;
|
|
595
|
+
ctx.strokeText(text, left, y);
|
|
596
|
+
ctx.fillStyle = colors.fg;
|
|
597
|
+
ctx.fillText(text, left, y);
|
|
598
|
+
counters.labels++;
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function drawLabels(width, height) {
|
|
603
|
+
ctx.font = LABEL_FONT_PX + 'px ' + colors.font;
|
|
604
|
+
ctx.textBaseline = 'middle';
|
|
605
|
+
ctx.lineJoin = 'round';
|
|
606
|
+
const placed = [];
|
|
607
|
+
const forced = [];
|
|
608
|
+
if (selected >= 0 && visibleMask[selected]) forced.push(selected);
|
|
609
|
+
if (hovered >= 0 && hovered !== selected && visibleMask[hovered]) forced.push(hovered);
|
|
610
|
+
forced.forEach(i => placeLabel(i, placed, width, height, true));
|
|
611
|
+
let drawn = 0;
|
|
612
|
+
const limit = Math.min(nodeCount, LABEL_SCAN);
|
|
613
|
+
for (let i = 0; i < limit && drawn < LABEL_BUDGET; i++) {
|
|
614
|
+
if (!visibleMask[i] || dimMask[i] || i === selected || i === hovered) continue;
|
|
615
|
+
if (placeLabel(i, placed, width, height, false)) drawn++;
|
|
616
|
+
}
|
|
617
|
+
ctx.globalAlpha = 1;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
function hitTest(px, py) {
|
|
621
|
+
const nodes = model.nodes;
|
|
622
|
+
let best = -1;
|
|
623
|
+
let bestDistance = Infinity;
|
|
624
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
625
|
+
if (!visibleMask[i]) continue;
|
|
626
|
+
const dx = nodes[i].x * view.scale + view.tx - px;
|
|
627
|
+
const dy = nodes[i].y * view.scale + view.ty - py;
|
|
628
|
+
const reach = radiusOf[i] + HIT_SLOP;
|
|
629
|
+
const distance = dx * dx + dy * dy;
|
|
630
|
+
if (distance <= reach * reach && distance < bestDistance) {
|
|
631
|
+
best = i;
|
|
632
|
+
bestDistance = distance;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return best;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function showTip(i, px, py) {
|
|
639
|
+
const node = model.nodes[i];
|
|
640
|
+
el.tip.textContent = node.path + ' \u00b7 ' + Math.round(node.rank * 100) + '% importance';
|
|
641
|
+
el.tip.hidden = false;
|
|
642
|
+
moveTip(px, py);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
function moveTip(px, py) {
|
|
646
|
+
const w = el.tip.offsetWidth;
|
|
647
|
+
const h = el.tip.offsetHeight;
|
|
648
|
+
let x = px + 14;
|
|
649
|
+
let y = py + 14;
|
|
650
|
+
if (x + w > size.width) x = Math.max(0, px - w - 14);
|
|
651
|
+
if (y + h > size.height) y = Math.max(0, py - h - 14);
|
|
652
|
+
el.tip.style.transform = 'translate(' + Math.round(x) + 'px,' + Math.round(y) + 'px)';
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function hideTip() {
|
|
656
|
+
el.tip.hidden = true;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function localPoint(ev) {
|
|
660
|
+
const rect = el.canvas.getBoundingClientRect();
|
|
661
|
+
return { x: ev.clientX - rect.left, y: ev.clientY - rect.top };
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function focusMap() {
|
|
665
|
+
el.canvas.focus({ preventScroll: true });
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function rebuildSearch() {
|
|
669
|
+
refreshMasks();
|
|
670
|
+
renderResults();
|
|
671
|
+
request();
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
el.canvas.addEventListener('pointerdown', ev => {
|
|
675
|
+
if (ev.button !== 0) return;
|
|
676
|
+
focusMap();
|
|
677
|
+
drag = { id: ev.pointerId, x0: ev.clientX, y0: ev.clientY, x: ev.clientX, y: ev.clientY, moved: false };
|
|
678
|
+
el.canvas.setPointerCapture(ev.pointerId);
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
el.canvas.addEventListener('pointermove', ev => {
|
|
682
|
+
if (drag && drag.id === ev.pointerId) {
|
|
683
|
+
if (!drag.moved) {
|
|
684
|
+
if (Math.hypot(ev.clientX - drag.x0, ev.clientY - drag.y0) < DRAG_THRESHOLD) return;
|
|
685
|
+
drag.moved = true;
|
|
686
|
+
el.canvas.classList.add('dragging');
|
|
687
|
+
hideTip();
|
|
688
|
+
}
|
|
689
|
+
pan(ev.clientX - drag.x, ev.clientY - drag.y);
|
|
690
|
+
drag.x = ev.clientX;
|
|
691
|
+
drag.y = ev.clientY;
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const p = localPoint(ev);
|
|
695
|
+
const hit = hitTest(p.x, p.y);
|
|
696
|
+
if (hit !== hovered) {
|
|
697
|
+
hovered = hit;
|
|
698
|
+
request();
|
|
699
|
+
}
|
|
700
|
+
el.canvas.classList.toggle('pointer', hit >= 0);
|
|
701
|
+
if (hit >= 0) showTip(hit, p.x, p.y);
|
|
702
|
+
else hideTip();
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
el.canvas.addEventListener('pointerup', ev => {
|
|
706
|
+
if (!drag || drag.id !== ev.pointerId) return;
|
|
707
|
+
const moved = drag.moved;
|
|
708
|
+
drag = null;
|
|
709
|
+
el.canvas.classList.remove('dragging');
|
|
710
|
+
if (!moved) {
|
|
711
|
+
const p = localPoint(ev);
|
|
712
|
+
select(hitTest(p.x, p.y), false);
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
el.canvas.addEventListener('pointercancel', () => {
|
|
717
|
+
drag = null;
|
|
718
|
+
el.canvas.classList.remove('dragging');
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
el.canvas.addEventListener('pointerleave', () => {
|
|
722
|
+
if (drag) return;
|
|
723
|
+
hovered = -1;
|
|
724
|
+
el.canvas.classList.remove('pointer');
|
|
725
|
+
hideTip();
|
|
726
|
+
request();
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
el.canvas.addEventListener('dblclick', ev => {
|
|
730
|
+
const p = localPoint(ev);
|
|
731
|
+
const hit = hitTest(p.x, p.y);
|
|
732
|
+
if (hit < 0) return;
|
|
733
|
+
select(hit, false);
|
|
734
|
+
openSelected();
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
el.canvas.addEventListener('wheel', ev => {
|
|
738
|
+
ev.preventDefault();
|
|
739
|
+
const p = localPoint(ev);
|
|
740
|
+
const deltaY = ev.deltaMode === 1 ? ev.deltaY * 16 : ev.deltaY;
|
|
741
|
+
zoomAt(p.x, p.y, Math.exp(-clamp(deltaY, -200, 200) * 0.0015));
|
|
742
|
+
}, { passive: false });
|
|
743
|
+
|
|
744
|
+
el.search.addEventListener('input', () => {
|
|
745
|
+
query = el.search.value.trim().toLowerCase();
|
|
746
|
+
rebuildSearch();
|
|
747
|
+
if (query) announce(fmt(resultIds.length) + (resultIds.length === 1 ? ' match' : ' matches'));
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
el.search.addEventListener('keydown', ev => {
|
|
751
|
+
if (ev.key === 'Escape') {
|
|
752
|
+
ev.preventDefault();
|
|
753
|
+
if (el.search.value) {
|
|
754
|
+
el.search.value = '';
|
|
755
|
+
query = '';
|
|
756
|
+
rebuildSearch();
|
|
757
|
+
}
|
|
758
|
+
focusMap();
|
|
759
|
+
} else if (ev.key === 'Enter') {
|
|
760
|
+
ev.preventDefault();
|
|
761
|
+
if (resultIds.length > 0) {
|
|
762
|
+
select(resultIds[0], true);
|
|
763
|
+
focusMap();
|
|
764
|
+
}
|
|
765
|
+
} else if (ev.key === 'ArrowDown') {
|
|
766
|
+
const first = el.results.querySelector('button');
|
|
767
|
+
if (first) {
|
|
768
|
+
ev.preventDefault();
|
|
769
|
+
first.focus();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
document.addEventListener('keydown', ev => {
|
|
775
|
+
const target = ev.target;
|
|
776
|
+
if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) return;
|
|
777
|
+
if (ev.altKey || ev.ctrlKey || ev.metaKey) return;
|
|
778
|
+
if (ev.key === '/') {
|
|
779
|
+
ev.preventDefault();
|
|
780
|
+
el.search.focus();
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
if (ev.key === 'Escape') {
|
|
784
|
+
if (selected >= 0) select(-1, false);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
const inMap = target === document.body || target === document.documentElement || target === el.canvas;
|
|
788
|
+
if (!inMap) return;
|
|
789
|
+
let handled = true;
|
|
790
|
+
switch (ev.key) {
|
|
791
|
+
case 'ArrowLeft': pan(PAN_STEP, 0); break;
|
|
792
|
+
case 'ArrowRight': pan(-PAN_STEP, 0); break;
|
|
793
|
+
case 'ArrowUp': pan(0, PAN_STEP); break;
|
|
794
|
+
case 'ArrowDown': pan(0, -PAN_STEP); break;
|
|
795
|
+
case '+':
|
|
796
|
+
case '=': zoomAt(size.width / 2, size.height / 2, 1.25); break;
|
|
797
|
+
case '-':
|
|
798
|
+
case '_': zoomAt(size.width / 2, size.height / 2, 0.8); break;
|
|
799
|
+
case '0': fitView(); break;
|
|
800
|
+
case 'Enter': openSelected(); break;
|
|
801
|
+
case 'n': step(1); break;
|
|
802
|
+
case 'N': step(-1); break;
|
|
803
|
+
default: handled = false;
|
|
804
|
+
}
|
|
805
|
+
if (handled) ev.preventDefault();
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
el.fit.addEventListener('click', fitView);
|
|
809
|
+
el.showAll.addEventListener('click', showAll);
|
|
810
|
+
el.open.addEventListener('click', openSelected);
|
|
811
|
+
|
|
812
|
+
window.addEventListener('message', event => {
|
|
813
|
+
const data = event.data;
|
|
814
|
+
if (!data || data.type !== 'model' || !isModel(data.model)) return;
|
|
815
|
+
setModel(data.model);
|
|
816
|
+
announce('Explorer updated: ' + describeModel(model));
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
new MutationObserver(() => {
|
|
820
|
+
readColors();
|
|
821
|
+
request();
|
|
822
|
+
}).observe(document.body, { attributes: true, attributeFilter: ['class'] });
|
|
823
|
+
|
|
824
|
+
if (typeof ResizeObserver === 'function') new ResizeObserver(() => measure()).observe(el.stage);
|
|
825
|
+
else window.addEventListener('resize', measure);
|
|
826
|
+
|
|
827
|
+
window.__squeeze = {
|
|
828
|
+
get stats() {
|
|
829
|
+
return {
|
|
830
|
+
version: model.version,
|
|
831
|
+
title: model.title,
|
|
832
|
+
nodes: nodeCount,
|
|
833
|
+
edges: edgeCount,
|
|
834
|
+
visible: counters.visible,
|
|
835
|
+
drawnNodes: counters.drawnNodes,
|
|
836
|
+
drawnEdges: counters.drawnEdges,
|
|
837
|
+
labels: counters.labels,
|
|
838
|
+
frameMs: counters.frameMs,
|
|
839
|
+
selected: selected >= 0 ? model.nodes[selected].path : null,
|
|
840
|
+
hidden: Array.from(hidden),
|
|
841
|
+
scale: view.scale,
|
|
842
|
+
query,
|
|
843
|
+
matches: resultIds.length,
|
|
844
|
+
opened: counters.opened,
|
|
845
|
+
};
|
|
846
|
+
},
|
|
847
|
+
/** Canvas position of a shown file, so tests can hover or click it. */
|
|
848
|
+
screenOf(path) {
|
|
849
|
+
const index = model.nodes.findIndex(node => node.path === path);
|
|
850
|
+
if (index < 0) return null;
|
|
851
|
+
return { x: model.nodes[index].x * view.scale + view.tx, y: model.nodes[index].y * view.scale + view.ty };
|
|
852
|
+
},
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
const initialNode = byId('squeze-model');
|
|
856
|
+
let initial = null;
|
|
857
|
+
try {
|
|
858
|
+
initial = JSON.parse(initialNode ? initialNode.textContent : 'null');
|
|
859
|
+
} catch (err) {
|
|
860
|
+
initial = null;
|
|
861
|
+
}
|
|
862
|
+
readColors();
|
|
863
|
+
setModel(isModel(initial) ? initial : EMPTY_MODEL);
|
|
864
|
+
if (!isModel(initial)) {
|
|
865
|
+
el.emptyText.textContent = 'The explorer data could not be read. Run Squeze: Refresh Index, then open the Explorer again.';
|
|
866
|
+
el.empty.hidden = false;
|
|
867
|
+
}
|
|
868
|
+
measure();
|
|
869
|
+
})();
|