@incremark/devtools 0.3.2 → 0.3.4
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.en.md +198 -30
- package/README.md +198 -30
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/tabs/index.d.ts +5 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/devtools.d.ts +63 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/i18n/index.svelte.d.ts +27 -0
- package/dist/i18n/index.svelte.d.ts.map +1 -0
- package/dist/i18n/locales/en-US.d.ts +6 -0
- package/dist/i18n/locales/en-US.d.ts.map +1 -0
- package/dist/i18n/locales/index.d.ts +6 -0
- package/dist/i18n/locales/index.d.ts.map +1 -0
- package/dist/i18n/locales/zh-CN.d.ts +6 -0
- package/dist/i18n/locales/zh-CN.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +33 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/index.d.ts +7 -112
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3665 -630
- package/dist/index.js.map +1 -0
- package/dist/stores/types.d.ts +6 -0
- package/dist/stores/types.d.ts.map +1 -0
- package/dist/stores/useDevTools.svelte.d.ts +55 -0
- package/dist/stores/useDevTools.svelte.d.ts.map +1 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +15 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/stores/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useDevTools - DevTools 核心状态管理
|
|
3
|
+
* @description 使用 Svelte 5 runes 管理 DevTools 状态和多 parser 注册
|
|
4
|
+
*/
|
|
5
|
+
import type { IncremarkParser } from '@incremark/core';
|
|
6
|
+
import type { DevToolsOptions, RegisterOptions, ParserRegistration, TabType } from '../types';
|
|
7
|
+
import { createI18n } from '../i18n/index.svelte';
|
|
8
|
+
/**
|
|
9
|
+
* DevTools 内部状态
|
|
10
|
+
*/
|
|
11
|
+
export interface DevToolsStore {
|
|
12
|
+
/** 所有注册的 parsers */
|
|
13
|
+
parsers: Map<string, ParserRegistration>;
|
|
14
|
+
/** 当前选中的 parser ID */
|
|
15
|
+
selectedParserId: string | null;
|
|
16
|
+
/** 面板是否打开 */
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
/** 当前激活的 tab */
|
|
19
|
+
activeTab: TabType;
|
|
20
|
+
/** 选中的 block ID */
|
|
21
|
+
selectedBlockId: string | null;
|
|
22
|
+
/** i18n */
|
|
23
|
+
i18n: ReturnType<typeof createI18n>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 创建 DevTools store
|
|
27
|
+
*/
|
|
28
|
+
export declare function createDevToolsStore(options?: DevToolsOptions): {
|
|
29
|
+
readonly parsers: Map<string, ParserRegistration>;
|
|
30
|
+
readonly parsersArray: ParserRegistration[];
|
|
31
|
+
readonly selectedParserId: string | null;
|
|
32
|
+
readonly selectedParser: ParserRegistration | null;
|
|
33
|
+
readonly isOpen: boolean;
|
|
34
|
+
readonly activeTab: TabType;
|
|
35
|
+
readonly selectedBlockId: string | null;
|
|
36
|
+
readonly hasLoadingParser: boolean;
|
|
37
|
+
readonly i18n: {
|
|
38
|
+
readonly locale: import("..").Locale;
|
|
39
|
+
setLocale(locale: import("..").Locale): void;
|
|
40
|
+
t(key: keyof import("..").I18nMessages): string;
|
|
41
|
+
readonly version: number;
|
|
42
|
+
};
|
|
43
|
+
register: (parser: IncremarkParser, options: RegisterOptions) => void;
|
|
44
|
+
unregister: (id: string) => void;
|
|
45
|
+
selectParser: (id: string) => void;
|
|
46
|
+
open: () => void;
|
|
47
|
+
close: () => void;
|
|
48
|
+
toggle: () => void;
|
|
49
|
+
setActiveTab: (tab: TabType) => void;
|
|
50
|
+
selectBlock: (id: string | null) => void;
|
|
51
|
+
clearHistory: () => void;
|
|
52
|
+
destroy: () => void;
|
|
53
|
+
};
|
|
54
|
+
export type DevToolsStoreReturn = ReturnType<typeof createDevToolsStore>;
|
|
55
|
+
//# sourceMappingURL=useDevTools.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDevTools.svelte.d.ts","sourceRoot":"","sources":["../../src/stores/useDevTools.svelte.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,iBAAiB,CAAA;AACnE,OAAO,KAAK,EAEV,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,OAAO,EACR,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACxC,sBAAsB;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,aAAa;IACb,MAAM,EAAE,OAAO,CAAA;IACf,gBAAgB;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,mBAAmB;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,WAAW;IACX,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;CACpC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,eAAoB;;;;;;;;;;;;;;;uBA4ErC,eAAe,WAAW,eAAe,KAAG,IAAI;qBAkClD,MAAM,KAAG,IAAI;uBAqBX,MAAM,KAAG,IAAI;gBAUtB,IAAI;iBAOH,IAAI;kBAOH,IAAI;wBAOI,OAAO,KAAG,IAAI;sBAOhB,MAAM,GAAG,IAAI,KAAG,IAAI;wBAOpB,IAAI;mBAiBT,IAAI;EAgCzB;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { IncremarkParser, ParsedBlock, Root } from '@incremark/core';
|
|
2
|
+
import type { Locale } from './i18n/types';
|
|
3
|
+
export type TabType = 'overview' | 'blocks' | 'ast' | 'timeline';
|
|
4
|
+
export interface DevToolsState {
|
|
5
|
+
/** 所有块 */
|
|
6
|
+
blocks: ParsedBlock[];
|
|
7
|
+
/** 已完成的块 */
|
|
8
|
+
completedBlocks: ParsedBlock[];
|
|
9
|
+
/** 待处理的块 */
|
|
10
|
+
pendingBlocks: ParsedBlock[];
|
|
11
|
+
/** Markdown 字符串 */
|
|
12
|
+
markdown: string;
|
|
13
|
+
/** AST */
|
|
14
|
+
ast: Root;
|
|
15
|
+
/** 是否加载中 */
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface AppendRecord {
|
|
19
|
+
timestamp: number;
|
|
20
|
+
chunk: string;
|
|
21
|
+
completedCount: number;
|
|
22
|
+
pendingCount: number;
|
|
23
|
+
}
|
|
24
|
+
export interface DevToolsOptions {
|
|
25
|
+
/** 初始是否打开 */
|
|
26
|
+
open?: boolean;
|
|
27
|
+
/** 位置 */
|
|
28
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
29
|
+
/** 主题 */
|
|
30
|
+
theme?: 'dark' | 'light';
|
|
31
|
+
/** 语言 */
|
|
32
|
+
locale?: Locale;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parser 注册选项
|
|
36
|
+
*/
|
|
37
|
+
export interface RegisterOptions {
|
|
38
|
+
/** 唯一标识符 */
|
|
39
|
+
id: string;
|
|
40
|
+
/** 显示标签,默认使用 id */
|
|
41
|
+
label?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parser 注册记录
|
|
45
|
+
*/
|
|
46
|
+
export interface ParserRegistration {
|
|
47
|
+
/** 唯一标识符 */
|
|
48
|
+
id: string;
|
|
49
|
+
/** 显示标签 */
|
|
50
|
+
label: string;
|
|
51
|
+
/** Parser 实例 */
|
|
52
|
+
parser: IncremarkParser;
|
|
53
|
+
/** 当前状态 */
|
|
54
|
+
state: DevToolsState | null;
|
|
55
|
+
/** Append 历史记录 */
|
|
56
|
+
appendHistory: AppendRecord[];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,CAAA;AAEhE,MAAM,WAAW,aAAa;IAC5B,UAAU;IACV,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,YAAY;IACZ,eAAe,EAAE,WAAW,EAAE,CAAA;IAC9B,YAAY;IACZ,aAAa,EAAE,WAAW,EAAE,CAAA;IAC5B,mBAAmB;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU;IACV,GAAG,EAAE,IAAI,CAAA;IACT,YAAY;IACZ,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,SAAS;IACT,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;IACpE,SAAS;IACT,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,SAAS;IACT,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,WAAW;IACX,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB;IAChB,MAAM,EAAE,eAAe,CAAA;IACvB,WAAW;IACX,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;IAC3B,kBAAkB;IAClB,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B"}
|
package/package.json
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@incremark/devtools",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "Incremark DevTools - Framework-agnostic debugging
|
|
5
|
+
"description": "Incremark DevTools - Framework-agnostic debugging SDK",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
12
13
|
"import": "./dist/index.js",
|
|
13
|
-
"
|
|
14
|
+
"default": "./dist/index.js"
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist"
|
|
18
19
|
],
|
|
19
20
|
"peerDependencies": {
|
|
20
|
-
"@incremark/core": "0.3.
|
|
21
|
+
"@incremark/core": "0.3.4"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"json-formatter-js": "^2.5.23"
|
|
21
25
|
},
|
|
22
26
|
"devDependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
27
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
28
|
+
"svelte": "^5.0.0",
|
|
29
|
+
"typescript": "^5.3.0",
|
|
30
|
+
"vite": "^6.0.0"
|
|
25
31
|
},
|
|
26
32
|
"keywords": [
|
|
27
33
|
"incremark",
|
|
@@ -38,7 +44,8 @@
|
|
|
38
44
|
},
|
|
39
45
|
"homepage": "https://www.incremark.com/",
|
|
40
46
|
"scripts": {
|
|
41
|
-
"build": "
|
|
42
|
-
"
|
|
47
|
+
"build": "vite build && pnpm build:types",
|
|
48
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
|
|
49
|
+
"dev": "vite build --watch"
|
|
43
50
|
}
|
|
44
51
|
}
|