@harnessio/yaml-editor 0.12.0 → 0.13.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 +17 -0
- package/dist/components/CodeEditor.d.ts +22 -0
- package/dist/components/DiffEditor.d.ts +21 -0
- package/dist/components/YamlEditor.d.ts +4 -3
- package/dist/components/YamlProvider.d.ts +4 -4
- 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 +660 -2
- package/dist/index.js.map +1 -0
- package/dist/monacoeditorwork/css.worker.bundle.js +52775 -0
- package/dist/monacoeditorwork/editor.worker.bundle.js +12832 -0
- package/dist/monacoeditorwork/html.worker.bundle.js +28975 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +20633 -0
- package/dist/monacoeditorwork/ts.worker.bundle.js +255666 -0
- package/dist/monacoeditorwork/yaml.worker.bundle.js +45105 -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 +24 -13
- 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,660 @@
|
|
|
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 oe = Object.defineProperty;
|
|
2
|
+
var re = (t, e, n) => e in t ? oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var K = (t, e, n) => (re(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
import ae, { useState as k, useEffect as C, useRef as x, useMemo as w, createContext as se, useCallback as ie, useContext as ce } from "react";
|
|
5
|
+
import U, { loader as D, useMonaco as T, DiffEditor as le } from "@monaco-editor/react";
|
|
6
|
+
import * as P from "monaco-editor";
|
|
7
|
+
import { languages as I, Uri as ue } from "monaco-editor";
|
|
8
|
+
import { configureMonacoYaml as de } from "monaco-yaml";
|
|
9
|
+
var Y = { exports: {} }, j = {};
|
|
10
|
+
/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.production.min.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
var me = ae, he = Symbol.for("react.element"), fe = Symbol.for("react.fragment"), pe = Object.prototype.hasOwnProperty, ge = me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, be = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function z(t, e, n) {
|
|
21
|
+
var r, a = {}, o = null, s = null;
|
|
22
|
+
n !== void 0 && (o = "" + n), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
23
|
+
for (r in e)
|
|
24
|
+
pe.call(e, r) && !be.hasOwnProperty(r) && (a[r] = e[r]);
|
|
25
|
+
if (t && t.defaultProps)
|
|
26
|
+
for (r in e = t.defaultProps, e)
|
|
27
|
+
a[r] === void 0 && (a[r] = e[r]);
|
|
28
|
+
return { $$typeof: he, type: t, key: o, ref: s, props: a, _owner: ge.current };
|
|
29
|
+
}
|
|
30
|
+
j.Fragment = fe;
|
|
31
|
+
j.jsx = z;
|
|
32
|
+
j.jsxs = z;
|
|
33
|
+
Y.exports = j;
|
|
34
|
+
var y = Y.exports;
|
|
35
|
+
const F = (t) => {
|
|
36
|
+
const { themeConfig: e, editor: n, theme: r } = t, { defaultTheme: a } = e ?? {}, [o, s] = k(r ?? a ?? "vs-dark");
|
|
37
|
+
return C(() => {
|
|
38
|
+
var g;
|
|
39
|
+
(g = e == null ? void 0 : e.themes) == null || g.forEach((u) => {
|
|
40
|
+
P.editor.defineTheme(u.themeName, u.themeData);
|
|
41
|
+
});
|
|
42
|
+
}, [P]), C(() => {
|
|
43
|
+
P.editor && r && (P.editor.setTheme(r), s(r));
|
|
44
|
+
}, [n, r]), { theme: o };
|
|
45
|
+
};
|
|
46
|
+
function ve(t) {
|
|
47
|
+
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
48
|
+
let n = "";
|
|
49
|
+
for (let r = 0; r < t; r++)
|
|
50
|
+
n += e.charAt(Math.floor(Math.random() * e.length));
|
|
51
|
+
return n;
|
|
52
|
+
}
|
|
53
|
+
function ye(t) {
|
|
54
|
+
return t.replace("'", "'");
|
|
55
|
+
}
|
|
56
|
+
function Ee({
|
|
57
|
+
instanceId: t,
|
|
58
|
+
lineNumbersPosition: e
|
|
59
|
+
}) {
|
|
60
|
+
let n = "";
|
|
61
|
+
return e === "center" && (n += `
|
|
62
|
+
.monaco-editor-${t} .monaco-scrollable-element.editor-scrollable {
|
|
63
|
+
width: 100% !important;
|
|
64
|
+
left: 0px !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.monaco-editor-${t} .view-lines, .view-zones {
|
|
68
|
+
width: 100% !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.monaco-editor-${t} .margin {
|
|
72
|
+
z-index: 1000;
|
|
73
|
+
background: transparent !important;
|
|
74
|
+
}`), n += `
|
|
75
|
+
.monaco-editor-${t} .blame-editor-separator {
|
|
76
|
+
right: 14px;
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.monaco-editor-${t} {
|
|
81
|
+
outline: none !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.monaco-editor-${t} .view-line .blame-editor-commit {
|
|
85
|
+
display: inline-block;
|
|
86
|
+
color: white;
|
|
87
|
+
}`, n;
|
|
88
|
+
}
|
|
89
|
+
function Me({
|
|
90
|
+
instanceId: t,
|
|
91
|
+
blameData: e,
|
|
92
|
+
dateWidth: n,
|
|
93
|
+
avatarSize: r
|
|
94
|
+
}) {
|
|
95
|
+
let a = "";
|
|
96
|
+
return e.forEach((o) => {
|
|
97
|
+
var d, f, c, p, m, i, b, l;
|
|
98
|
+
const s = (f = (d = o == null ? void 0 : o.commitInfo) == null ? void 0 : d.author) == null ? void 0 : f.avatarUrl, g = (p = (c = o == null ? void 0 : o.commitInfo) == null ? void 0 : c.author) == null ? void 0 : p.initials, u = s ? `background: url('${(i = (m = o == null ? void 0 : o.commitInfo) == null ? void 0 : m.author) == null ? void 0 : i.avatarUrl}');` : "";
|
|
99
|
+
for (let h = o.fromLineNumber; h <= o.toLineNumber; h++)
|
|
100
|
+
h === o.fromLineNumber ? a += `
|
|
101
|
+
.monaco-editor-${t} .view-line .blame-editor-commit-${h}:before {
|
|
102
|
+
content: '${ye(((l = (b = o == null ? void 0 : o.commitInfo) == null ? void 0 : b.author) == null ? void 0 : l.when) || "")}';
|
|
103
|
+
position: absolute;
|
|
104
|
+
left: 10px;
|
|
105
|
+
top: 0px;
|
|
106
|
+
color: hsl(var(--canary-foreground-03));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.monaco-editor-${t} .view-line .blame-editor-commit-${h}:after {
|
|
110
|
+
content: '${g ?? " "}';
|
|
111
|
+
position: absolute;
|
|
112
|
+
border-radius: 50%;
|
|
113
|
+
padding: 4px;
|
|
114
|
+
text-align: center;
|
|
115
|
+
background: hsl(var(--canary-background-11));
|
|
116
|
+
line-height: 17px;
|
|
117
|
+
left: ${n + 10}px;
|
|
118
|
+
top: -4px;
|
|
119
|
+
color: hsl(var(--canary-foreground-03));
|
|
120
|
+
width: ${r}px;
|
|
121
|
+
height: ${r}px;
|
|
122
|
+
${u}
|
|
123
|
+
background-size: 100% 100%;
|
|
124
|
+
}` : a += `
|
|
125
|
+
.monaco-editor-${t} .view-line .blame-editor-commit-${h}:before {
|
|
126
|
+
content: ' ';
|
|
127
|
+
left: 10px;
|
|
128
|
+
top: 0px;
|
|
129
|
+
color: gray;
|
|
130
|
+
}`;
|
|
131
|
+
}), a;
|
|
132
|
+
}
|
|
133
|
+
function Se(t, e) {
|
|
134
|
+
let n = "";
|
|
135
|
+
return t.length > e ? n = t.slice(0, e - 3) + "..." : t.length < e ? n = t + " ".repeat(e - t.length) : n = t, " ".repeat(25) + n + " ".repeat(10);
|
|
136
|
+
}
|
|
137
|
+
D.config({ monaco: P });
|
|
138
|
+
const R = 450, xe = 30, Ce = 140, Pe = 24, $e = 46, Ne = {
|
|
139
|
+
selectOnLineNumbers: !0,
|
|
140
|
+
readOnly: !0,
|
|
141
|
+
matchBrackets: "never",
|
|
142
|
+
renderValidationDecorations: "off",
|
|
143
|
+
guides: { indentation: !1 },
|
|
144
|
+
folding: !1,
|
|
145
|
+
stickyScroll: { enabled: !1 },
|
|
146
|
+
renderWhitespace: "none",
|
|
147
|
+
renderLineHighlight: "none",
|
|
148
|
+
minimap: { enabled: !1 },
|
|
149
|
+
scrollBeyondLastLine: !1,
|
|
150
|
+
fontSize: 14,
|
|
151
|
+
fontFamily: '"JetBrains Mono", "monospace"',
|
|
152
|
+
lineHeight: 20
|
|
153
|
+
};
|
|
154
|
+
function Ve(t) {
|
|
155
|
+
const {
|
|
156
|
+
code: e,
|
|
157
|
+
language: n,
|
|
158
|
+
themeConfig: r,
|
|
159
|
+
lineNumbersPosition: a = "left",
|
|
160
|
+
blameData: o,
|
|
161
|
+
showSeparators: s = !0,
|
|
162
|
+
theme: g
|
|
163
|
+
} = t, u = x(o);
|
|
164
|
+
u.current = o;
|
|
165
|
+
const d = x(ve(5));
|
|
166
|
+
T();
|
|
167
|
+
const [f, c] = k(), [p, m] = k(0), i = x(null), b = x(null);
|
|
168
|
+
function l() {
|
|
169
|
+
const M = b.current, $ = i.current;
|
|
170
|
+
if (!M || !$)
|
|
171
|
+
return;
|
|
172
|
+
s && M.changeViewZones(function(v) {
|
|
173
|
+
v.addZone({
|
|
174
|
+
afterLineNumber: 0,
|
|
175
|
+
heightInPx: 10,
|
|
176
|
+
domNode: document.createElement("div")
|
|
177
|
+
}), u.current.forEach((N, E) => {
|
|
178
|
+
if (E !== u.current.length - 1) {
|
|
179
|
+
const S = document.createElement("div");
|
|
180
|
+
S.style.borderTop = "1px solid hsl(var(--canary-border-01))", S.style.marginTop = "9px", S.className = "blame-editor-separator", v.addZone({
|
|
181
|
+
afterLineNumber: N.toLineNumber,
|
|
182
|
+
heightInPx: 20,
|
|
183
|
+
domNode: S
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
const L = [];
|
|
189
|
+
u.current.forEach((v) => {
|
|
190
|
+
var N;
|
|
191
|
+
for (let E = v.fromLineNumber; E <= v.toLineNumber; E++)
|
|
192
|
+
L.push({
|
|
193
|
+
range: new $.Range(E, 0, E + 1, 0),
|
|
194
|
+
options: {
|
|
195
|
+
before: {
|
|
196
|
+
content: Se(
|
|
197
|
+
E === v.fromLineNumber && ((N = v == null ? void 0 : v.commitInfo) == null ? void 0 : N.title) || "",
|
|
198
|
+
xe
|
|
199
|
+
),
|
|
200
|
+
cursorStops: $.editor.InjectedTextCursorStops.None,
|
|
201
|
+
inlineClassName: `blame-editor-commit blame-editor-commit-${E}`
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}), M.createDecorationsCollection(L);
|
|
206
|
+
}
|
|
207
|
+
function h(M, $) {
|
|
208
|
+
var L, v, N, E, S, W;
|
|
209
|
+
b.current = M, i.current = $, M.setValue(e), c(M), (N = (v = (L = $.languages.typescript) == null ? void 0 : L.typescriptDefaults) == null ? void 0 : v.setDiagnosticsOptions) == null || N.call(v, { noSuggestionDiagnostics: !0 }), (W = (S = (E = $.languages.typescript) == null ? void 0 : E.javascriptDefaults) == null ? void 0 : S.setDiagnosticsOptions) == null || W.call(S, { noSuggestionDiagnostics: !0 }), l();
|
|
210
|
+
}
|
|
211
|
+
C(() => {
|
|
212
|
+
f == null || f.setValue(e);
|
|
213
|
+
}, [e]);
|
|
214
|
+
const { theme: O } = F({ monacoRef: i, themeConfig: r, editor: f, theme: g }), B = w(
|
|
215
|
+
() => Ee({
|
|
216
|
+
instanceId: d.current,
|
|
217
|
+
lineNumbersPosition: a
|
|
218
|
+
}),
|
|
219
|
+
[o]
|
|
220
|
+
), ee = w(
|
|
221
|
+
() => Me({
|
|
222
|
+
instanceId: d.current,
|
|
223
|
+
blameData: o,
|
|
224
|
+
avatarSize: Pe,
|
|
225
|
+
dateWidth: Ce
|
|
226
|
+
}),
|
|
227
|
+
[o]
|
|
228
|
+
);
|
|
229
|
+
C(() => {
|
|
230
|
+
if (a === "center") {
|
|
231
|
+
const M = document.getElementsByClassName("lines-content")[0];
|
|
232
|
+
if (M) {
|
|
233
|
+
const $ = { attributes: !0 }, L = (N) => {
|
|
234
|
+
for (const E of N) {
|
|
235
|
+
const S = parseInt(getComputedStyle(M).left);
|
|
236
|
+
m(S);
|
|
237
|
+
}
|
|
238
|
+
}, v = new MutationObserver(L);
|
|
239
|
+
return v.observe(M, $), () => {
|
|
240
|
+
v.disconnect();
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
const te = w(() => `
|
|
246
|
+
.monaco-editor-${d.current} .margin {
|
|
247
|
+
left: ${R - $e + p}px !important;
|
|
248
|
+
pointer-events: none;
|
|
249
|
+
}`, [p]), ne = `
|
|
250
|
+
.monaco-editor-${d.current} .view-overlays {
|
|
251
|
+
clip-path: polygon(${R + 16}px 0, 100% 0%, 100% 100%, ${R + 16}px 100%);
|
|
252
|
+
height:100% !important;
|
|
253
|
+
}`;
|
|
254
|
+
return /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
|
|
255
|
+
/* @__PURE__ */ y.jsx(
|
|
256
|
+
"style",
|
|
257
|
+
{
|
|
258
|
+
dangerouslySetInnerHTML: {
|
|
259
|
+
__html: `${B} ${ee} ${te} ${ne}`
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ y.jsx(
|
|
264
|
+
U,
|
|
265
|
+
{
|
|
266
|
+
height: "75vh",
|
|
267
|
+
className: `monaco-editor-${d.current} overflow-hidden rounded-b-md border-x border-b`,
|
|
268
|
+
language: n,
|
|
269
|
+
theme: O,
|
|
270
|
+
options: Ne,
|
|
271
|
+
onMount: h
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
] });
|
|
275
|
+
}
|
|
276
|
+
D.config({ monaco: P });
|
|
277
|
+
const ke = {
|
|
278
|
+
selectOnLineNumbers: !0,
|
|
279
|
+
scrollBeyondLastLine: !1,
|
|
280
|
+
padding: {
|
|
281
|
+
top: 10
|
|
282
|
+
},
|
|
283
|
+
minimap: { enabled: !1 },
|
|
284
|
+
fontSize: 14,
|
|
285
|
+
fontFamily: '"JetBrains Mono", "monospace"',
|
|
286
|
+
lineHeight: 20
|
|
287
|
+
};
|
|
288
|
+
function Ye(t) {
|
|
289
|
+
const { codeRevision: e, onCodeRevisionChange: n, language: r, themeConfig: a, options: o, theme: s } = t;
|
|
290
|
+
T();
|
|
291
|
+
const [g, u] = k(), d = x(), f = x({ code: "", revisionId: 0 }), c = x(null);
|
|
292
|
+
function p(b, l) {
|
|
293
|
+
c.current = b, d.current = l, b.setValue(e.code), u(b);
|
|
294
|
+
}
|
|
295
|
+
C(() => {
|
|
296
|
+
var b, l;
|
|
297
|
+
if (c.current && (!e.revisionId || e.revisionId > Number((b = f.current) == null ? void 0 : b.revisionId))) {
|
|
298
|
+
const h = c.current.getModel();
|
|
299
|
+
h && (o != null && o.readOnly ? (l = c.current) == null || l.setValue(e.code) : (c.current.pushUndoStop(), c.current.executeEdits("edit", [
|
|
300
|
+
{
|
|
301
|
+
range: h.getFullModelRange(),
|
|
302
|
+
text: e.code
|
|
303
|
+
}
|
|
304
|
+
]), c.current.pushUndoStop()));
|
|
305
|
+
}
|
|
306
|
+
}, [e, c.current]);
|
|
307
|
+
const { theme: m } = F({ monacoRef: d, themeConfig: a, editor: g, theme: s }), i = w(() => ({ ...ke, ...o || {} }), [o]);
|
|
308
|
+
return /* @__PURE__ */ y.jsx(y.Fragment, { children: /* @__PURE__ */ y.jsx(
|
|
309
|
+
U,
|
|
310
|
+
{
|
|
311
|
+
className: "overflow-hidden rounded-b-md border-x border-b",
|
|
312
|
+
height: "75vh",
|
|
313
|
+
onChange: (b, l) => {
|
|
314
|
+
f.current = { code: b ?? "", revisionId: l.versionId }, n({ ...f.current }, l);
|
|
315
|
+
},
|
|
316
|
+
language: r,
|
|
317
|
+
theme: m,
|
|
318
|
+
options: i,
|
|
319
|
+
onMount: p
|
|
320
|
+
}
|
|
321
|
+
) });
|
|
322
|
+
}
|
|
323
|
+
D.config({ monaco: P });
|
|
324
|
+
const Le = {
|
|
325
|
+
selectOnLineNumbers: !0,
|
|
326
|
+
minimap: { enabled: !1 },
|
|
327
|
+
codeLens: !1,
|
|
328
|
+
scrollBeyondLastLine: !1,
|
|
329
|
+
smartSelect: {
|
|
330
|
+
selectLeadingAndTrailingWhitespace: !0
|
|
331
|
+
},
|
|
332
|
+
originalEditable: !1,
|
|
333
|
+
overviewRulerBorder: !1,
|
|
334
|
+
padding: {
|
|
335
|
+
top: 10
|
|
336
|
+
},
|
|
337
|
+
fontSize: 14,
|
|
338
|
+
fontFamily: '"JetBrains Mono", "monospace"',
|
|
339
|
+
lineHeight: 20
|
|
340
|
+
};
|
|
341
|
+
function ze(t) {
|
|
342
|
+
const { original: e, modified: n, language: r, themeConfig: a, options: o, theme: s } = t;
|
|
343
|
+
T();
|
|
344
|
+
const [g, u] = k(), d = x(), { theme: f } = F({ monacoRef: d, themeConfig: a, editor: g, theme: s }), c = w(() => ({ ...Le, ...o || {} }), [o]);
|
|
345
|
+
return /* @__PURE__ */ y.jsx(y.Fragment, { children: /* @__PURE__ */ y.jsx(
|
|
346
|
+
le,
|
|
347
|
+
{
|
|
348
|
+
className: "overflow-hidden rounded-b-md border-x border-b",
|
|
349
|
+
language: r,
|
|
350
|
+
theme: f,
|
|
351
|
+
original: e,
|
|
352
|
+
modified: n,
|
|
353
|
+
height: "75vh",
|
|
354
|
+
options: c,
|
|
355
|
+
onMount: u
|
|
356
|
+
}
|
|
357
|
+
) });
|
|
358
|
+
}
|
|
359
|
+
var q = /* @__PURE__ */ ((t) => (t.ContainsPath = "ContainsPath", t))(q || {});
|
|
360
|
+
function we(t) {
|
|
361
|
+
const { pathSymbolMap: e, inlineActions: n = [], commandId: r } = t, a = Object.fromEntries(e.entries()), o = [];
|
|
362
|
+
return n == null || n.forEach((s) => {
|
|
363
|
+
const g = s.actions;
|
|
364
|
+
s.selectors.forEach((d) => {
|
|
365
|
+
switch (d.type) {
|
|
366
|
+
case q.ContainsPath: {
|
|
367
|
+
d.paths.forEach((f) => {
|
|
368
|
+
let p = Object.keys(a).map((i) => ({
|
|
369
|
+
fullPath: i,
|
|
370
|
+
path: i,
|
|
371
|
+
symbol: a[i]
|
|
372
|
+
})).filter((i) => i.path.startsWith(d.basePath));
|
|
373
|
+
p = p.map((i) => ({
|
|
374
|
+
...i,
|
|
375
|
+
path: i.path.substring(d.basePath.length)
|
|
376
|
+
})), p.filter((i) => f.test(i.path)).forEach((i) => {
|
|
377
|
+
const b = i.fullPath, l = i.symbol, h = l.range;
|
|
378
|
+
g.forEach((O) => {
|
|
379
|
+
const B = {
|
|
380
|
+
range: h,
|
|
381
|
+
symbols: [l],
|
|
382
|
+
onClick: O.onClick,
|
|
383
|
+
data: O.data,
|
|
384
|
+
path: b
|
|
385
|
+
};
|
|
386
|
+
o.push({
|
|
387
|
+
range: h,
|
|
388
|
+
command: {
|
|
389
|
+
id: r,
|
|
390
|
+
title: O.title,
|
|
391
|
+
arguments: [B]
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}), o;
|
|
402
|
+
}
|
|
403
|
+
const _ = class _ {
|
|
404
|
+
static set(e) {
|
|
405
|
+
_.data = e;
|
|
406
|
+
}
|
|
407
|
+
static get() {
|
|
408
|
+
return _.data;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
K(_, "data", {});
|
|
412
|
+
let A = _;
|
|
413
|
+
async function J(t) {
|
|
414
|
+
const e = A.get(), { documentSymbolProvider: n } = e.StandaloneServices.get(e.ILanguageFeaturesService);
|
|
415
|
+
return await e.OutlineModel.create(n, t);
|
|
416
|
+
}
|
|
417
|
+
function Z(t) {
|
|
418
|
+
const e = /* @__PURE__ */ new Map();
|
|
419
|
+
return H({
|
|
420
|
+
pathSymbolMap: e,
|
|
421
|
+
parentPath: "",
|
|
422
|
+
children: t.children,
|
|
423
|
+
parentKind: I.SymbolKind.Module
|
|
424
|
+
}), e;
|
|
425
|
+
}
|
|
426
|
+
function H(t) {
|
|
427
|
+
switch (t.parentKind) {
|
|
428
|
+
case I.SymbolKind.Module: {
|
|
429
|
+
Oe(t);
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
case I.SymbolKind.Array: {
|
|
433
|
+
_e(t);
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
default:
|
|
437
|
+
De(t);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function Oe(t) {
|
|
441
|
+
t.children.forEach((e) => {
|
|
442
|
+
var r;
|
|
443
|
+
let n = t.parentPath;
|
|
444
|
+
e.symbol && (n = t.parentPath ? `${t.parentPath}.${e.symbol.name}` : e.symbol.name, t.pathSymbolMap.set(n, e.symbol)), H({
|
|
445
|
+
pathSymbolMap: t.pathSymbolMap,
|
|
446
|
+
parentPath: n,
|
|
447
|
+
children: e.children,
|
|
448
|
+
parentKind: ((r = e == null ? void 0 : e.symbol) == null ? void 0 : r.kind) ?? t.parentKind
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function _e(t) {
|
|
453
|
+
let e = 0;
|
|
454
|
+
t.children.forEach((n) => {
|
|
455
|
+
const r = t.parentPath ? `${t.parentPath}.${e}` : `${e}`;
|
|
456
|
+
t.pathSymbolMap.set(r, n.symbol), e += 1, H({
|
|
457
|
+
pathSymbolMap: t.pathSymbolMap,
|
|
458
|
+
parentPath: r,
|
|
459
|
+
children: n.children,
|
|
460
|
+
parentKind: n.symbol.kind
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function De(t) {
|
|
465
|
+
const e = t.children.get("0");
|
|
466
|
+
if (e) {
|
|
467
|
+
const n = t.parentPath ? `${t.parentPath}.${e.symbol.name}` : e == null ? void 0 : e.symbol.name;
|
|
468
|
+
t.pathSymbolMap.set(n, e.symbol);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function Te({
|
|
472
|
+
editorRef: t,
|
|
473
|
+
inlineActions: e
|
|
474
|
+
}) {
|
|
475
|
+
C(() => P.languages.registerCodeLensProvider("yaml", {
|
|
476
|
+
provideCodeLenses: async (r) => {
|
|
477
|
+
var u;
|
|
478
|
+
const a = await J(r), o = Z(a), s = (u = t == null ? void 0 : t.current) == null ? void 0 : u.addCommand(0, (d, { onClick: f, path: c, range: p, data: m }) => {
|
|
479
|
+
f({ path: c, range: p, data: m });
|
|
480
|
+
});
|
|
481
|
+
return s ? {
|
|
482
|
+
lenses: we({ pathSymbolMap: o, inlineActions: e, commandId: s }),
|
|
483
|
+
dispose: () => {
|
|
484
|
+
}
|
|
485
|
+
} : void 0;
|
|
486
|
+
}
|
|
487
|
+
}).dispose, [e, t]);
|
|
488
|
+
}
|
|
489
|
+
const je = ({ editorRef: t, selection: e }) => {
|
|
490
|
+
const [n, r] = k(), a = w(
|
|
491
|
+
() => async (o, s, g) => {
|
|
492
|
+
var p, m, i;
|
|
493
|
+
const u = (p = t == null ? void 0 : t.current) == null ? void 0 : p.getModel();
|
|
494
|
+
if (!u || !s)
|
|
495
|
+
return r(void 0);
|
|
496
|
+
const d = await J(u), c = (m = Z(d).get(s)) == null ? void 0 : m.range;
|
|
497
|
+
c && (r(c), g && ((i = t == null ? void 0 : t.current) == null || i.revealLineInCenter(c.startLineNumber)));
|
|
498
|
+
},
|
|
499
|
+
[]
|
|
500
|
+
);
|
|
501
|
+
C(() => {
|
|
502
|
+
if ("requestIdleCallback" in window) {
|
|
503
|
+
const o = requestIdleCallback(() => {
|
|
504
|
+
a(t, e == null ? void 0 : e.path, e == null ? void 0 : e.revealInCenter);
|
|
505
|
+
});
|
|
506
|
+
return () => cancelIdleCallback(o);
|
|
507
|
+
} else {
|
|
508
|
+
const o = setTimeout(() => {
|
|
509
|
+
a(t, e == null ? void 0 : e.path, e == null ? void 0 : e.revealInCenter);
|
|
510
|
+
}, 100);
|
|
511
|
+
return () => clearTimeout(o);
|
|
512
|
+
}
|
|
513
|
+
}, [e == null ? void 0 : e.path, e == null ? void 0 : e.revealInCenter, t, a]), C(() => {
|
|
514
|
+
var s;
|
|
515
|
+
if (!n)
|
|
516
|
+
return;
|
|
517
|
+
const o = (s = t == null ? void 0 : t.current) == null ? void 0 : s.createDecorationsCollection([
|
|
518
|
+
{
|
|
519
|
+
// TODO: check why startColumn is set to "end of row"
|
|
520
|
+
range: { ...n, startColumn: 1 },
|
|
521
|
+
options: {
|
|
522
|
+
isWholeLine: !1,
|
|
523
|
+
className: e == null ? void 0 : e.className
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
]);
|
|
527
|
+
return () => o == null ? void 0 : o.clear();
|
|
528
|
+
}, [n, t, e == null ? void 0 : e.className]);
|
|
529
|
+
}, G = se({
|
|
530
|
+
markers: [],
|
|
531
|
+
setMarkers: () => {
|
|
532
|
+
},
|
|
533
|
+
editor: null,
|
|
534
|
+
setEditor: (t) => {
|
|
535
|
+
},
|
|
536
|
+
updateCursorPosition: (t) => {
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
function qe({ children: t }) {
|
|
540
|
+
const [e, n] = k([]), [r, a] = k(null), o = ie(
|
|
541
|
+
(s) => {
|
|
542
|
+
r == null || r.setPosition(s), r == null || r.focus();
|
|
543
|
+
},
|
|
544
|
+
[r]
|
|
545
|
+
);
|
|
546
|
+
return /* @__PURE__ */ y.jsx(
|
|
547
|
+
G.Provider,
|
|
548
|
+
{
|
|
549
|
+
value: {
|
|
550
|
+
markers: e,
|
|
551
|
+
setMarkers: n,
|
|
552
|
+
editor: r,
|
|
553
|
+
setEditor: a,
|
|
554
|
+
updateCursorPosition: o
|
|
555
|
+
},
|
|
556
|
+
children: t
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
function Q() {
|
|
561
|
+
return ce(G);
|
|
562
|
+
}
|
|
563
|
+
const Fe = ({ monacoRef: t }) => {
|
|
564
|
+
const { setMarkers: e } = Q();
|
|
565
|
+
C(() => {
|
|
566
|
+
let n;
|
|
567
|
+
const r = setTimeout(() => {
|
|
568
|
+
var o;
|
|
569
|
+
const a = (o = t.current) == null ? void 0 : o.editor;
|
|
570
|
+
a && (n = a.onDidChangeMarkers(([s]) => {
|
|
571
|
+
const g = a.getModelMarkers({ resource: s });
|
|
572
|
+
e(g);
|
|
573
|
+
}));
|
|
574
|
+
}, 100);
|
|
575
|
+
return () => {
|
|
576
|
+
clearTimeout(r), n == null || n.dispose();
|
|
577
|
+
};
|
|
578
|
+
}, [t]);
|
|
579
|
+
};
|
|
580
|
+
let V = !1;
|
|
581
|
+
function Be(t) {
|
|
582
|
+
if (V)
|
|
583
|
+
return;
|
|
584
|
+
const e = {
|
|
585
|
+
hover: !0,
|
|
586
|
+
completion: !0,
|
|
587
|
+
enableSchemaRequest: !1,
|
|
588
|
+
validate: !0,
|
|
589
|
+
schemas: [t]
|
|
590
|
+
};
|
|
591
|
+
return V = !0, de(P, e);
|
|
592
|
+
}
|
|
593
|
+
const X = (t) => ue.parse(`file://${t}`).toString(), Re = (t) => {
|
|
594
|
+
const { schemaConfig: e, instanceId: n } = t;
|
|
595
|
+
C(() => {
|
|
596
|
+
e != null && e.schema && Be({
|
|
597
|
+
// If YAML file is opened matching this glob
|
|
598
|
+
fileMatch: [X(n.toString())],
|
|
599
|
+
...e
|
|
600
|
+
});
|
|
601
|
+
}, [e == null ? void 0 : e.schema, n]);
|
|
602
|
+
};
|
|
603
|
+
D.config({ monaco: P });
|
|
604
|
+
const Ie = {
|
|
605
|
+
selectOnLineNumbers: !0
|
|
606
|
+
};
|
|
607
|
+
function Je(t) {
|
|
608
|
+
const {
|
|
609
|
+
yamlRevision: e,
|
|
610
|
+
schemaConfig: n,
|
|
611
|
+
inlineActions: r,
|
|
612
|
+
themeConfig: a,
|
|
613
|
+
onYamlRevisionChange: o,
|
|
614
|
+
selection: s,
|
|
615
|
+
theme: g
|
|
616
|
+
} = t;
|
|
617
|
+
T();
|
|
618
|
+
const [u] = k("yaml"), { editor: d, setEditor: f } = Q(), c = x(), p = x({ yaml: "", revisionId: 0 }), m = x(null);
|
|
619
|
+
function i(l, h) {
|
|
620
|
+
m.current = l, c.current = h, l.setValue(e.yaml), f(l);
|
|
621
|
+
}
|
|
622
|
+
C(() => {
|
|
623
|
+
var l;
|
|
624
|
+
if (m.current && (!e.revisionId || e.revisionId > Number((l = p.current) == null ? void 0 : l.revisionId))) {
|
|
625
|
+
const h = m.current.getModel();
|
|
626
|
+
h && (m.current.pushUndoStop(), m.current.executeEdits("edit", [
|
|
627
|
+
{
|
|
628
|
+
range: h.getFullModelRange(),
|
|
629
|
+
text: e.yaml
|
|
630
|
+
}
|
|
631
|
+
]), m.current.pushUndoStop());
|
|
632
|
+
}
|
|
633
|
+
}, [e, m.current]), Re({ schemaConfig: n, instanceId: u }), Te({ editorRef: m, inlineActions: r });
|
|
634
|
+
const { theme: b } = F({ monacoRef: c, themeConfig: a, editor: d, theme: g });
|
|
635
|
+
return Fe({ monacoRef: c }), je({ editorRef: m, selection: s }), /* @__PURE__ */ y.jsx(y.Fragment, { children: /* @__PURE__ */ y.jsx(
|
|
636
|
+
U,
|
|
637
|
+
{
|
|
638
|
+
onChange: (l, h) => {
|
|
639
|
+
p.current = { yaml: l ?? "", revisionId: h.versionId }, o({ ...p.current }, h);
|
|
640
|
+
},
|
|
641
|
+
language: "yaml",
|
|
642
|
+
theme: b,
|
|
643
|
+
options: Ie,
|
|
644
|
+
path: X(u),
|
|
645
|
+
onMount: i
|
|
646
|
+
}
|
|
647
|
+
) });
|
|
648
|
+
}
|
|
649
|
+
export {
|
|
650
|
+
Ve as BlameEditor,
|
|
651
|
+
ze as CodeDiffEditor,
|
|
652
|
+
Ye as CodeEditor,
|
|
653
|
+
A as MonacoGlobals,
|
|
654
|
+
q as SelectorType,
|
|
655
|
+
Je as YamlEditor,
|
|
656
|
+
G as YamlEditorContext,
|
|
657
|
+
qe as YamlEditorContextProvider,
|
|
658
|
+
Q as useYamlEditorContext
|
|
659
|
+
};
|
|
660
|
+
//# sourceMappingURL=index.js.map
|