markstream-react 2.0.17 → 2.0.18
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/{Tooltip-D8qsfSuB.js → Tooltip-CJBn43zr.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/next.d.ts +2 -0
- package/dist/next.js +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +1 -1
- package/dist/types/types/component-props.d.ts +2 -0
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ return t("span",{className:"checkbox-node",children:/* @__PURE__ */t("input",{ty
|
|
|
10
10
|
/* @__PURE__ */t("span",{className:"html-preview-frame__dot"}),
|
|
11
11
|
/* @__PURE__ */t("span",{className:"html-preview-frame__label",children:n.title||`HTML ${r("common.preview")}`})]}),
|
|
12
12
|
/* @__PURE__ */t("button",{type:"button",className:"html-preview-frame__close"+(n.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var e;return null==(e=n.onClose)?void 0:e.call(n)},children:"×"})]}),
|
|
13
|
-
/* @__PURE__ */t("iframe",{className:"html-preview-frame__iframe",sandbox:l,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:i,title:n.title||"Preview"})]})}),document.body)}let Je=!1,Qe=null,et=!1,tt=null;async function nt(){if(tt)return tt;if(Qe)return Qe;if(et)return null;tt=(async()=>{try{const e=function(e){var t,n,r;const o="function"==typeof(null==e?void 0:e.createCodeBlockRuntime)||"function"==typeof(null==e?void 0:e.useMonaco)?e:null==e?void 0:e.default,i=null!=(t=null==o?void 0:o.createCodeBlockRuntime)?t:null==o?void 0:o.useMonaco;return"function"!=typeof i?null:{createCodeBlockRuntime:e=>i.call(o,e),detectLanguage:null==(n=null==o?void 0:o.detectLanguage)?void 0:n.bind(o),preloadStreamDiffs:null==(r=null==o?void 0:o.preloadStreamDiffs)?void 0:r.bind(o)}}(await import("stream-diffs/markstream"));if(e)return await async function(e){Je||(Je=!0,(null==e?void 0:e.preloadStreamDiffs)&&await e.preloadStreamDiffs())}(e),Qe=e,Qe}catch{}return et=!0,null})();try{return await tt}finally{tt=null}}const rt="undefined"!=typeof window?u:s,ot={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};async function it(e,t){var n;if(t)try{if(!(await t()))return!1}catch{return!1}if("undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return!1;const r=()=>new Promise(e=>window.requestAnimationFrame(()=>e()));for(let o=0;o<30;o++){await r();const t=null!=(n=e.querySelector([".stream-diffs-shell","[data-stream-diffs-state]"].join(",")))?n:e.firstElementChild;if(!t)continue;const o=t.getBoundingClientRect();if(o.width>0&&o.height>0)return await r(),!0}return!1}function lt(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const r=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},o={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...o,...n,parseDiffOptions:{...o.parseDiffOptions,...r}}}function at(e){const t=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,r,o]=t.slice(0,3).map(Number);return.2126*n+.7152*r+.0722*o}function ct(e){var t,n;const r=String(null!=e?e:"").trim().toLowerCase();if(!r||"transparent"===r)return!0;const o=r.match(/^#([0-9a-f]{8})$/);if(o)return 0===Number.parseInt(o[1].slice(6),16);const i=r.match(/^#([0-9a-f]{4})$/);if(i)return 0===Number.parseInt(i[1][3]+i[1][3],16);const l=null==(n=null==(t=r.match(/^(?:rgba?|hsla?)\(([^)]+)\)/))?void 0:t[1])?void 0:n.split(/[\s,/]+/).filter(Boolean);return 4===(null==l?void 0:l.length)&&0===Number(l[3])}function st(r){var l,a;const u={...ot,...r},{node:m,isDark:h,loading:f,stream:p,isShowPreview:g,enableFontSizeControl:v,darkTheme:y,lightTheme:w,codeBlockOptions:x,themes:k,minWidth:b,maxWidth:C,showHeader:N,showCopyButton:M,showExpandButton:B,showPreviewButton:S,showCollapseButton:T,showFontSizeButtons:E,showLineNumbers:L,showTooltips:D}=u,$=c(null),j=c(null),z=c(null),K=c(null),V=c(null),q=c(null),U=c(null),X=c(0),Z=c(null),Y=c(null),G=Pe(),J=c(null),Q=c(null),ee=c(x),te=c(null),ne=c([]),re=c(null),oe=c(!1),ie=c(void 0),[le,ae]=i(!1),[ce,se]=i(()=>"undefined"==typeof window),[de,ue]=i(!1),[me,he]=i(!1),[fe,pe]=i(!1),[ge,ve]=i(()=>m.language||"plaintext"),[ye,we]=i(()=>P(m.language)),[xe,ke]=i(!1),[be,Ce]=i(!1),[Ne,Me]=i(!1),[Be,Se]=i(!1),[Te,Ee]=i(0),{t:Le}=_e();s(()=>{oe.current=be},[be]);const De=o(()=>lt(Boolean(m.diff),x),[x,m.diff]),[$e,Ae]=i(()=>{var e;const t=Number(null==(e=lt(Boolean(m.diff),x))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:A}),[Re,Fe]=i($e),Ie=o(()=>!1!==D,[D]),He="boolean"==typeof L?L:!0!==De.disableLineNumbers,We=c(He),Oe=Number(null==(l=ee.current)?void 0:l.fontSize),je=Number(null==x?void 0:x.fontSize),ze=ee.current!==x&&Number.isFinite(Oe)&&Oe>0&&(!Number.isFinite(je)||je<=0),Ke=d(()=>{var e;const t=null!=(e=De.maxHeight)?e:500;return"number"==typeof t&&Number.isFinite(t)?t:500},[De.maxHeight]);rt(()=>{const e=Number(De.fontSize),t=Number.isFinite(e)&&e>0?e:A;Ae(t),Fe(t)},[De.fontSize]);const Ve=d(e=>{var t,n,r;if(le)return;const o=$.current,i=z.current;if(!o||!i)return;const l="diff"===q.current?null==(t=i.getDiffEditorView)?void 0:t.call(i):null==(n=i.getEditorView)?void 0:n.call(i);if(!l)return;const a=Ke(),c="diff"===q.current,s=c?"important":"";e?(o.style.minHeight="0px",o.style.setProperty("max-height","none",s),o.style.overflow="visible"):(o.style.minHeight="0px",o.style.setProperty("max-height",`${Math.ceil(a)}px`,s),o.style.overflow=c?"hidden":"auto");try{const t=Number((()=>{if("function"==typeof l.getContentHeight)return l.getContentHeight();if(c&&"function"==typeof l.getModifiedEditor){const e=l.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,a);o.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,s)}null==(r=l.layout)||r.call(l)}catch{}},[Ke,le]),qe=d(e=>{if(Ve(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Ve(e),window.requestAnimationFrame(()=>Ve(e))});return window.setTimeout(()=>Ve(e),180),()=>window.cancelAnimationFrame(t)},[Ve]),Ze=d(()=>{var e,t;for(const n of ne.current)try{"function"==typeof n?n():null==(e=null==n?void 0:n.dispose)||e.call(n)}catch{}ne.current=[],null==(t=re.current)||t.disconnect(),re.current=null},[]),Ye=d(()=>{var e,t,n;Ze();const r=z.current,o=$.current;if(!r||!o||"diff"!==q.current)return;const i=()=>qe(oe.current),l=(e,t)=>{try{const n=null==e?void 0:e[t];if("function"!=typeof n)return;const r=n.call(e,i);r&&ne.current.push(r)}catch{}},a=null==(e=r.getDiffEditorView)?void 0:e.call(r),c=null==(t=null==a?void 0:a.getOriginalEditor)?void 0:t.call(a),s=null==(n=null==a?void 0:a.getModifiedEditor)?void 0:n.call(a);if(l(a,"onDidUpdateDiff"),l(c,"onDidContentSizeChange"),l(s,"onDidContentSizeChange"),l(c,"onDidLayoutChange"),l(s,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==o)&&i()});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),re.current=e}},[Ze,qe]);s(()=>R(()=>{Ee(e=>e+1)}),[]),s(()=>{we(P(m.language))},[m.language]);const Je=c(m);Je.current=m;const Qe=d(()=>{var e;X.current+=1;try{null==(e=K.current)||e.call(K)}catch{}Ze(),V.current=null,q.current=null,U.current=null,pe(!1),he(!1)},[Ze]),et=o(()=>{var e,t;return h?null!=(e=null!=y?y:null==k?void 0:k[0])?e:"vitesse-dark":null!=(t=null!=w?w:null==k?void 0:k[1])?t:"vitesse-light"},[y,h,w,k]),tt=d(()=>et,[et]),st=o(()=>tt(),[tt]),dt=o(()=>function(e,t){var n;const r=null!=(n=function(e){return"string"==typeof e?e:null}(e))?n:"",o=r.toLowerCase();return o?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):t}(st,Boolean(h)),[h,st]),ut=o(()=>m.diff?h?"dark":"light":dt?"dark":"light",[h,m.diff,dt]),mt=o(()=>m.diff?"dark"===ut:dt,[ut,m.diff,dt]),ht=o(()=>{var e;const t=De,n=F(De,ze?A:Re),r=function(e){const t="number"==typeof e&&Number.isFinite(e)&&e>=0?e:0;return{top:t,bottom:t}}(null==t?void 0:t.padding),o=m.diff?0:8,i="number"==typeof(null==t?void 0:t.padding)&&Number.isFinite(t.padding)&&t.padding>=0,l=null!=(e=I(null==t?void 0:t.tabSize))?e:4;return{...n,paddingBottom:i?r.bottom:o,paddingTop:i?r.top:o,tabSize:l}},[ze,Re,m.diff,De]),ft=o(()=>!!m.diff&&"unified"===De.diffStyle,[m.diff,De]),pt=o(()=>{var e,t,n;const r=String(m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:"");if(!r)return 1;const o=f?r:r.replace(/\r\n$|\n$|\r$/,"");return Math.max(1,o.split(/\r\n|\r|\n/).length)},[f,m.code,m.diff,m.updatedCode]),gt=o(()=>Math.ceil(pt*ht.lineHeight+ht.paddingTop+ht.paddingBottom),[pt,ht]),vt=o(()=>{const e={"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${ht.lineHeight}px`,"--markstream-pre-line-number-top":`${ht.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${ht.fontSize}px`,lineHeight:`${ht.lineHeight}px`,maxHeight:`${Ke()}px`,overflow:"auto",paddingBottom:`${ht.paddingBottom}px`,paddingTop:`${ht.paddingTop}px`,tabSize:ht.tabSize,whiteSpace:"scroll"===De.overflow?"pre":"pre-wrap"};return ht.fontFamily&&(e.fontFamily=ht.fontFamily),e},[Ke,ht,De.overflow]),yt=d(()=>{var e,t,n,r,o;const i=$.current,l=j.current;if(!i||!l)return;if(l.style.removeProperty("--vscode-editor-foreground"),l.style.removeProperty("--vscode-editor-background"),l.style.removeProperty("--vscode-editor-selectionBackground"),i.style.setProperty("--diffs-tab-size",String(ht.tabSize)),"number"==typeof De.padding&&Number.isFinite(De.padding)&&De.padding>=0?i.style.setProperty("--diffs-gap-block",`${ht.paddingTop}px`):i.style.removeProperty("--diffs-gap-block"),m.diff)return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");const a=i;try{const c="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(a):null,s=String(null!=(e=null==c?void 0:c.getPropertyValue("--vscode-editor-foreground"))?e:"").trim()||String(null!=(t=null==c?void 0:c.color)?t:"").trim(),d=String(null!=(n=null==c?void 0:c.getPropertyValue("--vscode-editor-background"))?n:"").trim(),u=String(null!=(r=null==c?void 0:c.backgroundColor)?r:"").trim(),h=ct(d)?ct(u)?"":u:d,f=String(null!=(o=null==c?void 0:c.getPropertyValue("--vscode-editor-selectionBackground"))?o:"").trim();if(function(e,t,n,r){if(!n)return!1;const o=at(e),i=at(t);return r?null!=o&&o>170||null!=i&&i<110:null!=o&&o<85||null!=i&&i>190}(h,s,"plaintext"===_(String(m.language||ye||ge||"plaintext")),l.classList.contains("is-dark")))return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");s?i.style.setProperty("--vscode-editor-foreground",s):i.style.removeProperty("--vscode-editor-foreground"),h?i.style.setProperty("--vscode-editor-background",h):i.style.removeProperty("--vscode-editor-background"),f?i.style.setProperty("--vscode-editor-selectionBackground",f):i.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ye,ge,m.diff,m.language,ht,De]),wt=d(()=>{const e=De.maxHeight,t={...De||{},...null==e?{}:{MAX_HEIGHT:e},themes:k?[...k]:void 0,stream:!1,disableFileHeader:!0,disableLineNumbers:!He,fontSize:ht.fontSize,lineHeight:ht.lineHeight,...ht.fontFamily?{fontFamily:ht.fontFamily}:{},theme:st,themeType:h?"dark":"light",onThemeChange(){yt()}};delete t.maxHeight,delete t.padding,delete t.tabSize;const n="string"==typeof t.unsafeCSS?t.unsafeCSS:"";return t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }",n].filter(Boolean).join("\n"),t},[He,h,ht,st,De,yt,k]),xt=d(()=>{const e=wt(),t=J.current;if(!t)return J.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[wt]),kt=d(e=>{const t=e(xt());return z.current=t,K.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[xt]),bt=o(()=>{var e;return JSON.stringify({diffStyle:De.diffStyle,expandUnchanged:De.expandUnchanged,collapsedContextThreshold:De.collapsedContextThreshold,hunkSeparators:De.hunkSeparators,lineDiffType:De.lineDiffType,maxLineDiffLength:De.maxLineDiffLength,expansionLineCount:De.expansionLineCount,context:null==(e=De.parseDiffOptions)?void 0:e.context})},[De]);s(()=>{xt()},[De,xt]),s(()=>()=>{var e,t,n;X.current+=1,null==(e=K.current)||e.call(K),Ze(),K.current=null,V.current=null,q.current=null,U.current=null,z.current=null,Q.current=null,Z.current=null,null==(n=null==(t=Y.current)?void 0:t.destroy)||n.call(t),Y.current=null},[Ze]),s(()=>{var e,t;if("undefined"==typeof window)return;if(ce)return;const n=j.current;if(!n)return;null==(t=null==(e=Y.current)?void 0:e.destroy)||t.call(e);const r=G(n,{rootMargin:"400px"});return Y.current=r,r.isVisible()&&se(!0),r.whenVisible.then(()=>se(!0)),()=>{r.destroy(),Y.current===r&&(Y.current=null)}},[G,ce]),s(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:z.current?(xt(),()=>{e=!1}):((async()=>{try{const t=await nt();if(!e)return;if(!t)return void ae(!0);const n=t.createCodeBlockRuntime,r=t.detectLanguage;if("function"==typeof r&&(Z.current=r),"function"!=typeof n)return void ae(!0);Q.current=n,kt(n),ue(!0)}catch{e&&ae(!0)}})(),()=>{e=!1})},[kt,xt]),s(()=>{var e;if(!m.language&&!ye&&Z.current)try{const t=Z.current(String(null!=(e=m.code)?e:""));t&&ve(t)}catch{}},[ye,m.code,m.language]);const Ct=o(()=>String(m.language||ye||ge||"plaintext"),[ye,ge,m.language]),Nt=o(()=>P(Ct),[Ct]),Mt=o(()=>_(Nt),[Nt]),Bt=o(()=>"plaintext"===Mt,[Mt]),St=o(()=>H(Nt),[Nt,Te]),Tt=o(()=>!!g&&("html"===Nt||"svg"===Nt),[Nt,g]),Et=o(()=>{const e=Nt;return e?W[e]||e.charAt(0).toUpperCase()+e.slice(1):W[""]||"Plain Text"},[Nt]),Lt=o(()=>{var e;return function(e,t,n){const r=function(e){const t=function(e){var t,n;const r=null!=(n=null==(t=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:t.trim())?n:"";if(r.length<3)return"";const o=r[0];if("`"!==o&&"~"!==o||r[1]!==o||r[2]!==o)return"";let i=3;for(;r[i]===o;)i+=1;return r.slice(i).trim()}(e);if(!t)return"";const n=t.split(/\s+/).filter(Boolean);if(!n.length)return"";const r="diff"===n[0]?n.slice(1):n;for(const o of r){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:""}}(String(null!=(e=m.raw)?e:""),Et,Boolean(m.diff))},[Et,m.diff,m.raw]),Dt=Lt.title,$t=Lt.caption,Pt=o(()=>{var e,t,n;return m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:""},[m.code,m.diff,m.updatedCode]),At=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(b),r=e(C);return n&&(t.minWidth=n),r&&(t.maxWidth=r),m.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",t.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",t.borderColor="var(--markstream-code-border-color, var(--code-border))"),t},[C,b,m.diff]),Rt=o(()=>{var e,t,n,r;return m.code.length>0||(null!=(t=null==(e=m.originalCode)?void 0:e.length)?t:0)>0||(null!=(r=null==(n=m.updatedCode)?void 0:n.length)?r:0)>0},[m.code,m.originalCode,m.updatedCode]),Ft=!1===p&&f||!1!==p&&f&&!Rt;s(()=>{if(le)return;if(!de)return;if(!me||!ce)return;const e=z.current;xt();const t=()=>{var t;m.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),yt(),Ne||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>qe(be)):null)&&qe(be)};(null==e?void 0:e.setTheme)&&st?Promise.resolve(e.setTheme(st)).then(t).catch(()=>{}):t()},[Ne,me,ut,be,de,m.diff,st,qe,yt,xt,le,ce]);const It=d(async()=>{var e,t;if(le)return null;if(!ce)return null;if(Ne)return null;if(Ft)return null;const n=z.current,r=$.current;if(!n||!r||!n.createEditor)return null;xt();const o=Je.current,i=o.diff?"diff":"single",l=U.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(q.current===i&&l===r&&a)return null;if(V.current)return V.current;X.current+=1;const c=X.current;he(!0);const s=(async()=>{var e,t,i,l,a,s;try{null==(e=K.current)||e.call(K),q.current=null,U.current=null,pe(!1);const d=Mt;if(o.diff?"function"==typeof n.createDiffEditor?(q.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),d)):(q.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),d)):(q.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),d)),U.current=r,X.current!==c)return;Ye(),yt(),be||Ne||qe(!1);const u=await Promise.race([it(r,n.whenVisualReady),new Promise(e=>{window.setTimeout(()=>e(!0),1500)})]);if(X.current!==c)return;if(!u)return;Ve(be),pe(!0)}catch{X.current===c&&(ie.current=Mt,ae(!0))}})().finally(()=>{V.current===s&&(V.current=null)});return V.current=s,s},[Ve,Ye,Ne,be,Mt,qe,Ft,yt,xt,le,ce]);s(()=>{xt();const e=ee.current!==x;ee.current=x;const t=We.current!==He;We.current=He;const n=te.current;if(te.current=bt,le)return;if(!de)return;let r=!1;if(e||t){const e=Q.current;if(e){Qe(),z.current=null,K.current=null;try{kt(e),r=!0}catch{return void ae(!0)}}}const o=Boolean(m.diff&&n!==bt);if(!r&&!o)return;if(!ce||!me&&!r)return;if(Ne||Ft)return;let i=!1;return(async()=>{if(r||Qe(),!i)try{await It()}catch{}})(),()=>{i=!0}},[Ne,x,me,He,It,kt,de,bt,m.diff,Qe,Ft,xt,le,ce]),s(()=>{if(le){const e=ie.current;if(void 0===e||e===Mt)return;return ie.current=void 0,Qe(),void ae(!1)}de&&ce&&(Ne||Ft?Qe():It())},[Ne,It,Mt,de,Qe,Ft,le,ce]),s(()=>{var e;if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;const t=z.current;if(!t)return;const n=String(null!=(e=m.code)?e:"");(async()=>{var e,r;let o=ye;if(!o&&Z.current)try{o=P(Z.current(n)),o&&we(o)}catch{}const i=_(o||Nt);if(t.createEditor&&$.current){try{await Promise.resolve(It())}catch{}const e=V.current;if(e)try{await e}catch{}}try{m.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=m.originalCode)?e:""),String(null!=(r=m.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}const l=$.current;l&&"true"!==l.getAttribute("data-markstream-enhanced")&&await it(l,t.whenVisualReady)&&(Ve(be),pe(!0)),qe(be)})()},[Ve,Nt,ye,Ne,me,It,be,de,m.code,m.diff,m.originalCode,m.updatedCode,qe,Ft,le,ce]),s(()=>{if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;if(!be&&f)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>qe(be)):null;return null==e&&qe(be),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[Ne,be,f,de,qe,Ft,le,ce]),s(()=>{var e,t,n;if(!v)return;if(le)return;const r=z.current;if(r){try{const o="diff"===q.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Re})}catch{}qe(be)}},[v,be,Re,m.diff,qe,le]),s(()=>{Ie||Xe(!0)},[Ie]);const _t=d((e,t)=>{if(!Ie)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),Ue(n,t,"top",!1,0,mt))},[mt,Ie]),Ht=d(()=>{Ie&&Xe()},[Ie]),Wt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Pt)),ke(!0),null==(e=u.onCopy)||e.call(u,String(Pt)),setTimeout(()=>ke(!1),1e3)}catch{}},[u,Pt]),Ot=d(()=>{if(!Tt)return;const e="html"===Nt?"text/html":"image/svg+xml",t="html"===Nt?Le("artifacts.htmlPreviewTitle")||"HTML Preview":Le("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof u.onPreviewCode?"html"===Nt&&Se(e=>!e):u.onPreviewCode({node:m,artifactType:e,artifactTitle:t,id:`temp-${Nt}-${Date.now()}`})},[Nt,Tt,m,u,Le]);/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */t("iframe",{className:"html-preview-frame__iframe",sandbox:l,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:i,title:n.title||"Preview"})]})}),document.body)}let Je=!1,Qe=null,et=!1,tt=null;async function nt(){if(tt)return tt;if(Qe)return Qe;if(et)return null;tt=(async()=>{try{const e=function(e){var t,n,r;const o="function"==typeof(null==e?void 0:e.createCodeBlockRuntime)||"function"==typeof(null==e?void 0:e.useMonaco)?e:null==e?void 0:e.default,i=null!=(t=null==o?void 0:o.createCodeBlockRuntime)?t:null==o?void 0:o.useMonaco;return"function"!=typeof i?null:{createCodeBlockRuntime:e=>i.call(o,e),detectLanguage:null==(n=null==o?void 0:o.detectLanguage)?void 0:n.bind(o),preloadStreamDiffs:null==(r=null==o?void 0:o.preloadStreamDiffs)?void 0:r.bind(o)}}(await import("stream-diffs/markstream"));if(e)return await async function(e){Je||(Je=!0,(null==e?void 0:e.preloadStreamDiffs)&&await e.preloadStreamDiffs())}(e),Qe=e,Qe}catch{}return et=!0,null})();try{return await tt}finally{tt=null}}const rt="undefined"!=typeof window?u:s,ot={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};async function it(e,t){var n;if(t)try{if(!(await t()))return!1}catch{return!1}if("undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return!1;const r=()=>new Promise(e=>window.requestAnimationFrame(()=>e()));for(let o=0;o<30;o++){await r();const t=null!=(n=e.querySelector([".stream-diffs-shell","[data-stream-diffs-state]"].join(",")))?n:e.firstElementChild;if(!t)continue;const o=t.getBoundingClientRect();if(o.width>0&&o.height>0)return await r(),!0}return!1}function lt(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const r=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},o={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...o,...n,parseDiffOptions:{...o.parseDiffOptions,...r}}}function at(e){const t=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,r,o]=t.slice(0,3).map(Number);return.2126*n+.7152*r+.0722*o}function ct(e){var t,n;const r=String(null!=e?e:"").trim().toLowerCase();if(!r||"transparent"===r)return!0;const o=r.match(/^#([0-9a-f]{8})$/);if(o)return 0===Number.parseInt(o[1].slice(6),16);const i=r.match(/^#([0-9a-f]{4})$/);if(i)return 0===Number.parseInt(i[1][3]+i[1][3],16);const l=null==(n=null==(t=r.match(/^(?:rgba?|hsla?)\(([^)]+)\)/))?void 0:t[1])?void 0:n.split(/[\s,/]+/).filter(Boolean);return 4===(null==l?void 0:l.length)&&0===Number(l[3])}function st(r){var l,a;const u={...ot,...r},{node:m,isDark:h,loading:f,stream:p,isShowPreview:g,enableFontSizeControl:v,darkTheme:y,lightTheme:w,codeBlockOptions:x,themes:k,minWidth:b,maxWidth:C,showHeader:N,showCopyButton:M,showExpandButton:B,showPreviewButton:S,showCollapseButton:T,showFontSizeButtons:E,showLineNumbers:L,showTooltips:D}=u,$=c(null),j=c(null),z=c(null),K=c(null),V=c(null),q=c(null),U=c(null),X=c(0),Z=c(null),Y=c(null),G=Pe(),J=c(null),Q=c(null),ee=c(x),te=c(null),ne=c([]),re=c(null),oe=c(!1),ie=c(void 0),[le,ae]=i(!1),[ce,se]=i(()=>"undefined"==typeof window),[de,ue]=i(!1),[me,he]=i(!1),[fe,pe]=i(!1),[ge,ve]=i(()=>m.language||"plaintext"),[ye,we]=i(()=>P(m.language)),[xe,ke]=i(!1),[be,Ce]=i(!1),[Ne,Me]=i(!1),[Be,Se]=i(!1),[Te,Ee]=i(0),{t:Le}=_e();s(()=>{oe.current=be},[be]);const De=o(()=>lt(Boolean(m.diff),x),[x,m.diff]),[$e,Ae]=i(()=>{var e;const t=Number(null==(e=lt(Boolean(m.diff),x))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:A}),[Re,Fe]=i($e),Ie=o(()=>!1!==D,[D]),He="boolean"==typeof L?L:!0!==De.disableLineNumbers,We=c(He),Oe=Number(null==(l=ee.current)?void 0:l.fontSize),je=Number(null==x?void 0:x.fontSize),ze=ee.current!==x&&Number.isFinite(Oe)&&Oe>0&&(!Number.isFinite(je)||je<=0),Ke=d(()=>{var e;const t=null!=(e=De.maxHeight)?e:500;return"number"==typeof t&&Number.isFinite(t)?t:500},[De.maxHeight]);rt(()=>{const e=Number(De.fontSize),t=Number.isFinite(e)&&e>0?e:A;Ae(t),Fe(t)},[De.fontSize]);const Ve=d(e=>{var t,n,r;if(le)return;const o=$.current,i=z.current;if(!o||!i)return;const l="diff"===q.current?null==(t=i.getDiffEditorView)?void 0:t.call(i):null==(n=i.getEditorView)?void 0:n.call(i);if(!l)return;const a=Ke(),c="diff"===q.current,s=c?"important":"";e?(o.style.minHeight="0px",o.style.setProperty("max-height","none",s),o.style.overflow="visible"):(o.style.minHeight="0px",o.style.setProperty("max-height",`${Math.ceil(a)}px`,s),o.style.overflow=c?"hidden":"auto");try{const t=Number((()=>{if("function"==typeof l.getContentHeight)return l.getContentHeight();if(c&&"function"==typeof l.getModifiedEditor){const e=l.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,a);o.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,s)}null==(r=l.layout)||r.call(l)}catch{}},[Ke,le]),qe=d(e=>{if(Ve(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Ve(e),window.requestAnimationFrame(()=>Ve(e))});return window.setTimeout(()=>Ve(e),180),()=>window.cancelAnimationFrame(t)},[Ve]),Ze=d(()=>{var e,t;for(const n of ne.current)try{"function"==typeof n?n():null==(e=null==n?void 0:n.dispose)||e.call(n)}catch{}ne.current=[],null==(t=re.current)||t.disconnect(),re.current=null},[]),Ye=d(()=>{var e,t,n;Ze();const r=z.current,o=$.current;if(!r||!o||"diff"!==q.current)return;const i=()=>qe(oe.current),l=(e,t)=>{try{const n=null==e?void 0:e[t];if("function"!=typeof n)return;const r=n.call(e,i);r&&ne.current.push(r)}catch{}},a=null==(e=r.getDiffEditorView)?void 0:e.call(r),c=null==(t=null==a?void 0:a.getOriginalEditor)?void 0:t.call(a),s=null==(n=null==a?void 0:a.getModifiedEditor)?void 0:n.call(a);if(l(a,"onDidUpdateDiff"),l(c,"onDidContentSizeChange"),l(s,"onDidContentSizeChange"),l(c,"onDidLayoutChange"),l(s,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==o)&&i()});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),re.current=e}},[Ze,qe]);s(()=>R(()=>{Ee(e=>e+1)}),[]),s(()=>{we(P(m.language))},[m.language]);const Je=c(m);Je.current=m;const Qe=d(()=>{var e;X.current+=1;try{null==(e=K.current)||e.call(K)}catch{}Ze(),V.current=null,q.current=null,U.current=null,pe(!1),he(!1)},[Ze]),et=o(()=>{var e,t;return h?null!=(e=null!=y?y:null==k?void 0:k[0])?e:"vitesse-dark":null!=(t=null!=w?w:null==k?void 0:k[1])?t:"vitesse-light"},[y,h,w,k]),tt=d(()=>et,[et]),st=o(()=>tt(),[tt]),dt=o(()=>function(e,t){var n;const r=null!=(n=function(e){return"string"==typeof e?e:null}(e))?n:"",o=r.toLowerCase();return o?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):t}(st,Boolean(h)),[h,st]),ut=o(()=>m.diff?h?"dark":"light":dt?"dark":"light",[h,m.diff,dt]),mt=o(()=>m.diff?"dark"===ut:dt,[ut,m.diff,dt]),ht=o(()=>{var e;const t=De,n=F(De,ze?A:Re),r=function(e){const t="number"==typeof e&&Number.isFinite(e)&&e>=0?e:0;return{top:t,bottom:t}}(null==t?void 0:t.padding),o=m.diff?0:8,i="number"==typeof(null==t?void 0:t.padding)&&Number.isFinite(t.padding)&&t.padding>=0,l=null!=(e=I(null==t?void 0:t.tabSize))?e:4;return{...n,paddingBottom:i?r.bottom:o,paddingTop:i?r.top:o,tabSize:l}},[ze,Re,m.diff,De]),ft=o(()=>!!m.diff&&"unified"===De.diffStyle,[m.diff,De]),pt=o(()=>{var e,t,n;const r=String(m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:"");if(!r)return 1;const o=f?r:r.replace(/\r\n$|\n$|\r$/,"");return Math.max(1,o.split(/\r\n|\r|\n/).length)},[f,m.code,m.diff,m.updatedCode]),gt=o(()=>Math.ceil(pt*ht.lineHeight+ht.paddingTop+ht.paddingBottom),[pt,ht]),vt=o(()=>{const e={"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${ht.lineHeight}px`,"--markstream-pre-line-number-top":`${ht.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${ht.fontSize}px`,lineHeight:`${ht.lineHeight}px`,maxHeight:`${Ke()}px`,overflow:"auto",paddingBottom:`${ht.paddingBottom}px`,paddingTop:`${ht.paddingTop}px`,tabSize:ht.tabSize,whiteSpace:"scroll"===De.overflow?"pre":"pre-wrap"};return ht.fontFamily&&(e.fontFamily=ht.fontFamily),e},[Ke,ht,De.overflow]),yt=d(()=>{var e,t,n,r,o;const i=$.current,l=j.current;if(!i||!l)return;if(l.style.removeProperty("--vscode-editor-foreground"),l.style.removeProperty("--vscode-editor-background"),l.style.removeProperty("--vscode-editor-selectionBackground"),i.style.setProperty("--diffs-tab-size",String(ht.tabSize)),"number"==typeof De.padding&&Number.isFinite(De.padding)&&De.padding>=0?i.style.setProperty("--diffs-gap-block",`${ht.paddingTop}px`):i.style.removeProperty("--diffs-gap-block"),m.diff)return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");const a=i;try{const c="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(a):null,s=String(null!=(e=null==c?void 0:c.getPropertyValue("--vscode-editor-foreground"))?e:"").trim()||String(null!=(t=null==c?void 0:c.color)?t:"").trim(),d=String(null!=(n=null==c?void 0:c.getPropertyValue("--vscode-editor-background"))?n:"").trim(),u=String(null!=(r=null==c?void 0:c.backgroundColor)?r:"").trim(),h=ct(d)?ct(u)?"":u:d,f=String(null!=(o=null==c?void 0:c.getPropertyValue("--vscode-editor-selectionBackground"))?o:"").trim();if(function(e,t,n,r){if(!n)return!1;const o=at(e),i=at(t);return r?null!=o&&o>170||null!=i&&i<110:null!=o&&o<85||null!=i&&i>190}(h,s,"plaintext"===_(String(m.language||ye||ge||"plaintext")),l.classList.contains("is-dark")))return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");s?i.style.setProperty("--vscode-editor-foreground",s):i.style.removeProperty("--vscode-editor-foreground"),h?i.style.setProperty("--vscode-editor-background",h):i.style.removeProperty("--vscode-editor-background"),f?i.style.setProperty("--vscode-editor-selectionBackground",f):i.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ye,ge,m.diff,m.language,ht,De]),wt=d(()=>{const e=De.maxHeight,t={...De||{},...null==e?{}:{MAX_HEIGHT:e},themes:k?[...k]:void 0,stream:!1,disableFileHeader:!0,disableLineNumbers:!He,fontSize:ht.fontSize,lineHeight:ht.lineHeight,...ht.fontFamily?{fontFamily:ht.fontFamily}:{},theme:st,themeType:h?"dark":"light",onThemeChange(){yt()}};delete t.maxHeight,delete t.padding,delete t.tabSize;const n="string"==typeof t.unsafeCSS?t.unsafeCSS:"";return t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }",n].filter(Boolean).join("\n"),t},[He,h,ht,st,De,yt,k]),xt=d(()=>{const e=wt(),t=J.current;if(!t)return J.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[wt]),kt=d(e=>{const t=e(xt());return z.current=t,K.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[xt]),bt=o(()=>{var e;return JSON.stringify({diffStyle:De.diffStyle,expandUnchanged:De.expandUnchanged,collapsedContextThreshold:De.collapsedContextThreshold,hunkSeparators:De.hunkSeparators,lineDiffType:De.lineDiffType,maxLineDiffLength:De.maxLineDiffLength,expansionLineCount:De.expansionLineCount,context:null==(e=De.parseDiffOptions)?void 0:e.context})},[De]);s(()=>{xt()},[De,xt]),s(()=>()=>{var e,t,n;X.current+=1,null==(e=K.current)||e.call(K),Ze(),K.current=null,V.current=null,q.current=null,U.current=null,z.current=null,Q.current=null,Z.current=null,null==(n=null==(t=Y.current)?void 0:t.destroy)||n.call(t),Y.current=null},[Ze]),s(()=>{var e,t;if("undefined"==typeof window)return;if(ce)return;const n=j.current;if(!n)return;null==(t=null==(e=Y.current)?void 0:e.destroy)||t.call(e);const r=G(n,{rootMargin:"400px"});return Y.current=r,r.isVisible()&&se(!0),r.whenVisible.then(()=>se(!0)),()=>{r.destroy(),Y.current===r&&(Y.current=null)}},[G,ce]),s(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:z.current?(xt(),()=>{e=!1}):((async()=>{try{const t=await nt();if(!e)return;if(!t)return void ae(!0);const n=t.createCodeBlockRuntime,r=t.detectLanguage;if("function"==typeof r&&(Z.current=r),"function"!=typeof n)return void ae(!0);Q.current=n,kt(n),ue(!0)}catch{e&&ae(!0)}})(),()=>{e=!1})},[kt,xt]),s(()=>{var e;if(!m.language&&!ye&&Z.current)try{const t=Z.current(String(null!=(e=m.code)?e:""));t&&ve(t)}catch{}},[ye,m.code,m.language]);const Ct=o(()=>String(m.language||ye||ge||"plaintext"),[ye,ge,m.language]),Nt=o(()=>P(Ct),[Ct]),Mt=o(()=>_(Nt),[Nt]),Bt=o(()=>"plaintext"===Mt,[Mt]),St=o(()=>H(Nt),[Nt,Te]),Tt=o(()=>!!g&&("html"===Nt||"svg"===Nt),[Nt,g]),Et=o(()=>{const e=Nt;return e?W[e]||e.charAt(0).toUpperCase()+e.slice(1):W[""]||"Plain Text"},[Nt]),Lt=o(()=>{var e;return function(e,t,n){const r=function(e){const t=function(e){var t,n;const r=null!=(n=null==(t=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:t.trim())?n:"";if(r.length<3)return"";const o=r[0];if("`"!==o&&"~"!==o||r[1]!==o||r[2]!==o)return"";let i=3;for(;r[i]===o;)i+=1;return r.slice(i).trim()}(e);if(!t)return"";const n=t.split(/\s+/).filter(Boolean);if(!n.length)return"";const r="diff"===n[0]?n.slice(1):n;for(const o of r){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:""}}(String(null!=(e=m.raw)?e:""),Et,Boolean(m.diff))},[Et,m.diff,m.raw]),Dt=Lt.title,$t=Lt.caption,Pt=o(()=>{var e,t,n;return m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:""},[m.code,m.diff,m.updatedCode]),At=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(b),r=e(C);return n&&(t.minWidth=n),r&&(t.maxWidth=r),m.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",t.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",t.borderColor="var(--markstream-code-border-color, var(--code-border))"),t},[C,b,m.diff]),Rt=o(()=>{var e,t,n,r;return m.code.length>0||(null!=(t=null==(e=m.originalCode)?void 0:e.length)?t:0)>0||(null!=(r=null==(n=m.updatedCode)?void 0:n.length)?r:0)>0},[m.code,m.originalCode,m.updatedCode]),Ft=!1===p&&f||!1!==p&&f&&!Rt;s(()=>{if(le)return;if(!de)return;if(!me||!ce)return;const e=z.current;xt();const t=()=>{var t;m.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),yt(),Ne||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>qe(be)):null)&&qe(be)};(null==e?void 0:e.setTheme)&&st?Promise.resolve(e.setTheme(st)).then(t).catch(()=>{}):t()},[Ne,me,ut,be,de,m.diff,st,qe,yt,xt,le,ce]);const It=d(async()=>{var e,t;if(le)return null;if(!ce)return null;if(Ne)return null;if(Ft)return null;const n=z.current,r=$.current;if(!n||!r||!n.createEditor)return null;xt();const o=Je.current,i=o.diff?"diff":"single",l=U.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(q.current===i&&l===r&&a)return null;if(V.current)return V.current;X.current+=1;const c=X.current;he(!0);const s=(async()=>{var e,t,i,l,a,s;try{null==(e=K.current)||e.call(K),q.current=null,U.current=null,pe(!1);const d=Mt;if(o.diff?"function"==typeof n.createDiffEditor?(q.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),d)):(q.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),d)):(q.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),d)),U.current=r,X.current!==c)return;Ye(),yt(),be||Ne||qe(!1);const u=await Promise.race([it(r,n.whenVisualReady),new Promise(e=>{window.setTimeout(()=>e(!0),1500)})]);if(X.current!==c)return;if(!u)return;Ve(be),pe(!0)}catch{X.current===c&&(ie.current=Mt,ae(!0))}})().finally(()=>{V.current===s&&(V.current=null)});return V.current=s,s},[Ve,Ye,Ne,be,Mt,qe,Ft,yt,xt,le,ce]);s(()=>{xt();const e=ee.current!==x;ee.current=x;const t=We.current!==He;We.current=He;const n=te.current;if(te.current=bt,le)return;if(!de)return;let r=!1;if(e||t){const e=Q.current;if(e){Qe(),z.current=null,K.current=null;try{kt(e),r=!0}catch{return void ae(!0)}}}const o=Boolean(m.diff&&n!==bt);if(!r&&!o)return;if(!ce||!me&&!r)return;if(Ne||Ft)return;let i=!1;return(async()=>{if(r||Qe(),!i)try{await It()}catch{}})(),()=>{i=!0}},[Ne,x,me,He,It,kt,de,bt,m.diff,Qe,Ft,xt,le,ce]),s(()=>{if(le){const e=ie.current;if(void 0===e||e===Mt)return;return ie.current=void 0,Qe(),void ae(!1)}de&&ce&&(Ne||Ft?Qe():It())},[Ne,It,Mt,de,Qe,Ft,le,ce]),s(()=>{var e;if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;const t=z.current;if(!t)return;const n=String(null!=(e=m.code)?e:"");(async()=>{var e,r;let o=ye;if(!o&&Z.current)try{o=P(Z.current(n)),o&&we(o)}catch{}const i=_(o||Nt);if(t.createEditor&&$.current){try{await Promise.resolve(It())}catch{}const e=V.current;if(e)try{await e}catch{}}try{m.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=m.originalCode)?e:""),String(null!=(r=m.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}const l=$.current;l&&"true"!==l.getAttribute("data-markstream-enhanced")&&await it(l,t.whenVisualReady)&&(Ve(be),pe(!0)),qe(be)})()},[Ve,Nt,ye,Ne,me,It,be,de,m.code,m.diff,m.originalCode,m.updatedCode,qe,Ft,le,ce]),s(()=>{if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;if(!be&&f)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>qe(be)):null;return null==e&&qe(be),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[Ne,be,f,de,qe,Ft,le,ce]),s(()=>{var e,t,n;if(!v)return;if(le)return;const r=z.current;if(r){try{const o="diff"===q.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Re})}catch{}qe(be)}},[v,be,Re,m.diff,qe,le]),s(()=>{Ie||Xe(!0)},[Ie]);const _t=d((e,t)=>{if(!Ie)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),Ue(n,t,"top",!1,0,mt))},[mt,Ie]),Ht=d(()=>{Ie&&Xe()},[Ie]),Wt=d(async()=>{var e;const t=String(Pt);try{u.clipboardWriter?await u.clipboardWriter(t):"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(t),ke(!0),null==(e=u.onCopy)||e.call(u,t),setTimeout(()=>ke(!1),1e3)}catch{}},[u,Pt]),Ot=d(()=>{if(!Tt)return;const e="html"===Nt?"text/html":"image/svg+xml",t="html"===Nt?Le("artifacts.htmlPreviewTitle")||"HTML Preview":Le("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof u.onPreviewCode?"html"===Nt&&Se(e=>!e):u.onPreviewCode({node:m,artifactType:e,artifactTitle:t,id:`temp-${Nt}-${Date.now()}`})},[Nt,Tt,m,u,Le]);/* @__PURE__ */
|
|
14
14
|
return e("div",{ref:j,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",mt?"border-gray-700/30":"border-gray-200",f?"is-rendering":"",mt?"is-dark":"",m.diff?"is-diff":"",Bt?"is-plain-text":""].join(" "),style:At,children:[N&&/* @__PURE__ */e("div",{className:"code-block-header",children:[
|
|
15
15
|
/* @__PURE__ */e("div",{className:"code-header-main",children:[
|
|
16
16
|
/* @__PURE__ */t("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:St}}),
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,B as a,C as s,a as o,D as r,b as t,E as n,c as d,F as i,d as l,e as m,f as N,H as c,g as k,h as u,i as g,j as p,k as C,I as f,l as h,m as I,n as B,L as D,o as T,p as M,M as K,q as W,r as b,s as L,N as S,P as R,a as X,R as E,S as x,t as H,u as P,v as F,T as O,w as v,x as y,y as _,V as j,W as w,z as A,G as q,J as G,K as U,N as Y,O as z,Q as J,U as V,Y as Q,Z,_ as $,$ as ee,a0 as ae,a1 as se,a2 as oe,a3 as re,a4 as te,a5 as ne,a6 as de,a7 as ie,a8 as le,a9 as me,aa as Ne,ab as ce,ac as ke,ad as ue,ae as ge,af as pe}from"./Tooltip-
|
|
1
|
+
import{A as e,B as a,C as s,a as o,D as r,b as t,E as n,c as d,F as i,d as l,e as m,f as N,H as c,g as k,h as u,i as g,j as p,k as C,I as f,l as h,m as I,n as B,L as D,o as T,p as M,M as K,q as W,r as b,s as L,N as S,P as R,a as X,R as E,S as x,t as H,u as P,v as F,T as O,w as v,x as y,y as _,V as j,W as w,z as A,G as q,J as G,K as U,N as Y,O as z,Q as J,U as V,Y as Q,Z,_ as $,$ as ee,a0 as ae,a1 as se,a2 as oe,a3 as re,a4 as te,a5 as ne,a6 as de,a7 as ie,a8 as le,a9 as me,aa as Ne,ab as ce,ac as ke,ad as ue,ae as ge,af as pe}from"./Tooltip-CJBn43zr.js";import{P as Ce,b as fe,e as he,f as Ie,j as Be,l as De,m as Te,q as Me,u as Ke,y as We,A as be,G as Le,J as Se,K as Re,N as Xe,S as Ee}from"./codeBlockExtraProps-DKls4xQW.js";export{e as AdmonitionNode,a as BlockquoteNode,s as CheckboxNode,o as CodeBlockNode,r as D2BlockNode,t as DefinitionListNode,n as EmojiNode,d as EmphasisNode,i as FallbackComponent,l as FootnoteAnchorNode,m as FootnoteNode,N as FootnoteReferenceNode,c as HardBreakNode,k as HeadingNode,u as HighlightNode,g as HtmlBlockNode,p as HtmlInlineNode,C as HtmlPreviewFrame,f as ImageNode,h as InfographicBlockNode,I as InlineCodeNode,B as InsertNode,D as LinkNode,T as ListItemNode,M as ListNode,K as MERMAID_WORKER_BUSY_CODE,W as MathBlockNode,b as MathInlineNode,L as MermaidBlockNode,S as NodeRenderer,R as ParagraphNode,Ce as PreCodeNode,X as ReactCodeBlockNode,E as ReferenceNode,x as StrikethroughNode,H as StrongNode,P as SubscriptNode,F as SuperscriptNode,O as TableNode,v as TextNode,y as ThematicBreakNode,_ as Tooltip,j as VmrContainerNode,w as WORKER_BUSY_CODE,A as canParseOffthread,fe as clearGlobalCustomComponents,q as clearKaTeXCache,G as clearKaTeXWorker,U as clearMermaidWorker,Y as default,he as defineHtmlComponents,Ie as defineStreamingComponents,z as disableD2,J as enableD2,V as findPrefixOffthread,Be as getCustomComponentDisplay,De as getCustomNodeComponents,Q as getKaTeXBackpressureDefaults,Te as getLanguageIcon,Z as getMermaidWorkerLoad,$ as isD2Enabled,Me as languageMap,Ke as normalizeLanguageIdentifier,We as preloadExtendedLanguageIcons,be as removeCustomComponents,ee as renderKaTeXInWorker,ae as renderKaTeXWithBackpressure,se as renderNode,Le as resolveLanguageId,Se as setCustomComponents,oe as setD2Loader,re as setDefaultI18nMap,te as setKaTeXBackpressureDefaults,ne as setKaTeXCache,de as setKaTeXConcurrencyLimit,ie as setKaTeXWorker,le as setKaTeXWorkerDebug,Re as setLanguageIconResolver,me as setMermaidWorker,Ne as setMermaidWorkerClientDebug,ce as setMermaidWorkerMaxConcurrency,Xe as subscribeLanguageIconsRevision,ke as terminateWorker,ue as useSafeI18n,ge as useSmoothMarkdownStream,pe as waitForKaTeXWorkerSlot,Ee as withMarkstreamComponentDisplay};
|
package/dist/next.d.ts
CHANGED
|
@@ -123,6 +123,8 @@ interface CodeBlockOptions {
|
|
|
123
123
|
interface CodeBlockNodeProps extends CommonCodeBlockProps {
|
|
124
124
|
node: CodeBlockNode$1;
|
|
125
125
|
codeBlockOptions?: CodeBlockOptions;
|
|
126
|
+
/** Overrides browser clipboard writes. Copy feedback and events wait for completion. */
|
|
127
|
+
clipboardWriter?: (text: string) => void | Promise<void>;
|
|
126
128
|
isDark?: boolean;
|
|
127
129
|
loading?: boolean;
|
|
128
130
|
stream?: boolean;
|
package/dist/next.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import a,{useState as s,useEffect as e}from"react";import{A as r,B as o,C as t,a as n,D as i,b as m,E as l,c as d,F as c,d as u,e as p,f,H as g,g as C,h as k,i as T,j as E,k as D,I as K,l as M,m as W,n as I,L as _,o as L,p as R,q as X,r as b,s as x,N as B,P as S,R as y,S as h,t as A,u as N,v as j,T as v,w as P,x as O,y as w,V as F}from"./Tooltip-
|
|
2
|
+
import a,{useState as s,useEffect as e}from"react";import{A as r,B as o,C as t,a as n,D as i,b as m,E as l,c as d,F as c,d as u,e as p,f,H as g,g as C,h as k,i as T,j as E,k as D,I as K,l as M,m as W,n as I,L as _,o as L,p as R,q as X,r as b,s as x,N as B,P as S,R as y,S as h,t as A,u as N,v as j,T as v,w as P,x as O,y as w,V as F}from"./Tooltip-CJBn43zr.js";import{M as H,W as Y,z as q,G,J as U,K as V,O as z,Q as J,U as $,X as Q,Y as Z,Z as aa,_ as sa,$ as ea,a0 as ra,a1 as oa,a2 as ta,a3 as na,a4 as ia,a5 as ma,a6 as la,a7 as da,a8 as ca,a9 as ua,aa as pa,ab as fa,ac as ga,ad as Ca,af as ka}from"./Tooltip-CJBn43zr.js";import{P as Ta}from"./codeBlockExtraProps-DKls4xQW.js";import{b as Ea,e as Da,f as Ka,l as Ma,m as Wa,q as Ia,u as _a,y as La,A as Ra,G as Xa,J as ba,K as xa,N as Ba}from"./codeBlockExtraProps-DKls4xQW.js";import{A as Sa,B as ya,C as ha,a as Aa,D as Na,b as ja,E as va,c as Pa,F as Oa,d as wa,e as Fa,f as Ha,H as Ya,g as qa,h as Ga,i as Ua,j as Va,k as za,I as Ja,l as $a,m as Qa,n as Za,L as as,o as ss,p as es,M as rs,q as os,r as ts,N as ns,P as is,s as ms,R as ls,S as ds,t as cs,u as us,v as ps,T as fs,w as gs,x as Cs,y as ks,V as Ts}from"./index-DueMgs9g.js";function Es(r,o){function t(t){const[n,i]=s(!1);return e(()=>{i(!0)},[]),n?a.createElement(r,t):function(a){const s="__MARKSTREAM_REACT_DISABLE_SYNC_KATEX__",e=globalThis,r=e[s];e[s]=!0;try{return o(a)}finally{void 0===r?delete e[s]:e[s]=r}}(t)}return t.displayName=`MarkstreamNextEntry(${r.displayName||r.name||"Component"})`,t}const Ds=Es(r,Sa),Ks=Es(o,ya),Ms=Es(t,ha),Ws=Es(n,Aa),Is=Ws,_s=Es(D,za),Ls=Es(i,Na),Rs=Es(m,ja),Xs=Es(l,va),bs=Es(d,Pa),xs=Es(u,wa),Bs=Es(p,Fa),Ss=Es(f,Ha),ys=Es(g,Ya),hs=Es(C,qa),As=Es(k,Ga),Ns=Es(T,Ua),js=Es(E,Va),vs=Es(K,Ja),Ps=Es(M,$a),Os=Es(W,Qa),ws=Es(I,Za),Fs=Es(_,as),Hs=Es(L,ss),Ys=Es(R,es),qs=Es(X,rs),Gs=Es(b,os),Us=Es(x,ts),Vs=Es(B,ns),zs=Es(c,Oa),Js=Es(S,is),$s=Es(Ta,ms),Qs=Es(y,ls),Zs=Es(h,ds),ae=Es(A,cs),se=Es(N,us),ee=Es(j,ps),re=Es(v,fs),oe=Es(P,gs),te=Es(O,Cs),ne=Es(w,ks),ie=Es(F,Ts);export{Ds as AdmonitionNode,Ks as BlockquoteNode,Ms as CheckboxNode,Ws as CodeBlockNode,Ls as D2BlockNode,Rs as DefinitionListNode,Xs as EmojiNode,bs as EmphasisNode,zs as FallbackComponent,xs as FootnoteAnchorNode,Bs as FootnoteNode,Ss as FootnoteReferenceNode,ys as HardBreakNode,hs as HeadingNode,As as HighlightNode,Ns as HtmlBlockNode,js as HtmlInlineNode,_s as HtmlPreviewFrame,vs as ImageNode,Ps as InfographicBlockNode,Os as InlineCodeNode,ws as InsertNode,Fs as LinkNode,Hs as ListItemNode,Ys as ListNode,H as MERMAID_WORKER_BUSY_CODE,qs as MathBlockNode,Gs as MathInlineNode,Us as MermaidBlockNode,Vs as NodeRenderer,Js as ParagraphNode,$s as PreCodeNode,Is as ReactCodeBlockNode,Qs as ReferenceNode,Zs as StrikethroughNode,ae as StrongNode,se as SubscriptNode,ee as SuperscriptNode,re as TableNode,oe as TextNode,te as ThematicBreakNode,ne as Tooltip,ie as VmrContainerNode,Y as WORKER_BUSY_CODE,q as canParseOffthread,Ea as clearGlobalCustomComponents,G as clearKaTeXCache,U as clearKaTeXWorker,V as clearMermaidWorker,Vs as default,Da as defineHtmlComponents,Ka as defineStreamingComponents,z as disableD2,J as enableD2,$ as findPrefixOffthread,Ma as getCustomNodeComponents,Q as getD2,Z as getKaTeXBackpressureDefaults,Wa as getLanguageIcon,aa as getMermaidWorkerLoad,sa as isD2Enabled,Ia as languageMap,_a as normalizeLanguageIdentifier,La as preloadExtendedLanguageIcons,Ra as removeCustomComponents,ea as renderKaTeXInWorker,ra as renderKaTeXWithBackpressure,oa as renderNode,Xa as resolveLanguageId,ba as setCustomComponents,ta as setD2Loader,na as setDefaultI18nMap,ia as setKaTeXBackpressureDefaults,ma as setKaTeXCache,la as setKaTeXConcurrencyLimit,da as setKaTeXWorker,ca as setKaTeXWorkerDebug,xa as setLanguageIconResolver,ua as setMermaidWorker,pa as setMermaidWorkerClientDebug,fa as setMermaidWorkerMaxConcurrency,Ba as subscribeLanguageIconsRevision,ga as terminateWorker,Ca as useSafeI18n,ka as waitForKaTeXWorkerSlot};
|
package/dist/server.d.ts
CHANGED
|
@@ -109,6 +109,8 @@ interface CodeBlockOptions {
|
|
|
109
109
|
interface CodeBlockNodeProps extends CommonCodeBlockProps {
|
|
110
110
|
node: CodeBlockNode$1;
|
|
111
111
|
codeBlockOptions?: CodeBlockOptions;
|
|
112
|
+
/** Overrides browser clipboard writes. Copy feedback and events wait for completion. */
|
|
113
|
+
clipboardWriter?: (text: string) => void | Promise<void>;
|
|
112
114
|
isDark?: boolean;
|
|
113
115
|
loading?: boolean;
|
|
114
116
|
stream?: boolean;
|
package/dist/tailwind.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const safeList = `use client react stream-markdown-parser string cannot delete global call clearGlobalCustomComponents note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby blockquote-node auto
|
|
1
|
+
const safeList = `use client react stream-markdown-parser string cannot delete global call clearGlobalCustomComponents note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby blockquote-node auto html-block-node safe escape html-block html-block-node__placeholder html-block-node__placeholder-bar w-4/5 w-2/3 setHostEl shouldRender useDynamic reactNodes number ?? ease-in-out typeof infinite node.title top link-loading inline-flex items-baseline gap-1.5 link-text-wrapper relative leading-[normal] link-text text link-loading-indicator link-node aria-label noopener noreferrer clsx inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full text-node-stream-delta text-node-stream-delta--a text-node-stream-delta--b emoji-node checkbox-node checkbox checkbox-input href name xlink:href markstream-d2-root-svg window.requestAnimationFrame is not instance.render instance missing object render returned empty to d2-block my-4 rounded-lg border overflow-hidden shadow-sm border-gray-700/30 bg-gray-900 text-gray-100 border-gray-200 bg-white text-gray-900 d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5 gap-x-2 text-sm font-medium gap-x-1 rounded-md p-0.5 bg-gray-700 bg-gray-100 mode-btn px-2 py-1 text-xs !showSource is-active showSource d2-action-btn p-2 transition-colors hover:bg-[var(--vscode-editor-selectionBackground)] copying w-3 h-3 none currentColor round aria-pressed m9 bodyRef d2-block-body bodyStyle !hasPreview d2-source py-4 d2-code d2-error mt-2 d2-render d2-svg pb-3 dependency install it enable smooth footnote-anchor hover:underline cursor-pointer ↩︎ footnote-node leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2 flex-1 dl definition-list indexKey mb-4 dt definition-term font-semibold ctx renderNode definition dd definition-desc ml-4 heading-node footnote-reference handleScroll footnote-link mark highlight-node hard-break next code_block next.type window.requestIdleCallback [data-node-index] node-spacer dark virtualized data-custom-id node-slot data-node-index data-node-type fade-node typewriter-node node-placeholder typewriterCursorRef typewriter-cursor admonition math_block html_block image [data-node-type="code_block"] [data-node-type="admonition"] [data-node-type="table"] [data-node-type="math_block"] [data-node-type="html_block"] [data-node-type="image"] performance [markstream-react][perf] mermaid markdown-renderer boolean primary fallback failed is-loaded lazy eager async image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error load emphasis-node markstream-core react-dom w-4 h-4 flex-shrink-0 library error message rendered text-red-500 p-4">Failed instanceof error.message hidden keydown transform ease center fullscreen touch text-gray-400 hover:bg-gray-700 hover:text-gray-200 text-gray-600 hover:bg-gray-200 hover:text-gray-700 source hasRenderError hasPreview preview pending is-rendering bg-gray-800 bg-gray-50 truncate px-2.5 bg-gray-600 text-gray-200 text-gray-700 text-gray-500 m16 isCollapsed opacity-50 cursor-not-allowed m7 m14 whitespace-pre-wrap text-gray-300 baseCode absolute top-2 right-2 z-10 gap-2 backdrop-blur infographic-preview transition-all duration-100 block inset-0 overflow-auto p-4 text-left cursor-grab isDragging containerRef w-full text-center justify-center min-h-full markstream-react fixed z-50 bg-black/70 closeModal dialog h-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing [data-stream-diffs-state] theme themes themeType language languages stream disableFileHeader onThemeChange renderCustomHeader renderHeaderMetadata renderHeaderPrefix wrap split line-info night moon black dracula mocha frappe macchiato palenight ocean poimandres monokai laserwave tokyo slack-dark rose-pine github-dark material-theme one-dark catppuccin-mocha catppuccin-frappe catppuccin-macchiato light latte dawn lotus transparent marker diff plaintext important max-height visible height onDidUpdateDiff onDidContentSizeChange onDidLayoutChange window.MutationObserver childList record.type attributes class vitesse-dark vitesse-light unified node.code fontSize lineHeight maxHeight paddingBottom paddingTop tabSize resolvedRuntimeOptions.overflow scroll pre-wrap nextOptions.unsafeCSS [data-file] [data-diff] helpers.cleanupEditor canonicalLanguage single window.cancelAnimationFrame clientX navigator.clipboard navigator.clipboard.writeText code-block-container is-diff is-plain-text code-block-header code-header-main icon-slot code-header-copy min-w-0 code-header-title code-header-caption code-header-actions code-action-btn action-icon copied evenodd code-block-body--collapsed code-block-body--expanded code-fallback-plain m-0 code-editor-layer code-height-placeholder editorReady void aria-hidden code-editor-fallback-surface code-loading-placeholder loading-skeleton skeleton-line short sr-only polite status data-ssr-fallback aria-busy normalizedLanguage data-language no node.type html_inline infographic d2 d2lang configuredShowLineNumbers disableLineNumbers text-node-center paragraph-node renderNodeProp paragraph child.type classAttr node.cite children list-item pl-1.5 my-2 value list-node my-5 pl-[calc(13/8*1em)] list-decimal list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)] list right text-right table-node-wrapper table-node--loading border-[var(--table-border,#cbd5e1)] p-[calc(4/7*1em)] rowIdx bodyRows.length table-node__loading table-node__spinner isOpen strong-node emphasis strikethrough-node strikethrough highlight insert-node insert subscript-node subscript superscript-node superscript thematic-break-node cssVars image-node__img code-block-node code-block mermaid-block-node d2-block-node infographic-block-node math-block overflow-x-auto min-h-[40px] node.content $$ math-inline-wrapper math-inline reference-node bg-[hsl(var(--muted))] px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] data-reference-id customComponents html-inline vmr-container unknown-node italic node text_special heading list_item definition_list footnote footnote_reference footnote_anchor hardbreak inline_code checkbox_input emoji thematic_break math_inline reference vmr_container label_open label_close server-renderer node-content valueAttr hr-node thematic-break in out zoom containerClass pointermove pointerup pointercancel my-8 table-node colgroup table-node__resize-handle window.matchMedia ms-tooltip z-[9999] inline-block text-base py-2 px-3 shadow-md whitespace-nowrap pointer-events-none tooltip-element text-white border-gray-700 tooltip event.key text-node [mermaidWorkerClient] messageerror cleared worker inject via busy timed canParse findPrefix javascript typescript go python ruby shell powershell plain cpp csharp objectivec objectivecpp yaml markdown rust kotlin java cs php sql zsh objective-c objective-cpp [markstream-react] htmlPreviewSandbox contains both allow-scripts and this only fully trusted content served an isolated en utf-8 viewport content="width=device-width initial-scale=1 html-preview-frame__backdrop--dark html-preview-frame--dark html-preview-frame__header html-preview-frame__title html-preview-frame__dot html-preview-frame__label html-preview-frame__close--dark html-preview-frame__iframe no-referrer about:blank tag_open token.type self_closing child key ref className ms-html tag_close parse dynamic template html-inline-node html-inline-node--loading loose strict viewBox gantt open-modal [data-mermaid-wrapper] mermaid-action-btn toggle-mode common.zoomIn common.zoomOut common.resetZoom transition-[height] duration-150 ease-out data-mermaid-wrapper mermaid-loading mermaid-spinner diagram… mermaid-block-header space-x-2 space-x-1 common.preview common.source common.export mermaid-error hasRenderedOnce mermaid-block modeContainerRef mermaid-modal-overlay mermaid-modal-panel mermaid-modal-header mermaid-modal-title mermaid-modal-close mermaid-modal-body modalContentRef mermaid-modal-content available default abort thinking htmlFor markstream-react-d2 role aria-describedby [katexWorkerClient] init cache-hit timeout waiting slot npm development process document value?.useMonaco stream-diffs/markstream monospace hunk !options.preserveBlankKind context removed added markstream-pre__diff-pane--inline original markstream-pre__diff-pane--original modified markstream-pre__diff-pane--modified ui-monospace fontFamily markstream-pre--line-numbers markstream-pre--diff-preview markstream-pre--diff-inline showLineNumbers markstream-pre__diff-code line.empty markstream-pre__diff-line--empty markstream-pre__diff-rail markstream-pre__diff-number markstream-pre__diff-content markstream-pre__diff-content-inner markstream-pre__line-numbers markstream-pre__line-numbers-text markstream-pre__code sequencediagram classdiagram kind statediagram erdiagram flowchart graph prototype constructor normalizedType katex mathRef math-inline--hidden math-inline__loading math-inline__spinner rendering math-rendering globalThis.requestAnimationFrame globalThis.cancelAnimationFrame module did expected °C`;
|
|
2
2
|
module.exports = safeList;
|
|
3
3
|
module.exports.safeList = safeList;
|
|
4
4
|
module.exports.default = safeList;
|
package/dist/tailwind.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const safeList = `use client react stream-markdown-parser string cannot delete global call clearGlobalCustomComponents note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby blockquote-node auto
|
|
1
|
+
export const safeList = `use client react stream-markdown-parser string cannot delete global call clearGlobalCustomComponents note is-dark data-index-key headerId admonition-header admonition-icon admonition-title admonition-toggle aria-expanded aria-controls collapsed admonition-content aria-labelledby blockquote-node auto html-block-node safe escape html-block html-block-node__placeholder html-block-node__placeholder-bar w-4/5 w-2/3 setHostEl shouldRender useDynamic reactNodes number ?? ease-in-out typeof infinite node.title top link-loading inline-flex items-baseline gap-1.5 link-text-wrapper relative leading-[normal] link-text text link-loading-indicator link-node aria-label noopener noreferrer clsx inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full text-node-stream-delta text-node-stream-delta--a text-node-stream-delta--b emoji-node checkbox-node checkbox checkbox-input href name xlink:href markstream-d2-root-svg window.requestAnimationFrame is not instance.render instance missing object render returned empty to d2-block my-4 rounded-lg border overflow-hidden shadow-sm border-gray-700/30 bg-gray-900 text-gray-100 border-gray-200 bg-white text-gray-900 d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5 gap-x-2 text-sm font-medium gap-x-1 rounded-md p-0.5 bg-gray-700 bg-gray-100 mode-btn px-2 py-1 text-xs !showSource is-active showSource d2-action-btn p-2 transition-colors hover:bg-[var(--vscode-editor-selectionBackground)] copying w-3 h-3 none currentColor round aria-pressed m9 bodyRef d2-block-body bodyStyle !hasPreview d2-source py-4 d2-code d2-error mt-2 d2-render d2-svg pb-3 dependency install it enable smooth footnote-anchor hover:underline cursor-pointer ↩︎ footnote-node leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2 flex-1 dl definition-list indexKey mb-4 dt definition-term font-semibold ctx renderNode definition dd definition-desc ml-4 heading-node footnote-reference handleScroll footnote-link mark highlight-node hard-break next code_block next.type window.requestIdleCallback [data-node-index] node-spacer dark virtualized data-custom-id node-slot data-node-index data-node-type fade-node typewriter-node node-placeholder typewriterCursorRef typewriter-cursor admonition math_block html_block image [data-node-type="code_block"] [data-node-type="admonition"] [data-node-type="table"] [data-node-type="math_block"] [data-node-type="html_block"] [data-node-type="image"] performance [markstream-react][perf] mermaid markdown-renderer boolean primary fallback failed is-loaded lazy eager async image-node__placeholder image-node__spinner image-node__placeholder-text image… placeholder image-node__error load emphasis-node markstream-core react-dom w-4 h-4 flex-shrink-0 library error message rendered text-red-500 p-4">Failed instanceof error.message hidden keydown transform ease center fullscreen touch text-gray-400 hover:bg-gray-700 hover:text-gray-200 text-gray-600 hover:bg-gray-200 hover:text-gray-700 source hasRenderError hasPreview preview pending is-rendering bg-gray-800 bg-gray-50 truncate px-2.5 bg-gray-600 text-gray-200 text-gray-700 text-gray-500 m16 isCollapsed opacity-50 cursor-not-allowed m7 m14 whitespace-pre-wrap text-gray-300 baseCode absolute top-2 right-2 z-10 gap-2 backdrop-blur infographic-preview transition-all duration-100 block inset-0 overflow-auto p-4 text-left cursor-grab isDragging containerRef w-full text-center justify-center min-h-full markstream-react fixed z-50 bg-black/70 closeModal dialog h-full max-h-full shadow-lg top-6 right-6 !isDragging cursor-grabbing [data-stream-diffs-state] theme themes themeType language languages stream disableFileHeader onThemeChange renderCustomHeader renderHeaderMetadata renderHeaderPrefix wrap split line-info night moon black dracula mocha frappe macchiato palenight ocean poimandres monokai laserwave tokyo slack-dark rose-pine github-dark material-theme one-dark catppuccin-mocha catppuccin-frappe catppuccin-macchiato light latte dawn lotus transparent marker diff plaintext important max-height visible height onDidUpdateDiff onDidContentSizeChange onDidLayoutChange window.MutationObserver childList record.type attributes class vitesse-dark vitesse-light unified node.code fontSize lineHeight maxHeight paddingBottom paddingTop tabSize resolvedRuntimeOptions.overflow scroll pre-wrap nextOptions.unsafeCSS [data-file] [data-diff] helpers.cleanupEditor canonicalLanguage single window.cancelAnimationFrame clientX navigator.clipboard navigator.clipboard.writeText code-block-container is-diff is-plain-text code-block-header code-header-main icon-slot code-header-copy min-w-0 code-header-title code-header-caption code-header-actions code-action-btn action-icon copied evenodd code-block-body--collapsed code-block-body--expanded code-fallback-plain m-0 code-editor-layer code-height-placeholder editorReady void aria-hidden code-editor-fallback-surface code-loading-placeholder loading-skeleton skeleton-line short sr-only polite status data-ssr-fallback aria-busy normalizedLanguage data-language no node.type html_inline infographic d2 d2lang configuredShowLineNumbers disableLineNumbers text-node-center paragraph-node renderNodeProp paragraph child.type classAttr node.cite children list-item pl-1.5 my-2 value list-node my-5 pl-[calc(13/8*1em)] list-decimal list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)] list right text-right table-node-wrapper table-node--loading border-[var(--table-border,#cbd5e1)] p-[calc(4/7*1em)] rowIdx bodyRows.length table-node__loading table-node__spinner isOpen strong-node emphasis strikethrough-node strikethrough highlight insert-node insert subscript-node subscript superscript-node superscript thematic-break-node cssVars image-node__img code-block-node code-block mermaid-block-node d2-block-node infographic-block-node math-block overflow-x-auto min-h-[40px] node.content $$ math-inline-wrapper math-inline reference-node bg-[hsl(var(--muted))] px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))] data-reference-id customComponents html-inline vmr-container unknown-node italic node text_special heading list_item definition_list footnote footnote_reference footnote_anchor hardbreak inline_code checkbox_input emoji thematic_break math_inline reference vmr_container label_open label_close server-renderer node-content valueAttr hr-node thematic-break in out zoom containerClass pointermove pointerup pointercancel my-8 table-node colgroup table-node__resize-handle window.matchMedia ms-tooltip z-[9999] inline-block text-base py-2 px-3 shadow-md whitespace-nowrap pointer-events-none tooltip-element text-white border-gray-700 tooltip event.key text-node [mermaidWorkerClient] messageerror cleared worker inject via busy timed canParse findPrefix javascript typescript go python ruby shell powershell plain cpp csharp objectivec objectivecpp yaml markdown rust kotlin java cs php sql zsh objective-c objective-cpp [markstream-react] htmlPreviewSandbox contains both allow-scripts and this only fully trusted content served an isolated en utf-8 viewport content="width=device-width initial-scale=1 html-preview-frame__backdrop--dark html-preview-frame--dark html-preview-frame__header html-preview-frame__title html-preview-frame__dot html-preview-frame__label html-preview-frame__close--dark html-preview-frame__iframe no-referrer about:blank tag_open token.type self_closing child key ref className ms-html tag_close parse dynamic template html-inline-node html-inline-node--loading loose strict viewBox gantt open-modal [data-mermaid-wrapper] mermaid-action-btn toggle-mode common.zoomIn common.zoomOut common.resetZoom transition-[height] duration-150 ease-out data-mermaid-wrapper mermaid-loading mermaid-spinner diagram… mermaid-block-header space-x-2 space-x-1 common.preview common.source common.export mermaid-error hasRenderedOnce mermaid-block modeContainerRef mermaid-modal-overlay mermaid-modal-panel mermaid-modal-header mermaid-modal-title mermaid-modal-close mermaid-modal-body modalContentRef mermaid-modal-content available default abort thinking htmlFor markstream-react-d2 role aria-describedby [katexWorkerClient] init cache-hit timeout waiting slot npm development process document value?.useMonaco stream-diffs/markstream monospace hunk !options.preserveBlankKind context removed added markstream-pre__diff-pane--inline original markstream-pre__diff-pane--original modified markstream-pre__diff-pane--modified ui-monospace fontFamily markstream-pre--line-numbers markstream-pre--diff-preview markstream-pre--diff-inline showLineNumbers markstream-pre__diff-code line.empty markstream-pre__diff-line--empty markstream-pre__diff-rail markstream-pre__diff-number markstream-pre__diff-content markstream-pre__diff-content-inner markstream-pre__line-numbers markstream-pre__line-numbers-text markstream-pre__code sequencediagram classdiagram kind statediagram erdiagram flowchart graph prototype constructor normalizedType katex mathRef math-inline--hidden math-inline__loading math-inline__spinner rendering math-rendering globalThis.requestAnimationFrame globalThis.cancelAnimationFrame module did expected °C`;
|
|
2
2
|
export default safeList;
|
|
@@ -68,6 +68,8 @@ export interface CodeBlockOptions {
|
|
|
68
68
|
export interface CodeBlockNodeProps extends CommonCodeBlockProps {
|
|
69
69
|
node: CodeBlockNode;
|
|
70
70
|
codeBlockOptions?: CodeBlockOptions;
|
|
71
|
+
/** Overrides browser clipboard writes. Copy feedback and events wait for completion. */
|
|
72
|
+
clipboardWriter?: (text: string) => void | Promise<void>;
|
|
71
73
|
isDark?: boolean;
|
|
72
74
|
loading?: boolean;
|
|
73
75
|
stream?: boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markstream-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.18",
|
|
5
5
|
"description": "React/Next.js streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, long documents, Mermaid, KaTeX, stream-diffs powered code blocks, and custom React components.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"dependencies": {
|
|
109
109
|
"@floating-ui/dom": "^1.8.0",
|
|
110
110
|
"clsx": "^2.1.1",
|
|
111
|
-
"markstream-core": "2.0.
|
|
111
|
+
"markstream-core": "2.0.18",
|
|
112
112
|
"stream-markdown-parser": "1.2.19"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|