@incremark/react 0.2.3 → 0.2.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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ParserOptions, AnimationEffect, TransformerPlugin, ParsedBlock, Root, IncrementalUpdate, IncremarkParser, SourceBlock, TransformerOptions, DisplayBlock, BlockTransformer, RootContent } from '@incremark/core';
1
+ import { ParserOptions, AnimationEffect, TransformerPlugin, ParsedBlock, Root, IncrementalUpdate, IncremarkParser, SourceBlock, TransformerOptions, DisplayBlock, BlockTransformer, RootContent as RootContent$1 } from '@incremark/core';
2
2
  export { AnimationEffect, BlockTransformer, DisplayBlock, IncrementalUpdate, ParsedBlock, ParserOptions, Root, RootContent, SourceBlock, TransformerOptions, TransformerPlugin, TransformerState, allPlugins, cloneNode, codeBlockPlugin, countChars, createBlockTransformer, createPlugin, defaultPlugins, imagePlugin, mathPlugin, mermaidPlugin, sliceAst, thematicBreakPlugin } from '@incremark/core';
3
3
  import React, { ReactNode } from 'react';
4
- import { Definition, FootnoteDefinition, RootContent as RootContent$1 } from 'mdast';
4
+ import { Definition, FootnoteDefinition, RootContent, PhrasingContent } from 'mdast';
5
5
  import * as _incremark_devtools from '@incremark/devtools';
6
6
  import { DevToolsOptions } from '@incremark/devtools';
7
7
  import { DesignTokens } from '@incremark/theme';
