@rinova/devtools 0.10.0 → 0.11.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.
@@ -0,0 +1,26 @@
1
+ export type PopupPlacement = 'top' | 'bottom' | 'left' | 'right' | 'auto';
2
+ export type PopupCloseReason = 'outside' | 'escape' | 'anchor-hidden' | 'program';
3
+ export interface PopupOptions {
4
+ placement?: PopupPlacement;
5
+ offset?: number;
6
+ maxWidth?: number;
7
+ matchAnchorWidth?: boolean;
8
+ closeOnOutside?: boolean;
9
+ /** 锚点是点位弹出的大容器(如整个表格)时,锚点内弹层外的按下也算外部 */
10
+ closeOnAnchorPress?: boolean;
11
+ closeOnEscape?: boolean;
12
+ onClose?: (reason: PopupCloseReason) => void;
13
+ }
14
+ export interface PopupHandle {
15
+ open(point?: PopupPoint): boolean;
16
+ isOpen(): boolean;
17
+ close(): void;
18
+ dispose(): void;
19
+ }
20
+ export interface PopupPoint {
21
+ x: number;
22
+ y: number;
23
+ }
24
+ export declare function closeDialogPopups(dialog: HTMLDialogElement): void;
25
+ /** Floating content stays in the same DevTools ShadowRoot and theme as its trigger. */
26
+ export declare function createPopup(anchor: HTMLElement, content: HTMLElement, options?: PopupOptions): PopupHandle;
@@ -0,0 +1,43 @@
1
+ export interface SelectOption {
2
+ value: string;
3
+ label: string;
4
+ disabled?: boolean;
5
+ group?: string;
6
+ }
7
+ interface SelectBaseProps {
8
+ ariaLabel: string;
9
+ options: readonly SelectOption[];
10
+ placeholder?: string;
11
+ disabled?: boolean;
12
+ readonly?: boolean;
13
+ searchable?: boolean;
14
+ clearable?: boolean;
15
+ searchPlaceholder?: string;
16
+ onOpen?: () => void;
17
+ onClose?: () => void;
18
+ }
19
+ export interface SelectProps extends SelectBaseProps {
20
+ value?: string | null;
21
+ defaultValue?: string | null;
22
+ onChange?(value: string | null): void;
23
+ onClear?: () => void;
24
+ }
25
+ export interface MultiSelectProps extends SelectBaseProps {
26
+ value?: readonly string[];
27
+ defaultValue?: readonly string[];
28
+ onChange?: (value: string[]) => void;
29
+ }
30
+ type SingleEvents = {
31
+ change: string | null;
32
+ clear: undefined;
33
+ open: undefined;
34
+ close: undefined;
35
+ };
36
+ type MultiEvents = {
37
+ change: string[];
38
+ open: undefined;
39
+ close: undefined;
40
+ };
41
+ export declare const Select: import("./component.js").ComponentDef<SelectProps, SingleEvents, HTMLButtonElement>;
42
+ export declare const MultiSelect: import("./component.js").ComponentDef<MultiSelectProps, MultiEvents, HTMLButtonElement>;
43
+ export {};
@@ -0,0 +1,28 @@
1
+ type NoEvents = Record<never, never>;
2
+ /** 窗口按钮只有放大 / 还原与关闭(交互设计 6.2:缩小与胶囊已移除) */
3
+ export interface WindowControlsProps {
4
+ maximized?: boolean;
5
+ onToggleMaximize?(): void;
6
+ onClose?(): void;
7
+ }
8
+ export declare const WindowControls: import("./component.js").ComponentDef<WindowControlsProps, NoEvents, HTMLElement>;
9
+ export interface TitleBarProps {
10
+ appName: string;
11
+ envLabel: string;
12
+ envLocal?: boolean;
13
+ pageTitle?: string;
14
+ pageSubtitle?: string;
15
+ actions?: Node;
16
+ maximized?: boolean;
17
+ onDblClick?: (event: MouseEvent) => void;
18
+ }
19
+ export declare const TitleBar: import("./component.js").ComponentDef<TitleBarProps, NoEvents, HTMLElement>;
20
+ /** 侧栏只有图标一种形态(交互设计 6.3:展开 / 收起已移除) */
21
+ export interface SideNavProps {
22
+ ariaLabel?: string;
23
+ items?: Node[];
24
+ footer?: Node[];
25
+ indicator?: Node;
26
+ }
27
+ export declare const SideNav: import("./component.js").ComponentDef<SideNavProps, NoEvents, HTMLElement>;
28
+ export {};
@@ -1,30 +1,33 @@
1
- import type { DevtoolsPlugin, DevtoolsTheme, PanelPosition, PanelSize, ToastTone } from '../types.js';
1
+ import type { DefaultCorner, DevtoolsPlugin, DevtoolsTheme, PanelPosition, PanelSize, ToastTone } from '../types.js';
2
2
  import type { Runtime } from '../core/runtime.js';
