@harnessio/yaml-editor 0.12.0 → 0.14.0
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/LICENSE +201 -0
- package/dist/components/BlameEditor.d.ts +19 -0
- package/dist/components/CodeEditor.d.ts +24 -0
- package/dist/components/DiffEditor.d.ts +23 -0
- package/dist/components/YamlEditor.d.ts +9 -4
- package/dist/components/YamlProvider.d.ts +4 -4
- package/dist/constants/monaco-common-default-options.d.ts +2 -0
- package/dist/hooks/useCodeLens.d.ts +3 -2
- package/dist/hooks/useDecoration.d.ts +1 -0
- package/dist/hooks/useProblems.d.ts +1 -0
- package/dist/hooks/useTheme.d.ts +3 -1
- package/dist/index.d.ts +16 -7
- package/dist/index.js +775 -2
- package/dist/index.js.map +1 -0
- package/dist/monacoeditorwork/css.worker.bundle.js +47923 -0
- package/dist/monacoeditorwork/editor.worker.bundle.js +11141 -0
- package/dist/monacoeditorwork/html.worker.bundle.js +27172 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +18401 -0
- package/dist/monacoeditorwork/ts.worker.bundle.js +182489 -0
- package/dist/monacoeditorwork/yaml.worker.bundle.js +44988 -0
- package/dist/types/blame.d.ts +19 -0
- package/dist/types/monaco.d.ts +1 -1
- package/dist/utils/blame-editor-utils.d.ts +13 -0
- package/dist/utils/monaco-globals.d.ts +1 -0
- package/dist/utils/outline-model-to-path.d.ts +1 -0
- package/dist/utils/schema-utils.d.ts +2 -1
- package/dist/utils/utils.d.ts +2 -0
- package/package.json +30 -19
- package/dist/index.js.LICENSE.txt +0 -9
- package/dist/{hooks/utils.d.ts → utils/codelens-utils.d.ts} +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,775 @@
|
|
|
1
|
-
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("monaco-editor"),require("monaco-yaml")):"function"==typeof define&&define.amd?define(["react","monaco-editor","monaco-yaml"],t):"object"==typeof exports?exports.YamlEditor=t(require("react"),require("monaco-editor"),require("monaco-yaml")):e.YamlEditor=t(e.react,e["monaco-editor"],e["monaco-yaml"])}(self,((e,t,n)=>(()=>{"use strict";var r={921:(e,t,n)=>{var r=n(155),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};t.Fragment=i,t.jsx=function(e,t,n){var r,i={},l=null,s=null;for(r in void 0!==n&&(l=""+n),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(s=t.ref),t)a.call(t,r)&&!c.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:l,ref:s,props:i,_owner:u.current}}},723:(e,t,n)=>{e.exports=n(921)},839:e=>{e.exports=t},449:e=>{e.exports=n},155:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};i.r(a),i.d(a,{MonacoGlobals:()=>we,SelectorType:()=>le,YamlEditor:()=>Te,YamlEditorContext:()=>f,YamlEditorContextProvider:()=>d,useYamlEditorContext:()=>p});var u=i(723),c=i(155),l=i.n(c),s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)},f=l().createContext({markers:[],setMarkers:function(){},editor:null,setEditor:function(e){},updateCursorPosition:function(e){}});function d(e){var t=e.children,n=(0,c.useState)([]),r=n[0],o=n[1],i=(0,c.useState)(null),a=i[0],l=i[1],d=(0,c.useCallback)((function(e){null==a||a.setPosition(e),null==a||a.focus()}),[a]);return(0,u.jsx)(f.Provider,s({value:{markers:r,setMarkers:o,editor:a,setEditor:l,updateCursorPosition:d}},{children:t}))}function p(){return l().useContext(f)}var h=i(839);function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return t.apply(n,[].concat(o,r))}}}function M(e){return{}.toString.call(e).includes("Object")}function E(e){return"function"==typeof e}var S=j((function(e,t){throw new Error(e[t]||e.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),P=function(e,t){return M(t)||S("changeType"),Object.keys(t).some((function(t){return n=e,r=t,!Object.prototype.hasOwnProperty.call(n,r);var n,r}))&&S("changeField"),t},k=function(e){E(e)||S("selectorType")},x=function(e){E(e)||M(e)||S("handlerType"),M(e)&&Object.values(e).some((function(e){return!E(e)}))&&S("handlersType")},C=function(e){var t;e||S("initialIsRequired"),M(e)||S("initialType"),t=e,Object.keys(t).length||S("initialContent")};function R(e,t){return E(t)?t(e.current):t}function I(e,t){return e.current=O(O({},e.current),t),t}function T(e,t,n){return E(t)?t(e.current):Object.keys(n).forEach((function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.call(t,e.current[n])})),n}const _=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};C(e),x(t);var n={current:e},r=j(T)(n,t),o=j(I)(n),i=j(P)(e),a=j(R)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return k(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(r,o,i,a)(e)}]};var L,A={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},D=(L=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return r.length>=L.length?L.apply(this,r):function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return e.apply(t,[].concat(r,o))}})(A);const q={config:function(e){return e||D("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||D("configType"),e.urls?(console.warn(A.deprecation),{paths:{vs:e.urls.monacoBase}}):e;var t}},N=function e(t,n){return Object.keys(n).forEach((function(r){n[r]instanceof Object&&t[r]&&Object.assign(n[r],e(t[r],n[r]))})),m(m({},t),n)};var V={type:"cancelation",msg:"operation is manually canceled"};const F=function(e){var t=!1,n=new Promise((function(n,r){e.then((function(e){return t?r(V):n(e)})),e.catch(r)}));return n.cancel=function(){return t=!0},n};var Y,U=function(e){if(Array.isArray(e))return e}(Y=_({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}))||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var t=[],n=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(t.push(i.value),2!==t.length);n=!0);}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return t}}(Y)||function(e){if(e){if("string"==typeof e)return y(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?y(e,2):void 0}}(Y)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),K=U[0],z=U[1];function G(e){return document.body.appendChild(e)}function B(e){var t,n,r=K((function(e){return{config:e.config,reject:e.reject}})),o=(t="".concat(r.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return o.onload=function(){return e()},o.onerror=r.reject,o}function W(){var e=K((function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}})),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],(function(t){$(t),e.resolve(t)}),(function(t){e.reject(t)}))}function $(e){K().monaco||z({monaco:e})}var H=new Promise((function(e,t){return z({resolve:e,reject:t})})),J={config:function(e){var t=q.config(e),n=t.monaco,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["monaco"]);z((function(e){return{config:N(e.config,r),monaco:n}}))},init:function(){var e=K((function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}}));if(!e.isInitialized){if(z({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),F(H);if(window.monaco&&window.monaco.editor)return $(window.monaco),e.resolve(window.monaco),F(H);!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(G,B)(W)}return F(H)},__getMonacoInstance:function(){return K((function(e){return e.monaco}))}};const Q=J;var X={display:"flex",position:"relative",textAlign:"initial"},Z={width:"100%"},ee={display:"none"},te={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},ne=function({children:e}){return c.createElement("div",{style:te.container},e)},re=(0,c.memo)((function({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:i,wrapperProps:a}){return c.createElement("section",{style:{...X,width:e,height:t},...a},!n&&c.createElement(ne,null,r),c.createElement("div",{ref:o,style:{...Z,...!n&&ee},className:i}))})),oe=function(e){(0,c.useEffect)(e,[])},ie=function(e,t,n=!0){let r=(0,c.useRef)(!0);(0,c.useEffect)(r.current||!n?()=>{r.current=!1}:e,t)};function ae(){}function ue(e,t,n,r){return function(e,t){return e.editor.getModel(ce(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?ce(e,r):void 0)}(e,t,n,r)}function ce(e,t){return e.Uri.parse(t)}(0,c.memo)((function({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:a,keepCurrentOriginalModel:u=!1,keepCurrentModifiedModel:l=!1,theme:s="light",loading:f="Loading...",options:d={},height:p="100%",width:h="100%",className:v,wrapperProps:g={},beforeMount:m=ae,onMount:y=ae}){let[b,w]=(0,c.useState)(!1),[O,j]=(0,c.useState)(!0),M=(0,c.useRef)(null),E=(0,c.useRef)(null),S=(0,c.useRef)(null),P=(0,c.useRef)(y),k=(0,c.useRef)(m),x=(0,c.useRef)(!1);oe((()=>{let e=Q.init();return e.then((e=>(E.current=e)&&j(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>M.current?function(){let e=M.current?.getModel();u||e?.original?.dispose(),l||e?.modified?.dispose(),M.current?.dispose()}():e.cancel()})),ie((()=>{if(M.current&&E.current){let t=M.current.getOriginalEditor(),o=ue(E.current,e||"",r||n||"text",i||"");o!==t.getModel()&&t.setModel(o)}}),[i],b),ie((()=>{if(M.current&&E.current){let e=M.current.getModifiedEditor(),r=ue(E.current,t||"",o||n||"text",a||"");r!==e.getModel()&&e.setModel(r)}}),[a],b),ie((()=>{let e=M.current.getModifiedEditor();e.getOption(E.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())}),[t],b),ie((()=>{M.current?.getModel()?.original.setValue(e||"")}),[e],b),ie((()=>{let{original:e,modified:t}=M.current.getModel();E.current.editor.setModelLanguage(e,r||n||"text"),E.current.editor.setModelLanguage(t,o||n||"text")}),[n,r,o],b),ie((()=>{E.current?.editor.setTheme(s)}),[s],b),ie((()=>{M.current?.updateOptions(d)}),[d],b);let C=(0,c.useCallback)((()=>{if(!E.current)return;k.current(E.current);let u=ue(E.current,e||"",r||n||"text",i||""),c=ue(E.current,t||"",o||n||"text",a||"");M.current?.setModel({original:u,modified:c})}),[n,t,o,e,r,i,a]),R=(0,c.useCallback)((()=>{!x.current&&S.current&&(M.current=E.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...d}),C(),E.current?.editor.setTheme(s),w(!0),x.current=!0)}),[d,s,C]);return(0,c.useEffect)((()=>{b&&P.current(M.current,E.current)}),[b]),(0,c.useEffect)((()=>{!O&&!b&&R()}),[O,b,R]),c.createElement(re,{width:h,height:p,isEditorReady:b,loading:f,_ref:S,className:v,wrapperProps:g})}));var le,se=function(){let[e,t]=(0,c.useState)(Q.__getMonacoInstance());return oe((()=>{let n;return e||(n=Q.init(),n.then((e=>{t(e)}))),()=>n?.cancel()})),e},fe=new Map,de=(0,c.memo)((function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:i,theme:a="light",line:u,loading:l="Loading...",options:s={},overrideServices:f={},saveViewState:d=!0,keepCurrentModel:p=!1,width:h="100%",height:v="100%",className:g,wrapperProps:m={},beforeMount:y=ae,onMount:b=ae,onChange:w,onValidate:O=ae}){let[j,M]=(0,c.useState)(!1),[E,S]=(0,c.useState)(!0),P=(0,c.useRef)(null),k=(0,c.useRef)(null),x=(0,c.useRef)(null),C=(0,c.useRef)(b),R=(0,c.useRef)(y),I=(0,c.useRef)(),T=(0,c.useRef)(r),_=function(e){let t=(0,c.useRef)();return(0,c.useEffect)((()=>{t.current=e}),[e]),t.current}(i),L=(0,c.useRef)(!1),A=(0,c.useRef)(!1);oe((()=>{let e=Q.init();return e.then((e=>(P.current=e)&&S(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>k.current?(I.current?.dispose(),p?d&&fe.set(i,k.current.saveViewState()):k.current.getModel()?.dispose(),void k.current.dispose()):e.cancel()})),ie((()=>{let a=ue(P.current,e||r||"",t||o||"",i||n||"");a!==k.current?.getModel()&&(d&&fe.set(_,k.current?.saveViewState()),k.current?.setModel(a),d&&k.current?.restoreViewState(fe.get(i)))}),[i],j),ie((()=>{k.current?.updateOptions(s)}),[s],j),ie((()=>{!k.current||void 0===r||(k.current.getOption(P.current.editor.EditorOption.readOnly)?k.current.setValue(r):r!==k.current.getValue()&&(A.current=!0,k.current.executeEdits("",[{range:k.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),k.current.pushUndoStop(),A.current=!1))}),[r],j),ie((()=>{let e=k.current?.getModel();e&&o&&P.current?.editor.setModelLanguage(e,o)}),[o],j),ie((()=>{void 0!==u&&k.current?.revealLine(u)}),[u],j),ie((()=>{P.current?.editor.setTheme(a)}),[a],j);let D=(0,c.useCallback)((()=>{if(x.current&&P.current&&!L.current){R.current(P.current);let c=i||n,l=ue(P.current,r||e||"",t||o||"",c||"");k.current=P.current?.editor.create(x.current,{model:l,automaticLayout:!0,...s},f),d&&k.current.restoreViewState(fe.get(c)),P.current.editor.setTheme(a),void 0!==u&&k.current.revealLine(u),M(!0),L.current=!0}}),[e,t,n,r,o,i,s,f,d,a,u]);return(0,c.useEffect)((()=>{j&&C.current(k.current,P.current)}),[j]),(0,c.useEffect)((()=>{!E&&!j&&D()}),[E,j,D]),T.current=r,(0,c.useEffect)((()=>{j&&w&&(I.current?.dispose(),I.current=k.current?.onDidChangeModelContent((e=>{A.current||w(k.current.getValue(),e)})))}),[j,w]),(0,c.useEffect)((()=>{if(j){let e=P.current.editor.onDidChangeMarkers((e=>{let t=k.current.getModel()?.uri;if(t&&e.find((e=>e.path===t.path))){let e=P.current.editor.getModelMarkers({resource:t});O?.(e)}}));return()=>{e?.dispose()}}return()=>{}}),[j,O]),c.createElement(re,{width:h,height:v,isEditorReady:j,loading:l,_ref:x,className:g,wrapperProps:m})})),pe=function(e){var t=e.themeConfig,n=e.editor,r=null!=t?t:{},o=r.rootElementSelector,i=r.defaultTheme,a=(0,c.useState)(null!=i?i:"vs-dark"),u=a[0],l=a[1];return(0,c.useEffect)((function(){var e;null===(e=null==t?void 0:t.themes)||void 0===e||e.forEach((function(e){h.editor.defineTheme(e.themeName,e.themeData)}))}),[h]),(0,c.useEffect)((function(){var e=h.editor;if(e)if(o){var t=document.querySelector(o);if(t){var n=new MutationObserver((function(){var e=t.classList.contains("dark")?"dark":"light";if(u!==e){l(e);var n=h.editor;null==n||n.setTheme(e)}}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),function(){n.disconnect()}}}else null==e||e.setTheme(u)}),[n]),{theme:u}},he=i(449),ve=!1,ge=function(e){return h.Uri.parse("file://".concat(e)).toString()},me=function(){return me=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},me.apply(this,arguments)},ye=function(e){var t=e.schemaConfig,n=e.instanceId;(0,c.useEffect)((function(){(null==t?void 0:t.schema)&&function(e){if(!ve){var t={hover:!0,completion:!0,enableSchemaRequest:!1,validate:!0,schemas:[e]};ve=!0,(0,he.configureMonacoYaml)(h,t)}}(me({fileMatch:[ge(n.toString())]},t))}),[null==t?void 0:t.schema,n])},be=function(e){var t=e.monacoRef,n=p().setMarkers;(0,c.useEffect)((function(){var e,r=setTimeout((function(){var r,o=null===(r=t.current)||void 0===r?void 0:r.editor;o&&(e=o.onDidChangeMarkers((function(e){var t=e[0],r=o.getModelMarkers({resource:t});n(r)})))}),100);return function(){clearTimeout(r),null==e||e.dispose()}}),[t])},we=function(){function e(){}return e.set=function(t){e.data=t},e.get=function(){return e.data},e.data={},e}(),Oe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}c((r=r.apply(e,t||[])).next())}))},je=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};function Me(e){return Oe(this,void 0,void 0,(function(){var t,n;return je(this,(function(r){switch(r.label){case 0:return t=we.get(),n=t.StandaloneServices.get(t.ILanguageFeaturesService).documentSymbolProvider,[4,t.OutlineModel.create(n,e)];case 1:return[2,r.sent()]}}))}))}function Ee(e){var t=new Map;return Se({pathSymbolMap:t,parentPath:"",children:e.children,parentKind:h.languages.SymbolKind.Module}),t}function Se(e){switch(e.parentKind){case h.languages.SymbolKind.Module:!function(e){e.children.forEach((function(t){var n,r,o=e.parentPath;t.symbol&&(o=e.parentPath?"".concat(e.parentPath,".").concat(t.symbol.name):t.symbol.name,e.pathSymbolMap.set(o,t.symbol)),Se({pathSymbolMap:e.pathSymbolMap,parentPath:o,children:t.children,parentKind:null!==(r=null===(n=null==t?void 0:t.symbol)||void 0===n?void 0:n.kind)&&void 0!==r?r:e.parentKind})}))}(e);break;case h.languages.SymbolKind.Array:!function(e){var t=0;e.children.forEach((function(n){var r=e.parentPath?"".concat(e.parentPath,".").concat(t):"".concat(t);e.pathSymbolMap.set(r,n.symbol),t+=1,Se({pathSymbolMap:e.pathSymbolMap,parentPath:r,children:n.children,parentKind:n.symbol.kind})}))}(e);break;default:!function(e){var t=e.children.get("0");if(t){var n=e.parentPath?"".concat(e.parentPath,".").concat(t.symbol.name):null==t?void 0:t.symbol.name;e.pathSymbolMap.set(n,t.symbol)}}(e)}}!function(e){e.ContainsPath="ContainsPath"}(le||(le={}));var Pe=function(){return Pe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Pe.apply(this,arguments)},ke=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}c((r=r.apply(e,t||[])).next())}))},xe=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};var Ce=function(e){var t=e.editorRef,n=e.selection,r=(0,c.useState)(),o=r[0],i=r[1],a=(0,c.useMemo)((function(){return function(e,n,r){return o=void 0,a=void 0,c=function(){var e,o,a,u,c,l,s;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}(this,(function(f){switch(f.label){case 0:return(e=null===(c=null==t?void 0:t.current)||void 0===c?void 0:c.getModel())&&n?[4,Me(e)]:[2,i(void 0)];case 1:return o=f.sent(),a=Ee(o),(u=null===(l=a.get(n))||void 0===l?void 0:l.range)&&(i(u),r&&(null===(s=null==t?void 0:t.current)||void 0===s||s.revealLineInCenter(u.startLineNumber))),[2]}}))},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{i(c.next(e))}catch(e){t(e)}}function r(e){try{i(c.throw(e))}catch(e){t(e)}}function i(t){var o;t.done?e(t.value):(o=t.value,o instanceof u?o:new u((function(e){e(o)}))).then(n,r)}i((c=c.apply(o,a||[])).next())}));var o,a,u,c}}),[]);(0,c.useEffect)((function(){var e=setTimeout((function(){return a(t,null==n?void 0:n.path,null==n?void 0:n.revealInCenter)}),100);return function(){return clearTimeout(e)}}),[null==n?void 0:n.path,null==n?void 0:n.revealInCenter,t,a]),(0,c.useEffect)((function(){var e;if(o){var r=null===(e=null==t?void 0:t.current)||void 0===e?void 0:e.createDecorationsCollection([{range:o,options:{isWholeLine:!1,className:null==n?void 0:n.className}}]);return function(){return null==r?void 0:r.clear()}}}),[o,t,null==n?void 0:n.className])},Re=function(){return Re=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Re.apply(this,arguments)};Q.config({monaco:h});var Ie={selectOnLineNumbers:!0};function Te(e){var t=e.yamlRevision,n=e.schemaConfig,r=e.inlineActions,o=e.themeConfig,i=e.onYamlRevisionChange,a=e.selection,l=(se(),(0,c.useState)("yaml")[0]),s=p(),f=s.editor,d=s.setEditor,v=(0,c.useRef)(),g=(0,c.useRef)({yaml:"",revisionId:0}),m=(0,c.useRef)(null);(0,c.useEffect)((function(){var e;if(m.current&&(!t.revisionId||t.revisionId>(null===(e=g.current)||void 0===e?void 0:e.revisionId))){var n=m.current.getModel();n&&(m.current.pushUndoStop(),m.current.executeEdits("edit",[{range:n.getFullModelRange(),text:t.yaml}]),m.current.pushUndoStop())}}),[t,m.current]),ye({schemaConfig:n,instanceId:l}),function(e){var t=this,n=e.editorRef,r=e.inlineActions;(0,c.useEffect)((function(){var e=h.languages.registerCodeLensProvider("yaml",{provideCodeLenses:function(e){return ke(t,void 0,void 0,(function(){var t,o,i,a,u;return xe(this,(function(c){switch(c.label){case 0:return[4,Me(e)];case 1:return t=c.sent(),o=Ee(t),(i=null===(u=null==n?void 0:n.current)||void 0===u?void 0:u.addCommand(0,(function(e,t){(0,t.onClick)({path:t.path,range:t.range,data:t.data})})))?(a=function(e){var t=e.pathSymbolMap,n=e.inlineActions,r=void 0===n?[]:n,o=e.commandId,i=Object.fromEntries(t.entries()),a=[];return null==r||r.forEach((function(e){var t=e.actions;e.selectors.forEach((function(e){e.type===le.ContainsPath&&e.paths.forEach((function(n){var r=Object.keys(i).map((function(e){return{fullPath:e,path:e,symbol:i[e]}})).filter((function(t){return t.path.startsWith(e.basePath)}));(r=r.map((function(t){return Pe(Pe({},t),{path:t.path.substring(e.basePath.length)})}))).filter((function(e){return n.test(e.path)})).forEach((function(e){var n=e.fullPath,r=e.symbol,i=r.range;t.forEach((function(e){var t={range:i,symbols:[r],onClick:e.onClick,data:e.data,path:n};a.push({range:i,command:{id:o,title:e.title,arguments:[t]}})}))}))}))}))})),a}({pathSymbolMap:o,inlineActions:r,commandId:i}),[2,{lenses:a,dispose:function(){}}]):[2]}}))}))}});return e.dispose}),[r,n])}({editorRef:m,inlineActions:r});var y=pe({monacoRef:v,themeConfig:o,editor:f}).theme;return be({monacoRef:v}),Ce({editorRef:m,selection:a}),(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(de,{onChange:function(e,t){g.current={yaml:null!=e?e:"",revisionId:t.versionId},i(Re({},g.current),t)},language:"yaml",theme:y,options:Ie,path:ge(l),onMount:function(e,n){m.current=e,v.current=n,e.setValue(t.yaml),d(e)}})})}return a})()));
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var pe = (e, t, n) => t in e ? fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var X = (e, t, n) => (pe(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
import he, { useState as L, useEffect as P, useRef as C, useMemo as T, useCallback as R, createContext as ge, useContext as be } from "react";
|
|
5
|
+
import q, { loader as F, useMonaco as z, DiffEditor as ye } from "@monaco-editor/react";
|
|
6
|
+
import * as D from "monaco-editor";
|
|
7
|
+
import { languages as Y, Uri as ve } from "monaco-editor";
|
|
8
|
+
import { yamlDefaults as Se } from "monaco-yaml";
|
|
9
|
+
var oe = { exports: {} }, A = {};
|
|
10
|
+
/*
|
|
11
|
+
object-assign
|
|
12
|
+
(c) Sindre Sorhus
|
|
13
|
+
@license MIT
|
|
14
|
+
*/
|
|
15
|
+
var ee = Object.getOwnPropertySymbols, xe = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable;
|
|
16
|
+
function Me(e) {
|
|
17
|
+
if (e == null)
|
|
18
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
19
|
+
return Object(e);
|
|
20
|
+
}
|
|
21
|
+
function Oe() {
|
|
22
|
+
try {
|
|
23
|
+
if (!Object.assign)
|
|
24
|
+
return !1;
|
|
25
|
+
var e = new String("abc");
|
|
26
|
+
if (e[5] = "de", Object.getOwnPropertyNames(e)[0] === "5")
|
|
27
|
+
return !1;
|
|
28
|
+
for (var t = {}, n = 0; n < 10; n++)
|
|
29
|
+
t["_" + String.fromCharCode(n)] = n;
|
|
30
|
+
var r = Object.getOwnPropertyNames(t).map(function(o) {
|
|
31
|
+
return t[o];
|
|
32
|
+
});
|
|
33
|
+
if (r.join("") !== "0123456789")
|
|
34
|
+
return !1;
|
|
35
|
+
var a = {};
|
|
36
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(o) {
|
|
37
|
+
a[o] = o;
|
|
38
|
+
}), Object.keys(Object.assign({}, a)).join("") === "abcdefghijklmnopqrst";
|
|
39
|
+
} catch {
|
|
40
|
+
return !1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
Oe();
|
|
44
|
+
/** @license React v17.0.2
|
|
45
|
+
* react-jsx-runtime.production.min.js
|
|
46
|
+
*
|
|
47
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the MIT license found in the
|
|
50
|
+
* LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/
|
|
52
|
+
var Ce = he, ae = 60103;
|
|
53
|
+
A.Fragment = 60107;
|
|
54
|
+
if (typeof Symbol == "function" && Symbol.for) {
|
|
55
|
+
var te = Symbol.for;
|
|
56
|
+
ae = te("react.element"), A.Fragment = te("react.fragment");
|
|
57
|
+
}
|
|
58
|
+
var we = Ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Pe = Object.prototype.hasOwnProperty, $e = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
59
|
+
function se(e, t, n) {
|
|
60
|
+
var r, a = {}, o = null, s = null;
|
|
61
|
+
n !== void 0 && (o = "" + n), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref);
|
|
62
|
+
for (r in t)
|
|
63
|
+
Pe.call(t, r) && !$e.hasOwnProperty(r) && (a[r] = t[r]);
|
|
64
|
+
if (e && e.defaultProps)
|
|
65
|
+
for (r in t = e.defaultProps, t)
|
|
66
|
+
a[r] === void 0 && (a[r] = t[r]);
|
|
67
|
+
return { $$typeof: ae, type: e, key: o, ref: s, props: a, _owner: we.current };
|
|
68
|
+
}
|
|
69
|
+
A.jsx = se;
|
|
70
|
+
A.jsxs = se;
|
|
71
|
+
oe.exports = A;
|
|
72
|
+
var w = oe.exports;
|
|
73
|
+
const H = {
|
|
74
|
+
selectOnLineNumbers: !0,
|
|
75
|
+
scrollBeyondLastLine: !1,
|
|
76
|
+
padding: {
|
|
77
|
+
top: 16,
|
|
78
|
+
bottom: 16
|
|
79
|
+
},
|
|
80
|
+
minimap: { enabled: !1 },
|
|
81
|
+
fontSize: 14,
|
|
82
|
+
fontFamily: '"JetBrains Mono", "monospace"',
|
|
83
|
+
lineHeight: 20,
|
|
84
|
+
scrollbar: {
|
|
85
|
+
verticalScrollbarSize: 14,
|
|
86
|
+
horizontalScrollbarSize: 14,
|
|
87
|
+
verticalSliderSize: 6,
|
|
88
|
+
horizontalSliderSize: 6
|
|
89
|
+
}
|
|
90
|
+
}, B = (e) => {
|
|
91
|
+
const { themeConfig: t, editor: n, theme: r } = e, { defaultTheme: a } = t ?? {}, [o, s] = L(r ?? a ?? "vs-dark");
|
|
92
|
+
return P(() => {
|
|
93
|
+
var c;
|
|
94
|
+
(c = t == null ? void 0 : t.themes) == null || c.forEach((m) => {
|
|
95
|
+
D.editor.defineTheme(m.themeName, m.themeData);
|
|
96
|
+
});
|
|
97
|
+
}, [D]), P(() => {
|
|
98
|
+
D.editor && r && (D.editor.setTheme(r), s(r));
|
|
99
|
+
}, [n, r]), { theme: o };
|
|
100
|
+
};
|
|
101
|
+
function je(e) {
|
|
102
|
+
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
103
|
+
let n = "";
|
|
104
|
+
for (let r = 0; r < e; r++)
|
|
105
|
+
n += t.charAt(Math.floor(Math.random() * t.length));
|
|
106
|
+
return n;
|
|
107
|
+
}
|
|
108
|
+
function Ne(e) {
|
|
109
|
+
return e.replace("'", "'");
|
|
110
|
+
}
|
|
111
|
+
function ke({
|
|
112
|
+
instanceId: e,
|
|
113
|
+
lineNumbersPosition: t
|
|
114
|
+
}) {
|
|
115
|
+
let n = "";
|
|
116
|
+
return t === "center" && (n += `
|
|
117
|
+
.monaco-editor-${e} .monaco-scrollable-element.editor-scrollable {
|
|
118
|
+
width: 100% !important;
|
|
119
|
+
left: 0px !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.monaco-editor-${e} .view-lines, .view-zones {
|
|
123
|
+
width: 100% !important;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.monaco-editor-${e} .margin {
|
|
127
|
+
z-index: 1000;
|
|
128
|
+
background: transparent !important;
|
|
129
|
+
}`), n += `
|
|
130
|
+
.monaco-editor-${e} .blame-editor-separator {
|
|
131
|
+
right: 14px;
|
|
132
|
+
pointer-events: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.monaco-editor-${e} {
|
|
136
|
+
outline: none !important;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.monaco-editor-${e} .view-line .blame-editor-commit {
|
|
140
|
+
display: inline-block;
|
|
141
|
+
color: var(--canary-foreground-01);
|
|
142
|
+
}`, n;
|
|
143
|
+
}
|
|
144
|
+
function De({
|
|
145
|
+
instanceId: e,
|
|
146
|
+
blameData: t,
|
|
147
|
+
dateWidth: n,
|
|
148
|
+
avatarSize: r
|
|
149
|
+
}) {
|
|
150
|
+
let a = "";
|
|
151
|
+
return t.forEach((o) => {
|
|
152
|
+
var u, f, l, p, E, i, g, b;
|
|
153
|
+
const s = (f = (u = o == null ? void 0 : o.commitInfo) == null ? void 0 : u.author) == null ? void 0 : f.avatarUrl, c = (p = (l = o == null ? void 0 : o.commitInfo) == null ? void 0 : l.author) == null ? void 0 : p.initials, m = s ? `background: url('${(i = (E = o == null ? void 0 : o.commitInfo) == null ? void 0 : E.author) == null ? void 0 : i.avatarUrl}');` : "";
|
|
154
|
+
for (let y = o.fromLineNumber; y <= o.toLineNumber; y++)
|
|
155
|
+
y === o.fromLineNumber ? a += `
|
|
156
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${y}:before {
|
|
157
|
+
content: '${Ne(((b = (g = o == null ? void 0 : o.commitInfo) == null ? void 0 : g.author) == null ? void 0 : b.when) || "")}';
|
|
158
|
+
position: absolute;
|
|
159
|
+
left: 10px;
|
|
160
|
+
top: 0px;
|
|
161
|
+
color: hsl(var(--canary-foreground-03));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${y}:after {
|
|
165
|
+
content: '${c ?? " "}';
|
|
166
|
+
position: absolute;
|
|
167
|
+
border-radius: 50%;
|
|
168
|
+
padding: 4px;
|
|
169
|
+
text-align: center;
|
|
170
|
+
background: hsl(var(--canary-background-11));
|
|
171
|
+
line-height: 17px;
|
|
172
|
+
left: ${n + 10}px;
|
|
173
|
+
top: -4px;
|
|
174
|
+
color: hsl(var(--canary-foreground-03));
|
|
175
|
+
width: ${r}px;
|
|
176
|
+
height: ${r}px;
|
|
177
|
+
${m}
|
|
178
|
+
background-size: 100% 100%;
|
|
179
|
+
}` : a += `
|
|
180
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${y}:before {
|
|
181
|
+
content: ' ';
|
|
182
|
+
left: 10px;
|
|
183
|
+
top: 0px;
|
|
184
|
+
color: gray;
|
|
185
|
+
}`;
|
|
186
|
+
}), a;
|
|
187
|
+
}
|
|
188
|
+
function Le(e, t) {
|
|
189
|
+
let n = "";
|
|
190
|
+
return e.length > t ? n = e.slice(0, t - 3) + "..." : e.length < t ? n = e + " ".repeat(t - e.length) : n = e, " ".repeat(25) + n + " ".repeat(10);
|
|
191
|
+
}
|
|
192
|
+
F.config({ monaco: D });
|
|
193
|
+
const W = 450, _e = 30, Te = 140, Ie = 24, Ve = {
|
|
194
|
+
...H,
|
|
195
|
+
readOnly: !0,
|
|
196
|
+
matchBrackets: "never",
|
|
197
|
+
renderValidationDecorations: "off",
|
|
198
|
+
guides: { indentation: !1 },
|
|
199
|
+
folding: !1,
|
|
200
|
+
stickyScroll: { enabled: !1 },
|
|
201
|
+
renderWhitespace: "none",
|
|
202
|
+
renderLineHighlight: "none"
|
|
203
|
+
};
|
|
204
|
+
function et({
|
|
205
|
+
code: e,
|
|
206
|
+
language: t,
|
|
207
|
+
themeConfig: n,
|
|
208
|
+
lineNumbersPosition: r = "left",
|
|
209
|
+
blameData: a,
|
|
210
|
+
showSeparators: o = !0,
|
|
211
|
+
theme: s,
|
|
212
|
+
height: c = "75vh"
|
|
213
|
+
}) {
|
|
214
|
+
const m = C(a), u = C(je(5));
|
|
215
|
+
z();
|
|
216
|
+
const [f, l] = L(), [p, E] = L(0), i = C(null), g = C(null);
|
|
217
|
+
P(() => {
|
|
218
|
+
m.current = a;
|
|
219
|
+
}, [a]);
|
|
220
|
+
function b() {
|
|
221
|
+
const O = g.current, $ = i.current;
|
|
222
|
+
if (!O || !$)
|
|
223
|
+
return;
|
|
224
|
+
o && O.changeViewZones(function(v) {
|
|
225
|
+
v.addZone({
|
|
226
|
+
afterLineNumber: 0,
|
|
227
|
+
heightInPx: 10,
|
|
228
|
+
domNode: document.createElement("div")
|
|
229
|
+
}), m.current.forEach((h, d) => {
|
|
230
|
+
if (d !== m.current.length - 1) {
|
|
231
|
+
const x = document.createElement("div");
|
|
232
|
+
x.style.borderTop = "1px solid hsl(var(--canary-border-01))", x.style.marginTop = "9px", x.className = "blame-editor-separator", v.addZone({
|
|
233
|
+
afterLineNumber: h.toLineNumber,
|
|
234
|
+
heightInPx: 20,
|
|
235
|
+
domNode: x
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
const k = [];
|
|
241
|
+
m.current.forEach((v) => {
|
|
242
|
+
var h;
|
|
243
|
+
for (let d = v.fromLineNumber; d <= v.toLineNumber; d++)
|
|
244
|
+
k.push({
|
|
245
|
+
range: new $.Range(d, 0, d + 1, 0),
|
|
246
|
+
options: {
|
|
247
|
+
before: {
|
|
248
|
+
content: Le(
|
|
249
|
+
d === v.fromLineNumber && ((h = v == null ? void 0 : v.commitInfo) == null ? void 0 : h.title) || "",
|
|
250
|
+
_e
|
|
251
|
+
),
|
|
252
|
+
cursorStops: $.editor.InjectedTextCursorStops.None,
|
|
253
|
+
inlineClassName: `blame-editor-commit blame-editor-commit-${d}`
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}), O.createDecorationsCollection(k);
|
|
258
|
+
}
|
|
259
|
+
function y(O, $) {
|
|
260
|
+
var k, v, h, d, x, I;
|
|
261
|
+
g.current = O, i.current = $, O.setValue(e), l(O), (h = (v = (k = $.languages.typescript) == null ? void 0 : k.typescriptDefaults) == null ? void 0 : v.setDiagnosticsOptions) == null || h.call(v, {
|
|
262
|
+
noSuggestionDiagnostics: !0,
|
|
263
|
+
noSyntaxValidation: !0,
|
|
264
|
+
noSemanticValidation: !0
|
|
265
|
+
}), (I = (x = (d = $.languages.typescript) == null ? void 0 : d.javascriptDefaults) == null ? void 0 : x.setDiagnosticsOptions) == null || I.call(x, {
|
|
266
|
+
noSuggestionDiagnostics: !0,
|
|
267
|
+
noSyntaxValidation: !0,
|
|
268
|
+
noSemanticValidation: !0
|
|
269
|
+
}), b();
|
|
270
|
+
}
|
|
271
|
+
P(() => {
|
|
272
|
+
f == null || f.setValue(e);
|
|
273
|
+
}, [e]);
|
|
274
|
+
const { theme: M } = B({ monacoRef: i, themeConfig: n, editor: f, theme: s }), j = T(
|
|
275
|
+
() => ke({
|
|
276
|
+
instanceId: u.current,
|
|
277
|
+
lineNumbersPosition: r
|
|
278
|
+
}),
|
|
279
|
+
[a]
|
|
280
|
+
), _ = T(
|
|
281
|
+
() => De({
|
|
282
|
+
instanceId: u.current,
|
|
283
|
+
blameData: a,
|
|
284
|
+
avatarSize: Ie,
|
|
285
|
+
dateWidth: Te
|
|
286
|
+
}),
|
|
287
|
+
[a]
|
|
288
|
+
);
|
|
289
|
+
P(() => {
|
|
290
|
+
if (r === "center") {
|
|
291
|
+
const O = document.getElementsByClassName("lines-content")[0];
|
|
292
|
+
if (O) {
|
|
293
|
+
const $ = { attributes: !0 }, k = (h) => {
|
|
294
|
+
for (const d of h) {
|
|
295
|
+
const x = parseInt(getComputedStyle(O).left);
|
|
296
|
+
E(x);
|
|
297
|
+
}
|
|
298
|
+
}, v = new MutationObserver(k);
|
|
299
|
+
return v.observe(O, $), () => {
|
|
300
|
+
v.disconnect();
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
const S = T(() => `
|
|
306
|
+
.monaco-editor-${u.current} .margin {
|
|
307
|
+
left: ${W + 16 + p}px !important;
|
|
308
|
+
pointer-events: none;
|
|
309
|
+
}`, [p]), N = `
|
|
310
|
+
.monaco-editor-${u.current} .view-overlays {
|
|
311
|
+
clip-path: polygon(${W + 16}px 0, 100% 0%, 100% 100%, ${W + 16}px 100%);
|
|
312
|
+
height:100% !important;
|
|
313
|
+
}`;
|
|
314
|
+
return /* @__PURE__ */ w.jsxs(w.Fragment, { children: [
|
|
315
|
+
/* @__PURE__ */ w.jsx(
|
|
316
|
+
"style",
|
|
317
|
+
{
|
|
318
|
+
dangerouslySetInnerHTML: {
|
|
319
|
+
__html: `${j} ${_} ${S} ${N}`
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ w.jsx(
|
|
324
|
+
q,
|
|
325
|
+
{
|
|
326
|
+
className: `monaco-editor-${u.current} overflow-hidden rounded-b-md border-x border-b`,
|
|
327
|
+
height: c,
|
|
328
|
+
language: t,
|
|
329
|
+
theme: M,
|
|
330
|
+
options: Ve,
|
|
331
|
+
onMount: y
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
] });
|
|
335
|
+
}
|
|
336
|
+
F.config({ monaco: D });
|
|
337
|
+
const Ue = {
|
|
338
|
+
...H
|
|
339
|
+
};
|
|
340
|
+
function tt({
|
|
341
|
+
codeRevision: e,
|
|
342
|
+
onCodeRevisionChange: t,
|
|
343
|
+
language: n,
|
|
344
|
+
themeConfig: r,
|
|
345
|
+
options: a,
|
|
346
|
+
theme: o,
|
|
347
|
+
height: s = "75vh"
|
|
348
|
+
}) {
|
|
349
|
+
z();
|
|
350
|
+
const [c, m] = L(), u = C(), f = C({ code: "", revisionId: 0 }), l = C(null), p = R(
|
|
351
|
+
(g, b) => {
|
|
352
|
+
var y, M, j, _, S, N;
|
|
353
|
+
l.current = g, u.current = b, g.setValue(e.code), m(g), (j = (M = (y = b.languages.typescript) == null ? void 0 : y.typescriptDefaults) == null ? void 0 : M.setDiagnosticsOptions) == null || j.call(M, {
|
|
354
|
+
noSuggestionDiagnostics: !0,
|
|
355
|
+
noSyntaxValidation: !0,
|
|
356
|
+
noSemanticValidation: !0
|
|
357
|
+
}), (N = (S = (_ = b.languages.typescript) == null ? void 0 : _.javascriptDefaults) == null ? void 0 : S.setDiagnosticsOptions) == null || N.call(S, {
|
|
358
|
+
noSuggestionDiagnostics: !0,
|
|
359
|
+
noSyntaxValidation: !0,
|
|
360
|
+
noSemanticValidation: !0
|
|
361
|
+
});
|
|
362
|
+
},
|
|
363
|
+
[e.code]
|
|
364
|
+
);
|
|
365
|
+
P(() => {
|
|
366
|
+
var g, b;
|
|
367
|
+
if (l.current && (!e.revisionId || e.revisionId > Number((g = f.current) == null ? void 0 : g.revisionId))) {
|
|
368
|
+
const y = l.current.getModel();
|
|
369
|
+
y && (a != null && a.readOnly ? (b = l.current) == null || b.setValue(e.code) : (l.current.pushUndoStop(), l.current.executeEdits("edit", [
|
|
370
|
+
{
|
|
371
|
+
range: y.getFullModelRange(),
|
|
372
|
+
text: e.code
|
|
373
|
+
}
|
|
374
|
+
]), l.current.pushUndoStop()));
|
|
375
|
+
}
|
|
376
|
+
}, [e, l.current]);
|
|
377
|
+
const { theme: E } = B({ monacoRef: u, themeConfig: r, editor: c, theme: o }), i = T(() => ({ ...Ue, ...a || {} }), [a]);
|
|
378
|
+
return /* @__PURE__ */ w.jsx(w.Fragment, { children: /* @__PURE__ */ w.jsx(
|
|
379
|
+
q,
|
|
380
|
+
{
|
|
381
|
+
className: "overflow-hidden rounded-b-md border-x border-b",
|
|
382
|
+
height: s,
|
|
383
|
+
onChange: (g, b) => {
|
|
384
|
+
f.current = { code: g ?? "", revisionId: b.versionId }, t({ ...f.current }, b);
|
|
385
|
+
},
|
|
386
|
+
language: n,
|
|
387
|
+
theme: E,
|
|
388
|
+
options: i,
|
|
389
|
+
onMount: p
|
|
390
|
+
}
|
|
391
|
+
) });
|
|
392
|
+
}
|
|
393
|
+
F.config({ monaco: D });
|
|
394
|
+
const Ae = {
|
|
395
|
+
...H,
|
|
396
|
+
minimap: { enabled: !1 },
|
|
397
|
+
codeLens: !1,
|
|
398
|
+
smartSelect: {
|
|
399
|
+
selectLeadingAndTrailingWhitespace: !0
|
|
400
|
+
},
|
|
401
|
+
originalEditable: !1,
|
|
402
|
+
overviewRulerBorder: !1
|
|
403
|
+
};
|
|
404
|
+
function nt({
|
|
405
|
+
original: e,
|
|
406
|
+
modified: t,
|
|
407
|
+
language: n,
|
|
408
|
+
themeConfig: r,
|
|
409
|
+
options: a,
|
|
410
|
+
theme: o,
|
|
411
|
+
height: s = "75vh"
|
|
412
|
+
}) {
|
|
413
|
+
z();
|
|
414
|
+
const [c, m] = L(), u = C(), { theme: f } = B({ monacoRef: u, themeConfig: r, editor: c, theme: o }), l = T(() => ({ ...Ae, ...a || {} }), [a]);
|
|
415
|
+
return /* @__PURE__ */ w.jsx(w.Fragment, { children: /* @__PURE__ */ w.jsx(
|
|
416
|
+
ye,
|
|
417
|
+
{
|
|
418
|
+
className: "overflow-hidden rounded-b-md border-x border-b",
|
|
419
|
+
language: n,
|
|
420
|
+
theme: f,
|
|
421
|
+
original: e,
|
|
422
|
+
modified: t,
|
|
423
|
+
height: s,
|
|
424
|
+
options: l,
|
|
425
|
+
onMount: m
|
|
426
|
+
}
|
|
427
|
+
) });
|
|
428
|
+
}
|
|
429
|
+
var ie = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(ie || {});
|
|
430
|
+
function Fe(e) {
|
|
431
|
+
const { pathSymbolMap: t, inlineActions: n = [], commandId: r } = e, a = Object.fromEntries(t.entries()), o = [];
|
|
432
|
+
return n == null || n.forEach((s) => {
|
|
433
|
+
const c = s.actions;
|
|
434
|
+
s.selectors.forEach((u) => {
|
|
435
|
+
switch (u.type) {
|
|
436
|
+
case ie.ContainsPath: {
|
|
437
|
+
u.paths.forEach((f) => {
|
|
438
|
+
let p = Object.keys(a).map((i) => ({
|
|
439
|
+
fullPath: i,
|
|
440
|
+
path: i,
|
|
441
|
+
symbol: a[i]
|
|
442
|
+
})).filter((i) => i.path.startsWith(u.basePath));
|
|
443
|
+
p = p.map((i) => ({
|
|
444
|
+
...i,
|
|
445
|
+
path: i.path.substring(u.basePath.length)
|
|
446
|
+
})), p.filter((i) => f.test(i.path)).forEach((i) => {
|
|
447
|
+
const g = i.fullPath, b = i.symbol, y = b.range;
|
|
448
|
+
c.forEach((M) => {
|
|
449
|
+
const j = {
|
|
450
|
+
range: y,
|
|
451
|
+
symbols: [b],
|
|
452
|
+
onClick: M.onClick,
|
|
453
|
+
data: M.data,
|
|
454
|
+
path: g
|
|
455
|
+
};
|
|
456
|
+
o.push({
|
|
457
|
+
range: y,
|
|
458
|
+
command: {
|
|
459
|
+
id: r,
|
|
460
|
+
title: M.title,
|
|
461
|
+
arguments: [j]
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
}), o;
|
|
472
|
+
}
|
|
473
|
+
const U = class U {
|
|
474
|
+
static set(t) {
|
|
475
|
+
U.data = t;
|
|
476
|
+
}
|
|
477
|
+
static get() {
|
|
478
|
+
return U.data;
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
X(U, "data", {});
|
|
482
|
+
let K = U;
|
|
483
|
+
async function ce(e) {
|
|
484
|
+
const t = K.get(), { documentSymbolProvider: n } = t.StandaloneServices.get(t.ILanguageFeaturesService);
|
|
485
|
+
return await t.OutlineModel.create(n, e);
|
|
486
|
+
}
|
|
487
|
+
function le(e) {
|
|
488
|
+
const t = /* @__PURE__ */ new Map();
|
|
489
|
+
return Z({
|
|
490
|
+
pathSymbolMap: t,
|
|
491
|
+
parentPath: "",
|
|
492
|
+
children: e.children,
|
|
493
|
+
parentKind: Y.SymbolKind.Module
|
|
494
|
+
}), t;
|
|
495
|
+
}
|
|
496
|
+
function Z(e) {
|
|
497
|
+
switch (e.parentKind) {
|
|
498
|
+
case Y.SymbolKind.Module: {
|
|
499
|
+
ze(e);
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
case Y.SymbolKind.Array: {
|
|
503
|
+
Be(e);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
default:
|
|
507
|
+
We(e);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function ze(e) {
|
|
511
|
+
e.children.forEach((t) => {
|
|
512
|
+
var r;
|
|
513
|
+
let n = e.parentPath;
|
|
514
|
+
t.symbol && (n = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(n, t.symbol)), Z({
|
|
515
|
+
pathSymbolMap: e.pathSymbolMap,
|
|
516
|
+
parentPath: n,
|
|
517
|
+
children: t.children,
|
|
518
|
+
parentKind: ((r = t == null ? void 0 : t.symbol) == null ? void 0 : r.kind) ?? e.parentKind
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function Be(e) {
|
|
523
|
+
let t = 0;
|
|
524
|
+
e.children.forEach((n) => {
|
|
525
|
+
const r = e.parentPath ? `${e.parentPath}.${t}` : `${t}`;
|
|
526
|
+
e.pathSymbolMap.set(r, n.symbol), t += 1, Z({
|
|
527
|
+
pathSymbolMap: e.pathSymbolMap,
|
|
528
|
+
parentPath: r,
|
|
529
|
+
children: n.children,
|
|
530
|
+
parentKind: n.symbol.kind
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function We(e) {
|
|
535
|
+
const t = e.children.get("0");
|
|
536
|
+
if (t) {
|
|
537
|
+
const n = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t == null ? void 0 : t.symbol.name;
|
|
538
|
+
e.pathSymbolMap.set(n, t.symbol);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function Ye({
|
|
542
|
+
editorRef: e,
|
|
543
|
+
inlineActions: t
|
|
544
|
+
}) {
|
|
545
|
+
P(() => D.languages.registerCodeLensProvider("yaml", {
|
|
546
|
+
provideCodeLenses: async (r) => {
|
|
547
|
+
var m;
|
|
548
|
+
const a = await ce(r), o = le(a), s = (m = e == null ? void 0 : e.current) == null ? void 0 : m.addCommand(0, (u, { onClick: f, path: l, range: p, data: E }) => {
|
|
549
|
+
f({ path: l, range: p, data: E });
|
|
550
|
+
});
|
|
551
|
+
return s ? {
|
|
552
|
+
lenses: Fe({ pathSymbolMap: o, inlineActions: t, commandId: s }),
|
|
553
|
+
dispose: () => {
|
|
554
|
+
}
|
|
555
|
+
} : void 0;
|
|
556
|
+
}
|
|
557
|
+
}).dispose, [t, e]);
|
|
558
|
+
}
|
|
559
|
+
const Ke = ({ editorRef: e, selection: t }) => {
|
|
560
|
+
const [n, r] = L(), a = T(
|
|
561
|
+
() => async (o, s, c) => {
|
|
562
|
+
var p, E, i;
|
|
563
|
+
const m = (p = e == null ? void 0 : e.current) == null ? void 0 : p.getModel();
|
|
564
|
+
if (!m || !s)
|
|
565
|
+
return r(void 0);
|
|
566
|
+
const u = await ce(m), l = (E = le(u).get(s)) == null ? void 0 : E.range;
|
|
567
|
+
l && (r(l), c && ((i = e == null ? void 0 : e.current) == null || i.revealLineInCenter(l.startLineNumber)));
|
|
568
|
+
},
|
|
569
|
+
[]
|
|
570
|
+
);
|
|
571
|
+
P(() => {
|
|
572
|
+
if ("requestIdleCallback" in window) {
|
|
573
|
+
const o = requestIdleCallback(() => {
|
|
574
|
+
a(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
|
|
575
|
+
});
|
|
576
|
+
return () => cancelIdleCallback(o);
|
|
577
|
+
} else {
|
|
578
|
+
const o = setTimeout(() => {
|
|
579
|
+
a(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
|
|
580
|
+
}, 100);
|
|
581
|
+
return () => clearTimeout(o);
|
|
582
|
+
}
|
|
583
|
+
}, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, a]), P(() => {
|
|
584
|
+
var s;
|
|
585
|
+
if (!n)
|
|
586
|
+
return;
|
|
587
|
+
const o = (s = e == null ? void 0 : e.current) == null ? void 0 : s.createDecorationsCollection([
|
|
588
|
+
{
|
|
589
|
+
// TODO: check why startColumn is set to "end of row"
|
|
590
|
+
range: { ...n, startColumn: 1 },
|
|
591
|
+
options: {
|
|
592
|
+
isWholeLine: !1,
|
|
593
|
+
className: t == null ? void 0 : t.className
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
]);
|
|
597
|
+
return () => o == null ? void 0 : o.clear();
|
|
598
|
+
}, [n, e, t == null ? void 0 : t.className]);
|
|
599
|
+
}, ue = ge({
|
|
600
|
+
markers: [],
|
|
601
|
+
setMarkers: () => {
|
|
602
|
+
},
|
|
603
|
+
editor: null,
|
|
604
|
+
setEditor: (e) => {
|
|
605
|
+
},
|
|
606
|
+
updateCursorPosition: (e) => {
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
function rt({
|
|
610
|
+
children: e
|
|
611
|
+
}) {
|
|
612
|
+
const [t, n] = L([]), [r, a] = L(null), o = R(
|
|
613
|
+
(s) => {
|
|
614
|
+
r == null || r.setPosition(s), r == null || r.focus();
|
|
615
|
+
},
|
|
616
|
+
[r]
|
|
617
|
+
);
|
|
618
|
+
return /* @__PURE__ */ w.jsx(
|
|
619
|
+
ue.Provider,
|
|
620
|
+
{
|
|
621
|
+
value: {
|
|
622
|
+
markers: t,
|
|
623
|
+
setMarkers: n,
|
|
624
|
+
editor: r,
|
|
625
|
+
setEditor: a,
|
|
626
|
+
updateCursorPosition: o
|
|
627
|
+
},
|
|
628
|
+
children: e
|
|
629
|
+
}
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
function de() {
|
|
633
|
+
return be(ue);
|
|
634
|
+
}
|
|
635
|
+
const Re = ({ monacoRef: e }) => {
|
|
636
|
+
const { setMarkers: t } = de();
|
|
637
|
+
P(() => {
|
|
638
|
+
let n;
|
|
639
|
+
const r = setTimeout(() => {
|
|
640
|
+
var o;
|
|
641
|
+
const a = (o = e.current) == null ? void 0 : o.editor;
|
|
642
|
+
a && (n = a.onDidChangeMarkers(([s]) => {
|
|
643
|
+
const c = a.getModelMarkers({ resource: s });
|
|
644
|
+
t(c);
|
|
645
|
+
}));
|
|
646
|
+
}, 100);
|
|
647
|
+
return () => {
|
|
648
|
+
clearTimeout(r), n == null || n.dispose();
|
|
649
|
+
};
|
|
650
|
+
}, [e]);
|
|
651
|
+
};
|
|
652
|
+
let ne = !1;
|
|
653
|
+
function qe(e) {
|
|
654
|
+
if (ne)
|
|
655
|
+
return;
|
|
656
|
+
const t = {
|
|
657
|
+
hover: !0,
|
|
658
|
+
completion: !0,
|
|
659
|
+
enableSchemaRequest: !1,
|
|
660
|
+
validate: !0,
|
|
661
|
+
schemas: [e]
|
|
662
|
+
};
|
|
663
|
+
ne = !0, Se.setDiagnosticsOptions({ ...t });
|
|
664
|
+
}
|
|
665
|
+
const me = (e) => ve.parse(`file://${e}`).toString(), He = (e) => {
|
|
666
|
+
const { schemaConfig: t, instanceId: n } = e;
|
|
667
|
+
P(() => {
|
|
668
|
+
t != null && t.schema && qe({
|
|
669
|
+
// If YAML file is opened matching this glob
|
|
670
|
+
fileMatch: [me(n.toString())],
|
|
671
|
+
...t
|
|
672
|
+
});
|
|
673
|
+
}, [t == null ? void 0 : t.schema, n]);
|
|
674
|
+
};
|
|
675
|
+
F.config({ monaco: D });
|
|
676
|
+
const re = {
|
|
677
|
+
selectOnLineNumbers: !0,
|
|
678
|
+
minimap: {
|
|
679
|
+
enabled: !0
|
|
680
|
+
},
|
|
681
|
+
folding: !0
|
|
682
|
+
}, ot = function(t) {
|
|
683
|
+
const {
|
|
684
|
+
yamlRevision: n,
|
|
685
|
+
schemaConfig: r,
|
|
686
|
+
inlineActions: a,
|
|
687
|
+
themeConfig: o,
|
|
688
|
+
onYamlRevisionChange: s,
|
|
689
|
+
selection: c,
|
|
690
|
+
theme: m,
|
|
691
|
+
options: u,
|
|
692
|
+
minimap: f = !1,
|
|
693
|
+
folding: l = !0,
|
|
694
|
+
animateOnUpdate: p = !1,
|
|
695
|
+
onAnimateEnd: E
|
|
696
|
+
} = t, i = z(), [g] = L("yaml"), { editor: b, setEditor: y } = de(), M = C(null), j = C(), _ = C({ yaml: "", revisionId: 0 }), S = C(null), N = C(null), O = R(
|
|
697
|
+
(h) => {
|
|
698
|
+
var I, G, J;
|
|
699
|
+
const d = h.split(`
|
|
700
|
+
`), x = (I = S.current) == null ? void 0 : I.getModel();
|
|
701
|
+
if (x) {
|
|
702
|
+
(G = S.current) == null || G.pushUndoStop(), x.setValue("");
|
|
703
|
+
let V = 0;
|
|
704
|
+
N.current = window.setInterval(() => {
|
|
705
|
+
var Q;
|
|
706
|
+
V < d.length ? (i && ((Q = S.current) == null || Q.executeEdits("addLine", [
|
|
707
|
+
{
|
|
708
|
+
range: new i.Range(V + 1, 1, V + 1, 1),
|
|
709
|
+
text: d[V] + `
|
|
710
|
+
`
|
|
711
|
+
}
|
|
712
|
+
])), V++) : N.current && (clearInterval(N.current), E == null || E());
|
|
713
|
+
}, 100), (J = S.current) == null || J.pushUndoStop();
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
[i]
|
|
717
|
+
);
|
|
718
|
+
P(() => () => {
|
|
719
|
+
N.current && clearInterval(N.current);
|
|
720
|
+
}, []);
|
|
721
|
+
function $(h, d) {
|
|
722
|
+
S.current = h, j.current = d, h.setValue(n.yaml), y(h), setTimeout(() => {
|
|
723
|
+
var x;
|
|
724
|
+
(x = M.current) != null && x.style && (M.current.style.opacity = "1");
|
|
725
|
+
}, 50);
|
|
726
|
+
}
|
|
727
|
+
P(() => {
|
|
728
|
+
var h;
|
|
729
|
+
if (S.current && (!n.revisionId || n.revisionId > Number((h = _.current) == null ? void 0 : h.revisionId))) {
|
|
730
|
+
const d = S.current.getModel();
|
|
731
|
+
d && (S.current.executeEdits("edit", [
|
|
732
|
+
{
|
|
733
|
+
range: d.getFullModelRange(),
|
|
734
|
+
text: p ? "" : n.yaml
|
|
735
|
+
}
|
|
736
|
+
]), p && O(n.yaml));
|
|
737
|
+
}
|
|
738
|
+
}, [O, n, p]), He({ schemaConfig: r, instanceId: g }), Ye({ editorRef: S, inlineActions: a });
|
|
739
|
+
const { theme: k } = B({ monacoRef: j, themeConfig: o, editor: b, theme: m });
|
|
740
|
+
Re({ monacoRef: j }), Ke({ editorRef: S, selection: c });
|
|
741
|
+
const v = T(
|
|
742
|
+
() => ({
|
|
743
|
+
...re,
|
|
744
|
+
folding: l,
|
|
745
|
+
minimap: { ...re.minimap, enabled: f },
|
|
746
|
+
...u
|
|
747
|
+
}),
|
|
748
|
+
[l, f, u]
|
|
749
|
+
);
|
|
750
|
+
return /* @__PURE__ */ w.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: M, children: /* @__PURE__ */ w.jsx(
|
|
751
|
+
q,
|
|
752
|
+
{
|
|
753
|
+
onChange: (h, d) => {
|
|
754
|
+
_.current = { yaml: h ?? "", revisionId: d.versionId }, s({ ..._.current }, d);
|
|
755
|
+
},
|
|
756
|
+
language: "yaml",
|
|
757
|
+
theme: k,
|
|
758
|
+
options: v,
|
|
759
|
+
path: me(g),
|
|
760
|
+
onMount: $
|
|
761
|
+
}
|
|
762
|
+
) });
|
|
763
|
+
};
|
|
764
|
+
export {
|
|
765
|
+
et as BlameEditor,
|
|
766
|
+
nt as CodeDiffEditor,
|
|
767
|
+
tt as CodeEditor,
|
|
768
|
+
K as MonacoGlobals,
|
|
769
|
+
ie as SelectorType,
|
|
770
|
+
ot as YamlEditor,
|
|
771
|
+
ue as YamlEditorContext,
|
|
772
|
+
rt as YamlEditorContextProvider,
|
|
773
|
+
de as useYamlEditorContext
|
|
774
|
+
};
|
|
775
|
+
//# sourceMappingURL=index.js.map
|