@incremark/devtools 0.3.3 → 0.3.5
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 +4728 -629
- 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 +60 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +16 -8
package/README.en.md
CHANGED
|
@@ -8,8 +8,10 @@ Developer tools for Incremark, framework agnostic.
|
|
|
8
8
|
|
|
9
9
|
- 🔍 **Real-time State** - View parsing state, block list, AST
|
|
10
10
|
- 📊 **Timeline** - Record each append operation
|
|
11
|
+
- 🌐 **Internationalization** - Supports Chinese and English interfaces
|
|
11
12
|
- 🎨 **Themes** - Supports dark/light themes
|
|
12
|
-
- 📦 **Framework Agnostic** - Works with Vue, React, or vanilla JS
|
|
13
|
+
- 📦 **Framework Agnostic** - Works with Vue, React, Svelte, Solid, or vanilla JS
|
|
14
|
+
- 🔌 **Multi-parser Support** - Monitor multiple parser instances simultaneously
|
|
13
15
|
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
@@ -21,83 +23,249 @@ pnpm add @incremark/devtools
|
|
|
21
23
|
|
|
22
24
|
### With Vue
|
|
23
25
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
+
```vue
|
|
27
|
+
<script setup>
|
|
28
|
+
import { createDevTools } from '@incremark/devtools'
|
|
29
|
+
import { IncremarkContent } from '@incremark/vue'
|
|
30
|
+
import { onMounted, onUnmounted } from 'vue'
|
|
31
|
+
|
|
32
|
+
const devtools = createDevTools({
|
|
33
|
+
locale: 'en-US'
|
|
34
|
+
})
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
onMounted(() => {
|
|
37
|
+
devtools.mount()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
onUnmounted(() => {
|
|
41
|
+
devtools.unmount()
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<IncremarkContent
|
|
47
|
+
:content="markdown"
|
|
48
|
+
:devtools="devtools"
|
|
49
|
+
devtoolsId="main-parser"
|
|
50
|
+
devtoolsLabel="Main Content"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
29
53
|
```
|
|
30
54
|
|
|
31
55
|
### With React
|
|
32
56
|
|
|
33
57
|
```tsx
|
|
34
|
-
import {
|
|
58
|
+
import { createDevTools } from '@incremark/devtools'
|
|
59
|
+
import { IncremarkContent } from '@incremark/react'
|
|
60
|
+
import { useEffect, useRef } from 'react'
|
|
35
61
|
|
|
36
62
|
function App() {
|
|
37
|
-
const
|
|
38
|
-
|
|
63
|
+
const devtools = useRef(createDevTools({
|
|
64
|
+
locale: 'en-US'
|
|
65
|
+
}))
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
devtools.current.mount()
|
|
69
|
+
return () => devtools.current.unmount()
|
|
70
|
+
}, [])
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<IncremarkContent
|
|
74
|
+
content={markdown}
|
|
75
|
+
devtools={devtools.current}
|
|
76
|
+
devtoolsId="main-parser"
|
|
77
|
+
devtoolsLabel="Main Content"
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
39
80
|
}
|
|
40
81
|
```
|
|
41
82
|
|
|
83
|
+
### With Svelte
|
|
84
|
+
|
|
85
|
+
```svelte
|
|
86
|
+
<script lang="ts">
|
|
87
|
+
import { createDevTools } from '@incremark/devtools'
|
|
88
|
+
import { IncremarkContent } from '@incremark/svelte'
|
|
89
|
+
import { onMount, onDestroy } from 'svelte'
|
|
90
|
+
|
|
91
|
+
let devtools = createDevTools({
|
|
92
|
+
locale: 'en-US'
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
onMount(() => {
|
|
96
|
+
devtools.mount()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
onDestroy(() => {
|
|
100
|
+
devtools.unmount()
|
|
101
|
+
})
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<IncremarkContent
|
|
105
|
+
{content}
|
|
106
|
+
{devtools}
|
|
107
|
+
devtoolsId="main-parser"
|
|
108
|
+
devtoolsLabel="Main Content"
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### With Solid
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { createDevTools } from '@incremark/devtools'
|
|
116
|
+
import { IncremarkContent } from '@incremark/solid'
|
|
117
|
+
import { onMount, onCleanup } from 'solid-js'
|
|
118
|
+
|
|
119
|
+
const devtools = createDevTools({
|
|
120
|
+
locale: 'en-US'
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
onMount(() => {
|
|
124
|
+
devtools.mount()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
onCleanup(() => {
|
|
128
|
+
devtools.unmount()
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<IncremarkContent
|
|
133
|
+
content={markdown()}
|
|
134
|
+
devtools={devtools}
|
|
135
|
+
devtoolsId="main-parser"
|
|
136
|
+
devtoolsLabel="Main Content"
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
```
|
|
140
|
+
|
|
42
141
|
### Standalone Usage
|
|
43
142
|
|
|
44
143
|
```ts
|
|
45
144
|
import { createIncremarkParser } from '@incremark/core'
|
|
46
|
-
import {
|
|
145
|
+
import { createDevTools } from '@incremark/devtools'
|
|
47
146
|
|
|
48
147
|
const parser = createIncremarkParser()
|
|
49
|
-
|
|
148
|
+
const devtools = createDevTools({
|
|
149
|
+
locale: 'en-US'
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
devtools.mount()
|
|
153
|
+
|
|
154
|
+
// Register parser
|
|
155
|
+
devtools.register(parser, {
|
|
156
|
+
id: 'my-parser',
|
|
157
|
+
label: 'My Parser'
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
// Set up callback
|
|
161
|
+
parser.setOnChange((state) => {
|
|
162
|
+
// DevTools will update automatically
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
// Cleanup
|
|
166
|
+
devtools.unregister('my-parser')
|
|
167
|
+
devtools.unmount()
|
|
50
168
|
```
|
|
51
169
|
|
|
52
170
|
## API
|
|
53
171
|
|
|
54
|
-
###
|
|
172
|
+
### createDevTools(options?)
|
|
55
173
|
|
|
56
|
-
Create
|
|
174
|
+
Create a DevTools instance.
|
|
57
175
|
|
|
58
176
|
```ts
|
|
59
|
-
const
|
|
60
|
-
open: false,
|
|
61
|
-
position: 'bottom-right',
|
|
62
|
-
theme: 'dark'
|
|
177
|
+
const devtools = createDevTools({
|
|
178
|
+
open: false, // Initially open the panel
|
|
179
|
+
position: 'bottom-right', // Position
|
|
180
|
+
theme: 'dark', // Theme
|
|
181
|
+
locale: 'en-US' // Locale: 'en-US' | 'zh-CN'
|
|
63
182
|
})
|
|
64
|
-
|
|
65
|
-
parser.setOnChange(callback)
|
|
66
183
|
```
|
|
67
184
|
|
|
68
|
-
###
|
|
185
|
+
### devtools.mount()
|
|
69
186
|
|
|
70
|
-
DevTools
|
|
187
|
+
Mount DevTools to DOM.
|
|
71
188
|
|
|
72
189
|
```ts
|
|
73
|
-
const devtools = new IncremarkDevTools(options)
|
|
74
190
|
devtools.mount()
|
|
75
|
-
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### devtools.unmount()
|
|
194
|
+
|
|
195
|
+
Unmount DevTools from DOM.
|
|
196
|
+
|
|
197
|
+
```ts
|
|
76
198
|
devtools.unmount()
|
|
77
199
|
```
|
|
78
200
|
|
|
201
|
+
### devtools.register(parser, options)
|
|
202
|
+
|
|
203
|
+
Register a parser instance.
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
devtools.register(parser, {
|
|
207
|
+
id: 'unique-id', // Unique identifier
|
|
208
|
+
label: 'Display Name' // Display label
|
|
209
|
+
})
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### devtools.unregister(id)
|
|
213
|
+
|
|
214
|
+
Unregister a specific parser.
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
devtools.unregister('unique-id')
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### setLocale(locale)
|
|
221
|
+
|
|
222
|
+
Dynamically set DevTools language.
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
import { setLocale } from '@incremark/devtools'
|
|
226
|
+
|
|
227
|
+
setLocale('zh-CN') // Switch to Chinese
|
|
228
|
+
setLocale('en-US') // Switch to English
|
|
229
|
+
```
|
|
230
|
+
|
|
79
231
|
## Configuration Options
|
|
80
232
|
|
|
81
233
|
```ts
|
|
82
234
|
interface DevToolsOptions {
|
|
83
|
-
open?: boolean // Initially open
|
|
84
|
-
position?: Position // Position
|
|
85
|
-
theme?: 'dark' | 'light' // Theme
|
|
235
|
+
open?: boolean // Initially open the panel, default false
|
|
236
|
+
position?: Position // Position, default 'bottom-right'
|
|
237
|
+
theme?: 'dark' | 'light' // Theme, default 'dark'
|
|
238
|
+
locale?: Locale // Locale, default 'en-US'
|
|
86
239
|
}
|
|
87
240
|
|
|
88
241
|
type Position = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
|
|
242
|
+
type Locale = 'zh-CN' | 'en-US'
|
|
89
243
|
```
|
|
90
244
|
|
|
91
245
|
## Feature Panels
|
|
92
246
|
|
|
93
247
|
| Panel | Function |
|
|
94
248
|
|-------|----------|
|
|
95
|
-
| Overview | Shows character count, block count, etc. |
|
|
96
|
-
| Blocks | View all parsed blocks |
|
|
97
|
-
| AST | Complete
|
|
98
|
-
| Timeline | History of append operations |
|
|
249
|
+
| **Overview** | Shows character count, block count, node type distribution, streaming status, etc. |
|
|
250
|
+
| **Blocks** | View all parsed blocks with details including status, raw text, and AST nodes |
|
|
251
|
+
| **AST** | Complete Abstract Syntax Tree in JSON format with interactive expand/collapse |
|
|
252
|
+
| **Timeline** | History of append operations with timestamps and block count changes |
|
|
253
|
+
|
|
254
|
+
## Types
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
import type {
|
|
258
|
+
IncremarkDevTools,
|
|
259
|
+
DevToolsOptions,
|
|
260
|
+
DevToolsState,
|
|
261
|
+
AppendRecord,
|
|
262
|
+
ParserRegistration,
|
|
263
|
+
RegisterOptions,
|
|
264
|
+
Locale,
|
|
265
|
+
I18nMessages
|
|
266
|
+
} from '@incremark/devtools'
|
|
267
|
+
```
|
|
99
268
|
|
|
100
269
|
## License
|
|
101
270
|
|
|
102
271
|
MIT
|
|
103
|
-
|
package/README.md
CHANGED
|
@@ -8,8 +8,10 @@ Incremark 的开发者工具,框架无关。
|
|
|
8
8
|
|
|
9
9
|
- 🔍 **实时状态** - 查看解析状态、块列表、AST
|
|
10
10
|
- 📊 **时间线** - 记录每次 append 操作
|
|
11
|
+
- 🌐 **国际化** - 支持中英文界面
|
|
11
12
|
- 🎨 **主题** - 支持 dark/light 主题
|
|
12
|
-
- 📦 **框架无关** - 可在 Vue、React 或原生 JS 中使用
|
|
13
|
+
- 📦 **框架无关** - 可在 Vue、React、Svelte、Solid 或原生 JS 中使用
|
|
14
|
+
- 🔌 **多解析器** - 同时监控多个 parser 实例
|
|
13
15
|
|
|
14
16
|
## 安装
|
|
15
17
|
|
|
@@ -21,83 +23,249 @@ pnpm add @incremark/devtools
|
|
|
21
23
|
|
|
22
24
|
### 与 Vue 配合
|
|
23
25
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
+
```vue
|
|
27
|
+
<script setup>
|
|
28
|
+
import { createDevTools } from '@incremark/devtools'
|
|
29
|
+
import { IncremarkContent } from '@incremark/vue'
|
|
30
|
+
import { onMounted, onUnmounted } from 'vue'
|
|
31
|
+
|
|
32
|
+
const devtools = createDevTools({
|
|
33
|
+
locale: 'zh-CN'
|
|
34
|
+
})
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
onMounted(() => {
|
|
37
|
+
devtools.mount()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
onUnmounted(() => {
|
|
41
|
+
devtools.unmount()
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<IncremarkContent
|
|
47
|
+
:content="markdown"
|
|
48
|
+
:devtools="devtools"
|
|
49
|
+
devtoolsId="main-parser"
|
|
50
|
+
devtoolsLabel="主内容"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
29
53
|
```
|
|
30
54
|
|
|
31
55
|
### 与 React 配合
|
|
32
56
|
|
|
33
57
|
```tsx
|
|
34
|
-
import {
|
|
58
|
+
import { createDevTools } from '@incremark/devtools'
|
|
59
|
+
import { IncremarkContent } from '@incremark/react'
|
|
60
|
+
import { useEffect, useRef } from 'react'
|
|
35
61
|
|
|
36
62
|
function App() {
|
|
37
|
-
const
|
|
38
|
-
|
|
63
|
+
const devtools = useRef(createDevTools({
|
|
64
|
+
locale: 'zh-CN'
|
|
65
|
+
}))
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
devtools.current.mount()
|
|
69
|
+
return () => devtools.current.unmount()
|
|
70
|
+
}, [])
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<IncremarkContent
|
|
74
|
+
content={markdown}
|
|
75
|
+
devtools={devtools.current}
|
|
76
|
+
devtoolsId="main-parser"
|
|
77
|
+
devtoolsLabel="主内容"
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
39
80
|
}
|
|
40
81
|
```
|
|
41
82
|
|
|
83
|
+
### 与 Svelte 配合
|
|
84
|
+
|
|
85
|
+
```svelte
|
|
86
|
+
<script lang="ts">
|
|
87
|
+
import { createDevTools } from '@incremark/devtools'
|
|
88
|
+
import { IncremarkContent } from '@incremark/svelte'
|
|
89
|
+
import { onMount, onDestroy } from 'svelte'
|
|
90
|
+
|
|
91
|
+
let devtools = createDevTools({
|
|
92
|
+
locale: 'zh-CN'
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
onMount(() => {
|
|
96
|
+
devtools.mount()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
onDestroy(() => {
|
|
100
|
+
devtools.unmount()
|
|
101
|
+
})
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<IncremarkContent
|
|
105
|
+
{content}
|
|
106
|
+
{devtools}
|
|
107
|
+
devtoolsId="main-parser"
|
|
108
|
+
devtoolsLabel="主内容"
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 与 Solid 配合
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { createDevTools } from '@incremark/devtools'
|
|
116
|
+
import { IncremarkContent } from '@incremark/solid'
|
|
117
|
+
import { onMount, onCleanup } from 'solid-js'
|
|
118
|
+
|
|
119
|
+
const devtools = createDevTools({
|
|
120
|
+
locale: 'zh-CN'
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
onMount(() => {
|
|
124
|
+
devtools.mount()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
onCleanup(() => {
|
|
128
|
+
devtools.unmount()
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<IncremarkContent
|
|
133
|
+
content={markdown()}
|
|
134
|
+
devtools={devtools}
|
|
135
|
+
devtoolsId="main-parser"
|
|
136
|
+
devtoolsLabel="主内容"
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
```
|
|
140
|
+
|
|
42
141
|
### 独立使用
|
|
43
142
|
|
|
44
143
|
```ts
|
|
45
144
|
import { createIncremarkParser } from '@incremark/core'
|
|
46
|
-
import {
|
|
145
|
+
import { createDevTools } from '@incremark/devtools'
|
|
47
146
|
|
|
48
147
|
const parser = createIncremarkParser()
|
|
49
|
-
|
|
148
|
+
const devtools = createDevTools({
|
|
149
|
+
locale: 'zh-CN'
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
devtools.mount()
|
|
153
|
+
|
|
154
|
+
// 注册 parser
|
|
155
|
+
devtools.register(parser, {
|
|
156
|
+
id: 'my-parser',
|
|
157
|
+
label: 'My Parser'
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
// 设置回调
|
|
161
|
+
parser.setOnChange((state) => {
|
|
162
|
+
// DevTools 会自动更新
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
// 清理
|
|
166
|
+
devtools.unregister('my-parser')
|
|
167
|
+
devtools.unmount()
|
|
50
168
|
```
|
|
51
169
|
|
|
52
170
|
## API
|
|
53
171
|
|
|
54
|
-
###
|
|
172
|
+
### createDevTools(options?)
|
|
55
173
|
|
|
56
|
-
|
|
174
|
+
创建 DevTools 实例。
|
|
57
175
|
|
|
58
176
|
```ts
|
|
59
|
-
const
|
|
60
|
-
open: false,
|
|
61
|
-
position: 'bottom-right',
|
|
62
|
-
theme: 'dark'
|
|
177
|
+
const devtools = createDevTools({
|
|
178
|
+
open: false, // 初始是否打开面板
|
|
179
|
+
position: 'bottom-right', // 位置
|
|
180
|
+
theme: 'dark', // 主题
|
|
181
|
+
locale: 'zh-CN' // 语言: 'zh-CN' | 'en-US'
|
|
63
182
|
})
|
|
64
|
-
|
|
65
|
-
parser.setOnChange(callback)
|
|
66
183
|
```
|
|
67
184
|
|
|
68
|
-
###
|
|
185
|
+
### devtools.mount()
|
|
69
186
|
|
|
70
|
-
DevTools
|
|
187
|
+
挂载 DevTools 到 DOM。
|
|
71
188
|
|
|
72
189
|
```ts
|
|
73
|
-
const devtools = new IncremarkDevTools(options)
|
|
74
190
|
devtools.mount()
|
|
75
|
-
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### devtools.unmount()
|
|
194
|
+
|
|
195
|
+
从 DOM 卸载 DevTools。
|
|
196
|
+
|
|
197
|
+
```ts
|
|
76
198
|
devtools.unmount()
|
|
77
199
|
```
|
|
78
200
|
|
|
201
|
+
### devtools.register(parser, options)
|
|
202
|
+
|
|
203
|
+
注册一个 parser 实例。
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
devtools.register(parser, {
|
|
207
|
+
id: 'unique-id', // 唯一标识符
|
|
208
|
+
label: 'Display Name' // 显示名称
|
|
209
|
+
})
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### devtools.unregister(id)
|
|
213
|
+
|
|
214
|
+
注销指定的 parser。
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
devtools.unregister('unique-id')
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### setLocale(locale)
|
|
221
|
+
|
|
222
|
+
动态设置 DevTools 语言。
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
import { setLocale } from '@incremark/devtools'
|
|
226
|
+
|
|
227
|
+
setLocale('zh-CN') // 切换到中文
|
|
228
|
+
setLocale('en-US') // 切换到英文
|
|
229
|
+
```
|
|
230
|
+
|
|
79
231
|
## 配置选项
|
|
80
232
|
|
|
81
233
|
```ts
|
|
82
234
|
interface DevToolsOptions {
|
|
83
|
-
open?: boolean //
|
|
84
|
-
position?: Position //
|
|
85
|
-
theme?: 'dark' | 'light' //
|
|
235
|
+
open?: boolean // 初始是否打开面板,默认 false
|
|
236
|
+
position?: Position // 位置,默认 'bottom-right'
|
|
237
|
+
theme?: 'dark' | 'light' // 主题,默认 'dark'
|
|
238
|
+
locale?: Locale // 语言,默认 'en-US'
|
|
86
239
|
}
|
|
87
240
|
|
|
88
241
|
type Position = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
|
|
242
|
+
type Locale = 'zh-CN' | 'en-US'
|
|
89
243
|
```
|
|
90
244
|
|
|
91
245
|
## 功能面板
|
|
92
246
|
|
|
93
247
|
| 面板 | 功能 |
|
|
94
248
|
|------|------|
|
|
95
|
-
| Overview |
|
|
96
|
-
| Blocks |
|
|
97
|
-
| AST | JSON
|
|
98
|
-
| Timeline | append
|
|
249
|
+
| **Overview** | 显示字符数、块数量、节点类型分布、流式处理状态等统计 |
|
|
250
|
+
| **Blocks** | 查看所有解析出的块,包括块详情、状态、原始文本、AST 节点 |
|
|
251
|
+
| **AST** | JSON 格式的完整抽象语法树,可交互展开/折叠 |
|
|
252
|
+
| **Timeline** | append 操作历史,带时间戳和块数变化 |
|
|
253
|
+
|
|
254
|
+
## 类型
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
import type {
|
|
258
|
+
IncremarkDevTools,
|
|
259
|
+
DevToolsOptions,
|
|
260
|
+
DevToolsState,
|
|
261
|
+
AppendRecord,
|
|
262
|
+
ParserRegistration,
|
|
263
|
+
RegisterOptions,
|
|
264
|
+
Locale,
|
|
265
|
+
I18nMessages
|
|
266
|
+
} from '@incremark/devtools'
|
|
267
|
+
```
|
|
99
268
|
|
|
100
269
|
## License
|
|
101
270
|
|
|
102
271
|
MIT
|
|
103
|
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACvD,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as OverviewTab } from './OverviewTab.svelte';
|
|
2
|
+
export { default as BlocksTab } from './BlocksTab.svelte';
|
|
3
|
+
export { default as AstTab } from './AstTab.svelte';
|
|
4
|
+
export { default as TimelineTab } from './TimelineTab.svelte';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file devtools.ts - 框架无关的 DevTools API
|
|
3
|
+
* @description 提供纯 JS API 用于从任何框架挂载 DevTools
|
|
4
|
+
*/
|
|
5
|
+
import type { IncremarkParser } from '@incremark/core';
|
|
6
|
+
import type { DevToolsOptions, RegisterOptions } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* IncremarkDevTools - 框架无关的 DevTools 实现
|
|
9
|
+
* 支持多 parser 注册和切换
|
|
10
|
+
*/
|
|
11
|
+
export declare class IncremarkDevTools {
|
|
12
|
+
private container;
|
|
13
|
+
private options;
|
|
14
|
+
private svelteComponent;
|
|
15
|
+
private store;
|
|
16
|
+
private isMounted;
|
|
17
|
+
private pendingRegistrations;
|
|
18
|
+
constructor(options?: DevToolsOptions);
|
|
19
|
+
/**
|
|
20
|
+
* 挂载 DevTools 到 DOM
|
|
21
|
+
* 注意:此方法只能在浏览器环境中调用
|
|
22
|
+
* @returns Promise 完成后返回 this
|
|
23
|
+
*/
|
|
24
|
+
mount(target?: HTMLElement | string): this;
|
|
25
|
+
/**
|
|
26
|
+
* 卸载 DevTools
|
|
27
|
+
*/
|
|
28
|
+
unmount(): this;
|
|
29
|
+
/**
|
|
30
|
+
* 注册一个 parser
|
|
31
|
+
*/
|
|
32
|
+
register(parser: IncremarkParser, options: RegisterOptions): this;
|
|
33
|
+
/**
|
|
34
|
+
* 注销一个 parser
|
|
35
|
+
*/
|
|
36
|
+
unregister(id: string): this;
|
|
37
|
+
/**
|
|
38
|
+
* 选择一个 parser
|
|
39
|
+
*/
|
|
40
|
+
selectParser(id: string): this;
|
|
41
|
+
/**
|
|
42
|
+
* 打开面板
|
|
43
|
+
*/
|
|
44
|
+
open(): this;
|
|
45
|
+
/**
|
|
46
|
+
* 关闭面板
|
|
47
|
+
*/
|
|
48
|
+
close(): this;
|
|
49
|
+
/**
|
|
50
|
+
* 切换面板
|
|
51
|
+
*/
|
|
52
|
+
toggle(): this;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 创建 DevTools 实例
|
|
56
|
+
*/
|
|
57
|
+
export declare function createDevTools(options?: DevToolsOptions): IncremarkDevTools;
|
|
58
|
+
/**
|
|
59
|
+
* 一行代码挂载 DevTools(兼容旧 API)
|
|
60
|
+
* @deprecated 请使用 createDevTools() + register() 方式
|
|
61
|
+
*/
|
|
62
|
+
export declare function mountDevTools(options?: DevToolsOptions): () => void;
|
|
63
|
+
//# sourceMappingURL=devtools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAS/D;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,eAAe,CAAuC;IAC9D,OAAO,CAAC,KAAK,CAAqB;IAGlC,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,oBAAoB,CAAmE;gBAEnF,OAAO,GAAE,eAAoB;IAWzC;;;;OAIG;IACH,KAAK,CAAC,MAAM,GAAE,WAAW,GAAG,MAAe,GAAG,IAAI;IA4ClD;;OAEG;IACH,OAAO,IAAI,IAAI;IAuBf;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAWjE;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK5B;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK9B;;OAEG;IACH,IAAI,IAAI,IAAI;IAKZ;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,MAAM,IAAI,IAAI;CAIf;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAE3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,cAgBtD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts - i18n 工具函数
|
|
3
|
+
*/
|
|
4
|
+
import type { Locale, I18nMessages } from './types';
|
|
5
|
+
export type { I18nMessages };
|
|
6
|
+
/**
|
|
7
|
+
* 设置当前语言
|
|
8
|
+
*/
|
|
9
|
+
export declare function setLocale(locale: Locale): void;
|
|
10
|
+
/**
|
|
11
|
+
* 获取当前语言
|
|
12
|
+
*/
|
|
13
|
+
export declare function getLocale(): Locale;
|
|
14
|
+
/**
|
|
15
|
+
* 获取翻译消息
|
|
16
|
+
*/
|
|
17
|
+
export declare function t(key: keyof I18nMessages): string;
|
|
18
|
+
/**
|
|
19
|
+
* 创建响应式的 i18n store
|
|
20
|
+
*/
|
|
21
|
+
export declare function createI18n(initialLocale?: Locale): {
|
|
22
|
+
readonly locale: Locale;
|
|
23
|
+
setLocale(locale: Locale): void;
|
|
24
|
+
t(key: keyof I18nMessages): string;
|
|
25
|
+
readonly version: number;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.svelte.d.ts","sourceRoot":"","sources":["../../src/i18n/index.svelte.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGnD,YAAY,EAAE,YAAY,EAAE,CAAA;AAY5B;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAM9C;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;GAEG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,YAAY,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,aAAa,GAAE,MAAgB;;sBAkBpC,MAAM;WAIjB,MAAM,YAAY,GAAG,MAAM;;EAUrC"}
|