@willbooster/monaco-react 1.0.5 → 1.0.7
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/README.md +2 -1
- package/dist/DiffEditor/DiffEditor.cjs +1 -1
- package/dist/DiffEditor/DiffEditor.d.ts +1 -1
- package/dist/DiffEditor/DiffEditor.d.ts.map +1 -1
- package/dist/DiffEditor/DiffEditor.js +1 -1
- package/dist/DiffEditor/index.d.ts.map +1 -1
- package/dist/Editor/Editor.cjs +1 -1
- package/dist/Editor/Editor.d.ts +1 -1
- package/dist/Editor/Editor.d.ts.map +1 -1
- package/dist/Editor/Editor.js +1 -1
- package/dist/Editor/index.d.ts.map +1 -1
- package/dist/Loading/Loading.d.ts.map +1 -1
- package/dist/Loading/index.d.ts.map +1 -1
- package/dist/Loading/styles.d.ts.map +1 -1
- package/dist/MonacoContainer/MonacoContainer.d.ts +1 -1
- package/dist/MonacoContainer/MonacoContainer.d.ts.map +1 -1
- package/dist/MonacoContainer/index.d.ts.map +1 -1
- package/dist/MonacoContainer/styles.d.ts.map +1 -1
- package/dist/MonacoContainer/types.d.ts +1 -1
- package/dist/MonacoContainer/types.d.ts.map +1 -1
- package/dist/hooks/useMonaco/index.cjs +1 -1
- package/dist/hooks/useMonaco/index.cjs.map +1 -1
- package/dist/hooks/useMonaco/index.d.ts.map +1 -1
- package/dist/hooks/useMonaco/index.js +1 -1
- package/dist/hooks/useMonaco/index.js.map +1 -1
- package/dist/hooks/useMonaco/initMonaco.cjs +2 -0
- package/dist/hooks/useMonaco/initMonaco.cjs.map +1 -0
- package/dist/hooks/useMonaco/initMonaco.d.ts +4 -0
- package/dist/hooks/useMonaco/initMonaco.d.ts.map +1 -0
- package/dist/hooks/useMonaco/initMonaco.js +2 -0
- package/dist/hooks/useMonaco/initMonaco.js.map +1 -0
- package/dist/hooks/useMount/index.d.ts.map +1 -1
- package/dist/hooks/usePrevious/index.d.ts.map +1 -1
- package/dist/hooks/useUpdate/index.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +27 -25
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/WillBooster/monaco-react/actions/workflows/test.yml)
|
|
4
4
|
[](https://github.com/semantic-release/semantic-release)
|
|
5
|
+
|
|
5
6
|
[](https://www.npmjs.com/package/@willbooster/monaco-react)
|
|
6
7
|
[](https://www.npmjs.com/package/@willbooster/monaco-react)
|
|
7
8
|
|
|
@@ -39,7 +40,7 @@ import Editor, { DiffEditor, loader, useMonaco } from '@willbooster/monaco-react
|
|
|
39
40
|
|
|
40
41
|
- `Editor`: Monaco standalone code editor component.
|
|
41
42
|
- `DiffEditor`: Monaco standalone diff editor component.
|
|
42
|
-
- `useMonaco`: React hook returning the initialized Monaco instance.
|
|
43
|
+
- `useMonaco`: React hook returning the initialized Monaco instance after hydration. Wrap components that call it in `Suspense`.
|
|
43
44
|
- `loader`: the `@willbooster/monaco-loader` instance used by the components.
|
|
44
45
|
|
|
45
46
|
### Editor
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("react"),t=require("
|
|
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))})};
|
|
3
3
|
//# sourceMappingURL=DiffEditor.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { DiffEditorProps } from './types';
|
|
3
|
-
declare function DiffEditor(
|
|
3
|
+
declare function DiffEditor(props: DiffEditorProps): ReactElement;
|
|
4
4
|
export default DiffEditor;
|
|
5
5
|
//# sourceMappingURL=DiffEditor.d.ts.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,
|
|
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,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{objectSpread2 as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{
|
|
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};
|
|
3
3
|
//# sourceMappingURL=DiffEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/index.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,cAAc,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/index.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,cAAc,SAAS,CAAC"}
|
package/dist/Editor/Editor.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("react"),t=require("
|
|
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))})};
|
|
3
3
|
//# sourceMappingURL=Editor.cjs.map
|
package/dist/Editor/Editor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { EditorProps } from './types';
|
|
3
|
-
declare function Editor(
|
|
3
|
+
declare function Editor(props: EditorProps): ReactElement;
|
|
4
4
|
export default Editor;
|
|
5
5
|
//# sourceMappingURL=Editor.d.ts.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,
|
|
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"}
|
package/dist/Editor/Editor.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{objectSpread2 as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{
|
|
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};
|
|
3
3
|
//# sourceMappingURL=Editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Editor/index.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,cAAc,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Editor/index.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,cAAc,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../src/Loading/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI7D,iBAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAE9D;
|
|
1
|
+
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../src/Loading/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI7D,iBAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAE9D;eAEc,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Loading/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Loading/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;eAEjB,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/Loading/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAQzC,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/Loading/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAQzC,CAAC;eAEa,MAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ContainerProps } from './types';
|
|
3
|
-
declare function MonacoContainer({ width, height, isEditorReady, loading, _ref, className, wrapperProps }: ContainerProps): ReactElement;
|
|
3
|
+
declare function MonacoContainer({ width, height, isEditorReady, loading, _ref, className, wrapperProps, }: ContainerProps): ReactElement;
|
|
4
4
|
export default MonacoContainer;
|
|
5
5
|
//# sourceMappingURL=MonacoContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonacoContainer.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/MonacoContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,MAAM,EACN,aAAa,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,YAAY,
|
|
1
|
+
{"version":3,"file":"MonacoContainer.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/MonacoContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,MAAM,EACN,aAAa,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,YAAY,GACb,EAAE,cAAc,GAAG,YAAY,CAO/B;eAEc,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/index.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/index.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAYzC,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAYzC,CAAC;eAEa,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react"),r=require("
|
|
1
|
+
"use strict";var e=require("react"),r=require("./initMonaco.cjs");function t(e){const r=setTimeout(e,0);return()=>{clearTimeout(r)}}function n(){return!0}function u(){return!1}module.exports=function(){if(e.useSyncExternalStore(t,n,u))return e.use(r())};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import { use, useSyncExternalStore } from 'react';\n\nimport type { Monaco } from '../..';\nimport initMonaco from './initMonaco';\n\nfunction useMonaco(): Monaco | undefined {\n const isHydrated = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);\n\n if (!isHydrated) {\n return undefined;\n }\n\n return use(initMonaco());\n}\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const timeoutId = setTimeout(onStoreChange, 0);\n\n return () => {\n clearTimeout(timeoutId);\n };\n}\n\nfunction getClientSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport default useMonaco;\n"],"names":["subscribe","onStoreChange","timeoutId","setTimeout","clearTimeout","getClientSnapshot","getServerSnapshot","useSyncExternalStore","use","initMonaco"],"mappings":"kEAeA,SAASA,EAAUC,GACjB,MAAMC,EAAYC,WAAWF,EAAe,GAE5C,MAAO,KACLG,aAAaF,GAEjB,CAEA,SAASG,IACP,OAAO,CACT,CAEA,SAASC,IACP,OAAO,CACT,gBAxBA,WAGE,GAFmBC,EAAAA,qBAAqBP,EAAWK,EAAmBC,GAMtE,OAAOE,EAAAA,IAAIC,IACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMonaco/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMonaco/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGpC,iBAAS,SAAS,IAAI,MAAM,GAAG,SAAS,CAQvC;eAkBc,SAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useSyncExternalStore as t,use as n}from"react";import r from"./initMonaco.js";function o(){if(t(e,i,u))return n(r())}function e(t){const n=setTimeout(t,0);return()=>{clearTimeout(n)}}function i(){return!0}function u(){return!1}export{o as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import { use, useSyncExternalStore } from 'react';\n\nimport type { Monaco } from '../..';\nimport initMonaco from './initMonaco';\n\nfunction useMonaco(): Monaco | undefined {\n const isHydrated = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);\n\n if (!isHydrated) {\n return undefined;\n }\n\n return use(initMonaco());\n}\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const timeoutId = setTimeout(onStoreChange, 0);\n\n return () => {\n clearTimeout(timeoutId);\n };\n}\n\nfunction getClientSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport default useMonaco;\n"],"names":["useMonaco","useSyncExternalStore","subscribe","getClientSnapshot","getServerSnapshot","use","initMonaco","onStoreChange","timeoutId","setTimeout","clearTimeout"],"mappings":"qFAKA,SAASA,IAGP,GAFmBC,EAAqBC,EAAWC,EAAmBC,GAMtE,OAAOC,EAAIC,IACb,CAEA,SAASJ,EAAUK,GACjB,MAAMC,EAAYC,WAAWF,EAAe,GAE5C,MAAO,KACLG,aAAaF,GAEjB,CAEA,SAASL,IACP,OAAO,CACT,CAEA,SAASC,IACP,OAAO,CACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initMonaco.cjs","sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\n\nimport type { Monaco } from '../..';\n\nlet monacoPromise: Promise<Monaco> | undefined;\n\nfunction initMonaco(): Promise<Monaco> {\n monacoPromise ??= loader.init() as Promise<Monaco>;\n return monacoPromise;\n}\n\nexport default initMonaco;\n"],"names":["monacoPromise","loader","init"],"mappings":"yDAIA,IAAIA,iBAEJ,WAEE,OADa,MAAbA,IAAAA,EAAkBC,EAAOC,QAClBF,CACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initMonaco.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAIpC,iBAAS,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAGrC;eAEc,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initMonaco.js","sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\n\nimport type { Monaco } from '../..';\n\nlet monacoPromise: Promise<Monaco> | undefined;\n\nfunction initMonaco(): Promise<Monaco> {\n monacoPromise ??= loader.init() as Promise<Monaco>;\n return monacoPromise;\n}\n\nexport default initMonaco;\n"],"names":["monacoPromise","initMonaco","loader","init"],"mappings":"0CAIA,IAAIA,EAEJ,SAASC,IAEP,OADa,MAAbD,IAAAA,EAAkBE,EAAOC,QAClBH,CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMount/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,iBAAS,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAI9C;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMount/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,iBAAS,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAI9C;eAEc,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrevious/index.ts"],"names":[],"mappings":"AAEA,iBAAS,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAQ/C;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrevious/index.ts"],"names":[],"mappings":"AAEA,iBAAS,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAQ/C;eAEc,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUpdate/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,iBAAS,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,UAAO,GAAG,IAAI,CAiB1F;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUpdate/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,iBAAS,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,UAAO,GAAG,IAAI,CAiB1F;eAEc,SAAS"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;eACH,MAAM;AAGrB,OAAO,KAAK,KAAK,MAAM,MAAM,2CAA2C,CAAC;AACzE,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAGnC,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC"}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function t(t,r){if(function(t){return/^[a-z][a-z0-9+.-]+:/i.test(t)}(r))return t.Uri.parse(r);const e=r.replaceAll("\\","/");if(e.startsWith("//")){const[r,...i]=e.slice(2).split("/");return t.Uri.from({scheme:"file",authority:r,path:`/${i.join("/")}`})}return t.Uri.from({scheme:"file",path:e.startsWith("/")?e:`/${e}`})}exports.getOrCreateModel=function(r,e,i,n){var o;return null!=(o=function(r,e){return r.editor.getModel(t(r,e))}(r,n))?o:function(r,e,i,n){return r.editor.createModel(e,i,n?t(r,n):void 0)}(r,e,i,n)},exports.noop=function(){};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor/esm/vs/editor/editor.api.js';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n return monaco.Uri.parse(path);\n}\n\nexport { noop, getOrCreateModel };\n"],"names":["createModelUri","monaco","path","Uri","parse","value","language","_getModel","editor","getModel","createModel","undefined"],"mappings":"aAsDA,SAASA,EAAeC,EAAgBC,GACtC,OAAOD,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor/esm/vs/editor/editor.api.js';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n if (hasUriScheme(path)) {\n return monaco.Uri.parse(path);\n }\n\n const normalizedPath = path.replaceAll('\\\\', '/');\n if (normalizedPath.startsWith('//')) {\n const [authority, ...pathParts] = normalizedPath.slice(2).split('/');\n return monaco.Uri.from({\n scheme: 'file',\n authority,\n path: `/${pathParts.join('/')}`,\n });\n }\n\n return monaco.Uri.from({\n scheme: 'file',\n path: normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`,\n });\n}\n\nfunction hasUriScheme(path: string): boolean {\n return /^[a-z][a-z0-9+.-]+:/i.test(path);\n}\n\nexport { noop, getOrCreateModel };\n"],"names":["createModelUri","monaco","path","test","hasUriScheme","Uri","parse","normalizedPath","replaceAll","startsWith","authority","pathParts","slice","split","from","scheme","join","value","language","_getModel","editor","getModel","createModel","undefined"],"mappings":"aAsDA,SAASA,EAAeC,EAAgBC,GACtC,GAoBF,SAAsBA,GACpB,MAAO,uBAAuBC,KAAKD,EACrC,CAtBME,CAAaF,GACf,OAAOD,EAAOI,IAAIC,MAAMJ,GAG1B,MAAMK,EAAiBL,EAAKM,WAAW,KAAM,KAC7C,GAAID,EAAeE,WAAW,MAAO,CACnC,MAAOC,KAAcC,GAAaJ,EAAeK,MAAM,GAAGC,MAAM,KAChE,OAAOZ,EAAOI,IAAIS,KAAK,CACrBC,OAAQ,OACRL,YACAR,KAAM,IAAIS,EAAUK,KAAK,QAE7B,CAEA,OAAOf,EAAOI,IAAIS,KAAK,CACrBC,OAAQ,OACRb,KAAMK,EAAeE,WAAW,KAAOF,EAAiB,IAAIA,KAEhE,0BApDA,SAA0BN,EAAgBgB,EAAeC,EAAkBhB,GAAiC,IAAAiB,EAC1G,OAA6B,OAA7BA,EAUF,SAAkBlB,EAAgBC,GAChC,OAAOD,EAAOmB,OAAOC,SAASrB,EAAeC,EAAQC,GACvD,CAZSmB,CAASpB,EAAQC,IAAKiB,EAsB/B,SAAqBlB,EAAgBgB,EAAeC,EAAmBhB,GACrE,OAAOD,EAAOmB,OAAOE,YAAYL,EAAOC,EAAUhB,EAAOF,EAAeC,EAAQC,QAAQqB,EAC1F,CAxBmCD,CAAYrB,EAAQgB,EAAOC,EAAUhB,EACxE,eAhBA,WACE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAE7E;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAEpB;AAED;;;;;;;;;GASG;AACH,iBAAS,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAE1G;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAE7E;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAEpB;AAED;;;;;;;;;GASG;AACH,iBAAS,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAE1G;AAwDD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(){}function r(t,r,i,n){var o;return null!=(o=function(t,r){return t.editor.getModel(e(t,r))}(t,n))?o:function(t,r,i,n){return t.editor.createModel(r,i,n?e(t,n):void 0)}(t,r,i,n)}function e(t,r){if(function(t){return/^[a-z][a-z0-9+.-]+:/i.test(t)}(r))return t.Uri.parse(r);const e=r.replaceAll("\\","/");if(e.startsWith("//")){const[r,...i]=e.slice(2).split("/");return t.Uri.from({scheme:"file",authority:r,path:`/${i.join("/")}`})}return t.Uri.from({scheme:"file",path:e.startsWith("/")?e:`/${e}`})}export{r as getOrCreateModel,t as noop};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor/esm/vs/editor/editor.api.js';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n return monaco.Uri.parse(path);\n}\n\nexport { noop, getOrCreateModel };\n"],"names":["noop","getOrCreateModel","monaco","value","language","path","_getModel","editor","getModel","createModelUri","createModel","undefined","Uri","parse"],"mappings":"AAOA,SAASA,IACP,CAaF,SAASC,EAAiBC,EAAgBC,EAAeC,EAAkBC,GAAiC,IAAAC,EAC1G,OAA6B,OAA7BA,EAUF,SAAkBJ,EAAgBG,GAChC,OAAOH,EAAOK,OAAOC,SAASC,EAAeP,EAAQG,GACvD,CAZSG,CAASN,EAAQG,IAAKC,EAsB/B,SAAqBJ,EAAgBC,EAAeC,EAAmBC,GACrE,OAAOH,EAAOK,OAAOG,YAAYP,EAAOC,EAAUC,EAAOI,EAAeP,EAAQG,QAAQM,EAC1F,CAxBmCD,CAAYR,EAAQC,EAAOC,EAAUC,EACxE,CA+BA,SAASI,EAAeP,EAAgBG,GACtC,OAAOH,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor/esm/vs/editor/editor.api.js';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n if (hasUriScheme(path)) {\n return monaco.Uri.parse(path);\n }\n\n const normalizedPath = path.replaceAll('\\\\', '/');\n if (normalizedPath.startsWith('//')) {\n const [authority, ...pathParts] = normalizedPath.slice(2).split('/');\n return monaco.Uri.from({\n scheme: 'file',\n authority,\n path: `/${pathParts.join('/')}`,\n });\n }\n\n return monaco.Uri.from({\n scheme: 'file',\n path: normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`,\n });\n}\n\nfunction hasUriScheme(path: string): boolean {\n return /^[a-z][a-z0-9+.-]+:/i.test(path);\n}\n\nexport { noop, getOrCreateModel };\n"],"names":["noop","getOrCreateModel","monaco","value","language","path","_getModel","editor","getModel","createModelUri","createModel","undefined","test","hasUriScheme","Uri","parse","normalizedPath","replaceAll","startsWith","authority","pathParts","slice","split","from","scheme","join"],"mappings":"AAOA,SAASA,IACP,CAaF,SAASC,EAAiBC,EAAgBC,EAAeC,EAAkBC,GAAiC,IAAAC,EAC1G,OAA6B,OAA7BA,EAUF,SAAkBJ,EAAgBG,GAChC,OAAOH,EAAOK,OAAOC,SAASC,EAAeP,EAAQG,GACvD,CAZSG,CAASN,EAAQG,IAAKC,EAsB/B,SAAqBJ,EAAgBC,EAAeC,EAAmBC,GACrE,OAAOH,EAAOK,OAAOG,YAAYP,EAAOC,EAAUC,EAAOI,EAAeP,EAAQG,QAAQM,EAC1F,CAxBmCD,CAAYR,EAAQC,EAAOC,EAAUC,EACxE,CA+BA,SAASI,EAAeP,EAAgBG,GACtC,GAoBF,SAAsBA,GACpB,MAAO,uBAAuBO,KAAKP,EACrC,CAtBMQ,CAAaR,GACf,OAAOH,EAAOY,IAAIC,MAAMV,GAG1B,MAAMW,EAAiBX,EAAKY,WAAW,KAAM,KAC7C,GAAID,EAAeE,WAAW,MAAO,CACnC,MAAOC,KAAcC,GAAaJ,EAAeK,MAAM,GAAGC,MAAM,KAChE,OAAOpB,EAAOY,IAAIS,KAAK,CACrBC,OAAQ,OACRL,YACAd,KAAM,IAAIe,EAAUK,KAAK,QAE7B,CAEA,OAAOvB,EAAOY,IAAIS,KAAK,CACrBC,OAAQ,OACRnB,KAAMW,EAAeE,WAAW,KAAOF,EAAiB,IAAIA,KAEhE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/monaco-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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",
|
|
@@ -14,19 +14,13 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/WillBooster/monaco-react/issues"
|
|
16
16
|
},
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"author": "WillBooster Inc.",
|
|
19
17
|
"repository": {
|
|
20
18
|
"type": "git",
|
|
21
19
|
"url": "git+https://github.com/WillBooster/monaco-react.git"
|
|
22
20
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "WillBooster Inc.",
|
|
26
23
|
"type": "module",
|
|
27
|
-
"main": "dist/index.cjs",
|
|
28
|
-
"module": "dist/index.js",
|
|
29
|
-
"types": "dist/index.d.ts",
|
|
30
24
|
"exports": {
|
|
31
25
|
".": {
|
|
32
26
|
"types": "./dist/index.d.ts",
|
|
@@ -34,18 +28,19 @@
|
|
|
34
28
|
"import": "./dist/index.js"
|
|
35
29
|
}
|
|
36
30
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
"main": "dist/index.cjs",
|
|
32
|
+
"module": "dist/index.js",
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/"
|
|
36
|
+
],
|
|
40
37
|
"scripts": {
|
|
41
38
|
"build": "yarn run build/core",
|
|
42
39
|
"build/core": "build-ts lib",
|
|
43
|
-
"check-all-for-ai": "yarn check-for-ai && yarn test",
|
|
44
|
-
"check-for-ai": "yarn install > /dev/null && yarn format > /dev/null 2> /dev/null || true && yarn lint-fix --quiet",
|
|
45
40
|
"cleanup": "yarn format && yarn lint-fix",
|
|
46
41
|
"common/ci-setup": "yarn run build/core",
|
|
47
42
|
"format": "sort-package-json && yarn format-code",
|
|
48
|
-
"format-code": "oxfmt --write --no-error-on-unmatched-pattern .",
|
|
43
|
+
"format-code": "oxfmt --write --no-error-on-unmatched-pattern . '!**/package.json'",
|
|
49
44
|
"lint": "oxlint --no-error-on-unmatched-pattern .",
|
|
50
45
|
"lint-fix": "yarn lint --fix",
|
|
51
46
|
"prepare": "lefthook install || true",
|
|
@@ -53,7 +48,9 @@
|
|
|
53
48
|
"test:e2e:next": "yarn build && next build e2e/next-app && playwright test --config e2e/next-app/playwright.config.ts",
|
|
54
49
|
"test:unit": "vitest",
|
|
55
50
|
"test/ci-setup": "playwright install chromium",
|
|
56
|
-
"typecheck": "
|
|
51
|
+
"typecheck": "wb typecheck",
|
|
52
|
+
"verify": "wb verify",
|
|
53
|
+
"verify-full": "wb verify --full"
|
|
57
54
|
},
|
|
58
55
|
"dependencies": {
|
|
59
56
|
"@willbooster/monaco-loader": "1.1.1",
|
|
@@ -69,17 +66,19 @@
|
|
|
69
66
|
"@types/node": "25.6.0",
|
|
70
67
|
"@types/react": "19.2.14",
|
|
71
68
|
"@types/react-dom": "19.2.3",
|
|
72
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
73
|
-
"@willbooster/oxfmt-config": "1.2.
|
|
74
|
-
"@willbooster/oxlint-config": "1.4.
|
|
75
|
-
"
|
|
69
|
+
"@typescript/native-preview": "7.0.0-dev.20260421.2",
|
|
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",
|
|
76
74
|
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
77
75
|
"jsdom": "29.0.2",
|
|
78
|
-
"lefthook": "2.1.
|
|
76
|
+
"lefthook": "2.1.6",
|
|
79
77
|
"next": "16.2.4",
|
|
80
|
-
"oxfmt": "0.
|
|
81
|
-
"oxlint": "1.
|
|
82
|
-
"oxlint-tsgolint": "0.
|
|
78
|
+
"oxfmt": "0.50.0",
|
|
79
|
+
"oxlint": "1.65.0",
|
|
80
|
+
"oxlint-tsgolint": "0.22.1",
|
|
81
|
+
"prettier": "3.8.3",
|
|
83
82
|
"react": "19.2.5",
|
|
84
83
|
"react-dom": "19.2.5",
|
|
85
84
|
"semantic-release": "25.0.3",
|
|
@@ -90,8 +89,11 @@
|
|
|
90
89
|
"react": "^19.0.0",
|
|
91
90
|
"react-dom": "^19.0.0"
|
|
92
91
|
},
|
|
92
|
+
"packageManager": "yarn@4.15.0",
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": ">=24"
|
|
95
95
|
},
|
|
96
|
-
"
|
|
96
|
+
"publishConfig": {
|
|
97
|
+
"access": "public"
|
|
98
|
+
}
|
|
97
99
|
}
|