@@ -180,6 +180,13 @@ declare function useIncremark(options?: UseIncremarkOptions): {
180
180
  isLoading: boolean;
181
181
  /** 是否已完成(finalize) */
182
182
  isFinalized: boolean;
183
+ /**
184
+ * 内容是否完全显示完成
185
+ * - 无打字机:等于 isFinalized
186
+ * - 有打字机:isFinalized + 动画播放完成
187
+ * 适用于控制 footnote 等需要在内容完全显示后才出现的元素
188
+ */
189
+ isDisplayComplete: boolean;
183
190
  /** 追加内容 */
184
191
  append: (chunk: string) => IncrementalUpdate;
185
192
  /** 完成解析 */
@@ -298,6 +305,17 @@ interface IncremarkProps {
298
305
  components?: Partial<Record<string, React.ComponentType<{
299
306
  node: any;
300
307
  }>>>;
308
+ /** 自定义容器组件映射,key 为容器名称(如 'warning', 'info') */
309
+ customContainers?: Record<string, React.ComponentType<{
310
+ name: string;
311
+ options?: Record<string, any>;
312
+ children?: React.ReactNode;
313
+ }>>;
314
+ /** 自定义代码块组件映射,key 为代码语言名称(如 'echart', 'mermaid') */
315
+ customCodeBlocks?: Record<string, React.ComponentType<{
316
+ codeStr: string;
317
+ lang?: string;
318
+ }>>;
301
319
  /** 是否显示块状态(待处理块边框) */
302
320
  showBlockStatus?: boolean;
303
321
  /** 自定义类名 */
@@ -321,11 +339,32 @@ interface IncremarkProps {
321
339
  */
322
340
  declare const Incremark: React.FC<IncremarkProps>;
323
341
 
342
+ /**
343
+ * 容器节点类型定义
344
+ * 根据 directive 解析后的结构
345
+ */
346
+ interface ContainerNode {
347
+ type: 'containerDirective' | 'leafDirective' | 'textDirective';
348
+ name: string;
349
+ attributes?: Record<string, string>;
350
+ children?: RootContent[];
351
+ }
352
+
324
353
  interface IncremarkRendererProps {
325
- node: RootContent;
354
+ node: RootContent$1 | ContainerNode;
326
355
  components?: Partial<Record<string, React.ComponentType<{
327
- node: RootContent;
356
+ node: RootContent$1;
328
357
  }>>>;
358
+ customContainers?: Record<string, React.ComponentType<{
359
+ name: string;
360
+ options?: Record<string, any>;
361
+ children?: React.ReactNode;
362
+ }>>;
363
+ customCodeBlocks?: Record<string, React.ComponentType<{
364
+ codeStr: string;
365
+ lang?: string;
366
+ }>>;
367
+ blockStatus?: 'pending' | 'stable' | 'completed';
329
368
  }
330
369
  /**
331
370
  * 渲染单个 AST 节点
@@ -374,6 +413,26 @@ interface AutoScrollContainerRef {
374
413
  */
375
414
  declare const AutoScrollContainer: React.ForwardRefExoticComponent<AutoScrollContainerProps & React.RefAttributes<AutoScrollContainerRef>>;
376
415
 
416
+ interface IncremarkInlineProps {
417
+ nodes: PhrasingContent[];
418
+ }
419
+ /**
420
+ * IncremarkInline 组件
421
+ *
422
+ * 渲染行内内容(文本、加粗、斜体、链接、图片等)
423
+ *
424
+ * 支持特性:
425
+ * - 文本节点(含 chunks 动画)
426
+ * - 加粗、斜体、删除线
427
+ * - 行内代码
428
+ * - 链接(link)和引用式链接(linkReference)
429
+ * - 图片(image)和引用式图片(imageReference)
430
+ * - HTML 元素
431
+ *
432
+ * 注意:此组件与 Vue 版本保持完全一致的逻辑和结构
433
+ */
434
+ declare const IncremarkInline: React.FC<IncremarkInlineProps>;
435
+
377
436
  /**
378
437
  * HtmlElementNode 类型定义(与 @incremark/core 中的定义一致)
379
438
  */
@@ -381,7 +440,7 @@ interface HtmlElementNode {
381
440
  type: 'htmlElement';
382
441
  tagName: string;
383
442
  attrs: Record<string, string>;
384
- children: RootContent$1[];
443
+ children: RootContent[];
385
444
  data?: {
386
445
  rawHtml?: string;
387
446
  parsed?: boolean;
@@ -489,4 +548,4 @@ interface ThemeProviderProps {
489
548
  */
490
549
  declare const ThemeProvider: React.FC<ThemeProviderProps>;
491
550
 
492
- export { AutoScrollContainer, type AutoScrollContainerProps, type AutoScrollContainerRef, type DefinitionsContextValue, DefinitionsProvider, type DefinitionsProviderProps, type HtmlElementNode, Incremark, IncremarkContainerProvider, type IncremarkContainerProviderProps, IncremarkFootnotes, IncremarkHtmlElement, type IncremarkHtmlElementProps, type IncremarkProps, IncremarkRenderer, type IncremarkRendererProps, ThemeProvider, type ThemeProviderProps, type TypewriterControls, type TypewriterOptions, type UseBlockTransformerOptions, type UseBlockTransformerReturn, type UseDevToolsOptions, type UseIncremarkOptions, type UseIncremarkReturn, useBlockTransformer, useDefinitions, useDevTools, useIncremark };
551
+ export { AutoScrollContainer, type AutoScrollContainerProps, type AutoScrollContainerRef, type DefinitionsContextValue, DefinitionsProvider, type DefinitionsProviderProps, type HtmlElementNode, Incremark, IncremarkContainerProvider, type IncremarkContainerProviderProps, IncremarkFootnotes, IncremarkHtmlElement, type IncremarkHtmlElementProps, IncremarkInline, type IncremarkInlineProps, type IncremarkProps, IncremarkRenderer, type IncremarkRendererProps, ThemeProvider, type ThemeProviderProps, type TypewriterControls, type TypewriterOptions, type UseBlockTransformerOptions, type UseBlockTransformerReturn, type UseDevToolsOptions, type UseIncremarkOptions, type UseIncremarkReturn, useBlockTransformer, useDefinitions, useDevTools, useIncremark };
package/dist/index.js CHANGED
@@ -146,6 +146,7 @@ function useTypewriter(options) {
146
146
  typewriterConfig?.effect ?? "none"
147
147
  );
148
148
  const [displayBlocks, setDisplayBlocks] = useState2([]);
149
+ const [isAnimationComplete, setIsAnimationComplete] = useState2(true);
149
150
  if (hasTypewriterConfig && !transformerRef.current) {
150
151
  const twOptions = typewriterConfig;
151
152
  transformerRef.current = createBlockTransformer({
@@ -158,6 +159,12 @@ function useTypewriter(options) {
158
159
  setDisplayBlocks(blocks2);
159
160
  setIsTypewriterProcessing(transformerRef.current?.isProcessing() ?? false);
160
161
  setIsTypewriterPaused(transformerRef.current?.isPausedState() ?? false);
162
+ if (transformerRef.current?.isProcessing()) {
163
+ setIsAnimationComplete(false);
164
+ }
165
+ },
166
+ onAllComplete: () => {
167
+ setIsAnimationComplete(true);
161
168
  }
162
169
  });
163
170
  }
@@ -283,7 +290,8 @@ function useTypewriter(options) {
283
290
  return {
284
291
  blocks,
285
292
  typewriter: typewriterControls,
286
- transformer
293
+ transformer,
294
+ isAnimationComplete
287
295
  };
288
296
  }
289
297
 
@@ -318,11 +326,12 @@ function useIncremark(options = {}) {
318
326
  const [pendingBlocks, setPendingBlocks] = useState3([]);
319
327
  const [isLoading, setIsLoading] = useState3(false);
320
328
  const [isFinalized, setIsFinalized] = useState3(false);
321
- const { blocks, typewriter, transformer } = useTypewriter({
329
+ const { blocks, typewriter, transformer, isAnimationComplete } = useTypewriter({
322
330
  typewriter: options.typewriter,
323
331
  completedBlocks,
324
332
  pendingBlocks
325
333
  });
334
+ const isDisplayComplete = isFinalized && isAnimationComplete;
326
335
  const ast = useMemo2(
327
336
  () => ({
328
337
  type: "root",
@@ -397,6 +406,13 @@ function useIncremark(options = {}) {
397
406
  isLoading,
398
407
  /** 是否已完成(finalize) */
399
408
  isFinalized,
409
+ /**
410
+ * 内容是否完全显示完成
411
+ * - 无打字机:等于 isFinalized
412
+ * - 有打字机:isFinalized + 动画播放完成
413
+ * 适用于控制 footnote 等需要在内容完全显示后才出现的元素
414
+ */
415
+ isDisplayComplete,
400
416
  /** 追加内容 */
401
417
  append,
402
418
  /** 完成解析 */
@@ -822,13 +838,15 @@ var IncremarkParagraph = ({ node }) => {
822
838
  };
823
839
 
824
840
  // src/components/IncremarkCode.tsx
825
- import { useState as useState5, useEffect as useEffect4, useRef as useRef5, useCallback as useCallback5 } from "react";
841
+ import React4, { useState as useState5, useEffect as useEffect4, useRef as useRef5, useCallback as useCallback5 } from "react";
826
842
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
827
843
  var IncremarkCode = ({
828
844
  node,
829
845
  theme = "github-dark",
830
846
  disableHighlight = false,
831
- mermaidDelay = 500
847
+ mermaidDelay = 500,
848
+ customCodeBlocks,
849
+ blockStatus = "completed"
832
850
  }) => {
833
851
  const [copied, setCopied] = useState5(false);
834
852
  const [highlightedHtml, setHighlightedHtml] = useState5("");
@@ -844,6 +862,13 @@ var IncremarkCode = ({
844
862
  const language = node.lang || "text";
845
863
  const code = node.value;
846
864
  const isMermaid = language === "mermaid";
865
+ const CustomCodeBlock = React4.useMemo(() => {
866
+ if (blockStatus === "pending") {
867
+ return null;
868
+ }
869
+ return customCodeBlocks?.[language] || null;
870
+ }, [customCodeBlocks, language, blockStatus]);
871
+ const useCustomComponent = !!CustomCodeBlock;
847
872
  const toggleMermaidView = useCallback5(() => {
848
873
  setMermaidViewMode((prev) => prev === "preview" ? "source" : "preview");
849
874
  }, []);
@@ -943,6 +968,9 @@ var IncremarkCode = ({
943
968
  }
944
969
  };
945
970
  }, []);
971
+ if (useCustomComponent && CustomCodeBlock) {
972
+ return /* @__PURE__ */ jsx6(CustomCodeBlock, { codeStr: code, lang: language });
973
+ }
946
974
  if (isMermaid) {
947
975
  return /* @__PURE__ */ jsxs2("div", { className: "incremark-mermaid", children: [
948
976
  /* @__PURE__ */ jsxs2("div", { className: "mermaid-header", children: [
@@ -975,19 +1003,28 @@ var IncremarkCode = ({
975
1003
 
976
1004
  // src/components/IncremarkList.tsx
977
1005
  import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
978
- function getItemContent(item) {
1006
+ function getItemInlineContent(item) {
979
1007
  const firstChild = item.children[0];
980
1008
  if (firstChild?.type === "paragraph") {
981
1009
  return firstChild.children;
982
1010
  }
983
1011
  return [];
984
1012
  }
1013
+ function getItemBlockChildren(item) {
1014
+ return item.children.filter((child, index) => {
1015
+ if (index === 0 && child.type === "paragraph") {
1016
+ return false;
1017
+ }
1018
+ return true;
1019
+ });
1020
+ }
985
1021
  var IncremarkList = ({ node }) => {
986
1022
  const Tag = node.ordered ? "ol" : "ul";
987
1023
  const isTaskList = node.children?.some((item) => item.checked !== null && item.checked !== void 0);
988
1024
  return /* @__PURE__ */ jsx7(Tag, { className: `incremark-list ${isTaskList ? "task-list" : ""}`, children: node.children?.map((item, index) => {
989
1025
  const isTaskItem = item.checked !== null && item.checked !== void 0;
990
- const content = getItemContent(item);
1026
+ const inlineContent = getItemInlineContent(item);
1027
+ const blockChildren = getItemBlockChildren(item);
991
1028
  if (isTaskItem) {
992
1029
  return /* @__PURE__ */ jsx7("li", { className: "incremark-list-item task-item", children: /* @__PURE__ */ jsxs3("label", { className: "task-label", children: [
993
1030
  /* @__PURE__ */ jsx7(
@@ -999,10 +1036,18 @@ var IncremarkList = ({ node }) => {
999
1036
  className: "checkbox"
1000
1037
  }
1001
1038
  ),
1002
- /* @__PURE__ */ jsx7("span", { className: "task-content", children: /* @__PURE__ */ jsx7(IncremarkInline, { nodes: content }) })
1039
+ /* @__PURE__ */ jsx7("span", { className: "task-content", children: /* @__PURE__ */ jsx7(IncremarkInline, { nodes: inlineContent }) })
1003
1040
  ] }) }, index);
1004
1041
  }
1005
- return /* @__PURE__ */ jsx7("li", { className: "incremark-list-item", children: /* @__PURE__ */ jsx7(IncremarkInline, { nodes: content }) }, index);
1042
+ return /* @__PURE__ */ jsxs3("li", { className: "incremark-list-item", children: [
1043
+ /* @__PURE__ */ jsx7(IncremarkInline, { nodes: inlineContent }),
1044
+ blockChildren.map((child, childIndex) => {
1045
+ if (child.type === "list") {
1046
+ return /* @__PURE__ */ jsx7(IncremarkList, { node: child }, childIndex);
1047
+ }
1048
+ return null;
1049
+ })
1050
+ ] }, index);
1006
1051
  }) });
1007
1052
  };
1008
1053
 
@@ -1120,20 +1165,44 @@ var IncremarkDefault = ({ node }) => {
1120
1165
  ] });
1121
1166
  };
1122
1167
 
1168
+ // src/components/IncremarkContainer.tsx
1169
+ import { jsx as jsx13 } from "react/jsx-runtime";
1170
+ function parseOptions(attributes) {
1171
+ if (!attributes) return {};
1172
+ const options = {};
1173
+ for (const [key, value] of Object.entries(attributes)) {
1174
+ try {
1175
+ options[key] = JSON.parse(value);
1176
+ } catch {
1177
+ options[key] = value;
1178
+ }
1179
+ }
1180
+ return options;
1181
+ }
1182
+ var IncremarkContainer = ({ node, customContainers }) => {
1183
+ const containerName = node.name;
1184
+ const options = parseOptions(node.attributes);
1185
+ const CustomContainer = customContainers?.[containerName];
1186
+ if (CustomContainer) {
1187
+ return /* @__PURE__ */ jsx13(CustomContainer, { name: containerName, options, children: node.children?.map((child, index) => /* @__PURE__ */ jsx13(IncremarkRenderer, { node: child }, index)) });
1188
+ }
1189
+ return /* @__PURE__ */ jsx13("div", { className: `incremark-container incremark-container-${containerName}`, children: node.children && node.children.length > 0 && /* @__PURE__ */ jsx13("div", { className: "incremark-container-content", children: node.children.map((child, index) => /* @__PURE__ */ jsx13(IncremarkRenderer, { node: child }, index)) }) });
1190
+ };
1191
+
1123
1192
  // src/components/IncremarkRenderer.tsx
1124
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1193
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1125
1194
  var DefaultHeading = ({ node }) => {
1126
- return /* @__PURE__ */ jsx13(IncremarkHeading, { node });
1195
+ return /* @__PURE__ */ jsx14(IncremarkHeading, { node });
1127
1196
  };
1128
- var DefaultParagraph = ({ node }) => /* @__PURE__ */ jsx13(IncremarkParagraph, { node });
1129
- var DefaultCode = ({ node }) => /* @__PURE__ */ jsx13(IncremarkCode, { node });
1130
- var DefaultList = ({ node }) => /* @__PURE__ */ jsx13(IncremarkList, { node });
1131
- var DefaultBlockquote = ({ node }) => /* @__PURE__ */ jsx13(IncremarkBlockquote, { node });
1132
- var DefaultTable = ({ node }) => /* @__PURE__ */ jsx13(IncremarkTable, { node });
1133
- var DefaultThematicBreak = () => /* @__PURE__ */ jsx13(IncremarkThematicBreak, {});
1134
- var DefaultMath = ({ node }) => /* @__PURE__ */ jsx13(IncremarkMath, { node });
1135
- var DefaultHtmlElement = ({ node }) => /* @__PURE__ */ jsx13(IncremarkHtmlElement, { node });
1136
- var DefaultDefault = ({ node }) => /* @__PURE__ */ jsx13(IncremarkDefault, { node });
1197
+ var DefaultParagraph = ({ node }) => /* @__PURE__ */ jsx14(IncremarkParagraph, { node });
1198
+ var DefaultCode = ({ node }) => /* @__PURE__ */ jsx14(IncremarkCode, { node });
1199
+ var DefaultList = ({ node }) => /* @__PURE__ */ jsx14(IncremarkList, { node });
1200
+ var DefaultBlockquote = ({ node }) => /* @__PURE__ */ jsx14(IncremarkBlockquote, { node });
1201
+ var DefaultTable = ({ node }) => /* @__PURE__ */ jsx14(IncremarkTable, { node });
1202
+ var DefaultThematicBreak = () => /* @__PURE__ */ jsx14(IncremarkThematicBreak, {});
1203
+ var DefaultMath = ({ node }) => /* @__PURE__ */ jsx14(IncremarkMath, { node });
1204
+ var DefaultHtmlElement = ({ node }) => /* @__PURE__ */ jsx14(IncremarkHtmlElement, { node });
1205
+ var DefaultDefault = ({ node }) => /* @__PURE__ */ jsx14(IncremarkDefault, { node });
1137
1206
  var defaultComponents = {
1138
1207
  heading: DefaultHeading,
1139
1208
  paragraph: DefaultParagraph,
@@ -1147,21 +1216,49 @@ var defaultComponents = {
1147
1216
  htmlElement: DefaultHtmlElement,
1148
1217
  default: DefaultDefault
1149
1218
  };
1150
- var IncremarkRenderer = ({ node, components = {} }) => {
1219
+ function isContainerNode(node) {
1220
+ return node.type === "containerDirective" || node.type === "leafDirective" || node.type === "textDirective";
1221
+ }
1222
+ var IncremarkRenderer = ({
1223
+ node,
1224
+ components = {},
1225
+ customContainers,
1226
+ customCodeBlocks,
1227
+ blockStatus
1228
+ }) => {
1151
1229
  if (node.type === "footnoteDefinition") {
1152
1230
  return null;
1153
1231
  }
1154
1232
  if (node.type === "html") {
1155
- return /* @__PURE__ */ jsx13("pre", { className: "incremark-html-code", children: /* @__PURE__ */ jsx13("code", { children: node.value }) });
1233
+ return /* @__PURE__ */ jsx14("pre", { className: "incremark-html-code", children: /* @__PURE__ */ jsx14("code", { children: node.value }) });
1234
+ }
1235
+ if (isContainerNode(node)) {
1236
+ return /* @__PURE__ */ jsx14(
1237
+ IncremarkContainer,
1238
+ {
1239
+ node,
1240
+ customContainers
1241
+ }
1242
+ );
1243
+ }
1244
+ if (node.type === "code") {
1245
+ return /* @__PURE__ */ jsx14(
1246
+ IncremarkCode,
1247
+ {
1248
+ node,
1249
+ customCodeBlocks,
1250
+ blockStatus
1251
+ }
1252
+ );
1156
1253
  }
1157
1254
  const mergedComponents = { ...defaultComponents, ...components };
1158
1255
  const Component = mergedComponents[node.type] || DefaultDefault;
1159
- return /* @__PURE__ */ jsx13(Component, { node });
1256
+ return /* @__PURE__ */ jsx14(Component, { node });
1160
1257
  };
1161
1258
 
1162
1259
  // src/components/IncremarkFootnotes.tsx
1163
1260
  import React7 from "react";
1164
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
1261
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1165
1262
  var IncremarkFootnotes = () => {
1166
1263
  const { footnoteDefinitions, footnoteReferenceOrder } = useDefinitions();
1167
1264
  const orderedFootnotes = React7.useMemo(() => {
@@ -1174,8 +1271,8 @@ var IncremarkFootnotes = () => {
1174
1271
  return null;
1175
1272
  }
1176
1273
  return /* @__PURE__ */ jsxs7("section", { className: "incremark-footnotes", children: [
1177
- /* @__PURE__ */ jsx14("hr", { className: "incremark-footnotes-divider" }),
1178
- /* @__PURE__ */ jsx14("ol", { className: "incremark-footnotes-list", children: orderedFootnotes.map((item, index) => /* @__PURE__ */ jsxs7(
1274
+ /* @__PURE__ */ jsx15("hr", { className: "incremark-footnotes-divider" }),
1275
+ /* @__PURE__ */ jsx15("ol", { className: "incremark-footnotes-list", children: orderedFootnotes.map((item, index) => /* @__PURE__ */ jsxs7(
1179
1276
  "li",
1180
1277
  {
1181
1278
  id: `fn-${item.identifier}`,
@@ -1186,9 +1283,9 @@ var IncremarkFootnotes = () => {
1186
1283
  index + 1,
1187
1284
  "."
1188
1285
  ] }),
1189
- /* @__PURE__ */ jsx14("div", { className: "incremark-footnote-body", children: item.definition.children.map((child, childIndex) => /* @__PURE__ */ jsx14(IncremarkRenderer, { node: child }, childIndex)) })
1286
+ /* @__PURE__ */ jsx15("div", { className: "incremark-footnote-body", children: item.definition.children.map((child, childIndex) => /* @__PURE__ */ jsx15(IncremarkRenderer, { node: child }, childIndex)) })
1190
1287
  ] }),
1191
- /* @__PURE__ */ jsx14(
1288
+ /* @__PURE__ */ jsx15(
1192
1289
  "a",
1193
1290
  {
1194
1291
  href: `#fnref-${item.identifier}`,
@@ -1205,53 +1302,61 @@ var IncremarkFootnotes = () => {
1205
1302
  };
1206
1303
 
1207
1304
  // src/components/IncremarkContainerProvider.tsx
1208
- import { jsx as jsx15 } from "react/jsx-runtime";
1305
+ import { jsx as jsx16 } from "react/jsx-runtime";
1209
1306
  var IncremarkContainerProvider = ({ children, definitions }) => {
1210
- return /* @__PURE__ */ jsx15(DefinitionsContext.Provider, { value: definitions, children });
1307
+ return /* @__PURE__ */ jsx16(DefinitionsContext.Provider, { value: definitions, children });
1211
1308
  };
1212
1309
 
1213
1310
  // src/components/Incremark.tsx
1214
- import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1311
+ import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
1215
1312
  var Incremark = (props) => {
1216
1313
  const {
1217
1314
  blocks: propsBlocks,
1218
1315
  components,
1316
+ customContainers,
1317
+ customCodeBlocks,
1219
1318
  showBlockStatus = true,
1220
1319
  className = "",
1221
1320
  incremark
1222
1321
  } = props;
1223
1322
  if (incremark) {
1224
- const { blocks: blocks2, isFinalized: isFinalized2, _definitionsContextValue } = incremark;
1225
- return /* @__PURE__ */ jsx16(IncremarkContainerProvider, { definitions: _definitionsContextValue, children: /* @__PURE__ */ jsx16(
1323
+ const { blocks: blocks2, isDisplayComplete: isDisplayComplete2, _definitionsContextValue } = incremark;
1324
+ return /* @__PURE__ */ jsx17(IncremarkContainerProvider, { definitions: _definitionsContextValue, children: /* @__PURE__ */ jsx17(
1226
1325
  IncremarkInternal,
1227
1326
  {
1228
1327
  blocks: blocks2,
1229
1328
  components,
1329
+ customContainers,
1330
+ customCodeBlocks,
1230
1331
  showBlockStatus,
1231
1332
  className,
1232
- isFinalized: isFinalized2
1333
+ isDisplayComplete: isDisplayComplete2
1233
1334
  }
1234
1335
  ) });
1235
1336
  }
1236
1337
  const blocks = propsBlocks || [];
1237
- const isFinalized = blocks.length > 0 && blocks.every((b) => b.status === "completed");
1238
- return /* @__PURE__ */ jsx16(
1338
+ const isDisplayComplete = blocks.length > 0 && blocks.every((b) => b.status === "completed");
1339
+ return /* @__PURE__ */ jsx17(
1239
1340
  IncremarkInternal,
1240
1341
  {
1241
1342
  blocks,
1242
1343
  components,
1344
+ customContainers,
1345
+ customCodeBlocks,
1243
1346
  showBlockStatus,
1244
1347
  className,
1245
- isFinalized
1348
+ isDisplayComplete
1246
1349
  }
1247
1350
  );
1248
1351
  };
1249
1352
  var IncremarkInternal = ({
1250
1353
  blocks,
1251
1354
  components,
1355
+ customContainers,
1356
+ customCodeBlocks,
1252
1357
  showBlockStatus,
1253
1358
  className,
1254
- isFinalized
1359
+ isDisplayComplete
1255
1360
  }) => {
1256
1361
  return /* @__PURE__ */ jsxs8("div", { className: `incremark ${className}`, children: [
1257
1362
  blocks.map((block) => {
@@ -1265,9 +1370,18 @@ var IncremarkInternal = ({
1265
1370
  showBlockStatus && "incremark-show-status",
1266
1371
  block.isLastPending && "incremark-last-pending"
1267
1372
  ].filter(Boolean).join(" ");
1268
- return /* @__PURE__ */ jsx16("div", { className: classes, children: /* @__PURE__ */ jsx16(IncremarkRenderer, { node: block.node, components }) }, block.stableId);
1373
+ return /* @__PURE__ */ jsx17("div", { className: classes, children: /* @__PURE__ */ jsx17(
1374
+ IncremarkRenderer,
1375
+ {
1376
+ node: block.node,
1377
+ components,
1378
+ customContainers,
1379
+ customCodeBlocks,
1380
+ blockStatus: block.status
1381
+ }
1382
+ ) }, block.stableId);
1269
1383
  }),
1270
- isFinalized && /* @__PURE__ */ jsx16(IncremarkFootnotes, {})
1384
+ isDisplayComplete && /* @__PURE__ */ jsx17(IncremarkFootnotes, {})
1271
1385
  ] });
1272
1386
  };
1273
1387
 
@@ -1280,7 +1394,7 @@ import {
1280
1394
  forwardRef,
1281
1395
  useImperativeHandle
1282
1396
  } from "react";
1283
- import { jsx as jsx17 } from "react/jsx-runtime";
1397
+ import { jsx as jsx18 } from "react/jsx-runtime";
1284
1398
  var AutoScrollContainer = forwardRef(
1285
1399
  ({
1286
1400
  children,
@@ -1378,11 +1492,11 @@ var AutoScrollContainer = forwardRef(
1378
1492
  }),
1379
1493
  [scrollToBottom, isUserScrolledUp]
1380
1494
  );
1381
- return /* @__PURE__ */ jsx17(
1495
+ return /* @__PURE__ */ jsx18(
1382
1496
  "div",
1383
1497
  {
1384
1498
  ref: containerRef,
1385
- className,
1499
+ className: `auto-scroll-container ${className || ""}`.trim(),
1386
1500
  style: {
1387
1501
  overflowY: "auto",
1388
1502
  height: "100%",
@@ -1399,7 +1513,7 @@ AutoScrollContainer.displayName = "AutoScrollContainer";
1399
1513
  // src/ThemeProvider.tsx
1400
1514
  import { useEffect as useEffect7, useRef as useRef8 } from "react";
1401
1515
  import { applyTheme } from "@incremark/theme";
1402
- import { jsx as jsx18 } from "react/jsx-runtime";
1516
+ import { jsx as jsx19 } from "react/jsx-runtime";
1403
1517
  var ThemeProvider = ({
1404
1518
  theme,
1405
1519
  children,
@@ -1411,7 +1525,7 @@ var ThemeProvider = ({
1411
1525
  applyTheme(containerRef.current, theme);
1412
1526
  }
1413
1527
  }, [theme]);
1414
- return /* @__PURE__ */ jsx18("div", { ref: containerRef, className, children });
1528
+ return /* @__PURE__ */ jsx19("div", { ref: containerRef, className: `incremark-theme-provider ${className}`.trim(), children });
1415
1529
  };
1416
1530
 
1417
1531
  // src/index.ts
@@ -1445,6 +1559,7 @@ export {
1445
1559
  IncremarkContainerProvider,
1446
1560
  IncremarkFootnotes,
1447
1561
  IncremarkHtmlElement,
1562
+ IncremarkInline,
1448
1563
  IncremarkRenderer,
1449
1564
  ThemeProvider,
1450
1565
  allPlugins,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incremark/react",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "license": "MIT",
5
5
  "description": "Incremark React integration - Incremental Markdown parser for AI streaming",
6
6
  "type": "module",
@@ -21,13 +21,13 @@
21
21
  "mermaid": "^10.0.0 || ^11.0.0",
22
22
  "katex": "^0.16.0",
23
23
  "react": ">=18.0.0",
24
- "@incremark/core": "0.2.3"
24
+ "@incremark/core": "0.2.5"
25
25
  },
26
26
  "dependencies": {
27
27
  "shiki": "^3.20.0",
28
- "@incremark/devtools": "0.2.3",
29
- "@incremark/theme": "0.2.3",
30
- "@incremark/shared": "0.2.3"
28
+ "@incremark/theme": "0.2.5",
29
+ "@incremark/shared": "0.2.5",
30
+ "@incremark/devtools": "0.2.5"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/mdast": "^4.0.0",