3
3
  export interface ShellUiState {
4
4
  theme: DevtoolsTheme;
5
5
  size: PanelSize;
6
- /** 是否收起为迷你胶囊 */
7
- collapsed: boolean;
8
- /** 收起胶囊的自由停放坐标 */
9
- collapsedPos?: PanelPosition | null;
10
- /** 展开面板的自由拖拽坐标;null 表示默认停靠在右下角悬浮球上方 */
6
+ panelDimensions: {
7
+ width: number;
8
+ height: number;
9
+ } | null;
10
+ /** 是否原位放大(交互设计 6.2) */
11
+ maximized: boolean;
12
+ /** 展开面板的自由拖拽坐标;null 表示停靠在默认角(出厂为左下角)并与悬浮球错开 */
11
13
  panelPos: PanelPosition | null;
12
14
  /** 悬浮球空闲 4s 自动向吸附边轻度半隐 */
13
15
  autoTuck: boolean;
14
- /** 用户覆盖的快捷键;undefined 表示沿用 options.shortcut */
15
- shortcut?: string | false;
16
16
  activePlugin: string;
17
17
  launcher: PanelPosition | null;
18
+ /** 网络列表栏占比(百分比),未拖过为 null */
19
+ splitNetwork?: number | null;
20
+ /** 存储列表栏占比(百分比),未拖过为 null */
21
+ splitStorage?: number | null;
18
22
  }
19
23
  export interface SizeSpec {
20
24
  fontSize: number;
21
25
  width: number;
22
26
  height: number;
23
- collapsedWidth: number;
24
- collapsedHeight: number;
25
27
  rowHeight: number;
26
28
  }
27
29
  export declare const PANEL_SIZE_SPECS: Record<PanelSize, SizeSpec>;
