@vitalens/panel 0.1.0 → 0.1.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 +6 -2
- package/dist/PerfPanel.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +787 -600
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/thresholds.d.ts +34 -0
- package/dist/utils/thresholds.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RequestRecord, ResourceRecord, RouteRecord, VitalName } from '@vitalens/core';
|
|
2
|
+
import { Tone } from '../types';
|
|
3
|
+
/** 请求慢阈值:面板与验收口径一致。 */
|
|
4
|
+
export declare const REQUEST_SLOW_MS = 1000;
|
|
5
|
+
/** 路由慢阈值。 */
|
|
6
|
+
export declare const ROUTE_SLOW_MS = 1000;
|
|
7
|
+
/** 资源慢阈值。 */
|
|
8
|
+
export declare const RESOURCE_SLOW_MS = 2000;
|
|
9
|
+
/** 长任务阈值(与 core 采集阈值一致)。 */
|
|
10
|
+
export declare const LONG_TASK_MS = 50;
|
|
11
|
+
export interface VitalThresholdConfig {
|
|
12
|
+
/** ≤ good 为良好。 */
|
|
13
|
+
good: number;
|
|
14
|
+
/** ≤ warn 为需关注,> warn 为较差。 */
|
|
15
|
+
warn: number;
|
|
16
|
+
unit: 'ms' | '';
|
|
17
|
+
/** 概览卡片阈值提示。 */
|
|
18
|
+
hint: string;
|
|
19
|
+
}
|
|
20
|
+
/** Core Web Vitals 标准阈值。 */
|
|
21
|
+
export declare const VITAL_THRESHOLDS: Record<VitalName, VitalThresholdConfig>;
|
|
22
|
+
export declare function toneFromThreshold(value: number | null, good: number, warn: number): Tone;
|
|
23
|
+
export declare function vitalTone(name: VitalName, value: number | null): Tone;
|
|
24
|
+
export declare function statusTone(status: number | undefined): Tone;
|
|
25
|
+
/**
|
|
26
|
+
* 请求状态:失败或 4xx/5xx 为较差;≥1000ms 为需关注;其余为良好。
|
|
27
|
+
*
|
|
28
|
+
* 失败优先于慢,保证错误请求在视觉上始终标红。
|
|
29
|
+
*/
|
|
30
|
+
export declare function requestTone(record: Pick<RequestRecord, 'durationMs' | 'status' | 'success'>): Tone;
|
|
31
|
+
export declare function routeTone(record: Pick<RouteRecord, 'durationMs'>): Tone;
|
|
32
|
+
/** 资源状态:失败为较差;≥2000ms 为需关注;其余为良好。 */
|
|
33
|
+
export declare function resourceTone(record: Pick<ResourceRecord, 'durationMs' | 'failed'>): Tone;
|
|
34
|
+
//# sourceMappingURL=thresholds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../src/utils/thresholds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE5F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,uBAAuB;AACvB,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,aAAa;AACb,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,aAAa;AACb,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,4BAA4B;AAC5B,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,MAAM,WAAW,oBAAoB;IACnC,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC;IAChB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4BAA4B;AAC5B,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAMpE,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAKxF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGrE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG,IAAI,CAKlG;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,IAAI,CAEvE;AAED,qCAAqC;AACrC,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,QAAQ,CAAC,GAAG,IAAI,CAIxF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitalens/panel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Optional performance dashboard UI for Vitalens",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@vitalens/core": "^0.1.
|
|
25
|
+
"@vitalens/core": "^0.1.1",
|
|
26
26
|
"echarts": "^5.4.0",
|
|
27
27
|
"tdesign-vue-next": "^1.15.0",
|
|
28
28
|
"vue": "^3.3.0"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"echarts": "5.4.3",
|
|
32
32
|
"tdesign-vue-next": "^1.15.2",
|
|
33
33
|
"vue": "^3.5.0",
|
|
34
|
-
"@vitalens/core": "0.1.
|
|
34
|
+
"@vitalens/core": "0.1.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|