markdown-flow-ui 0.1.83-beta.0 → 0.1.83-beta.1

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.
Files changed (30) hide show
  1. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js +1 -1
  2. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.js +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.js +1 -1
  6. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +1 -1
  7. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/index.js +1 -1
  12. package/dist/_virtual/index2.js +5 -2
  13. package/dist/_virtual/index2.js.map +1 -1
  14. package/dist/_virtual/index3.js +2 -5
  15. package/dist/_virtual/index3.js.map +1 -1
  16. package/dist/_virtual/index7.js +2 -3
  17. package/dist/_virtual/index7.js.map +1 -1
  18. package/dist/_virtual/index8.js +3 -2
  19. package/dist/_virtual/index8.js.map +1 -1
  20. package/dist/components/ContentRender/ContentRender.js +91 -90
  21. package/dist/components/ContentRender/ContentRender.js.map +1 -1
  22. package/dist/components/ContentRender/IframeSandbox.js +115 -62
  23. package/dist/components/ContentRender/IframeSandbox.js.map +1 -1
  24. package/dist/components/ContentRender/SandboxApp.js +94 -76
  25. package/dist/components/ContentRender/SandboxApp.js.map +1 -1
  26. package/dist/components/ContentRender/utils/split-content.js +12 -12
  27. package/dist/components/ContentRender/utils/split-content.js.map +1 -1
  28. package/dist/components/ContentRender/utils/split-content.test.d.ts +1 -0
  29. package/dist/components/ui/inputGroup/textarea.js +1 -1
  30. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- const m = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\s>]/i, h = [
1
+ const r = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\s>]/i, m = [
2
2
  /<svg[\s\S]*?<\/svg>/i,
3
3
  /<img\b[^>]*?>/i,
4
4
  /```mermaid[\s\S]*?```/i,
5
5
  /```[a-zA-Z0-9]+[\s\S]*?```/i
6
- ], d = /<\/[a-z][^>]*>\s*\n(?=[^\s<])/gi, u = (e, n) => {
6
+ ], a = /<\/[a-z][^>]*>\s*\n(?=[^\s<])/gi, h = (e, n) => {
7
7
  let s = e.length, t;
8
- for (d.lastIndex = 0; t = d.exec(e); )
8
+ for (a.lastIndex = 0; t = a.exec(e); )
9
9
  if (!(t.index <= n)) {
10
10
  s = t.index + t[0].length;
11
11
  break;
@@ -13,23 +13,23 @@ const m = /<(script|style|link|iframe|html|head|body|meta|title|base|template|di
13
13
  return s;
14
14
  }, x = (e) => {
15
15
  let n = null;
16
- return h.forEach((s) => {
16
+ return m.forEach((s) => {
17
17
  const t = s.exec(e);
18
18
  if (!t || typeof t.index != "number") return;
19
19
  const i = t.index, c = t.index + t[0].length;
20
20
  (!n || i < n.start) && (n = { start: i, end: c });
21
21
  }), n;
22
- }, f = (e) => {
23
- const n = e.search(m), s = x(e);
22
+ }, u = (e) => {
23
+ const n = e.search(r), s = x(e);
24
24
  if (n === -1 && !s)
25
- return [{ type: "markdown", value: e }];
26
- const t = !!s && (n === -1 || s.start < n), i = t ? s.start : n, c = t ? s.end : u(e, i), o = [], l = e.slice(0, i), r = e.slice(i, c), a = e.slice(c);
27
- return l.trim() && o.push({ type: "markdown", value: l }), o.push({
25
+ return [];
26
+ const t = !!s && (n === -1 || s.start < n), i = t ? s.start : n, c = t ? s.end : h(e, i), o = [], d = e.slice(i, c), l = e.slice(c);
27
+ return o.push({
28
28
  type: t ? "markdown" : "sandbox",
29
- value: r
30
- }), a.trim() && o.push(...f(a)), console.log("segments", o), o;
29
+ value: d
30
+ }), l.trim() && o.push(...u(l)), o;
31
31
  };
32
32
  export {
33
- f as splitContentSegments
33
+ u as splitContentSegments
34
34
  };
35
35
  //# sourceMappingURL=split-content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"split-content.js","sources":["../../../../src/components/ContentRender/utils/split-content.ts"],"sourcesContent":["export type RenderSegment =\n | { type: \"markdown\"; value: string }\n | { type: \"sandbox\"; value: string };\n\nconst SANDBOX_START_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\\s>]/i;\n\nconst INLINE_SANDBOX_PATTERNS: RegExp[] = [\n /<svg[\\s\\S]*?<\\/svg>/i,\n /<img\\b[^>]*?>/i,\n /```mermaid[\\s\\S]*?```/i,\n /```[a-zA-Z0-9]+[\\s\\S]*?```/i,\n];\n\nconst closingBoundary = /<\\/[a-z][^>]*>\\s*\\n(?=[^\\s<])/gi;\n\ntype MatchResult = { start: number; end: number };\n\nconst findHtmlBlockEnd = (raw: string, startIndex: number) => {\n let blockEnd = raw.length;\n let match: RegExpExecArray | null;\n closingBoundary.lastIndex = 0;\n\n while ((match = closingBoundary.exec(raw))) {\n if (match.index <= startIndex) continue;\n blockEnd = match.index + match[0].length;\n break;\n }\n\n return blockEnd;\n};\n\nconst findInlineSandboxMatch = (raw: string): MatchResult | null => {\n let earliest: MatchResult | null = null;\n\n INLINE_SANDBOX_PATTERNS.forEach((pattern) => {\n const match = pattern.exec(raw);\n if (!match || typeof match.index !== \"number\") return;\n const start = match.index;\n const end = match.index + match[0].length;\n\n if (!earliest || start < earliest.start) {\n earliest = { start, end };\n }\n });\n\n return earliest;\n};\n\n// Split incoming markdown content into markdown and sandbox HTML segments\nexport const splitContentSegments = (raw: string): RenderSegment[] => {\n const sandboxStartIndex = raw.search(SANDBOX_START_PATTERN);\n const inlineMatch = findInlineSandboxMatch(raw);\n\n if (sandboxStartIndex === -1 && !inlineMatch) {\n return [{ type: \"markdown\", value: raw }];\n }\n\n const shouldUseInline =\n !!inlineMatch &&\n (sandboxStartIndex === -1 || inlineMatch.start < sandboxStartIndex);\n\n const startIndex = shouldUseInline ? inlineMatch!.start : sandboxStartIndex;\n const blockEnd = shouldUseInline\n ? inlineMatch!.end\n : findHtmlBlockEnd(raw, startIndex);\n\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, startIndex);\n const htmlBlock = raw.slice(startIndex, blockEnd);\n const after = raw.slice(blockEnd);\n\n if (before.trim()) {\n segments.push({ type: \"markdown\", value: before });\n }\n\n segments.push({\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: htmlBlock,\n });\n\n if (after.trim()) {\n segments.push(...splitContentSegments(after));\n }\n console.log(\"segments\", segments);\n return segments;\n};\n"],"names":["SANDBOX_START_PATTERN","INLINE_SANDBOX_PATTERNS","closingBoundary","findHtmlBlockEnd","raw","startIndex","blockEnd","match","findInlineSandboxMatch","earliest","pattern","start","end","splitContentSegments","sandboxStartIndex","inlineMatch","shouldUseInline","segments","before","htmlBlock","after"],"mappings":"AAIA,MAAMA,IACJ,sGAEIC,IAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAkB,mCAIlBC,IAAmB,CAACC,GAAaC,MAAuB;AAC5D,MAAIC,IAAWF,EAAI,QACfG;AAGJ,OAFAL,EAAgB,YAAY,GAEpBK,IAAQL,EAAgB,KAAKE,CAAG;AACtC,QAAI,EAAAG,EAAM,SAASF,IACnB;AAAA,MAAAC,IAAWC,EAAM,QAAQA,EAAM,CAAC,EAAE;AAClC;AAAA;AAGF,SAAOD;AACT,GAEME,IAAyB,CAACJ,MAAoC;AAClE,MAAIK,IAA+B;AAEnC,SAAAR,EAAwB,QAAQ,CAACS,MAAY;AAC3C,UAAMH,IAAQG,EAAQ,KAAKN,CAAG;AAC9B,QAAI,CAACG,KAAS,OAAOA,EAAM,SAAU,SAAU;AAC/C,UAAMI,IAAQJ,EAAM,OACdK,IAAML,EAAM,QAAQA,EAAM,CAAC,EAAE;AAEnC,KAAI,CAACE,KAAYE,IAAQF,EAAS,WAChCA,IAAW,EAAE,OAAAE,GAAO,KAAAC,EAAA;AAAA,EAExB,CAAC,GAEMH;AACT,GAGaI,IAAuB,CAACT,MAAiC;AACpE,QAAMU,IAAoBV,EAAI,OAAOJ,CAAqB,GACpDe,IAAcP,EAAuBJ,CAAG;AAE9C,MAAIU,MAAsB,MAAM,CAACC;AAC/B,WAAO,CAAC,EAAE,MAAM,YAAY,OAAOX,GAAK;AAG1C,QAAMY,IACJ,CAAC,CAACD,MACDD,MAAsB,MAAMC,EAAY,QAAQD,IAE7CT,IAAaW,IAAkBD,EAAa,QAAQD,GACpDR,IAAWU,IACbD,EAAa,MACbZ,EAAiBC,GAAKC,CAAU,GAE9BY,IAA4B,CAAA,GAC5BC,IAASd,EAAI,MAAM,GAAGC,CAAU,GAChCc,IAAYf,EAAI,MAAMC,GAAYC,CAAQ,GAC1Cc,IAAQhB,EAAI,MAAME,CAAQ;AAEhC,SAAIY,EAAO,UACTD,EAAS,KAAK,EAAE,MAAM,YAAY,OAAOC,GAAQ,GAGnDD,EAAS,KAAK;AAAA,IACZ,MAAMD,IAAkB,aAAa;AAAA,IACrC,OAAOG;AAAA,EAAA,CACR,GAEGC,EAAM,UACRH,EAAS,KAAK,GAAGJ,EAAqBO,CAAK,CAAC,GAE9C,QAAQ,IAAI,YAAYH,CAAQ,GACzBA;AACT;"}
1
+ {"version":3,"file":"split-content.js","sources":["../../../../src/components/ContentRender/utils/split-content.ts"],"sourcesContent":["export type RenderSegment =\n | { type: \"markdown\"; value: string }\n | { type: \"sandbox\"; value: string };\n\nconst SANDBOX_START_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\\s>]/i;\n\nconst INLINE_SANDBOX_PATTERNS: RegExp[] = [\n /<svg[\\s\\S]*?<\\/svg>/i,\n /<img\\b[^>]*?>/i,\n /```mermaid[\\s\\S]*?```/i,\n /```[a-zA-Z0-9]+[\\s\\S]*?```/i,\n];\n\nconst closingBoundary = /<\\/[a-z][^>]*>\\s*\\n(?=[^\\s<])/gi;\n\ntype MatchResult = { start: number; end: number };\n\nconst findHtmlBlockEnd = (raw: string, startIndex: number) => {\n let blockEnd = raw.length;\n let match: RegExpExecArray | null;\n closingBoundary.lastIndex = 0;\n\n while ((match = closingBoundary.exec(raw))) {\n if (match.index <= startIndex) continue;\n blockEnd = match.index + match[0].length;\n break;\n }\n\n return blockEnd;\n};\n\nconst findInlineSandboxMatch = (raw: string): MatchResult | null => {\n let earliest: MatchResult | null = null;\n\n INLINE_SANDBOX_PATTERNS.forEach((pattern) => {\n const match = pattern.exec(raw);\n if (!match || typeof match.index !== \"number\") return;\n const start = match.index;\n const end = match.index + match[0].length;\n\n if (!earliest || start < earliest.start) {\n earliest = { start, end };\n }\n });\n\n return earliest;\n};\n\n// Split incoming markdown content into markdown and sandbox HTML segments\nexport const splitContentSegments = (raw: string): RenderSegment[] => {\n const sandboxStartIndex = raw.search(SANDBOX_START_PATTERN);\n const inlineMatch = findInlineSandboxMatch(raw);\n\n if (sandboxStartIndex === -1 && !inlineMatch) {\n return [];\n }\n\n const shouldUseInline =\n !!inlineMatch &&\n (sandboxStartIndex === -1 || inlineMatch.start < sandboxStartIndex);\n\n const startIndex = shouldUseInline ? inlineMatch!.start : sandboxStartIndex;\n const blockEnd = shouldUseInline\n ? inlineMatch!.end\n : findHtmlBlockEnd(raw, startIndex);\n\n const segments: RenderSegment[] = [];\n const matchedBlock = raw.slice(startIndex, blockEnd);\n const after = raw.slice(blockEnd);\n\n segments.push({\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: matchedBlock,\n });\n\n if (after.trim()) {\n segments.push(...splitContentSegments(after));\n }\n\n return segments;\n};\n"],"names":["SANDBOX_START_PATTERN","INLINE_SANDBOX_PATTERNS","closingBoundary","findHtmlBlockEnd","raw","startIndex","blockEnd","match","findInlineSandboxMatch","earliest","pattern","start","end","splitContentSegments","sandboxStartIndex","inlineMatch","shouldUseInline","segments","matchedBlock","after"],"mappings":"AAIA,MAAMA,IACJ,sGAEIC,IAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAkB,mCAIlBC,IAAmB,CAACC,GAAaC,MAAuB;AAC5D,MAAIC,IAAWF,EAAI,QACfG;AAGJ,OAFAL,EAAgB,YAAY,GAEpBK,IAAQL,EAAgB,KAAKE,CAAG;AACtC,QAAI,EAAAG,EAAM,SAASF,IACnB;AAAA,MAAAC,IAAWC,EAAM,QAAQA,EAAM,CAAC,EAAE;AAClC;AAAA;AAGF,SAAOD;AACT,GAEME,IAAyB,CAACJ,MAAoC;AAClE,MAAIK,IAA+B;AAEnC,SAAAR,EAAwB,QAAQ,CAACS,MAAY;AAC3C,UAAMH,IAAQG,EAAQ,KAAKN,CAAG;AAC9B,QAAI,CAACG,KAAS,OAAOA,EAAM,SAAU,SAAU;AAC/C,UAAMI,IAAQJ,EAAM,OACdK,IAAML,EAAM,QAAQA,EAAM,CAAC,EAAE;AAEnC,KAAI,CAACE,KAAYE,IAAQF,EAAS,WAChCA,IAAW,EAAE,OAAAE,GAAO,KAAAC,EAAA;AAAA,EAExB,CAAC,GAEMH;AACT,GAGaI,IAAuB,CAACT,MAAiC;AACpE,QAAMU,IAAoBV,EAAI,OAAOJ,CAAqB,GACpDe,IAAcP,EAAuBJ,CAAG;AAE9C,MAAIU,MAAsB,MAAM,CAACC;AAC/B,WAAO,CAAA;AAGT,QAAMC,IACJ,CAAC,CAACD,MACDD,MAAsB,MAAMC,EAAY,QAAQD,IAE7CT,IAAaW,IAAkBD,EAAa,QAAQD,GACpDR,IAAWU,IACbD,EAAa,MACbZ,EAAiBC,GAAKC,CAAU,GAE9BY,IAA4B,CAAA,GAC5BC,IAAed,EAAI,MAAMC,GAAYC,CAAQ,GAC7Ca,IAAQf,EAAI,MAAME,CAAQ;AAEhC,SAAAW,EAAS,KAAK;AAAA,IACZ,MAAMD,IAAkB,aAAa;AAAA,IACrC,OAAOE;AAAA,EAAA,CACR,GAEGC,EAAM,UACRF,EAAS,KAAK,GAAGJ,EAAqBM,CAAK,CAAC,GAGvCF;AACT;"}
@@ -1,7 +1,7 @@
1
1
  import { j as i } from "../../../_virtual/jsx-runtime.js";
2
2
  import * as d from "react";
3
3
  import n from "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.js";
4
- import "../../../_virtual/index3.js";
4
+ import "../../../_virtual/index2.js";
5
5
  import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
6
6
  import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
7
7
  import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/raf.js";
package/package.json CHANGED
@@ -149,7 +149,7 @@
149
149
  "storybook": "storybook dev -p 6006",
150
150
  "test": "echo \"No tests specified\" && exit 0"
151
151
  },
152
- "version": "0.1.83-beta.0",
152
+ "version": "0.1.83-beta.1",
153
153
  "type": "module",
154
154
  "exports": {
155
155
  ".": {