@kaizenreport/kensho-viewer 0.1.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/LICENSE +21 -0
- package/README.md +19 -0
- package/assets/app.js +1396 -0
- package/assets/app.jsx +860 -0
- package/assets/charts.js +1156 -0
- package/assets/charts.jsx +593 -0
- package/assets/colors_and_type.css +219 -0
- package/assets/components.js +894 -0
- package/assets/components.jsx +520 -0
- package/assets/data-bridge.js +49 -0
- package/assets/data-bridge.jsx +55 -0
- package/assets/data-loader.js +543 -0
- package/assets/kaizen-mark.svg +5 -0
- package/assets/kensho-wordmark.svg +18 -0
- package/assets/pages.js +1472 -0
- package/assets/pages.jsx +822 -0
- package/assets/test-detail.js +1058 -0
- package/assets/test-detail.jsx +502 -0
- package/assets/tokens.css +357 -0
- package/assets/tree-detail.js +1705 -0
- package/assets/tree-detail.jsx +947 -0
- package/dist/component.d.ts +115 -0
- package/dist/component.js +698 -0
- package/index.html +35 -0
- package/package.json +65 -0
- package/scripts/build.js +117 -0
- package/src/component.d.ts +115 -0
- package/src/component.jsx +340 -0
- package/src/data.js +538 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Type declarations for @kaizenreport/kensho-viewer/component.
|
|
2
|
+
//
|
|
3
|
+
// Hand-written; the implementation is JSX. Kept minimal — covers the public
|
|
4
|
+
// API only.
|
|
5
|
+
|
|
6
|
+
import type * as React from 'react';
|
|
7
|
+
|
|
8
|
+
export interface KenshoSidebarItem {
|
|
9
|
+
/** Stable key, used for React reconciliation. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Visible label. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Lucide icon name (https://lucide.dev/icons). */
|
|
14
|
+
icon: string;
|
|
15
|
+
/** Render the page body when this item is active. */
|
|
16
|
+
render: () => React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface KenshoExtraTab {
|
|
20
|
+
/** Stable key, used for React reconciliation. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Visible tab label. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Render the tab body for the given test (`RichTest` shape). */
|
|
25
|
+
render: (test: any) => React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface KenshoViewerProps {
|
|
29
|
+
/**
|
|
30
|
+
* URL to a Kensho `data/` directory. The component will fetch
|
|
31
|
+
* `${dataUrl}/index.json` and (lazily) `${dataUrl}/cases/<id>.json`.
|
|
32
|
+
* Trailing slashes are normalized.
|
|
33
|
+
*/
|
|
34
|
+
dataUrl: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Override for per-case JSON URLs. Default: `${dataUrl}/cases/<id>.json`.
|
|
38
|
+
*/
|
|
39
|
+
caseUrl?: (caseId: string) => string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* URL to the directory containing the viewer's compiled `assets/*.js`
|
|
43
|
+
* files. Required if you don't drop a `<link data-kensho-viewer-assets="…">`
|
|
44
|
+
* marker in your <head>.
|
|
45
|
+
*/
|
|
46
|
+
assetsUrl?: string;
|
|
47
|
+
|
|
48
|
+
/** Fired when a case is opened (deep-link integration). */
|
|
49
|
+
onCaseOpen?: (caseId: string | null) => void;
|
|
50
|
+
|
|
51
|
+
/** Fired when the user navigates to a different sidebar page. */
|
|
52
|
+
onPageChange?: (page: string) => void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Optional extra sidebar items rendered after the built-ins.
|
|
56
|
+
*/
|
|
57
|
+
extraSidebar?: KenshoSidebarItem[];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Optional extra tabs injected at the end of the test detail tab list.
|
|
61
|
+
*/
|
|
62
|
+
extraTabs?: KenshoExtraTab[];
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Initial state — useful for SSR / deep-linked URLs.
|
|
66
|
+
*/
|
|
67
|
+
initial?: {
|
|
68
|
+
page?: string;
|
|
69
|
+
caseId?: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* When `true`, the viewer suppresses its own hash-router and keyboard
|
|
74
|
+
* shortcuts. The host must update `initial.page` / `initial.caseId` (or
|
|
75
|
+
* remount) in response to the `onPageChange` / `onCaseOpen` callbacks.
|
|
76
|
+
*/
|
|
77
|
+
ownKeyboard?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare function KenshoViewer(props: KenshoViewerProps): JSX.Element;
|
|
81
|
+
export default KenshoViewer;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Pure data loader — fetches `${dataUrl}/index.json` and normalizes the
|
|
85
|
+
* Kensho v1 schema into the shape the viewer expects. Exposed for hosts that
|
|
86
|
+
* want to introspect the loaded data themselves.
|
|
87
|
+
*/
|
|
88
|
+
export declare function loadKenshoData(
|
|
89
|
+
dataUrl: string,
|
|
90
|
+
opts?: {
|
|
91
|
+
caseUrl?: (caseId: string) => string;
|
|
92
|
+
fetch?: typeof fetch;
|
|
93
|
+
}
|
|
94
|
+
): Promise<KenshoState>;
|
|
95
|
+
|
|
96
|
+
export interface KenshoState {
|
|
97
|
+
kenshoIndex: any;
|
|
98
|
+
reportType: 'unit' | 'e2e' | 'mixed' | string;
|
|
99
|
+
run: any;
|
|
100
|
+
env: Array<[string, string]>;
|
|
101
|
+
suites: Array<{ name: string; segs: Array<{ k: string; n: number }>; total: number }>;
|
|
102
|
+
tests: any[];
|
|
103
|
+
richTests: Record<string, any>;
|
|
104
|
+
suiteTree: any[];
|
|
105
|
+
behaviorTree: any[];
|
|
106
|
+
categories: any[];
|
|
107
|
+
timelineTests: any[];
|
|
108
|
+
trendRuns: any[];
|
|
109
|
+
histogram: Array<{ label: string; n: number }>;
|
|
110
|
+
historyRuns: any[];
|
|
111
|
+
ensureCaseLoaded: (richTest: any) => Promise<any>;
|
|
112
|
+
loadCase: (id: string) => Promise<any>;
|
|
113
|
+
fmtDuration: (ms: number) => string;
|
|
114
|
+
relTime: (iso: string) => string;
|
|
115
|
+
}
|