@incremark/vue 0.3.1 → 0.3.3
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/dist/components/CachedCodeRenderer.vue.d.ts +16 -0
- package/dist/components/IncremarkCode.vue.d.ts +1 -1
- package/dist/components/IncremarkCodeDefault.vue.d.ts +3 -0
- package/dist/composables/useIncremark.d.ts +2 -42
- package/dist/composables/useShiki.d.ts +2 -0
- package/dist/composables/useTypewriter.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1048 -287
- package/dist/index.js.map +1 -1
- package/package.json +14 -10
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
code: string;
|
|
3
|
+
lang: string;
|
|
4
|
+
theme: string;
|
|
5
|
+
highlighter: any;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"stream-start": () => any;
|
|
9
|
+
"stream-end": () => any;
|
|
10
|
+
"stream-error": () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
12
|
+
"onStream-start"?: (() => any) | undefined;
|
|
13
|
+
"onStream-end"?: (() => any) | undefined;
|
|
14
|
+
"onStream-error"?: (() => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -25,9 +25,9 @@ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
25
25
|
mermaidDelay: number;
|
|
26
26
|
fallbackTheme: string;
|
|
27
27
|
disableHighlight: boolean;
|
|
28
|
+
blockStatus: "pending" | "stable" | "completed";
|
|
28
29
|
customCodeBlocks: Record<string, Component>;
|
|
29
30
|
codeBlockConfigs: Record<string, CodeBlockConfig>;
|
|
30
|
-
blockStatus: "pending" | "stable" | "completed";
|
|
31
31
|
defaultCodeComponent: Component;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
33
|
export default _default;
|
|
@@ -7,10 +7,13 @@ interface Props {
|
|
|
7
7
|
fallbackTheme?: string;
|
|
8
8
|
/** 是否禁用代码高亮 */
|
|
9
9
|
disableHighlight?: boolean;
|
|
10
|
+
/** block 状态 */
|
|
11
|
+
blockStatus?: 'pending' | 'stable' | 'completed';
|
|
10
12
|
}
|
|
11
13
|
declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
12
14
|
theme: string;
|
|
13
15
|
fallbackTheme: string;
|
|
14
16
|
disableHighlight: boolean;
|
|
17
|
+
blockStatus: "pending" | "stable" | "completed";
|
|
15
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
19
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import { type IncremarkParserOptions, type
|
|
2
|
+
import { type IncremarkParserOptions, type TransformerPlugin, type AnimationEffect } from '@incremark/core';
|
|
3
3
|
/** 打字机效果配置 */
|
|
4
4
|
export interface TypewriterOptions {
|
|
5
5
|
/** 是否启用打字机效果(可响应式切换) */
|
|
@@ -76,44 +76,4 @@ export type UseIncremarkReturn = ReturnType<typeof useIncremark>;
|
|
|
76
76
|
* </template>
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
|
-
export declare function useIncremark(optionsInput?: MaybeRefOrGetter<UseIncremarkOptions>):
|
|
80
|
-
/** 已收集的完整 Markdown 字符串 */
|
|
81
|
-
markdown: import("vue").Ref<string, string>;
|
|
82
|
-
/** 已完成的块列表 */
|
|
83
|
-
completedBlocks: import("vue").ShallowRef<ParsedBlock[], ParsedBlock[]>;
|
|
84
|
-
/** 待处理的块列表 */
|
|
85
|
-
pendingBlocks: import("vue").ShallowRef<ParsedBlock[], ParsedBlock[]>;
|
|
86
|
-
/** 当前完整的 AST */
|
|
87
|
-
ast: ComputedRef<Root>;
|
|
88
|
-
/** 用于渲染的 blocks(根据打字机设置自动处理) */
|
|
89
|
-
blocks: ComputedRef<(ParsedBlock & {
|
|
90
|
-
isLastPending?: boolean;
|
|
91
|
-
})[]>;
|
|
92
|
-
/** 是否正在加载 */
|
|
93
|
-
isLoading: import("vue").Ref<boolean, boolean>;
|
|
94
|
-
/** 是否已完成(finalize) */
|
|
95
|
-
isFinalized: import("vue").Ref<boolean, boolean>;
|
|
96
|
-
/**
|
|
97
|
-
* 内容是否完全显示完成
|
|
98
|
-
* - 无打字机:等于 isFinalized
|
|
99
|
-
* - 有打字机:isFinalized + 动画播放完成
|
|
100
|
-
* 适用于控制 footnote 等需要在内容完全显示后才出现的元素
|
|
101
|
-
*/
|
|
102
|
-
isDisplayComplete: ComputedRef<boolean>;
|
|
103
|
-
/** 脚注引用的出现顺序 */
|
|
104
|
-
footnoteReferenceOrder: import("vue").Ref<string[], string[]>;
|
|
105
|
-
/** 追加内容 */
|
|
106
|
-
append: (chunk: string) => IncrementalUpdate;
|
|
107
|
-
/** 完成解析 */
|
|
108
|
-
finalize: () => IncrementalUpdate;
|
|
109
|
-
/** 强制中断 */
|
|
110
|
-
abort: () => IncrementalUpdate;
|
|
111
|
-
/** 重置解析器和打字机 */
|
|
112
|
-
reset: () => void;
|
|
113
|
-
/** 一次性渲染(reset + append + finalize) */
|
|
114
|
-
render: (content: string) => IncrementalUpdate;
|
|
115
|
-
/** 解析器实例 */
|
|
116
|
-
parser: import("@incremark/core").IncremarkParser;
|
|
117
|
-
/** 打字机控制 */
|
|
118
|
-
typewriter: TypewriterControls;
|
|
119
|
-
};
|
|
79
|
+
export declare function useIncremark(optionsInput?: MaybeRefOrGetter<UseIncremarkOptions>): any;
|
|
@@ -62,5 +62,7 @@ export { getShikiManager, ShikiManager };
|
|
|
62
62
|
export declare function useShiki(theme: string): {
|
|
63
63
|
highlighterInfo: import("vue").ShallowRef<HighlighterInfo | null, HighlighterInfo | null>;
|
|
64
64
|
isHighlighting: import("vue").ShallowRef<boolean, boolean>;
|
|
65
|
+
isReady: import("vue").ShallowRef<boolean, boolean>;
|
|
66
|
+
initHighlighter: () => Promise<void>;
|
|
65
67
|
highlight: (code: string, lang: string, fallbackTheme: string) => Promise<string>;
|
|
66
68
|
};
|
|
@@ -26,6 +26,12 @@ export interface UseTypewriterReturn {
|
|
|
26
26
|
transformer: BlockTransformer<RootContent> | null;
|
|
27
27
|
/** 所有动画是否已完成(队列为空且没有正在处理的 block) */
|
|
28
28
|
isAnimationComplete: Ref<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* 脚注引用顺序(所有动画完成后才返回)
|
|
31
|
+
* 用于控制脚注的显示时机:只有当所有 blocks 的打字机动画都完成后才显示脚注
|
|
32
|
+
* 动画进行中时返回空数组
|
|
33
|
+
*/
|
|
34
|
+
displayedFootnoteReferenceOrder: ComputedRef<string[]>;
|
|
29
35
|
}
|
|
30
36
|
/**
|
|
31
37
|
* useTypewriter Composable
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './components';
|
|
|
6
6
|
export { default as ThemeProvider } from './ThemeProvider.vue';
|
|
7
7
|
export { default as ConfigProvider } from './components/ConfigProvider.vue';
|
|
8
8
|
export type { ParsedBlock, IncrementalUpdate, ParserOptions, BlockStatus, Root, RootContent, SourceBlock, DisplayBlock, TransformerPlugin, TransformerOptions, TransformerState, AnimationEffect } from '@incremark/core';
|
|
9
|
+
export type { Root as MdastRoot, Parent, Heading, Paragraph, Code, Blockquote, List, ListItem, Table, TableCell, ThematicBreak, Text, PhrasingContent, InlineCode, Link, LinkReference, Image, ImageReference, HTML, Definition, FootnoteDefinition } from 'mdast';
|
|
9
10
|
export { BlockTransformer, createBlockTransformer, countChars, sliceAst, cloneNode, codeBlockPlugin, mermaidPlugin, imagePlugin, mathPlugin, thematicBreakPlugin, defaultPlugins, allPlugins, createPlugin } from '@incremark/core';
|
|
10
11
|
export { type DesignTokens, defaultTheme, darkTheme, generateCSSVars, mergeTheme, applyTheme } from '@incremark/theme';
|
|
11
12
|
import { en as enShared, zhCN as zhCNShared } from '@incremark/shared';
|