@octanejs/streamdown 0.1.32 → 0.1.34

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.
@@ -358,7 +358,7 @@ var animate = createAnimatePlugin();
358
358
 
359
359
  // src/lib/block-incomplete-context.ts
360
360
  import { createContext, useContext } from "octane";
361
- var BlockIncompleteContext = createContext(false);
361
+ var BlockIncompleteContext = /* @__PURE__ */ createContext(false);
362
362
  var useIsCodeFenceIncomplete = () => useContext(BlockIncompleteContext);
363
363
 
364
364
  // src/lib/components.tsrx
@@ -436,7 +436,7 @@ var save = (filename, content, mimeType) => {
436
436
  };
437
437
 
438
438
  // src/lib/prefix-context.tsrx
439
- var PrefixContext = createContext2(cn);
439
+ var PrefixContext = /* @__PURE__ */ createContext2(cn);
440
440
  var useCn = () => useContext2(PrefixContext);
441
441
 
442
442
  // src/lib/code-block/body.tsrx
@@ -473,7 +473,7 @@ var parseRootStyle = (rootStyle) => {
473
473
  }
474
474
  return style;
475
475
  };
476
- var CodeBlockBody = memo(
476
+ var CodeBlockBody = /* @__PURE__ */ memo(
477
477
  ({
478
478
  children,
479
479
  result,
@@ -602,7 +602,7 @@ var CodeBlockContainer = ({ className, language, style, isIncomplete, ...props }
602
602
 
603
603
  // src/lib/code-block/context.tsrx
604
604
  import { createContext as createContext3, useContext as useContext3 } from "octane";
605
- var CodeBlockContext = createContext3({ code: "" });
605
+ var CodeBlockContext = /* @__PURE__ */ createContext3({ code: "" });
606
606
  var useCodeBlockContext = () => useContext3(CodeBlockContext);
607
607
 
608
608
  // src/lib/code-block/header.tsrx
@@ -639,7 +639,7 @@ var trimTrailingNewlines = (str) => {
639
639
  }
640
640
  return str.slice(0, end);
641
641
  };
642
- var HighlightedCodeBlockBody = /* @__PURE__ */ lazy(() => import("./highlighted-body-PO42OPN2.js").then((mod) => ({ default: mod.HighlightedCodeBlockBody })));
642
+ var HighlightedCodeBlockBody = /* @__PURE__ */ lazy(() => import("./highlighted-body-PUZR4KPW.js").then((mod) => ({ default: mod.HighlightedCodeBlockBody })));
643
643
  var CodeBlock = ({
644
644
  code,
645
645
  language,
@@ -986,7 +986,7 @@ var defaultIcons = {
986
986
  ZoomInIcon,
987
987
  ZoomOutIcon
988
988
  };
989
- var IconContext = createContext4(defaultIcons);
989
+ var IconContext = /* @__PURE__ */ createContext4(defaultIcons);
990
990
  var shallowEqual = (a, b) => {
991
991
  if (a === b) {
992
992
  return true;
@@ -1046,7 +1046,7 @@ var defaultTranslations = {
1046
1046
  copied: "Copied",
1047
1047
  openLink: "Open link"
1048
1048
  };
1049
- var TranslationsContext = createContext5(defaultTranslations);
1049
+ var TranslationsContext = /* @__PURE__ */ createContext5(defaultTranslations);
1050
1050
  var useTranslations = () => useContext5(TranslationsContext);
1051
1051
 
1052
1052
  // src/lib/code-block/copy-button.tsrx
@@ -1874,7 +1874,7 @@ var _h$110 = /* @__PURE__ */ Symbol(_hs$12 + 1);
1874
1874
  var _h$28 = /* @__PURE__ */ Symbol(_hs$12 + 2);
1875
1875
  var _h$36 = /* @__PURE__ */ Symbol(_hs$12 + 3);
1876
1876
  var _h$45 = /* @__PURE__ */ Symbol(_hs$12 + 4);
1877
- var PluginContext = createContext6(null);
1877
+ var PluginContext = /* @__PURE__ */ createContext6(null);
1878
1878
  var usePlugins = () => useContext8(PluginContext);
1879
1879
  var useCodePlugin = () => {
1880
1880
  const plugins = _$withSlot10(_h$012, usePlugins);
@@ -2142,7 +2142,7 @@ var MermaidFullscreenButton = ({ chart, config, onFullscreen, onExit, className,
2142
2142
  },
2143
2143
  () => _$createElementFromConfig8("c:9e767713", Maximize2Icon2, { size: 14 })
2144
2144
  )),
2145
- isFullscreen ? createPortal(
2145
+ isFullscreen ? /* @__PURE__ */ createPortal(
2146
2146
  _$createScopedValue13(() => _$createScopedElement11(
2147
2147
  "div",
2148
2148
  {
@@ -2717,7 +2717,7 @@ var TableFullscreenButton = ({ children, className, showCopy = true, showDownloa
2717
2717
  },
2718
2718
  () => _$createElementFromConfig11("c:06098222", Maximize2Icon2, { size: 14 })
2719
2719
  )),
2720
- isFullscreen ? createPortal2(
2720
+ isFullscreen ? /* @__PURE__ */ createPortal2(
2721
2721
  _$createScopedValue16(() => _$createScopedElement14(
2722
2722
  "div",
2723
2723
  {
@@ -2858,7 +2858,7 @@ var _h$262 = /* @__PURE__ */ Symbol(_hs$19 + 26);
2858
2858
  var _h$272 = /* @__PURE__ */ Symbol(_hs$19 + 27);
2859
2859
  var START_LINE_PATTERN = /startLine=(\d+)/;
2860
2860
  var NO_LINE_NUMBERS_PATTERN = /\bnoLineNumbers\b/;
2861
- var Mermaid2 = /* @__PURE__ */ lazy2(() => import("./mermaid-2J5JVDRZ.js").then((mod) => ({ default: mod.Mermaid })));
2861
+ var Mermaid2 = /* @__PURE__ */ lazy2(() => import("./mermaid-VJLFYSWR.js").then((mod) => ({ default: mod.Mermaid })));
2862
2862
  var LANGUAGE_REGEX = /language-([^\s]+)/;
2863
2863
  function sameNodePosition(prev, next) {
2864
2864
  if (!(prev?.position || next?.position)) {
@@ -2921,7 +2921,7 @@ var shouldShowMermaidControl = (config, controlType) => {
2921
2921
  }
2922
2922
  return mermaidConfig[controlType] !== false;
2923
2923
  };
2924
- var MemoOl = memo2(
2924
+ var MemoOl = /* @__PURE__ */ memo2(
2925
2925
  ({ children, className, node, ...props }) => {
2926
2926
  const cn2 = _$withSlot17(_h$019, useCn);
2927
2927
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -2937,7 +2937,7 @@ var MemoOl = memo2(
2937
2937
  (p, n) => sameClassAndNode(p, n)
2938
2938
  );
2939
2939
  Object.assign(MemoOl, { displayName: "MarkdownOl" });
2940
- var MemoLi = memo2(
2940
+ var MemoLi = /* @__PURE__ */ memo2(
2941
2941
  ({ children, className, node, ...props }) => {
2942
2942
  const cn2 = _$withSlot17(_h$116, useCn);
2943
2943
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -2953,7 +2953,7 @@ var MemoLi = memo2(
2953
2953
  (p, n) => p.className === n.className && sameNodePosition(p.node, n.node)
2954
2954
  );
2955
2955
  Object.assign(MemoLi, { displayName: "MarkdownLi" });
2956
- var MemoUl = memo2(
2956
+ var MemoUl = /* @__PURE__ */ memo2(
2957
2957
  ({ children, className, node, ...props }) => {
2958
2958
  const cn2 = _$withSlot17(_h$214, useCn);
2959
2959
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -2969,7 +2969,7 @@ var MemoUl = memo2(
2969
2969
  (p, n) => sameClassAndNode(p, n)
2970
2970
  );
2971
2971
  Object.assign(MemoUl, { displayName: "MarkdownUl" });
2972
- var MemoHr = memo2(
2972
+ var MemoHr = /* @__PURE__ */ memo2(
2973
2973
  ({ className, node, ...props }) => {
2974
2974
  const cn2 = _$withSlot17(_h$312, useCn);
2975
2975
  return _$createScopedValue18(() => _$createElement5("hr", {
@@ -2981,7 +2981,7 @@ var MemoHr = memo2(
2981
2981
  (p, n) => sameClassAndNode(p, n)
2982
2982
  );
2983
2983
  Object.assign(MemoHr, { displayName: "MarkdownHr" });
2984
- var MemoStrong = memo2(
2984
+ var MemoStrong = /* @__PURE__ */ memo2(
2985
2985
  ({ children, className, node, ...props }) => {
2986
2986
  const cn2 = _$withSlot17(_h$411, useCn);
2987
2987
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3071,9 +3071,9 @@ var LinkComponent = ({ children, className, href, node, ...props }) => {
3071
3071
  () => children
3072
3072
  ));
3073
3073
  };
3074
- var MemoA = memo2(LinkComponent, (p, n) => sameClassAndNode(p, n) && p.href === n.href);
3074
+ var MemoA = /* @__PURE__ */ memo2(LinkComponent, (p, n) => sameClassAndNode(p, n) && p.href === n.href);
3075
3075
  Object.assign(MemoA, { displayName: "MarkdownA" });
3076
- var MemoH1 = memo2(
3076
+ var MemoH1 = /* @__PURE__ */ memo2(
3077
3077
  ({ children, className, node, ...props }) => {
3078
3078
  const cn2 = _$withSlot17(_h$10, useCn);
3079
3079
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3089,7 +3089,7 @@ var MemoH1 = memo2(
3089
3089
  (p, n) => sameClassAndNode(p, n)
3090
3090
  );
3091
3091
  Object.assign(MemoH1, { displayName: "MarkdownH1" });
3092
- var MemoH2 = memo2(
3092
+ var MemoH2 = /* @__PURE__ */ memo2(
3093
3093
  ({ children, className, node, ...props }) => {
3094
3094
  const cn2 = _$withSlot17(_h$11, useCn);
3095
3095
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3105,7 +3105,7 @@ var MemoH2 = memo2(
3105
3105
  (p, n) => sameClassAndNode(p, n)
3106
3106
  );
3107
3107
  Object.assign(MemoH2, { displayName: "MarkdownH2" });
3108
- var MemoH3 = memo2(
3108
+ var MemoH3 = /* @__PURE__ */ memo2(
3109
3109
  ({ children, className, node, ...props }) => {
3110
3110
  const cn2 = _$withSlot17(_h$122, useCn);
3111
3111
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3121,7 +3121,7 @@ var MemoH3 = memo2(
3121
3121
  (p, n) => sameClassAndNode(p, n)
3122
3122
  );
3123
3123
  Object.assign(MemoH3, { displayName: "MarkdownH3" });
3124
- var MemoH4 = memo2(
3124
+ var MemoH4 = /* @__PURE__ */ memo2(
3125
3125
  ({ children, className, node, ...props }) => {
3126
3126
  const cn2 = _$withSlot17(_h$132, useCn);
3127
3127
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3137,7 +3137,7 @@ var MemoH4 = memo2(
3137
3137
  (p, n) => sameClassAndNode(p, n)
3138
3138
  );
3139
3139
  Object.assign(MemoH4, { displayName: "MarkdownH4" });
3140
- var MemoH5 = memo2(
3140
+ var MemoH5 = /* @__PURE__ */ memo2(
3141
3141
  ({ children, className, node, ...props }) => {
3142
3142
  const cn2 = _$withSlot17(_h$142, useCn);
3143
3143
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3153,7 +3153,7 @@ var MemoH5 = memo2(
3153
3153
  (p, n) => sameClassAndNode(p, n)
3154
3154
  );
3155
3155
  Object.assign(MemoH5, { displayName: "MarkdownH5" });
3156
- var MemoH6 = memo2(
3156
+ var MemoH6 = /* @__PURE__ */ memo2(
3157
3157
  ({ children, className, node, ...props }) => {
3158
3158
  const cn2 = _$withSlot17(_h$152, useCn);
3159
3159
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3169,7 +3169,7 @@ var MemoH6 = memo2(
3169
3169
  (p, n) => sameClassAndNode(p, n)
3170
3170
  );
3171
3171
  Object.assign(MemoH6, { displayName: "MarkdownH6" });
3172
- var MemoTable = memo2(
3172
+ var MemoTable = /* @__PURE__ */ memo2(
3173
3173
  ({ children, className, node, ...props }) => {
3174
3174
  const { controls: controlsConfig } = useContext14(StreamdownContext);
3175
3175
  const showTableControls = shouldShowControls(controlsConfig, "table");
@@ -3193,7 +3193,7 @@ var MemoTable = memo2(
3193
3193
  (p, n) => sameClassAndNode(p, n)
3194
3194
  );
3195
3195
  Object.assign(MemoTable, { displayName: "MarkdownTable" });
3196
- var MemoThead = memo2(
3196
+ var MemoThead = /* @__PURE__ */ memo2(
3197
3197
  ({ children, className, node, ...props }) => {
3198
3198
  const cn2 = _$withSlot17(_h$162, useCn);
3199
3199
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3209,7 +3209,7 @@ var MemoThead = memo2(
3209
3209
  (p, n) => sameClassAndNode(p, n)
3210
3210
  );
3211
3211
  Object.assign(MemoThead, { displayName: "MarkdownThead" });
3212
- var MemoTbody = memo2(
3212
+ var MemoTbody = /* @__PURE__ */ memo2(
3213
3213
  ({ children, className, node, ...props }) => {
3214
3214
  const cn2 = _$withSlot17(_h$172, useCn);
3215
3215
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3225,7 +3225,7 @@ var MemoTbody = memo2(
3225
3225
  (p, n) => sameClassAndNode(p, n)
3226
3226
  );
3227
3227
  Object.assign(MemoTbody, { displayName: "MarkdownTbody" });
3228
- var MemoTr = memo2(
3228
+ var MemoTr = /* @__PURE__ */ memo2(
3229
3229
  ({ children, className, node, ...props }) => {
3230
3230
  const cn2 = _$withSlot17(_h$182, useCn);
3231
3231
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3241,7 +3241,7 @@ var MemoTr = memo2(
3241
3241
  (p, n) => sameClassAndNode(p, n)
3242
3242
  );
3243
3243
  Object.assign(MemoTr, { displayName: "MarkdownTr" });
3244
- var MemoTh = memo2(
3244
+ var MemoTh = /* @__PURE__ */ memo2(
3245
3245
  ({ children, className, node, ...props }) => {
3246
3246
  const cn2 = _$withSlot17(_h$192, useCn);
3247
3247
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3257,7 +3257,7 @@ var MemoTh = memo2(
3257
3257
  (p, n) => sameClassAndNode(p, n)
3258
3258
  );
3259
3259
  Object.assign(MemoTh, { displayName: "MarkdownTh" });
3260
- var MemoTd = memo2(
3260
+ var MemoTd = /* @__PURE__ */ memo2(
3261
3261
  ({ children, className, node, ...props }) => {
3262
3262
  const cn2 = _$withSlot17(_h$20, useCn);
3263
3263
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3273,7 +3273,7 @@ var MemoTd = memo2(
3273
3273
  (p, n) => sameClassAndNode(p, n)
3274
3274
  );
3275
3275
  Object.assign(MemoTd, { displayName: "MarkdownTd" });
3276
- var MemoBlockquote = memo2(
3276
+ var MemoBlockquote = /* @__PURE__ */ memo2(
3277
3277
  ({ children, className, node, ...props }) => {
3278
3278
  const cn2 = _$withSlot17(_h$21, useCn);
3279
3279
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3289,7 +3289,7 @@ var MemoBlockquote = memo2(
3289
3289
  (p, n) => sameClassAndNode(p, n)
3290
3290
  );
3291
3291
  Object.assign(MemoBlockquote, { displayName: "MarkdownBlockquote" });
3292
- var MemoSup = memo2(
3292
+ var MemoSup = /* @__PURE__ */ memo2(
3293
3293
  ({ children, className, node, ...props }) => {
3294
3294
  const cn2 = _$withSlot17(_h$222, useCn);
3295
3295
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3305,7 +3305,7 @@ var MemoSup = memo2(
3305
3305
  (p, n) => sameClassAndNode(p, n)
3306
3306
  );
3307
3307
  Object.assign(MemoSup, { displayName: "MarkdownSup" });
3308
- var MemoSub = memo2(
3308
+ var MemoSub = /* @__PURE__ */ memo2(
3309
3309
  ({ children, className, node, ...props }) => {
3310
3310
  const cn2 = _$withSlot17(_h$232, useCn);
3311
3311
  return _$createScopedValue18(() => _$createScopedElement16(
@@ -3321,7 +3321,7 @@ var MemoSub = memo2(
3321
3321
  (p, n) => sameClassAndNode(p, n)
3322
3322
  );
3323
3323
  Object.assign(MemoSub, { displayName: "MarkdownSub" });
3324
- var MemoSection = memo2(
3324
+ var MemoSection = /* @__PURE__ */ memo2(
3325
3325
  ({ children, className, node, ...props }) => {
3326
3326
  const isFootnotesSection = "data-footnotes" in props;
3327
3327
  if (isFootnotesSection) {
@@ -3518,11 +3518,11 @@ var CodeComponent = ({ node, className, children, ...props }) => {
3518
3518
  "c:3237a6ea"
3519
3519
  ));
3520
3520
  };
3521
- var MemoCode = memo2(CodeComponent, (p, n) => p.className === n.className && sameNodePosition(p.node, n.node));
3521
+ var MemoCode = /* @__PURE__ */ memo2(CodeComponent, (p, n) => p.className === n.className && sameNodePosition(p.node, n.node));
3522
3522
  Object.assign(MemoCode, { displayName: "MarkdownCode" });
3523
- var MemoImg = memo2(ImageComponent);
3523
+ var MemoImg = /* @__PURE__ */ memo2(ImageComponent);
3524
3524
  Object.assign(MemoImg, { displayName: "MarkdownImg" });
3525
- var MemoParagraph = memo2(({ children, node, ...props }) => {
3525
+ var MemoParagraph = /* @__PURE__ */ memo2(({ children, node, ...props }) => {
3526
3526
  const childArray = Array.isArray(children) ? children : [children];
3527
3527
  const validChildren = childArray.filter((child) => child !== null && child !== void 0 && child !== "");
3528
3528
  if (validChildren.length === 1 && isValidElement(validChildren[0])) {
@@ -4132,8 +4132,8 @@ var defaultStreamdownContext = {
4132
4132
  mermaid: void 0,
4133
4133
  linkSafety: defaultLinkSafetyConfig
4134
4134
  };
4135
- var StreamdownContext = createContext7(defaultStreamdownContext);
4136
- var Block = memo3(({
4135
+ var StreamdownContext = /* @__PURE__ */ createContext7(defaultStreamdownContext);
4136
+ var Block = /* @__PURE__ */ memo3(({
4137
4137
  content,
4138
4138
  shouldParseIncompleteMarkdown: _,
4139
4139
  shouldNormalizeHtmlIndentation,
@@ -4158,7 +4158,7 @@ var Block = memo3(({
4158
4158
  ));
4159
4159
  });
4160
4160
  Object.assign(Block, { displayName: "Block" });
4161
- var Streamdown = memo3(({
4161
+ var Streamdown = /* @__PURE__ */ memo3(({
4162
4162
  children,
4163
4163
  mode = "streaming",
4164
4164
  dir,
@@ -3,7 +3,7 @@ import {
3
3
  CodeBlockBody,
4
4
  StreamdownContext,
5
5
  useCodePlugin
6
- } from "./chunk-HTKGPGBF.js";
6
+ } from "./chunk-U3I54OBJ.js";
7
7
 
8
8
  // src/lib/code-block/highlighted-body.tsrx
9
9
  import {
@@ -1,7 +1,7 @@
1
1
  // octane-no-slot: this package already contains compiler-assigned hook slots.
2
2
  import {
3
3
  Mermaid
4
- } from "./chunk-HTKGPGBF.js";
4
+ } from "./chunk-U3I54OBJ.js";
5
5
  export {
6
6
  Mermaid
7
7
  };
@@ -26,7 +26,7 @@ import {
26
26
  tableDataToMarkdown,
27
27
  tableDataToTSV,
28
28
  useIsCodeFenceIncomplete
29
- } from "./chunks/chunk-HTKGPGBF.js";
29
+ } from "./chunks/chunk-U3I54OBJ.js";
30
30
  export {
31
31
  Block,
32
32
  CodeBlock,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/streamdown",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -92,7 +92,7 @@
92
92
  "unist-util-visit-parents": "^6.0.0"
93
93
  },
94
94
  "peerDependencies": {
95
- "octane": "^0.1.51 || ^0.2.0 || ^0.3.0"
95
+ "octane": "^0.4.0"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@testing-library/jest-dom": "^6.9.1",
@@ -108,8 +108,8 @@
108
108
  "@streamdown/mermaid": "1.0.2",
109
109
  "@streamdown/cjk": "1.0.3",
110
110
  "vitest": "^4.1.10",
111
- "@octanejs/testing-library": "0.1.52",
112
- "octane": "0.3.0"
111
+ "@octanejs/testing-library": "0.1.53",
112
+ "octane": "0.4.3"
113
113
  },
114
114
  "scripts": {
115
115
  "build": "node scripts/build.mjs",