@apform-ui/core 1.7.4 → 1.8.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/README.md +36 -5
- package/dist/apform-ui.css +1 -1
- package/dist/apform-ui.js +4107 -3024
- package/dist/apform-ui.umd.cjs +138 -64
- package/dist/components/LogStream/LogStream.vue.d.ts +37 -0
- package/dist/components/LogStream/doc.d.ts +3 -0
- package/dist/components/LogStream/index.d.ts +2 -0
- package/dist/components/MetricChart/MetricChart.vue.d.ts +49 -0
- package/dist/components/MetricChart/doc.d.ts +3 -0
- package/dist/components/MetricChart/index.d.ts +2 -0
- package/dist/components/ServiceGrid/ServiceGrid.vue.d.ts +28 -0
- package/dist/components/ServiceGrid/doc.d.ts +3 -0
- package/dist/components/ServiceGrid/index.d.ts +2 -0
- package/dist/components/SeverityBadge/SeverityBadge.vue.d.ts +14 -0
- package/dist/components/SeverityBadge/doc.d.ts +3 -0
- package/dist/components/SeverityBadge/index.d.ts +2 -0
- package/dist/components/StatCard/StatCard.vue.d.ts +33 -0
- package/dist/components/StatCard/doc.d.ts +3 -0
- package/dist/components/StatCard/index.d.ts +2 -0
- package/dist/components/StatusTimeline/StatusTimeline.vue.d.ts +24 -0
- package/dist/components/StatusTimeline/doc.d.ts +3 -0
- package/dist/components/StatusTimeline/index.d.ts +2 -0
- package/dist/components/ThresholdSlider/ThresholdSlider.vue.d.ts +23 -0
- package/dist/components/ThresholdSlider/doc.d.ts +3 -0
- package/dist/components/ThresholdSlider/index.d.ts +2 -0
- package/dist/components/TimeRangePicker/TimeRangePicker.vue.d.ts +36 -0
- package/dist/components/TimeRangePicker/doc.d.ts +3 -0
- package/dist/components/TimeRangePicker/index.d.ts +2 -0
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/useRealtime.d.ts +32 -0
- package/dist/docs/index.d.ts +8 -0
- package/dist/index-v6HiJkED.js +44296 -0
- package/dist/index.d.ts +20 -2
- package/dist/tokens/index.d.ts +16 -0
- package/dist/utils/metricFormat.d.ts +21 -0
- package/dist/utils/optionalPeers.d.ts +16 -0
- package/package.json +6 -1
- package/src/docs/index.ts +24 -0
- package/src/tokens/index.ts +26 -0
- package/src/tokens/tokens.css +393 -193
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** 日志条目 */
|
|
2
|
+
export interface LogEntry {
|
|
3
|
+
id: string | number;
|
|
4
|
+
timestamp: string;
|
|
5
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
6
|
+
service: string;
|
|
7
|
+
message: string;
|
|
8
|
+
payload?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
type __VLS_Props = {
|
|
11
|
+
/** 日志列表(新到旧) */
|
|
12
|
+
logs: LogEntry[];
|
|
13
|
+
/** 容器高度 */
|
|
14
|
+
height: number;
|
|
15
|
+
/** 单行高度 */
|
|
16
|
+
rowHeight?: number;
|
|
17
|
+
/** 高亮关键词 */
|
|
18
|
+
highlight?: string;
|
|
19
|
+
/** 新数据滚到顶部(最新) */
|
|
20
|
+
autoScroll?: boolean;
|
|
21
|
+
/** 加载态 */
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
};
|
|
24
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
25
|
+
"log-click": (log: LogEntry) => any;
|
|
26
|
+
"reach-top": () => any;
|
|
27
|
+
"reach-bottom": () => any;
|
|
28
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
+
"onLog-click"?: ((log: LogEntry) => any) | undefined;
|
|
30
|
+
"onReach-top"?: (() => any) | undefined;
|
|
31
|
+
"onReach-bottom"?: (() => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
loading: boolean;
|
|
34
|
+
rowHeight: number;
|
|
35
|
+
autoScroll: boolean;
|
|
36
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MetricUnit } from '../../utils/metricFormat';
|
|
2
|
+
export type { MetricUnit };
|
|
3
|
+
/** 指标系列 */
|
|
4
|
+
export interface MetricSeries {
|
|
5
|
+
name: string;
|
|
6
|
+
data: [number, number][];
|
|
7
|
+
color?: string;
|
|
8
|
+
area?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** 阈值参考线 */
|
|
11
|
+
export interface MetricThreshold {
|
|
12
|
+
value: number;
|
|
13
|
+
label: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
type __VLS_Props = {
|
|
17
|
+
title: string;
|
|
18
|
+
unit: MetricUnit;
|
|
19
|
+
series: MetricSeries[];
|
|
20
|
+
type?: 'line' | 'bar' | 'area';
|
|
21
|
+
thresholds?: MetricThreshold[];
|
|
22
|
+
variant?: 'full' | 'spark';
|
|
23
|
+
height?: number;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
yAxisMin?: number;
|
|
26
|
+
yAxisMax?: number;
|
|
27
|
+
};
|
|
28
|
+
declare var __VLS_6: {}, __VLS_12: {};
|
|
29
|
+
type __VLS_Slots = {} & {
|
|
30
|
+
'header-actions'?: (props: typeof __VLS_6) => any;
|
|
31
|
+
} & {
|
|
32
|
+
empty?: (props: typeof __VLS_12) => any;
|
|
33
|
+
};
|
|
34
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
35
|
+
"chart-click": (params: unknown) => any;
|
|
36
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
37
|
+
"onChart-click"?: ((params: unknown) => any) | undefined;
|
|
38
|
+
}>, {
|
|
39
|
+
loading: boolean;
|
|
40
|
+
type: "line" | "bar" | "area";
|
|
41
|
+
variant: "full" | "spark";
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** 服务项 */
|
|
2
|
+
export interface ServiceItem {
|
|
3
|
+
id: string | number;
|
|
4
|
+
name: string;
|
|
5
|
+
status: 'healthy' | 'warning' | 'error' | 'unknown';
|
|
6
|
+
metrics?: {
|
|
7
|
+
errorRate?: number;
|
|
8
|
+
latencyP95?: number;
|
|
9
|
+
eventCount?: number;
|
|
10
|
+
lastSeen?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
type __VLS_Props = {
|
|
14
|
+
/** 服务列表 */
|
|
15
|
+
services: ServiceItem[];
|
|
16
|
+
/** 列数(不传则响应式) */
|
|
17
|
+
columns?: number;
|
|
18
|
+
/** 骨架屏 */
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
22
|
+
"service-click": (service: ServiceItem) => any;
|
|
23
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
24
|
+
"onService-click"?: ((service: ServiceItem) => any) | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
loading: boolean;
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** 告警严重级别 */
|
|
2
|
+
export type AlertSeverity = 'critical' | 'warning' | 'info';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 严重级别 */
|
|
5
|
+
severity: AlertSeverity;
|
|
6
|
+
/** 脉冲动画(critical 默认开启) */
|
|
7
|
+
pulse?: boolean;
|
|
8
|
+
/** 尺寸 */
|
|
9
|
+
size?: 'small' | 'default' | 'large';
|
|
10
|
+
};
|
|
11
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
+
size: "small" | "default" | "large";
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** 环比趋势 */
|
|
2
|
+
export interface StatTrend {
|
|
3
|
+
direction: 'up' | 'down' | 'flat';
|
|
4
|
+
percent?: number;
|
|
5
|
+
/** 默认 true:up=绿 */
|
|
6
|
+
positiveIsGood?: boolean;
|
|
7
|
+
}
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
/** 标签 */
|
|
10
|
+
label: string;
|
|
11
|
+
/** 数值 */
|
|
12
|
+
value: number | string;
|
|
13
|
+
/** 单位后缀 */
|
|
14
|
+
unit?: string;
|
|
15
|
+
/** 环比 */
|
|
16
|
+
trend?: StatTrend;
|
|
17
|
+
/** 趋势线 */
|
|
18
|
+
sparkline?: number[];
|
|
19
|
+
/** 左侧色条状态 */
|
|
20
|
+
status?: 'healthy' | 'warning' | 'error' | 'unknown';
|
|
21
|
+
/** 跳转链接(宿主路由或外链) */
|
|
22
|
+
to?: string;
|
|
23
|
+
/** 骨架屏 */
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
27
|
+
click: (event: MouseEvent) => any;
|
|
28
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
loading: boolean;
|
|
32
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** 时间线段 */
|
|
2
|
+
export interface TimelineSegment {
|
|
3
|
+
start: string;
|
|
4
|
+
end: string;
|
|
5
|
+
status: 'healthy' | 'warning' | 'error' | 'unknown';
|
|
6
|
+
}
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
/** 状态段 */
|
|
9
|
+
segments: TimelineSegment[];
|
|
10
|
+
/** 对齐范围 */
|
|
11
|
+
range?: {
|
|
12
|
+
start: string;
|
|
13
|
+
end: string;
|
|
14
|
+
};
|
|
15
|
+
/** 高度 */
|
|
16
|
+
height?: number;
|
|
17
|
+
/** hover 提示 */
|
|
18
|
+
showTooltip?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
|
+
height: number;
|
|
22
|
+
showTooltip: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** 阈值类型 */
|
|
2
|
+
export type ThresholdType = 'errorRate' | 'latency' | 'eventCount' | 'timeout';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 阈值类型 */
|
|
5
|
+
type: ThresholdType;
|
|
6
|
+
/** 当前值 */
|
|
7
|
+
modelValue: number;
|
|
8
|
+
/** 显示输入框 */
|
|
9
|
+
showInput?: boolean;
|
|
10
|
+
/** 禁用 */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
"update:modelValue": (value: number) => any;
|
|
15
|
+
change: (value: number) => any;
|
|
16
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
18
|
+
onChange?: ((value: number) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
showInput: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** 时间范围预设 */
|
|
2
|
+
export type TimeRangePreset = '5m' | '15m' | '1h' | '6h' | '24h' | '7d' | '30d' | 'custom';
|
|
3
|
+
/** 时间范围值 */
|
|
4
|
+
export interface TimeRange {
|
|
5
|
+
preset: TimeRangePreset;
|
|
6
|
+
start?: string;
|
|
7
|
+
end?: string;
|
|
8
|
+
}
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
/** 当前时间范围 */
|
|
11
|
+
modelValue: TimeRange;
|
|
12
|
+
/** 显示快捷按钮组 */
|
|
13
|
+
showPresets?: boolean;
|
|
14
|
+
/** 快捷预设列表 */
|
|
15
|
+
presets?: TimeRangePreset[];
|
|
16
|
+
/** 允许自定义范围 */
|
|
17
|
+
allowCustom?: boolean;
|
|
18
|
+
/** 尺寸 */
|
|
19
|
+
size?: 'small' | 'default' | 'large';
|
|
20
|
+
/** 禁用 */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
};
|
|
23
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
|
+
"update:modelValue": (value: TimeRange) => any;
|
|
25
|
+
change: (value: TimeRange) => any;
|
|
26
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
|
+
"onUpdate:modelValue"?: ((value: TimeRange) => any) | undefined;
|
|
28
|
+
onChange?: ((value: TimeRange) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
size: "small" | "default" | "large";
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
showPresets: boolean;
|
|
33
|
+
presets: TimeRangePreset[];
|
|
34
|
+
allowCustom: boolean;
|
|
35
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
export default _default;
|
|
@@ -14,3 +14,5 @@ export { useChatScroll } from './useChatScroll';
|
|
|
14
14
|
export type { UseChatScrollOptions, UseChatScrollReturn } from './useChatScroll';
|
|
15
15
|
export { useClipboard } from './useClipboard';
|
|
16
16
|
export type { UseClipboardOptions } from './useClipboard';
|
|
17
|
+
export { useRealtime } from './useRealtime';
|
|
18
|
+
export type { RealtimeEventType, RealtimeMessage, UseRealtimeOptions, UseRealtimeReturn, } from './useRealtime';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/** 实时事件类型 */
|
|
3
|
+
export type RealtimeEventType = 'event:new' | 'alert:triggered' | 'alert:resolved' | 'health:change';
|
|
4
|
+
/** 实时消息 */
|
|
5
|
+
export interface RealtimeMessage {
|
|
6
|
+
type: RealtimeEventType;
|
|
7
|
+
project_id: number;
|
|
8
|
+
data: unknown;
|
|
9
|
+
ts: string;
|
|
10
|
+
}
|
|
11
|
+
/** useRealtime 选项 */
|
|
12
|
+
export interface UseRealtimeOptions {
|
|
13
|
+
/** WebSocket 地址 */
|
|
14
|
+
url: string;
|
|
15
|
+
/** 订阅项目,空则全部 */
|
|
16
|
+
projectId?: number;
|
|
17
|
+
/** 初始重连间隔 ms */
|
|
18
|
+
reconnectInterval?: number;
|
|
19
|
+
/** 最大重试次数 */
|
|
20
|
+
maxRetries?: number;
|
|
21
|
+
}
|
|
22
|
+
/** useRealtime 返回值 */
|
|
23
|
+
export interface UseRealtimeReturn {
|
|
24
|
+
status: Ref<'connecting' | 'open' | 'closed' | 'error'>;
|
|
25
|
+
connect: () => void;
|
|
26
|
+
disconnect: () => void;
|
|
27
|
+
on: <T = unknown>(type: RealtimeEventType, handler: (data: T) => void) => () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 创建 / 复用 WebSocket 连接
|
|
31
|
+
*/
|
|
32
|
+
export declare function useRealtime(options: UseRealtimeOptions): UseRealtimeReturn;
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -51,5 +51,13 @@ export { TableRowActionsDoc } from '../components/TableRowActions/doc';
|
|
|
51
51
|
export { ToastDoc } from '../components/Toast/doc';
|
|
52
52
|
export { TruncatedTooltipTextDoc } from '../components/TruncatedTooltipText/doc';
|
|
53
53
|
export { UserAvatarDoc } from '../components/UserAvatar/doc';
|
|
54
|
+
export { TimeRangePickerDoc } from '../components/TimeRangePicker/doc';
|
|
55
|
+
export { MetricChartDoc } from '../components/MetricChart/doc';
|
|
56
|
+
export { StatCardDoc } from '../components/StatCard/doc';
|
|
57
|
+
export { SeverityBadgeDoc } from '../components/SeverityBadge/doc';
|
|
58
|
+
export { ServiceGridDoc } from '../components/ServiceGrid/doc';
|
|
59
|
+
export { StatusTimelineDoc } from '../components/StatusTimeline/doc';
|
|
60
|
+
export { LogStreamDoc } from '../components/LogStream/doc';
|
|
61
|
+
export { ThresholdSliderDoc } from '../components/ThresholdSlider/doc';
|
|
54
62
|
/** 按组件名索引的文档表 */
|
|
55
63
|
export declare const componentDocs: Record<string, ComponentDoc>;
|