@willbooster/monaco-react 1.0.8 → 1.0.9

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.
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("react"),t=require("../MonacoContainer/index.cjs"),n=require("../hooks/useMount/index.cjs"),o=require("../hooks/useUpdate/index.cjs"),i=require("../hooks/useMonaco/index.cjs"),u=require("../utils/index.cjs"),l=require("react/jsx-runtime");function a(r){const n=i();if(!n){const{width:e="100%",height:n="100%",loading:o="Loading...",className:i,wrapperProps:u={}}=r;return l.jsx(t,{width:e,height:n,isEditorReady:!1,loading:o,className:i,wrapperProps:u})}return l.jsx(s,e.objectSpread2(e.objectSpread2({},r),{},{monaco:n}))}function s({monaco:i,original:a,modified:s,language:d,originalLanguage:c,modifiedLanguage:g,originalModelPath:p,modifiedModelPath:f,keepCurrentOriginalModel:M=!1,keepCurrentModifiedModel:h=!1,theme:m="light",loading:x="Loading...",options:j={},height:w="100%",width:E="100%",className:v,wrapperProps:O={},beforeMount:R=u.noop,onMount:b=u.noop}){const[k,C]=r.useState(!1),P=r.useRef(null),q=r.useRef(i),L=r.useRef(null),S=r.useRef(b),N=r.useRef(R),y=r.useRef(!1);q.current=i,n(()=>()=>{P.current&&function(){const e=P.current,r=null==e?void 0:e.getModel();var t,n;null==e||e.setModel(null),null==e||e.dispose(),M||null!=r&&r.original.isDisposed()||null==r||null==(t=r.original)||t.dispose();h||null!=r&&r.modified.isDisposed()||null==r||null==(n=r.modified)||n.dispose();P.current=null,y.current=!1,C(!1)}()}),o(()=>{if(P.current&&q.current){const e=P.current.getOriginalEditor(),r=u.getOrCreateModel(q.current,a||"",c||d||"text",p||"");r!==e.getModel()&&e.setModel(r)}},[p],k),o(()=>{if(P.current&&q.current){const e=P.current.getModifiedEditor(),r=u.getOrCreateModel(q.current,s||"",g||d||"text",f||"");r!==e.getModel()&&e.setModel(r)}},[f],k),o(()=>{const e=P.current.getModifiedEditor();e.getOption(q.current.editor.EditorOption.readOnly)?e.setValue(s||""):s!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:s||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[s],k),o(()=>{var e;null==(e=P.current)||null==(e=e.getModel())||e.original.setValue(a||"")},[a],k),o(()=>{const{original:e,modified:r}=P.current.getModel();q.current.editor.setModelLanguage(e,c||d||"text"),q.current.editor.setModelLanguage(r,g||d||"text")},[d,c,g],k),o(()=>{var e;null==(e=q.current)||e.editor.setTheme(m)},[m],k),o(()=>{var e;null==(e=P.current)||e.updateOptions(j)},[j],k);const D=r.useCallback(()=>{var e;N.current(q.current);const r=u.getOrCreateModel(q.current,a||"",c||d||"text",p||""),t=u.getOrCreateModel(q.current,s||"",g||d||"text",f||"");null==(e=P.current)||e.setModel({original:r,modified:t})},[d,s,g,a,c,p,f]),V=r.useCallback(()=>{var r;!y.current&&L.current&&(P.current=q.current.editor.createDiffEditor(L.current,e.objectSpread2({automaticLayout:!0},j)),D(),null==(r=q.current)||r.editor.setTheme(m),C(!0),y.current=!0)},[j,m,D]);return r.useEffect(()=>{k&&S.current(P.current,q.current)},[k]),r.useEffect(()=>{k||V()},[k,V]),l.jsx(t,{width:E,height:w,isEditorReady:k,loading:x,_ref:L,className:v,wrapperProps:O})}module.exports=function(n){const{width:o="100%",height:i="100%",loading:u="Loading...",className:s,wrapperProps:d={}}=n;return l.jsx(r.Suspense,{fallback:l.jsx(t,{width:o,height:i,isEditorReady:!1,loading:u,className:s,wrapperProps:d}),children:l.jsx(a,e.objectSpread2({},n))})};
2
+ "use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("react"),t=require("../MonacoContainer/index.cjs"),o=require("../hooks/useMount/index.cjs"),i=require("../hooks/useUpdate/index.cjs"),n=require("../hooks/useMonaco/index.cjs"),u=require("../utils/index.cjs"),d=require("react/jsx-runtime");function l(r){const o=n();if(!o){const{width:e="100%",height:o="100%",loading:i="Loading...",className:n,wrapperProps:u={}}=r;return d.jsx(t,{width:e,height:o,isEditorReady:!1,loading:i,className:n,wrapperProps:u})}return d.jsx(a,e.objectSpread2(e.objectSpread2({},r),{},{monaco:o}))}function a({monaco:n,original:l,modified:a,language:s,originalLanguage:c,modifiedLanguage:g,originalModelPath:p,modifiedModelPath:f,keepCurrentOriginalModel:M=!1,keepCurrentModifiedModel:h=!1,theme:m="light",loading:x="Loading...",options:j={},height:E="100%",width:w="100%",className:O,wrapperProps:R={},beforeMount:b=u.noop,onMount:k=u.noop}){const[v,C]=r.useState(!1),P=r.useRef(null),q=r.useRef(n),L=r.useRef(null),S=r.useRef(k),N=r.useRef(b),y=r.useRef(!1);q.current=n,o(()=>()=>{P.current&&function(){const e=P.current,r=null==e?void 0:e.getModel();null==e||e.getOriginalEditor().setModel(null),null==e||e.getModifiedEditor().setModel(null),null==e||e.dispose(),M||null==r||!r.original||r.original.isDisposed()||r.original.isAttachedToEditor()||r.original.dispose();h||null==r||!r.modified||r.modified.isDisposed()||r.modified.isAttachedToEditor()||r.modified.dispose();P.current=null,y.current=!1,C(!1)}()}),i(()=>{if(P.current&&q.current){const e=P.current.getOriginalEditor(),r=u.getOrCreateModel(q.current,l||"",c||s||"text",p||"");r!==e.getModel()&&e.setModel(r)}},[p],v),i(()=>{if(P.current&&q.current){const e=P.current.getModifiedEditor(),r=u.getOrCreateModel(q.current,a||"",g||s||"text",f||"");r!==e.getModel()&&e.setModel(r)}},[f],v),i(()=>{const e=P.current.getModifiedEditor();e.getOption(q.current.editor.EditorOption.readOnly)?e.setValue(a||""):a!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:a||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[a],v),i(()=>{var e;null==(e=P.current)||null==(e=e.getModel())||e.original.setValue(l||"")},[l],v),i(()=>{const{original:e,modified:r}=P.current.getModel();q.current.editor.setModelLanguage(e,c||s||"text"),q.current.editor.setModelLanguage(r,g||s||"text")},[s,c,g],v),i(()=>{var e;null==(e=q.current)||e.editor.setTheme(m)},[m],v),i(()=>{var e;null==(e=P.current)||e.updateOptions(j)},[j],v);const T=r.useCallback(()=>{var e;N.current(q.current);const r=u.getOrCreateModel(q.current,l||"",c||s||"text",p||""),t=u.getOrCreateModel(q.current,a||"",g||s||"text",f||"");null==(e=P.current)||e.setModel({original:r,modified:t})},[s,a,g,l,c,p,f]),D=r.useCallback(()=>{var r;!y.current&&L.current&&(P.current=q.current.editor.createDiffEditor(L.current,e.objectSpread2({automaticLayout:!0},j)),T(),null==(r=q.current)||r.editor.setTheme(m),C(!0),y.current=!0)},[j,m,T]);return r.useEffect(()=>{v&&S.current(P.current,q.current)},[v]),r.useEffect(()=>{v||D()},[v,D]),d.jsx(t,{width:w,height:E,isEditorReady:v,loading:x,_ref:L,className:O,wrapperProps:R})}module.exports=function(o){const{width:i="100%",height:n="100%",loading:u="Loading...",className:a,wrapperProps:s={}}=o;return d.jsx(r.Suspense,{fallback:d.jsx(t,{width:i,height:n,isEditorReady:!1,loading:u,className:a,wrapperProps:s}),children:d.jsx(l,e.objectSpread2({},o))})};
3
3
  //# sourceMappingURL=DiffEditor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiffEditor.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/DiffEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,SAAS,CAAC;AAGjE,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAmBxD;eAqPc,UAAU"}
1
+ {"version":3,"file":"DiffEditor.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/DiffEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,SAAS,CAAC;AAGjE,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAmBxD;eAkQc,UAAU"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{objectSpread2 as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{Suspense as r,useState as t,useRef as o,useCallback as n,useEffect as i}from"react";import l from"../MonacoContainer/index.js";import u from"../hooks/useMount/index.js";import d from"../hooks/useUpdate/index.js";import a from"../hooks/useMonaco/index.js";import{noop as s,getOrCreateModel as c}from"../utils/index.js";import{jsx as g}from"react/jsx-runtime";function p(t){const{width:o="100%",height:n="100%",loading:i="Loading...",className:u,wrapperProps:d={}}=t;return g(r,{fallback:g(l,{width:o,height:n,isEditorReady:!1,loading:i,className:u,wrapperProps:d}),children:g(m,e({},t))})}function m(r){const t=a();if(!t){const{width:e="100%",height:t="100%",loading:o="Loading...",className:n,wrapperProps:i={}}=r;return g(l,{width:e,height:t,isEditorReady:!1,loading:o,className:n,wrapperProps:i})}return g(f,e(e({},r),{},{monaco:t}))}function f({monaco:r,original:a,modified:p,language:m,originalLanguage:f,modifiedLanguage:h,originalModelPath:M,modifiedModelPath:x,keepCurrentOriginalModel:w=!1,keepCurrentModifiedModel:v=!1,theme:E="light",loading:P="Loading...",options:j={},height:L="100%",width:k="100%",className:N,wrapperProps:O={},beforeMount:y=s,onMount:b=s}){const[R,C]=t(!1),D=o(null),V=o(r),_=o(null),S=o(b),T=o(y),U=o(!1);V.current=r,u(()=>()=>{D.current&&function(){const e=D.current,r=null==e?void 0:e.getModel();var t,o;null==e||e.setModel(null),null==e||e.dispose(),w||null!=r&&r.original.isDisposed()||null==r||null==(t=r.original)||t.dispose();v||null!=r&&r.modified.isDisposed()||null==r||null==(o=r.modified)||o.dispose();D.current=null,U.current=!1,C(!1)}()}),d(()=>{if(D.current&&V.current){const e=D.current.getOriginalEditor(),r=c(V.current,a||"",f||m||"text",M||"");r!==e.getModel()&&e.setModel(r)}},[M],R),d(()=>{if(D.current&&V.current){const e=D.current.getModifiedEditor(),r=c(V.current,p||"",h||m||"text",x||"");r!==e.getModel()&&e.setModel(r)}},[x],R),d(()=>{const e=D.current.getModifiedEditor();e.getOption(V.current.editor.EditorOption.readOnly)?e.setValue(p||""):p!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:p||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[p],R),d(()=>{var e;null==(e=D.current)||null==(e=e.getModel())||e.original.setValue(a||"")},[a],R),d(()=>{const{original:e,modified:r}=D.current.getModel();V.current.editor.setModelLanguage(e,f||m||"text"),V.current.editor.setModelLanguage(r,h||m||"text")},[m,f,h],R),d(()=>{var e;null==(e=V.current)||e.editor.setTheme(E)},[E],R),d(()=>{var e;null==(e=D.current)||e.updateOptions(j)},[j],R);const B=n(()=>{var e;T.current(V.current);const r=c(V.current,a||"",f||m||"text",M||""),t=c(V.current,p||"",h||m||"text",x||"");null==(e=D.current)||e.setModel({original:r,modified:t})},[m,p,h,a,f,M,x]),F=n(()=>{var r;!U.current&&_.current&&(D.current=V.current.editor.createDiffEditor(_.current,e({automaticLayout:!0},j)),B(),null==(r=V.current)||r.editor.setTheme(E),C(!0),U.current=!0)},[j,E,B]);return i(()=>{R&&S.current(D.current,V.current)},[R]),i(()=>{R||F()},[R,F]),g(l,{width:k,height:L,isEditorReady:R,loading:P,_ref:_,className:N,wrapperProps:O})}export{p as default};
2
+ import{objectSpread2 as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{Suspense as r,useState as t,useRef as o,useCallback as i,useEffect as n}from"react";import d from"../MonacoContainer/index.js";import l from"../hooks/useMount/index.js";import a from"../hooks/useUpdate/index.js";import u from"../hooks/useMonaco/index.js";import{noop as s,getOrCreateModel as c}from"../utils/index.js";import{jsx as g}from"react/jsx-runtime";function p(t){const{width:o="100%",height:i="100%",loading:n="Loading...",className:l,wrapperProps:a={}}=t;return g(r,{fallback:g(d,{width:o,height:i,isEditorReady:!1,loading:n,className:l,wrapperProps:a}),children:g(m,e({},t))})}function m(r){const t=u();if(!t){const{width:e="100%",height:t="100%",loading:o="Loading...",className:i,wrapperProps:n={}}=r;return g(d,{width:e,height:t,isEditorReady:!1,loading:o,className:i,wrapperProps:n})}return g(f,e(e({},r),{},{monaco:t}))}function f({monaco:r,original:u,modified:p,language:m,originalLanguage:f,modifiedLanguage:h,originalModelPath:M,modifiedModelPath:x,keepCurrentOriginalModel:E=!1,keepCurrentModifiedModel:w=!1,theme:P="light",loading:j="Loading...",options:v={},height:L="100%",width:k="100%",className:O,wrapperProps:N={},beforeMount:y=s,onMount:b=s}){const[R,T]=t(!1),C=o(null),D=o(r),V=o(null),_=o(b),A=o(y),S=o(!1);D.current=r,l(()=>()=>{C.current&&function(){const e=C.current,r=null==e?void 0:e.getModel();null==e||e.getOriginalEditor().setModel(null),null==e||e.getModifiedEditor().setModel(null),null==e||e.dispose(),E||null==r||!r.original||r.original.isDisposed()||r.original.isAttachedToEditor()||r.original.dispose();w||null==r||!r.modified||r.modified.isDisposed()||r.modified.isAttachedToEditor()||r.modified.dispose();C.current=null,S.current=!1,T(!1)}()}),a(()=>{if(C.current&&D.current){const e=C.current.getOriginalEditor(),r=c(D.current,u||"",f||m||"text",M||"");r!==e.getModel()&&e.setModel(r)}},[M],R),a(()=>{if(C.current&&D.current){const e=C.current.getModifiedEditor(),r=c(D.current,p||"",h||m||"text",x||"");r!==e.getModel()&&e.setModel(r)}},[x],R),a(()=>{const e=C.current.getModifiedEditor();e.getOption(D.current.editor.EditorOption.readOnly)?e.setValue(p||""):p!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:p||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[p],R),a(()=>{var e;null==(e=C.current)||null==(e=e.getModel())||e.original.setValue(u||"")},[u],R),a(()=>{const{original:e,modified:r}=C.current.getModel();D.current.editor.setModelLanguage(e,f||m||"text"),D.current.editor.setModelLanguage(r,h||m||"text")},[m,f,h],R),a(()=>{var e;null==(e=D.current)||e.editor.setTheme(P)},[P],R),a(()=>{var e;null==(e=C.current)||e.updateOptions(v)},[v],R);const U=i(()=>{var e;A.current(D.current);const r=c(D.current,u||"",f||m||"text",M||""),t=c(D.current,p||"",h||m||"text",x||"");null==(e=C.current)||e.setModel({original:r,modified:t})},[m,p,h,u,f,M,x]),B=i(()=>{var r;!S.current&&V.current&&(C.current=D.current.editor.createDiffEditor(V.current,e({automaticLayout:!0},v)),U(),null==(r=D.current)||r.editor.setTheme(P),T(!0),S.current=!0)},[v,P,U]);return n(()=>{R&&_.current(C.current,D.current)},[R]),n(()=>{R||B()},[R,B]),g(d,{width:k,height:L,isEditorReady:R,loading:j,_ref:V,className:O,wrapperProps:N})}export{p as default};
3
3
  //# sourceMappingURL=DiffEditor.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("react"),t=require("../hooks/useMount/index.cjs"),n=require("../hooks/useUpdate/index.cjs"),u=require("../hooks/usePrevious/index.cjs"),o=require("../hooks/useMonaco/index.cjs"),s=require("../utils/index.cjs"),a=require("../MonacoContainer/index.cjs"),i=require("react/jsx-runtime");const c=new Map;function l(r){const t=o();if(!t){const{width:e="100%",height:t="100%",loading:n="Loading...",className:u,wrapperProps:o={}}=r;return i.jsx(a,{width:e,height:t,isEditorReady:!1,loading:n,className:u,wrapperProps:o})}return i.jsx(d,e.objectSpread2(e.objectSpread2({},r),{},{monaco:t}))}function d({monaco:o,defaultValue:l,defaultLanguage:d,defaultPath:p,value:g,language:h,path:f,theme:v="light",line:M,loading:j="Loading...",options:w={},overrideServices:x={},saveViewState:m=!0,keepCurrentModel:R=!1,width:S="100%",height:k="100%",className:V,wrapperProps:q={},beforeMount:C=s.noop,onMount:E=s.noop,onChange:P,onValidate:b=s.noop}){const[L,N]=r.useState(!1),O=r.useRef(o),y=r.useRef(void 0),_=r.useRef(null),D=r.useRef(E),T=r.useRef(C),U=r.useRef(void 0),B=r.useRef(g),F=u(f),H=r.useRef(!1),z=r.useRef(!1);O.current=o,t(()=>()=>{y.current&&function(){var e,r;null==(e=U.current)||e.dispose(),R?m&&c.set(f,y.current.saveViewState()):null==(r=y.current.getModel())||r.dispose();y.current.dispose(),y.current=void 0,H.current=!1,N(!1)}()}),n(()=>{var e;const r=s.getOrCreateModel(O.current,l||g||"",d||h||"",f||p||"");var t,n,u;r!==(null==(e=y.current)?void 0:e.getModel())&&(m&&c.set(F,null==(t=y.current)?void 0:t.saveViewState()),null==(n=y.current)||n.setModel(r),m&&(null==(u=y.current)||u.restoreViewState(c.get(f))))},[f],L),n(()=>{var e;null==(e=y.current)||e.updateOptions(w)},[w],L),n(()=>{y.current&&void 0!==g&&(y.current.getOption(O.current.editor.EditorOption.readOnly)?y.current.setValue(g):g!==y.current.getValue()&&(z.current=!0,y.current.executeEdits("",[{range:y.current.getModel().getFullModelRange(),text:g,forceMoveMarkers:!0}]),y.current.pushUndoStop(),z.current=!1))},[g],L),n(()=>{var e;const r=null==(e=y.current)?void 0:e.getModel();var t;L&&r&&h&&(null==(t=O.current)||t.editor.setModelLanguage(r,h))},[h,L],L),n(()=>{var e;void 0!==M&&(null==(e=y.current)||e.revealLine(M))},[M],L),n(()=>{var e;null==(e=O.current)||e.editor.setTheme(v)},[v],L);const A=r.useCallback(()=>{if(_.current&&!H.current){T.current(O.current);const r=f||p,t=s.getOrCreateModel(O.current,g||l||"",d||h||"",r||""),n=O.current.editor.create(_.current,e.objectSpread2({model:t,automaticLayout:!0},w),x);y.current=n,m&&n.restoreViewState(c.get(r)),O.current.editor.setTheme(v),void 0!==M&&n.revealLine(M),N(!0),H.current=!0}},[l,d,p,g,h,f,w,x,m,v,M]);return r.useEffect(()=>{L&&D.current(y.current,O.current)},[L]),r.useEffect(()=>{L||A()},[L,A]),B.current=g,r.useEffect(()=>{var e,r;L&&P&&(null==(e=U.current)||e.dispose(),U.current=null==(r=y.current)?void 0:r.onDidChangeModelContent(e=>{z.current||P(y.current.getValue(),e)}))},[L,P]),r.useEffect(()=>{if(L){const e=O.current.editor.onDidChangeMarkers(e=>{var r;const t=null==(r=y.current.getModel())?void 0:r.uri;if(t){if(e.find(e=>e.path===t.path)){const e=O.current.editor.getModelMarkers({resource:t});null==b||b(e)}}});return()=>{null==e||e.dispose()}}return()=>{}},[L,b]),i.jsx(a,{width:S,height:k,isEditorReady:L,loading:j,_ref:_,className:V,wrapperProps:q})}module.exports=function(t){const{width:n="100%",height:u="100%",loading:o="Loading...",className:s,wrapperProps:c={}}=t;return i.jsx(r.Suspense,{fallback:i.jsx(a,{width:n,height:u,isEditorReady:!1,loading:o,className:s,wrapperProps:c}),children:i.jsx(l,e.objectSpread2({},t))})};
2
+ "use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("react"),t=require("../hooks/useMount/index.cjs"),n=require("../hooks/useUpdate/index.cjs"),u=require("../hooks/usePrevious/index.cjs"),o=require("../hooks/useMonaco/index.cjs"),s=require("../utils/index.cjs"),i=require("../MonacoContainer/index.cjs"),a=require("react/jsx-runtime");const c=new Map;function l(r){const t=o();if(!t){const{width:e="100%",height:t="100%",loading:n="Loading...",className:u,wrapperProps:o={}}=r;return a.jsx(i,{width:e,height:t,isEditorReady:!1,loading:n,className:u,wrapperProps:o})}return a.jsx(d,e.objectSpread2(e.objectSpread2({},r),{},{monaco:t}))}function d({monaco:o,defaultValue:l,defaultLanguage:d,defaultPath:p,value:g,language:h,path:f,theme:v="light",line:M,loading:j="Loading...",options:w={},overrideServices:x={},saveViewState:m=!0,keepCurrentModel:R=!1,width:S="100%",height:k="100%",className:E,wrapperProps:V={},beforeMount:q=s.noop,onMount:C=s.noop,onChange:P,onValidate:b=s.noop}){const[L,N]=r.useState(!1),O=r.useRef(o),y=r.useRef(void 0),D=r.useRef(null),T=r.useRef(C),_=r.useRef(q),U=r.useRef(void 0),A=r.useRef(g),B=u(f),F=r.useRef(!1),H=r.useRef(!1);O.current=o,t(()=>()=>{y.current&&function(){var e;null==(e=U.current)||e.dispose();const r=y.current,t=r.getModel();R?(m&&c.set(f,r.saveViewState()),r.setModel(null)):t&&(r.setModel(null),t.isDisposed()||t.isAttachedToEditor()||t.dispose());r.dispose(),y.current=void 0,F.current=!1,N(!1)}()}),n(()=>{var e;const r=s.getOrCreateModel(O.current,l||g||"",d||h||"",f||p||"");var t,n,u;r!==(null==(e=y.current)?void 0:e.getModel())&&(m&&c.set(B,null==(t=y.current)?void 0:t.saveViewState()),null==(n=y.current)||n.setModel(r),m&&(null==(u=y.current)||u.restoreViewState(c.get(f))))},[f],L),n(()=>{var e;null==(e=y.current)||e.updateOptions(w)},[w],L),n(()=>{y.current&&void 0!==g&&(y.current.getOption(O.current.editor.EditorOption.readOnly)?y.current.setValue(g):g!==y.current.getValue()&&(H.current=!0,y.current.executeEdits("",[{range:y.current.getModel().getFullModelRange(),text:g,forceMoveMarkers:!0}]),y.current.pushUndoStop(),H.current=!1))},[g],L),n(()=>{var e;const r=null==(e=y.current)?void 0:e.getModel();var t;L&&r&&h&&(null==(t=O.current)||t.editor.setModelLanguage(r,h))},[h,L],L),n(()=>{var e;void 0!==M&&(null==(e=y.current)||e.revealLine(M))},[M],L),n(()=>{var e;null==(e=O.current)||e.editor.setTheme(v)},[v],L);const z=r.useCallback(()=>{if(D.current&&!F.current){_.current(O.current);const r=f||p,t=s.getOrCreateModel(O.current,g||l||"",d||h||"",r||""),n=O.current.editor.create(D.current,e.objectSpread2({model:t,automaticLayout:!0},w),x);y.current=n,m&&n.restoreViewState(c.get(r)),O.current.editor.setTheme(v),void 0!==M&&n.revealLine(M),N(!0),F.current=!0}},[l,d,p,g,h,f,w,x,m,v,M]);return r.useEffect(()=>{L&&T.current(y.current,O.current)},[L]),r.useEffect(()=>{L||z()},[L,z]),A.current=g,r.useEffect(()=>{var e,r;L&&P&&(null==(e=U.current)||e.dispose(),U.current=null==(r=y.current)?void 0:r.onDidChangeModelContent(e=>{H.current||P(y.current.getValue(),e)}))},[L,P]),r.useEffect(()=>{if(L){const e=O.current.editor.onDidChangeMarkers(e=>{var r;const t=null==(r=y.current.getModel())?void 0:r.uri;if(t){if(e.find(e=>e.path===t.path)){const e=O.current.editor.getModelMarkers({resource:t});null==b||b(e)}}});return()=>{null==e||e.dispose()}}return()=>{}},[L,b]),a.jsx(i,{width:S,height:k,isEditorReady:L,loading:j,_ref:D,className:E,wrapperProps:V})}module.exports=function(t){const{width:n="100%",height:u="100%",loading:o="Loading...",className:s,wrapperProps:c={}}=t;return a.jsx(r.Suspense,{fallback:a.jsx(i,{width:n,height:u,isEditorReady:!1,loading:o,className:s,wrapperProps:c}),children:a.jsx(l,e.objectSpread2({},t))})};
3
3
  //# sourceMappingURL=Editor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/Editor/Editor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAmBhD;eAgSc,MAAM"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/Editor/Editor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAmBhD;eAySc,MAAM"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{objectSpread2 as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{Suspense as r,useState as t,useRef as n,useCallback as o,useEffect as u}from"react";import i from"../hooks/useMount/index.js";import a from"../hooks/useUpdate/index.js";import c from"../hooks/usePrevious/index.js";import l from"../hooks/useMonaco/index.js";import{noop as s,getOrCreateModel as d}from"../utils/index.js";import p from"../MonacoContainer/index.js";import{jsx as g}from"react/jsx-runtime";const h=new Map;function m(t){const{width:n="100%",height:o="100%",loading:u="Loading...",className:i,wrapperProps:a={}}=t;return g(r,{fallback:g(p,{width:n,height:o,isEditorReady:!1,loading:u,className:i,wrapperProps:a}),children:g(v,e({},t))})}function v(r){const t=l();if(!t){const{width:e="100%",height:t="100%",loading:n="Loading...",className:o,wrapperProps:u={}}=r;return g(p,{width:e,height:t,isEditorReady:!1,loading:n,className:o,wrapperProps:u})}return g(f,e(e({},r),{},{monaco:t}))}function f({monaco:r,defaultValue:l,defaultLanguage:m,defaultPath:v,value:f,language:M,path:w,theme:x="light",line:V,loading:j="Loading...",options:k={},overrideServices:P={},saveViewState:L=!0,keepCurrentModel:S=!1,width:C="100%",height:N="100%",className:y,wrapperProps:E={},beforeMount:b=s,onMount:O=s,onChange:R,onValidate:_=s}){const[D,T]=t(!1),U=n(r),B=n(void 0),F=n(null),H=n(O),q=n(b),z=n(void 0),A=n(f),G=c(w),I=n(!1),J=n(!1);U.current=r,i(()=>()=>{B.current&&function(){var e,r;null==(e=z.current)||e.dispose(),S?L&&h.set(w,B.current.saveViewState()):null==(r=B.current.getModel())||r.dispose();B.current.dispose(),B.current=void 0,I.current=!1,T(!1)}()}),a(()=>{var e;const r=d(U.current,l||f||"",m||M||"",w||v||"");var t,n,o;r!==(null==(e=B.current)?void 0:e.getModel())&&(L&&h.set(G,null==(t=B.current)?void 0:t.saveViewState()),null==(n=B.current)||n.setModel(r),L&&(null==(o=B.current)||o.restoreViewState(h.get(w))))},[w],D),a(()=>{var e;null==(e=B.current)||e.updateOptions(k)},[k],D),a(()=>{B.current&&void 0!==f&&(B.current.getOption(U.current.editor.EditorOption.readOnly)?B.current.setValue(f):f!==B.current.getValue()&&(J.current=!0,B.current.executeEdits("",[{range:B.current.getModel().getFullModelRange(),text:f,forceMoveMarkers:!0}]),B.current.pushUndoStop(),J.current=!1))},[f],D),a(()=>{var e;const r=null==(e=B.current)?void 0:e.getModel();var t;D&&r&&M&&(null==(t=U.current)||t.editor.setModelLanguage(r,M))},[M,D],D),a(()=>{var e;void 0!==V&&(null==(e=B.current)||e.revealLine(V))},[V],D),a(()=>{var e;null==(e=U.current)||e.editor.setTheme(x)},[x],D);const K=o(()=>{if(F.current&&!I.current){q.current(U.current);const r=w||v,t=d(U.current,f||l||"",m||M||"",r||""),n=U.current.editor.create(F.current,e({model:t,automaticLayout:!0},k),P);B.current=n,L&&n.restoreViewState(h.get(r)),U.current.editor.setTheme(x),void 0!==V&&n.revealLine(V),T(!0),I.current=!0}},[l,m,v,f,M,w,k,P,L,x,V]);return u(()=>{D&&H.current(B.current,U.current)},[D]),u(()=>{D||K()},[D,K]),A.current=f,u(()=>{var e,r;D&&R&&(null==(e=z.current)||e.dispose(),z.current=null==(r=B.current)?void 0:r.onDidChangeModelContent(e=>{J.current||R(B.current.getValue(),e)}))},[D,R]),u(()=>{if(D){const e=U.current.editor.onDidChangeMarkers(e=>{var r;const t=null==(r=B.current.getModel())?void 0:r.uri;if(t){if(e.find(e=>e.path===t.path)){const e=U.current.editor.getModelMarkers({resource:t});null==_||_(e)}}});return()=>{null==e||e.dispose()}}return()=>{}},[D,_]),g(p,{width:C,height:N,isEditorReady:D,loading:j,_ref:F,className:y,wrapperProps:E})}export{m as default};
2
+ import{objectSpread2 as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{Suspense as r,useState as t,useRef as n,useCallback as o,useEffect as u}from"react";import i from"../hooks/useMount/index.js";import a from"../hooks/useUpdate/index.js";import s from"../hooks/usePrevious/index.js";import l from"../hooks/useMonaco/index.js";import{noop as c,getOrCreateModel as d}from"../utils/index.js";import p from"../MonacoContainer/index.js";import{jsx as g}from"react/jsx-runtime";const h=new Map;function m(t){const{width:n="100%",height:o="100%",loading:u="Loading...",className:i,wrapperProps:a={}}=t;return g(r,{fallback:g(p,{width:n,height:o,isEditorReady:!1,loading:u,className:i,wrapperProps:a}),children:g(v,e({},t))})}function v(r){const t=l();if(!t){const{width:e="100%",height:t="100%",loading:n="Loading...",className:o,wrapperProps:u={}}=r;return g(p,{width:e,height:t,isEditorReady:!1,loading:n,className:o,wrapperProps:u})}return g(f,e(e({},r),{},{monaco:t}))}function f({monaco:r,defaultValue:l,defaultLanguage:m,defaultPath:v,value:f,language:M,path:w,theme:x="light",line:V,loading:j="Loading...",options:k={},overrideServices:P={},saveViewState:L=!0,keepCurrentModel:S=!1,width:C="100%",height:E="100%",className:N,wrapperProps:y={},beforeMount:b=c,onMount:O=c,onChange:R,onValidate:D=c}){const[T,_]=t(!1),U=n(r),A=n(void 0),B=n(null),F=n(O),H=n(b),q=n(void 0),z=n(f),G=s(w),I=n(!1),J=n(!1);U.current=r,i(()=>()=>{A.current&&function(){var e;null==(e=q.current)||e.dispose();const r=A.current,t=r.getModel();S?(L&&h.set(w,r.saveViewState()),r.setModel(null)):t&&(r.setModel(null),t.isDisposed()||t.isAttachedToEditor()||t.dispose());r.dispose(),A.current=void 0,I.current=!1,_(!1)}()}),a(()=>{var e;const r=d(U.current,l||f||"",m||M||"",w||v||"");var t,n,o;r!==(null==(e=A.current)?void 0:e.getModel())&&(L&&h.set(G,null==(t=A.current)?void 0:t.saveViewState()),null==(n=A.current)||n.setModel(r),L&&(null==(o=A.current)||o.restoreViewState(h.get(w))))},[w],T),a(()=>{var e;null==(e=A.current)||e.updateOptions(k)},[k],T),a(()=>{A.current&&void 0!==f&&(A.current.getOption(U.current.editor.EditorOption.readOnly)?A.current.setValue(f):f!==A.current.getValue()&&(J.current=!0,A.current.executeEdits("",[{range:A.current.getModel().getFullModelRange(),text:f,forceMoveMarkers:!0}]),A.current.pushUndoStop(),J.current=!1))},[f],T),a(()=>{var e;const r=null==(e=A.current)?void 0:e.getModel();var t;T&&r&&M&&(null==(t=U.current)||t.editor.setModelLanguage(r,M))},[M,T],T),a(()=>{var e;void 0!==V&&(null==(e=A.current)||e.revealLine(V))},[V],T),a(()=>{var e;null==(e=U.current)||e.editor.setTheme(x)},[x],T);const K=o(()=>{if(B.current&&!I.current){H.current(U.current);const r=w||v,t=d(U.current,f||l||"",m||M||"",r||""),n=U.current.editor.create(B.current,e({model:t,automaticLayout:!0},k),P);A.current=n,L&&n.restoreViewState(h.get(r)),U.current.editor.setTheme(x),void 0!==V&&n.revealLine(V),_(!0),I.current=!0}},[l,m,v,f,M,w,k,P,L,x,V]);return u(()=>{T&&F.current(A.current,U.current)},[T]),u(()=>{T||K()},[T,K]),z.current=f,u(()=>{var e,r;T&&R&&(null==(e=q.current)||e.dispose(),q.current=null==(r=A.current)?void 0:r.onDidChangeModelContent(e=>{J.current||R(A.current.getValue(),e)}))},[T,R]),u(()=>{if(T){const e=U.current.editor.onDidChangeMarkers(e=>{var r;const t=null==(r=A.current.getModel())?void 0:r.uri;if(t){if(e.find(e=>e.path===t.path)){const e=U.current.editor.getModelMarkers({resource:t});null==D||D(e)}}});return()=>{null==e||e.dispose()}}return()=>{}},[T,D]),g(p,{width:C,height:E,isEditorReady:T,loading:j,_ref:B,className:N,wrapperProps:y})}export{m as default};
3
3
  //# sourceMappingURL=Editor.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/monaco-react",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins",
5
5
  "keywords": [
6
6
  "code",
@@ -53,7 +53,7 @@
53
53
  "verify-full": "wb verify --full"
54
54
  },
55
55
  "dependencies": {
56
- "@willbooster/monaco-loader": "1.1.2",
56
+ "@willbooster/monaco-loader": "1.1.3",
57
57
  "monaco-editor": "0.55.1"
58
58
  },
59
59
  "devDependencies": {
@@ -68,28 +68,27 @@
68
68
  "@types/react-dom": "19.2.3",
69
69
  "@typescript/native-preview": "7.0.0-dev.20260421.2",
70
70
  "@willbooster/oxfmt-config": "1.2.2",
71
- "@willbooster/oxlint-config": "1.4.6",
72
- "@willbooster/wb": "13.20.0",
73
- "build-ts": "17.1.15",
71
+ "@willbooster/oxlint-config": "1.4.8",
72
+ "@willbooster/wb": "13.22.18",
73
+ "build-ts": "17.1.26",
74
74
  "conventional-changelog-conventionalcommits": "9.3.1",
75
75
  "jsdom": "29.0.2",
76
- "lefthook": "2.1.6",
76
+ "lefthook": "2.1.9",
77
77
  "next": "16.2.4",
78
- "oxfmt": "0.50.0",
79
- "oxlint": "1.65.0",
80
- "oxlint-tsgolint": "0.22.1",
81
- "prettier": "3.8.3",
78
+ "oxfmt": "0.56.0",
79
+ "oxlint": "1.71.0",
80
+ "oxlint-tsgolint": "0.23.0",
82
81
  "react": "19.2.5",
83
82
  "react-dom": "19.2.5",
84
83
  "semantic-release": "25.0.3",
85
- "sort-package-json": "3.6.1",
84
+ "sort-package-json": "4.0.0",
86
85
  "vitest": "4.1.4"
87
86
  },
88
87
  "peerDependencies": {
89
88
  "react": "^19.0.0",
90
89
  "react-dom": "^19.0.0"
91
90
  },
92
- "packageManager": "yarn@4.15.0",
91
+ "packageManager": "yarn@4.17.0",
93
92
  "engines": {
94
93
  "node": ">=24"
95
94
  },