30
+ export declare function resolveDefaultCorner(value: unknown): DefaultCorner;
28
31
  export declare class Shell {
29
32
  private shadow;
30
33
  private rt;
@@ -38,7 +41,6 @@ export declare class Shell {
38
41
  private launcherBadge;
39
42
  private launcherPill;
40
43
  private pillNav;
41
- private pillKbd;
42
44
  private panel;
43
45
  private headerEl;
44
46
  private rail;
@@ -46,9 +48,13 @@ export declare class Shell {
46
48
  private titleEl;
47
49
  private subtitleEl;
48
50
  private bodyEl;
49
- private collapseButton;
50
51
  private themeButton;
51
- private statusShortcut;
52
+ private titleBar;
53
+ private windowControls;
54
+ private sideNav;
55
+ private titleTooltip;
56
+ private themeTip?;
57
+ private railTips;
52
58
  private toastsEl;
53
59
  private statusNet;
54
60
  private statusLogs;
@@ -57,6 +63,7 @@ export declare class Shell {
57
63
  private emptyView;
58
64
  private openState;
59
65
  private activeId;
66
+ private visibleEntry;
60
67
  private listeners;
61
68
  private timers;
62
69
  private tuckTimer;
@@ -70,26 +77,40 @@ export declare class Shell {
70
77
  private onMediaChange;
71
78
  private suppressedClick;
72
79
  private suppressedHeaderDblClick;
80
+ private finishPanelResize?;
81
+ /** 进入放大态时锁定的基础矩形、锚定角与档位(交互设计 6.2);视口变化只按快照重算放大矩形 */
82
+ private maxSnapshot;
83
+ /** 还原时把档位恢复为放大前的值,此时不重算位置、不清尺寸记忆 */
84
+ private restoringSize;
73
85
  constructor(shadow: ShadowRoot, rt: Runtime, ui: ShellUiState, saveUi: (patch: Partial<ShellUiState>) => void);
74
86
  private schedule;
75
87
  private clearTimer;
76
88
  /** 按当前视口计算指定档位的实际安全宽高(小屏自动收敛,绝不超出视口) */
77
89
  private resolveDimensions;
78
- private clampCollapsedPos;
79
90
  private clampExpandedPos;
80
91
  /** 在设置面板切换 小 / 默认 / 大 档位:若已自定义拖拽坐标,按屏幕左/右半区锚定并严格防越界 */
81
92
  private onSizeTransition;
82
- private onCollapsedTransition;
93
+ private defaultCorner;
94
+ private launcherClearance;
95
+ private defaultLauncherPos;
96
+ private launcherPoint;
97
+ /** 非放大态的面板矩形:自由定位取 panelPos;停靠时与 panel.less 默认角规则一致(左右 12px、上下 56px) */
98
+ private restoredRect;
99
+ /** 锚定角:停在默认角时为默认角;拖离后按面板中心所在象限选最近视口角(中线上水平取左、垂直取下) */
100
+ private maximizeAnchor;
101
+ private launcherRect;
102
+ private captureMaxSnapshot;
103
+ private onMaximizedTransition;
83
104
  private applyPanelGeometry;
84
105
  private envLabel;
85
106
  private resolveNonce;
86
- private ariaShortcut;
87
- private shortcutHint;
88
- private refreshShortcut;
89
- private syncCollapseButton;
107
+ private syncWindowControls;
108
+ private sideNavProps;
109
+ private syncTitleTooltip;
90
110
  private syncCustomThemeStyles;
91
111
  private resolvedBaseTheme;
92
112
  private applyTheme;
113
+ private themeLabel;
93
114
  private toggleTheme;
94
115
  mountPlugins(plugins: DevtoolsPlugin[]): void;
95
116
  private syncEmptyState;
@@ -97,12 +118,15 @@ export declare class Shell {
97
118
  unregisterPlugin(id: string): void;
98
119
  private sortedEntries;
99
120
  private renderRail;
121
+ private syncRailTips;
122
+ private syncThemeTip;
100
123
  private syncRailIndicator;
101
124
  private renderQuickPill;
102
125
  private syncQuickPillBadges;
103
126
  private createContext;
104
127
  activate(id: string): void;
105
128
  private applyActive;
129
+ private syncPluginVisibility;
106
130
  private updateSubtitle;
107
131
  private computeErrorCount;
108
132
  private onNetworkActivity;
@@ -121,9 +145,9 @@ export declare class Shell {
121
145
  private snapLauncher;
122
146
  private positionLauncher;
123
147
  private applyLauncherPosition;
148
+ private startPanelResize;
124
149
  /** 面板展开态(小/默认/大)与收起胶囊态均支持按住顶栏任意拖拽位置,松手持久化 */
125
150
  private bindPanelDrag;
126
- private isShortcutRecorder;
127
151
  private bindGlobal;
128
152
  /** 面板打开时让 toast 跟随面板(底部居中;收起态在标题条下方),否则回退到默认右下角 */
129
153
  private positionToasts;
@@ -0,0 +1,16 @@
1
+ export interface SplitterProps {
2
+ first?: Node | string;
3
+ second?: Node | string;
4
+ direction?: 'horizontal' | 'vertical';
5
+ /** Optional height in pixels, particularly useful for stacked panes. */
6
+ height?: number;
7
+ size?: number;
8
+ defaultSize?: number;
9
+ minSize?: number;
10
+ maxSize?: number;
11
+ ariaLabel?: string;
12
+ onResize?: (size: number) => void;
13
+ }
14
+ export declare const Splitter: import("./component.js").ComponentDef<SplitterProps, {
15
+ resize: number;
16
+ }, HTMLElement>;
@@ -0,0 +1,79 @@
1
+ export type TableRowKey = string | number;
2
+ export interface TableColumn<Row extends object = object> {
3
+ key: string;
4
+ title: string;
5
+ /** 默认列宽,如 `'120px'` */
6
+ width?: string;
7
+ /** 最小列宽(px)。未给时为 64,或 `width` 更小时取 `width` */
8
+ minWidth?: number;
9
+ /** 填充列:列宽总和小于容器时吃掉剩余宽度;用户拖过后按拖后宽度 */
10
+ fill?: boolean;
11
+ /** 为 `false` 时不渲染列宽把柄 */
12
+ resizable?: boolean;
13
+ /** 为 `false` 时列设置里该项禁用,列始终显示 */
14
+ hideable?: boolean;
15
+ align?: 'left' | 'center' | 'right';
16
+ /** 默认可排序;为 `false` 时该列表头不提供排序(如操作列) */
17
+ sortable?: boolean;
18
+ compare?: (a: Row, b: Row) => number;
19
+ render?: (value: unknown, row: Row) => Node | string | number;
20
+ }
21
+ export interface TableSort {
22
+ key: string;
23
+ direction: 'asc' | 'desc';
24
+ }
25
+ export interface TableVirtualOptions {
26
+ /** 固定行高(px),默认 32 */
27
+ rowHeight?: number;
28
+ /** 可视区上下各多渲染的行数,默认 6 */
29
+ overscan?: number;
30
+ }
31
+ export interface TableProps<Row extends object = object> {
32
+ ariaLabel?: string;
33
+ columns: readonly TableColumn<Row>[];
34
+ rows: readonly Row[];
35
+ rowKey?: string | ((row: Row) => TableRowKey);
36
+ sort?: TableSort | null;
37
+ defaultSort?: TableSort;
38
+ selectable?: boolean;
39
+ selectedKeys?: readonly TableRowKey[];
40
+ activeRowKey?: TableRowKey | null;
41
+ dense?: boolean;
42
+ maxHeight?: number;
43
+ empty?: string;
44
+ hiddenKeys?: readonly string[];
45
+ defaultHiddenKeys?: readonly string[];
46
+ columnWidths?: Readonly<Record<string, number>>;
47
+ defaultColumnWidths?: Readonly<Record<string, number>>;
48
+ columnSettings?: boolean;
49
+ /** 虚拟滚动:固定行高,只渲染可视行 ± 缓冲行。表格需要确定高度(`maxHeight` 或父容器高度) */
50
+ virtual?: boolean | TableVirtualOptions;
51
+ /** 行级附加类 */
52
+ rowClass?: (row: Row, key: TableRowKey) => string | undefined;
53
+ onSortChange?: (sort: TableSort | null) => void;
54
+ onSelectionChange?: (keys: TableRowKey[]) => void;
55
+ onRowClick?: (key: TableRowKey, row: Row) => void;
56
+ onColumnVisibilityChange?: (hiddenKeys: string[]) => void;
57
+ onColumnWidthChange?: (widths: Record<string, number>) => void;
58
+ }
59
+ export declare const TABLE_SETTINGS_HINT = "\u53F3\u952E\u6216 Shift+F10 \u6253\u5F00\u5217\u8BBE\u7F6E";
60
+ export declare function defineTable<Row extends object = object>(): import("./component.js").ComponentDef<TableProps<Row>, {
61
+ sort: TableSort | null;
62
+ selection: TableRowKey[];
63
+ rowClick: {
64
+ key: TableRowKey;
65
+ row: Row;
66
+ };
67
+ columnVisibility: string[];
68
+ columnWidth: Record<string, number>;
69
+ }, HTMLElement>;
70
+ export declare const Table: import("./component.js").ComponentDef<TableProps<object>, {
71
+ sort: TableSort | null;
72
+ selection: TableRowKey[];
73
+ rowClick: {
74
+ key: TableRowKey;
75
+ row: object;
76
+ };
77
+ columnVisibility: string[];
78
+ columnWidth: Record<string, number>;
79
+ }, HTMLElement>;
@@ -0,0 +1,20 @@
1
+ import type { IconName } from '../types.js';
2
+ export interface TabItem {
3
+ key: string;
4
+ label: string;
5
+ icon?: IconName;
6
+ badge?: string | number;
7
+ disabled?: boolean;
8
+ content?: Node | string;
9
+ }
10
+ export interface TabsProps {
11
+ items: readonly TabItem[];
12
+ ariaLabel?: string;
13
+ activeKey?: string;
14
+ defaultActiveKey?: string;
15
+ placement?: 'top' | 'left';
16
+ onChange?: (key: string) => void;
17
+ }
18
+ export declare const Tabs: import("./component.js").ComponentDef<TabsProps, {
19
+ change: string;
20
+ }, HTMLElement>;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.10.0";
1
+ export declare const VERSION = "0.11.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rinova/devtools",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "框架无关的开发者调试工具:环境配置、网络、存储、日志与插件扩展",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,22 +0,0 @@
1
- export interface Hotkey {
2
- key: string;
3
- alt: boolean;
4
- ctrl: boolean;
5
- meta: boolean;
6
- shift: boolean;
7
- }
8
- /** 解析 "alt+shift+d" / "ctrl+shift+i" 形式的快捷键 */
9
- export declare function parseHotkey(input: string): Hotkey | null;
10
- /** 配置里允许出现的按键名:单字符、F1–F12、以及少量具名键 */
11
- export declare function isValidHotkey(input: string | false | null | undefined): input is string;
12
- /** 把 "alt+shift+d" 渲染成「⌥⇧D」,用于 tooltip 与状态栏 */
13
- export declare function formatHotkey(input: string | false): string;
14
- /**
15
- * 从键盘事件生成持久化用的快捷键字符串;不合法时返回 null。
16
- * 单字符必须搭配 Ctrl / Meta / Alt;Shift 单独不算修饰键,否则会和正常输入冲突。
17
- * 只有 F1–F12 允许不带修饰键。
18
- */
19
- export declare function hotkeyFromEvent(event: KeyboardEvent): string | null;
20
- export declare function matchHotkey(event: KeyboardEvent, hotkey: Hotkey): boolean;
21
- /** 焦点位于输入控件时,避免无修饰键快捷键误触 */
22
- export declare function isEditableTarget(target: EventTarget | null): boolean;