@rinova/devtools 0.0.0-stage → 0.10.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,2 @@
1
+ import type { Runtime } from '../core/runtime.js';
2
+ export declare function actionsPlugin(rt: Runtime): import('../types.js').DevtoolsPlugin;
@@ -0,0 +1,2 @@
1
+ import type { Runtime } from '../core/runtime.js';
2
+ export declare function configPlugin(rt: Runtime): import('../types.js').DevtoolsPlugin;
@@ -0,0 +1,2 @@
1
+ import type { Runtime } from '../core/runtime.js';
2
+ export declare function consolePlugin(rt: Runtime): import('../types.js').DevtoolsPlugin;
@@ -0,0 +1,5 @@
1
+ import type { DevtoolsPlugin } from '../types.js';
2
+ import type { Runtime } from '../core/runtime.js';
3
+ export declare const BUILTIN_PLUGIN_IDS: readonly ["config", "network", "storage", "console", "actions", "settings"];
4
+ /** 内置面板按侧栏顺序创建;第三方插件用 order 插空 */
5
+ export declare function createBuiltinPlugins(rt: Runtime): DevtoolsPlugin[];
@@ -0,0 +1,2 @@
1
+ import type { Runtime } from '../core/runtime.js';
2
+ export declare function networkPlugin(rt: Runtime): import('../types.js').DevtoolsPlugin;
@@ -0,0 +1,2 @@
1
+ import type { Runtime } from '../core/runtime.js';
2
+ export declare function settingsPlugin(rt: Runtime): import('../types.js').DevtoolsPlugin;
@@ -0,0 +1,2 @@
1
+ import type { Runtime } from '../core/runtime.js';
2
+ export declare function storagePlugin(_rt: Runtime): import('../types.js').DevtoolsPlugin;
@@ -0,0 +1,306 @@
1
+ /**
2
+ * @rinova/devtools 公共类型定义。
3
+ *
4
+ * 这一层不依赖任何框架:所有类型都是可 JSON 序列化的描述,
5
+ * 适配器(Vue / React / 原生)只负责把宿主状态翻译成这些描述。
6
+ */
7
+ export type DevtoolsBuiltinTheme = 'dark' | 'light' | 'auto';
8
+ export type DevtoolsTheme = DevtoolsBuiltinTheme | (string & {});
9
+ /** 面板视图大小档位:小 (300×320) · 默认 (380×420) · 大 (580×520 双栏) */
10
+ export type PanelSize = 'sm' | 'md' | 'lg';
11
+ export interface PanelPosition {
12
+ x: number;
13
+ y: number;
14
+ }
15
+ /** @deprecated 停靠切换已移除,面板支持任意位置拖拽并按 PanelSize 三档自适应 */
16
+ export type DockSide = 'right' | 'left' | 'bottom' | 'float';
17
+ /** @deprecated 已由 PanelSize ('sm' | 'md' | 'lg') 统一驱动视图密度与尺寸 */
18
+ export type DevtoolsDensity = 'compact' | 'comfortable';
19
+ export interface DevtoolsThemeDefinition {
20
+ /** 唯一主题标识,写入 data-theme 属性 */
21
+ id: string;
22
+ /** 设置面板展示名称 */
23
+ label: string;
24
+ /** 继承基准:未声明的 token 自动回退到 dark 或 light */
25
+ base: 'dark' | 'light';
26
+ /** 预览色 [背景色, 强调色] */
27
+ preview?: [string, string];
28
+ /** 增量覆盖的 CSS 变量表(键名可带或不带 --rdt- 前缀) */
29
+ tokens: Record<string, string>;
30
+ }
31
+ export interface LauncherOptions {
32
+ draggable?: boolean;
33
+ /** 空闲 4s 自动向吸附边缘半隐藏,默认 true */
34
+ autoTuck?: boolean;
35
+ }
36
+ export interface FloatRect {
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ }
42
+ export type ConfigValue = string | number | boolean | null;
43
+ export type ValueMap = Record<string, ConfigValue>;
44
+ export type ToastTone = 'success' | 'error' | 'info' | 'warning';
45
+ export interface ToastMessage {
46
+ id: number;
47
+ text: string;
48
+ tone: ToastTone;
49
+ }
50
+ export interface ConfigOption {
51
+ label: string;
52
+ value: string;
53
+ description?: string;
54
+ /** 用户运行时新增的选项,可删除 */
55
+ custom?: boolean;
56
+ }
57
+ interface ConfigFieldBase {
58
+ /** 唯一键,同时作为持久化与业务读取的键 */
59
+ key: string;
60
+ label: string;
61
+ /** 分组 id,对应 {@link ConfigGroup.id};缺省归入“常规” */
62
+ group?: string;
63
+ description?: string;
64
+ disabled?: boolean;
65
+ /**
66
+ * 是否写入 localStorage,默认 true。
67
+ * token / 密钥等敏感值设为 false:只在当前页面内存中保留,刷新后回到默认值。
68
+ */
69
+ persist?: boolean;
70
+ }
71
+ export interface SelectField extends ConfigFieldBase {
72
+ type: 'select';
73
+ options: ConfigOption[];
74
+ /** 允许输入预设之外的值(写入并保留为自定义项) */
75
+ allowCustom?: boolean;
76
+ placeholder?: string;
77
+ defaultValue?: string;
78
+ }
79
+ export interface TextField extends ConfigFieldBase {
80
+ type: 'text';
81
+ placeholder?: string;
82
+ /** 只读且带复制按钮(token / 灰度号等) */
83
+ copyable?: boolean;
84
+ mono?: boolean;
85
+ defaultValue?: string;
86
+ }
87
+ export interface TextareaField extends ConfigFieldBase {
88
+ type: 'textarea';
89
+ placeholder?: string;
90
+ rows?: number;
91
+ mono?: boolean;
92
+ defaultValue?: string;
93
+ }
94
+ export interface NumberField extends ConfigFieldBase {
95
+ type: 'number';
96
+ min?: number;
97
+ max?: number;
98
+ step?: number;
99
+ defaultValue?: number;
100
+ }
101
+ export interface SwitchField extends ConfigFieldBase {
102
+ type: 'switch';
103
+ defaultValue?: boolean;
104
+ }
105
+ export type ConfigField = SelectField | TextField | TextareaField | NumberField | SwitchField;
106
+ export interface ConfigGroup {
107
+ id: string;
108
+ label: string;
109
+ description?: string;
110
+ }
111
+ export type IconName = 'activity' | 'alert-circle' | 'arrow-left' | 'arrow-up-right' | 'box' | 'bug' | 'check' | 'chevron-down' | 'chevron-right' | 'chevron-up' | 'circle' | 'clipboard' | 'copy' | 'database' | 'eraser' | 'external-link' | 'eye' | 'eye-off' | 'filter' | 'ghost' | 'globe' | 'key' | 'layers' | 'list-filter' | 'maximize-2' | 'minimize-2' | 'minus' | 'moon' | 'palette' | 'panel-bottom' | 'panel-left' | 'panel-right' | 'pip' | 'play' | 'plus' | 'radar' | 'refresh-cw' | 'rotate-ccw' | 'search' | 'send' | 'settings' | 'sliders-horizontal' | 'sparkles' | 'square-terminal' | 'sun' | 'terminal' | 'trash' | 'x' | 'zap';
112
+ export interface NetworkEntry {
113
+ id: string;
114
+ kind: 'fetch' | 'xhr';
115
+ method: string;
116
+ url: string;
117
+ status: number;
118
+ statusText: string;
119
+ ok: boolean;
120
+ pending: boolean;
121
+ startAt: number;
122
+ duration: number;
123
+ requestHeaders: Record<string, string>;
124
+ requestBody?: string;
125
+ responseHeaders: Record<string, string>;
126
+ responseBody?: string;
127
+ responseSize: number;
128
+ error?: string;
129
+ }
130
+ export type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
131
+ export interface LogEntry {
132
+ id: number;
133
+ level: LogLevel;
134
+ at: number;
135
+ args: string;
136
+ count: number;
137
+ }
138
+ export interface DevtoolsActionContext {
139
+ devtools: DevtoolsInstance;
140
+ values: ValueMap;
141
+ getValue<T extends ConfigValue = ConfigValue>(key: string, fallback?: T): T;
142
+ setValue(key: string, value: ConfigValue): void;
143
+ open(pluginId?: string): void;
144
+ close(): void;
145
+ toast(text: string, tone?: ToastTone): void;
146
+ copy(text: string): Promise<boolean>;
147
+ }
148
+ export type ActionTone = 'default' | 'danger';
149
+ export interface DevtoolsAction {
150
+ id: string;
151
+ label: string;
152
+ description?: string;
153
+ icon?: IconName;
154
+ tone?: ActionTone;
155
+ /** 执行前确认文案;true 使用默认文案 */
156
+ confirm?: boolean | string;
157
+ run(ctx: DevtoolsActionContext): void | Promise<void>;
158
+ }
159
+ export interface NetworkApi {
160
+ entries(): NetworkEntry[];
161
+ clear(): void;
162
+ replay(id: string): Promise<NetworkEntry | undefined>;
163
+ capturing(): boolean;
164
+ setCapturing(value: boolean): void;
165
+ }
166
+ export interface PluginContext {
167
+ id: string;
168
+ /** shadow root,可用于挂弹层;普通渲染请用 container */
169
+ root: ShadowRoot;
170
+ /** 插件独占的内容容器(面板切换时保留现场) */
171
+ container: HTMLElement;
172
+ app: {
173
+ name: string;
174
+ version: string;
175
+ };
176
+ get values(): ValueMap;
177
+ getValue<T extends ConfigValue = ConfigValue>(key: string, fallback?: T): T;
178
+ setValue(key: string, value: ConfigValue): void;
179
+ /** 监听配置变更,返回取消函数 */
180
+ onChange(handler: (payload: ConfigChangePayload) => void): () => void;
181
+ /** 监听任意 devtools 事件,返回取消函数 */
182
+ on<T = unknown>(event: string, handler: (payload: T) => void): () => void;
183
+ emit(event: string, payload?: unknown): void;
184
+ /** 命名空间为本插件 id 的持久化存储 */
185
+ storage: {
186
+ get<T>(key: string, fallback: T): T;
187
+ set(key: string, value: unknown): void;
188
+ remove(key: string): void;
189
+ };
190
+ network: NetworkApi;
191
+ toast(text: string, tone?: ToastTone): void;
192
+ copy(text: string): Promise<boolean>;
193
+ /** 在插件被移除 / devtools 销毁时执行 */
194
+ onDispose(fn: () => void): void;
195
+ devtools: DevtoolsInstance;
196
+ }
197
+ export interface DevtoolsPlugin {
198
+ id: string;
199
+ title: string;
200
+ icon?: IconName;
201
+ /** 侧栏排序,数字小的在前 */
202
+ order?: number;
203
+ /** 面板标题下方的说明文案 */
204
+ subtitle?: string | (() => string);
205
+ enabled?: boolean | (() => boolean);
206
+ /** 侧栏角标,返回 null 表示不显示 */
207
+ badge?: () => number | string | null;
208
+ /**
209
+ * 渲染入口。容器会在首次激活时创建,之后切换标签不复建。
210
+ * 需要清理的资源请用 ctx.onDispose 注册。
211
+ */
212
+ render(container: HTMLElement, ctx: PluginContext): void;
213
+ /** 插件自身的内部状态变更时调用,驱动角标刷新 */
214
+ refresh?(): void;
215
+ }
216
+ export interface ConfigChangePayload {
217
+ values: ValueMap;
218
+ changed: string;
219
+ source: 'user' | 'program' | 'reset';
220
+ }
221
+ export interface NetworkCaptureOptions {
222
+ maxEntries?: number;
223
+ /** 是否捕获响应体,默认 true,单条上限 200KB */
224
+ responseBody?: boolean;
225
+ /** 额外跳过的 URL 片段 */
226
+ ignore?: string[];
227
+ }
228
+ export interface DevtoolsOptions {
229
+ /** 面板标题与应用名,默认取 document.title */
230
+ appName?: string;
231
+ version?: string;
232
+ /** false 时完全不挂载(生产环境常用) */
233
+ enabled?: boolean | (() => boolean);
234
+ theme?: DevtoolsTheme;
235
+ /** 自定义主题列表,也可在运行时通过 registerTheme 动态添加 */
236
+ themes?: DevtoolsThemeDefinition[];
237
+ /** 面板视图大小档位:'sm'(小)| 'md'(默认)| 'lg'(大),默认 'md' */
238
+ size?: PanelSize;
239
+ /** @deprecated 已移除视图停靠切换,请使用 size 控制视图档位,面板支持直接拖拽 */
240
+ dock?: DockSide;
241
+ /** @deprecated 请使用 size: 'sm' | 'md' | 'lg' */
242
+ density?: DevtoolsDensity;
243
+ /** @deprecated 请使用 size: 'sm' | 'md' | 'lg' */
244
+ width?: number;
245
+ /** @deprecated 请使用 size: 'sm' | 'md' | 'lg' */
246
+ minWidth?: number;
247
+ /** @deprecated 请使用 size: 'sm' | 'md' | 'lg' */
248
+ maxWidth?: number;
249
+ /** 悬浮球;false 表示不显示(只保留快捷键/程序调用) */
250
+ launcher?: boolean | LauncherOptions;
251
+ /** 快捷键,默认 alt+shift+d;false 关闭。用户在设置面板修改后以本地保存值为准 */
252
+ shortcut?: string | false;
253
+ /**
254
+ * 严格 CSP 环境下的 style nonce:`style-src 'nonce-...'`。
255
+ * 传入函数时每次挂载重新求值(适配服务端注入的随机 nonce)。
256
+ */
257
+ styleNonce?: string | (() => string);
258
+ /** localStorage 前缀,默认 rinova-devtools */
259
+ storagePrefix?: string;
260
+ config?: ConfigField[];
261
+ groups?: ConfigGroup[];
262
+ /** 初始值,优先级低于用户本地保存值 */
263
+ values?: ValueMap;
264
+ actions?: DevtoolsAction[];
265
+ plugins?: DevtoolsPlugin[];
266
+ /** 内置面板白名单,false 表示全部不装 */
267
+ builtinPlugins?: BuiltinPluginId[] | false;
268
+ captureNetwork?: boolean;
269
+ captureConsole?: boolean;
270
+ network?: NetworkCaptureOptions;
271
+ maxLogEntries?: number;
272
+ /** 挂到 window.__RINOVA_DEVTOOLS__,便于控制台调试 */
273
+ exposeGlobal?: boolean | string;
274
+ onConfigChange?(payload: ConfigChangePayload): void;
275
+ onOpen?(): void;
276
+ onClose?(): void;
277
+ }
278
+ export type BuiltinPluginId = 'config' | 'network' | 'storage' | 'console' | 'actions' | 'settings';
279
+ export interface DevtoolsInstance {
280
+ readonly version: string;
281
+ readonly appName: string;
282
+ readonly mounted: boolean;
283
+ mount(): DevtoolsInstance;
284
+ destroy(): void;
285
+ open(pluginId?: string): void;
286
+ close(): void;
287
+ toggle(): void;
288
+ isOpen(): boolean;
289
+ registerPlugin(plugin: DevtoolsPlugin): () => void;
290
+ removePlugin(id: string): void;
291
+ listPlugins(): DevtoolsPlugin[];
292
+ registerAction(action: DevtoolsAction): () => void;
293
+ registerConfigField(field: ConfigField): () => void;
294
+ registerTheme(theme: DevtoolsThemeDefinition): () => void;
295
+ listThemes(): DevtoolsThemeDefinition[];
296
+ getValues(): ValueMap;
297
+ getValue<T extends ConfigValue = ConfigValue>(key: string, fallback?: T): T;
298
+ setValue(key: string, value: ConfigValue): void;
299
+ setValues(patch: ValueMap): void;
300
+ resetConfig(): void;
301
+ on<T = unknown>(event: string, handler: (payload: T) => void): () => void;
302
+ off(event: string, handler: (payload: never) => void): void;
303
+ toast(text: string, tone?: ToastTone): void;
304
+ network: NetworkApi;
305
+ }
306
+ export {};
@@ -0,0 +1,38 @@
1
+ import type { IconName } from '../types.js';
2
+ type Child = Node | string | number | null | undefined | false;
3
+ type Children = Child | Children[];
4
+ export interface ElementAttrs {
5
+ class?: string;
6
+ text?: string;
7
+ html?: string;
8
+ title?: string;
9
+ type?: string;
10
+ value?: string;
11
+ placeholder?: string;
12
+ disabled?: boolean;
13
+ checked?: boolean;
14
+ style?: Partial<CSSStyleDeclaration> | Record<string, string>;
15
+ dataset?: Record<string, string>;
16
+ [key: string]: unknown;
17
+ }
18
+ export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: ElementAttrs | null, children?: Children): HTMLElementTagNameMap[K];
19
+ export declare function append(parent: Element, children?: Children): void;
20
+ export declare function icon(name: IconName | undefined, size?: number, strokeWidth?: number): SVGSVGElement;
21
+ export declare function clear(node: Element): void;
22
+ export declare function button(label: string, opts?: {
23
+ icon?: IconName;
24
+ tone?: 'default' | 'primary' | 'danger' | 'ghost';
25
+ onClick?: (event: MouseEvent) => void;
26
+ title?: string;
27
+ }): HTMLButtonElement;
28
+ /** 复制成功微交互:按钮短暂切换为绿色对勾并回弹还原 */
29
+ export declare function flashCopied(btn: HTMLButtonElement): void;
30
+ export declare function field(label: string, control: Node, hint?: string): HTMLElement;
31
+ export declare function empty(text: string, iconName?: IconName): HTMLElement;
32
+ export declare function tag(text: string, tone?: 'neutral' | 'ok' | 'warn' | 'error' | 'info'): HTMLElement;
33
+ export declare function segmented<T extends string>(items: Array<{
34
+ value: T;
35
+ label: string;
36
+ icon?: IconName;
37
+ }>, value: T, onPick: (value: T) => void): HTMLElement;
38
+ export {};
@@ -0,0 +1,133 @@
1
+ import type { DevtoolsPlugin, DevtoolsTheme, PanelPosition, PanelSize, ToastTone } from '../types.js';
2
+ import type { Runtime } from '../core/runtime.js';
3
+ export interface ShellUiState {
4
+ theme: DevtoolsTheme;
5
+ size: PanelSize;
6
+ /** 是否收起为迷你胶囊 */
7
+ collapsed: boolean;
8
+ /** 收起胶囊的自由停放坐标 */
9
+ collapsedPos?: PanelPosition | null;
10
+ /** 展开面板的自由拖拽坐标;null 表示默认停靠在右下角悬浮球上方 */
11
+ panelPos: PanelPosition | null;
12
+ /** 悬浮球空闲 4s 自动向吸附边轻度半隐 */
13
+ autoTuck: boolean;
14
+ /** 用户覆盖的快捷键;undefined 表示沿用 options.shortcut */
15
+ shortcut?: string | false;
16
+ activePlugin: string;
17
+ launcher: PanelPosition | null;
18
+ }
19
+ export interface SizeSpec {
20
+ fontSize: number;
21
+ width: number;
22
+ height: number;
23
+ collapsedWidth: number;
24
+ collapsedHeight: number;
25
+ rowHeight: number;
26
+ }
27
+ export declare const PANEL_SIZE_SPECS: Record<PanelSize, SizeSpec>;
28
+ export declare class Shell {
29
+ private shadow;
30
+ private rt;
31
+ private ui;
32
+ private saveUi;
33
+ readonly root: HTMLElement;
34
+ private styleEl;
35
+ private launcher;
36
+ private launcherPulse;
37
+ private launcherStatus;
38
+ private launcherBadge;
39
+ private launcherPill;
40
+ private pillNav;
41
+ private pillKbd;
42
+ private panel;
43
+ private headerEl;
44
+ private rail;
45
+ private railIndicator;
46
+ private titleEl;
47
+ private subtitleEl;
48
+ private bodyEl;
49
+ private collapseButton;
50
+ private themeButton;
51
+ private statusShortcut;
52
+ private toastsEl;
53
+ private statusNet;
54
+ private statusLogs;
55
+ private statusCapture;
56
+ private entries;
57
+ private emptyView;
58
+ private openState;
59
+ private activeId;
60
+ private listeners;
61
+ private timers;
62
+ private tuckTimer;
63
+ private pillOpenTimer;
64
+ private pillCloseTimer;
65
+ private pillVisible;
66
+ private lastNetTotal;
67
+ private lastErrorCount;
68
+ private lastPulseAt;
69
+ private mediaQuery?;
70
+ private onMediaChange;
71
+ private suppressedClick;
72
+ private suppressedHeaderDblClick;
73
+ constructor(shadow: ShadowRoot, rt: Runtime, ui: ShellUiState, saveUi: (patch: Partial<ShellUiState>) => void);
74
+ private schedule;
75
+ private clearTimer;
76
+ /** 按当前视口计算指定档位的实际安全宽高(小屏自动收敛,绝不超出视口) */
77
+ private resolveDimensions;
78
+ private clampCollapsedPos;
79
+ private clampExpandedPos;
80
+ /** 在设置面板切换 小 / 默认 / 大 档位:若已自定义拖拽坐标,按屏幕左/右半区锚定并严格防越界 */
81
+ private onSizeTransition;
82
+ private onCollapsedTransition;
83
+ private applyPanelGeometry;
84
+ private envLabel;
85
+ private resolveNonce;
86
+ private ariaShortcut;
87
+ private shortcutHint;
88
+ private refreshShortcut;
89
+ private syncCollapseButton;
90
+ private syncCustomThemeStyles;
91
+ private resolvedBaseTheme;
92
+ private applyTheme;
93
+ private toggleTheme;
94
+ mountPlugins(plugins: DevtoolsPlugin[]): void;
95
+ private syncEmptyState;
96
+ registerPlugin(plugin: DevtoolsPlugin): void;
97
+ unregisterPlugin(id: string): void;
98
+ private sortedEntries;
99
+ private renderRail;
100
+ private syncRailIndicator;
101
+ private renderQuickPill;
102
+ private syncQuickPillBadges;
103
+ private createContext;
104
+ activate(id: string): void;
105
+ private applyActive;
106
+ private updateSubtitle;
107
+ private computeErrorCount;
108
+ private onNetworkActivity;
109
+ refreshBadges(silent?: boolean): void;
110
+ open(pluginId?: string): void;
111
+ close(): void;
112
+ toggle(): void;
113
+ isOpen(): boolean;
114
+ private wakeLauncher;
115
+ private scheduleTuck;
116
+ private syncPillPosition;
117
+ private showPill;
118
+ private hidePill;
119
+ private bindLauncher;
120
+ private clampLauncher;
121
+ private snapLauncher;
122
+ private positionLauncher;
123
+ private applyLauncherPosition;
124
+ /** 面板展开态(小/默认/大)与收起胶囊态均支持按住顶栏任意拖拽位置,松手持久化 */
125
+ private bindPanelDrag;
126
+ private isShortcutRecorder;
127
+ private bindGlobal;
128
+ /** 面板打开时让 toast 跟随面板(底部居中;收起态在标题条下方),否则回退到默认右下角 */
129
+ private positionToasts;
130
+ addToast(text: string, tone?: ToastTone): void;
131
+ private applyReset;
132
+ dispose(): void;
133
+ }
@@ -0,0 +1,4 @@
1
+ import type { NetworkEntry } from '../types.js';
2
+ export declare function shellQuote(value: string): string;
3
+ /** 把一条网络记录转成可直接粘到终端的 cURL */
4
+ export declare function toCurl(entry: Pick<NetworkEntry, 'method' | 'url' | 'requestHeaders' | 'requestBody'>): string;
@@ -0,0 +1,15 @@
1
+ /** 纯函数工具:不依赖 DOM,可单独测试 */
2
+ export declare function formatBytes(bytes: number): string;
3
+ export declare function formatDuration(ms: number): string;
4
+ export declare function formatClock(at: number): string;
5
+ export declare function truncate(text: string, max: number): string;
6
+ /** 安全 JSON 预览:处理循环引用、函数、超长字符串 */
7
+ export declare function previewValue(value: unknown, maxLength?: number): string;
8
+ export declare function prettyJSON(text: string | undefined): string;
9
+ export declare function isProbablyJSON(text: string | undefined): boolean;
10
+ export declare function shortUrl(url: string, max?: number): string;
11
+ export declare function id(prefix?: string): string;
12
+ /** 从 RequestInfo 推导 URL 字符串 */
13
+ export declare function requestUrl(input: RequestInfo | URL): string;
14
+ /** 简易 headers 归一化 */
15
+ export declare function normalizeHeaders(headers: HeadersInit | undefined | null): Record<string, string>;
@@ -0,0 +1,22 @@
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;
@@ -0,0 +1 @@
1
+ export declare const VERSION = "0.10.0";
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@rinova/devtools",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.10.0",
4
+ "description": "框架无关的开发者调试工具:环境配置、网络、存储、日志与插件扩展",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "build": "vite build && tsc -p tsconfig.build.json && node ../../scripts/fix-dts.mjs dist",
24
+ "prepack": "pnpm run build",
25
+ "typecheck": "tsc -p tsconfig.json --noEmit",
26
+ "test": "vitest run",
27
+ "test:coverage": "vitest run --coverage",
28
+ "dev": "vite build --watch"
29
+ },
30
+ "dependencies": {
31
+ "lucide": "1.68.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "26.6.6",
35
+ "@vitest/coverage-v8": "5.1.0",
36
+ "jsdom": "30.1.3",
37
+ "less": "4.9.1",
38
+ "typescript": "5.9.3",
39
+ "vite": "8.3.5",
40
+ "vitest": "5.1.0"
41
+ },
42
+ "keywords": [
43
+ "devtools",
44
+ "debug",
45
+ "vue",
46
+ "react",
47
+ "framework-agnostic"
48
+ ],
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/jove-rina/rinova-devtools"
52
+ }
53
+ }