bee-ladybug 0.5.4 → 0.6.1
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/README.MD +17 -1
- package/package.json +1 -1
- package/src/adapters/AntAdapter.js +52 -1
- package/src/adapters/CSSAdapter.js +131 -3
- package/src/adapters/CanvasAdapter.js +87 -1
- package/src/adapters/SpiderAdapter.js +53 -2
- package/src/adapters/WebDOMAdapter.js +209 -1
- package/src/adapters/python/PythonBridge.js +74 -2
- package/src/core/BeeLadybugCore.js +48 -4
- package/src/core/ReportExporter.js +695 -0
- package/src/core/UIOverlay.js +3 -1
- package/src/index.d.ts +89 -0
- package/src/index.js +1 -0
package/src/core/UIOverlay.js
CHANGED
|
@@ -542,11 +542,12 @@ export class UIOverlay {
|
|
|
542
542
|
<button class="bl-btn" data-act="slow" type="button">F3 SLOW</button>
|
|
543
543
|
<button class="bl-btn" data-act="freeze" type="button">F4 STOP</button>
|
|
544
544
|
<button class="bl-btn" data-act="live" type="button">1x LIVE</button>
|
|
545
|
+
<button class="bl-btn" data-act="export" type="button">F8 EXPORT</button>
|
|
545
546
|
<span class="bl-hotkeys" data-el="hotkeys"></span>
|
|
546
547
|
<button class="bl-btn" data-act="ask" type="button">ASK AI</button>
|
|
547
548
|
<span class="bl-providers" data-el="providers"></span>
|
|
548
549
|
<span class="bl-adapters" data-el="adapters"></span>
|
|
549
|
-
<span class="bl-hint">F2 overlay</span>
|
|
550
|
+
<span class="bl-hint">F2 overlay · F8 export</span>
|
|
550
551
|
</div>
|
|
551
552
|
</div>
|
|
552
553
|
</div>
|
|
@@ -581,6 +582,7 @@ export class UIOverlay {
|
|
|
581
582
|
if (act === 'slow') this.core.applySlowMo();
|
|
582
583
|
else if (act === 'freeze') this.core.toggleFreeze();
|
|
583
584
|
else if (act === 'live') this.core.restoreRealtime();
|
|
585
|
+
else if (act === 'export') this.core.exportReport('html');
|
|
584
586
|
else if (act === 'ask') this.core.ask();
|
|
585
587
|
else if (act === 'assist') this.core.setActiveAssistant(btn.getAttribute('data-name'));
|
|
586
588
|
else if (act === 'adapter') this.core.toggleAdapter(btn.getAttribute('data-name'));
|
package/src/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export interface CoreOptions {
|
|
|
67
67
|
toggleKey?: string;
|
|
68
68
|
slowKey?: string;
|
|
69
69
|
freezeKey?: string;
|
|
70
|
+
exportKey?: string;
|
|
70
71
|
slowScale?: number;
|
|
71
72
|
maxLogs?: number;
|
|
72
73
|
historySize?: number;
|
|
@@ -108,12 +109,86 @@ export interface AssistantProvider {
|
|
|
108
109
|
complete(input: { question: string; snapshot: AssistantSnapshot }): unknown;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
export type ReportFormat = 'html' | 'json' | 'csv';
|
|
113
|
+
export type ReportSeverity = 'error' | 'warn' | 'ok';
|
|
114
|
+
|
|
115
|
+
export interface ReportItem {
|
|
116
|
+
severity: ReportSeverity;
|
|
117
|
+
selector: string;
|
|
118
|
+
rule: string;
|
|
119
|
+
value: string;
|
|
120
|
+
source: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ReportSection {
|
|
124
|
+
name: string;
|
|
125
|
+
items: ReportItem[];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ReportSeries {
|
|
129
|
+
name: string;
|
|
130
|
+
min: number;
|
|
131
|
+
max: number;
|
|
132
|
+
avg: number;
|
|
133
|
+
last: number;
|
|
134
|
+
samples: number[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface ReportDocument {
|
|
138
|
+
version: string;
|
|
139
|
+
generatedAt: string;
|
|
140
|
+
fileStamp: string;
|
|
141
|
+
url: string;
|
|
142
|
+
viewport: { width: number; height: number } | null;
|
|
143
|
+
clock: {
|
|
144
|
+
wallTime: number;
|
|
145
|
+
simTime: number;
|
|
146
|
+
frame: number;
|
|
147
|
+
frozen: boolean;
|
|
148
|
+
timeScale: number;
|
|
149
|
+
coreFps: number;
|
|
150
|
+
};
|
|
151
|
+
summary: { error: number; warn: number; ok: number };
|
|
152
|
+
logs: Array<{
|
|
153
|
+
type: string;
|
|
154
|
+
level: LogLevel | null;
|
|
155
|
+
source: string;
|
|
156
|
+
message: string;
|
|
157
|
+
wallTime: number;
|
|
158
|
+
simTime: number;
|
|
159
|
+
frame: number;
|
|
160
|
+
}>;
|
|
161
|
+
series: ReportSeries[];
|
|
162
|
+
latest: BeePacket[];
|
|
163
|
+
adapters: ReportSection[];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ReportSnapshotItem {
|
|
167
|
+
severity?: string;
|
|
168
|
+
selector?: string;
|
|
169
|
+
rule?: string;
|
|
170
|
+
value?: unknown;
|
|
171
|
+
source?: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface ReportSnapshot {
|
|
175
|
+
name?: string;
|
|
176
|
+
items?: ReportSnapshotItem[];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface AdapterSnapshotResult {
|
|
180
|
+
name: string;
|
|
181
|
+
result?: unknown;
|
|
182
|
+
error?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
111
185
|
export interface AdapterHooks {
|
|
112
186
|
enable(): void;
|
|
113
187
|
disable(): void;
|
|
114
188
|
label?: string;
|
|
115
189
|
hotkey?: string;
|
|
116
190
|
enabled?: boolean;
|
|
191
|
+
snapshot?(): ReportSnapshot | null | undefined;
|
|
117
192
|
}
|
|
118
193
|
|
|
119
194
|
export interface AdapterInfo {
|
|
@@ -125,11 +200,16 @@ export interface AdapterInfo {
|
|
|
125
200
|
|
|
126
201
|
export function formatSimTime(ms: number): string;
|
|
127
202
|
|
|
203
|
+
export function exportReport(core: BeeLadybugCore, options: { format: 'json' }): ReportDocument;
|
|
204
|
+
export function exportReport(core: BeeLadybugCore, options?: { format?: 'html' | 'csv' }): string;
|
|
205
|
+
export function isReportNoise(node: object | null | undefined): boolean;
|
|
206
|
+
|
|
128
207
|
export class BeeLadybugCore {
|
|
129
208
|
readonly version: string;
|
|
130
209
|
toggleKey: string;
|
|
131
210
|
slowKey: string;
|
|
132
211
|
freezeKey: string;
|
|
212
|
+
exportKey: string;
|
|
133
213
|
slowScale: number;
|
|
134
214
|
maxLogs: number;
|
|
135
215
|
historySize: number;
|
|
@@ -158,6 +238,8 @@ export class BeeLadybugCore {
|
|
|
158
238
|
setTimeScale(scale: number): this;
|
|
159
239
|
applySlowMo(): this;
|
|
160
240
|
restoreRealtime(): this;
|
|
241
|
+
exportReport(format: 'json'): ReportDocument;
|
|
242
|
+
exportReport(format?: 'html' | 'csv'): string;
|
|
161
243
|
getState(): CoreState;
|
|
162
244
|
getLogs(): BeePacket[];
|
|
163
245
|
getHistory(name: string): MetricHistory;
|
|
@@ -175,6 +257,7 @@ export class BeeLadybugCore {
|
|
|
175
257
|
registerAdapter(name: string, hooks: AdapterHooks): this;
|
|
176
258
|
unregisterAdapter(name: string): this;
|
|
177
259
|
getAdapters(): AdapterInfo[];
|
|
260
|
+
collectSnapshots(): AdapterSnapshotResult[];
|
|
178
261
|
toggleAdapter(name: string): this;
|
|
179
262
|
setAdapterEnabled(name: string, enabled: boolean): this;
|
|
180
263
|
publishDetail(items: DetailItem[]): this;
|
|
@@ -254,6 +337,7 @@ export class CanvasAdapter {
|
|
|
254
337
|
setCanvas(canvas: HTMLCanvasElement | null): this;
|
|
255
338
|
setEntities(entities: CanvasEntity[]): this;
|
|
256
339
|
pump(ctx?: CanvasRenderingContext2D): this;
|
|
340
|
+
snapshot(): ReportSnapshot | null;
|
|
257
341
|
}
|
|
258
342
|
|
|
259
343
|
export interface WebDOMAdapterOptions {
|
|
@@ -285,6 +369,7 @@ export class WebDOMAdapter {
|
|
|
285
369
|
detach(): this;
|
|
286
370
|
setRoot(root: ParentNode | null): this;
|
|
287
371
|
pump(): this;
|
|
372
|
+
snapshot(): ReportSnapshot | null;
|
|
288
373
|
}
|
|
289
374
|
|
|
290
375
|
export interface CSSAdapterOptions {
|
|
@@ -315,6 +400,7 @@ export class CSSAdapter {
|
|
|
315
400
|
attach(): this;
|
|
316
401
|
detach(): this;
|
|
317
402
|
scan(): this;
|
|
403
|
+
snapshot(): ReportSnapshot | null;
|
|
318
404
|
}
|
|
319
405
|
|
|
320
406
|
export interface AntAdapterOptions {
|
|
@@ -335,6 +421,7 @@ export class AntAdapter {
|
|
|
335
421
|
constructor(core: BeeLadybugCore, options?: AntAdapterOptions);
|
|
336
422
|
attach(): this;
|
|
337
423
|
detach(): this;
|
|
424
|
+
snapshot(): ReportSnapshot | null;
|
|
338
425
|
}
|
|
339
426
|
|
|
340
427
|
export interface SpiderAdapterOptions {
|
|
@@ -353,6 +440,7 @@ export class SpiderAdapter {
|
|
|
353
440
|
constructor(core: BeeLadybugCore, options?: SpiderAdapterOptions);
|
|
354
441
|
attach(): this;
|
|
355
442
|
detach(): this;
|
|
443
|
+
snapshot(): ReportSnapshot | null;
|
|
356
444
|
}
|
|
357
445
|
|
|
358
446
|
export type PythonBridgeStatus = 'idle' | 'connecting' | 'open' | 'closed';
|
|
@@ -378,4 +466,5 @@ export class PythonBridge {
|
|
|
378
466
|
connect(url?: string): this;
|
|
379
467
|
disconnect(): this;
|
|
380
468
|
ingest(raw: unknown): this;
|
|
469
|
+
snapshot(): ReportSnapshot;
|
|
381
470
|
}
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { BeeLadybugCore, BEE_LADYBUG_VERSION, CORE_DEFAULTS, WELL_KNOWN_TYPES, formatSimTime } from './core/BeeLadybugCore.js';
|
|
2
|
+
export { exportReport, isReportNoise } from './core/ReportExporter.js';
|
|
2
3
|
export { UIOverlay } from './core/UIOverlay.js';
|
|
3
4
|
export { CanvasAdapter, CANVAS_ADAPTER_DEFAULTS } from './adapters/CanvasAdapter.js';
|
|
4
5
|
export { WebDOMAdapter, WEB_DOM_ADAPTER_DEFAULTS } from './adapters/WebDOMAdapter.js';
|