@ws-ui/code-editor 0.2.0-beta.20240726.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/demo/common.d.ts +5 -0
- package/dist/index.cjs.js +7 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +108 -104
- package/dist/index.es.js.map +1 -1
- package/dist/studio/assets/css.worker.bundle.js +18131 -14357
- package/dist/studio/assets/editor.worker.bundle.js +1948 -924
- package/dist/studio/assets/html.worker.bundle.js +4726 -3749
- package/dist/studio/assets/json.worker.bundle.js +6007 -4623
- package/dist/studio/assets/textmate.worker.bundle.js +2158 -1055
- package/dist/studio/assets/ts.worker.bundle.js +90386 -54619
- package/package.json +24 -23
package/dist/demo/common.d.ts
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty;var Ie=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>(Ie(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),f=require("react"),D=require("@monaco-editor/react"),Z=require("@ws-ui/shared"),Ce=require("monaco-languageclient"),z=require("monaco-languageclient/vscode/services"),U=require("@codingame/monaco-vscode-configuration-service-override"),me=require("@codingame/monaco-vscode-theme-service-override"),fe=require("@codingame/monaco-vscode-textmate-service-override"),Ae=require("@codingame/monaco-vscode-languages-service-override");require("@codingame/monaco-vscode-theme-defaults-default-extension");const x=require("monaco-editor"),
|
|
1
|
+
"use strict";var de=Object.defineProperty;var Ie=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>(Ie(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),f=require("react"),D=require("@monaco-editor/react"),Z=require("@ws-ui/shared"),Ce=require("monaco-languageclient"),z=require("monaco-languageclient/vscode/services"),U=require("@codingame/monaco-vscode-configuration-service-override"),me=require("@codingame/monaco-vscode-theme-service-override"),fe=require("@codingame/monaco-vscode-textmate-service-override"),Ae=require("@codingame/monaco-vscode-languages-service-override"),pe=require("@codingame/monaco-vscode-editor-service-override");require("@codingame/monaco-vscode-theme-defaults-default-extension");const x=require("monaco-editor"),be=require("monaco-languageclient/tools"),P=require("vscode-languageclient"),V=require("vscode-ws-jsonrpc"),E=require("vscode-languageserver-protocol"),q=require("vscode/services");require("@codingame/monaco-vscode-standalone-languages");require("@codingame/monaco-vscode-standalone-html-language-features");require("@codingame/monaco-vscode-standalone-css-language-features");require("@codingame/monaco-vscode-standalone-json-language-features");require("@codingame/monaco-vscode-standalone-typescript-language-features");require("@codingame/monaco-vscode-css-default-extension");require("@codingame/monaco-vscode-json-default-extension");require("@codingame/monaco-vscode-html-default-extension");require("@codingame/monaco-vscode-javascript-default-extension");const he=require("vscode/extensions");function ve(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const o=ve(x),Se=()=>U(),ye=()=>{const t=me(),e=t.themeService.ctor.prototype;return e.defineTheme=()=>{},t},xe=()=>pe(()=>Promise.resolve(void 0)),Ne=`{
|
|
2
2
|
"workbench.colorTheme": "Default Dark+",
|
|
3
3
|
"workbench.iconTheme": "vs-seti",
|
|
4
4
|
"editor.autoClosingBrackets": "languageDefined",
|
|
@@ -83,27 +83,27 @@
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
`,_=()=>U.initUserConfiguration(
|
|
86
|
+
`,_=()=>U.initUserConfiguration(Ne),Q=async t=>{var r;const e=t.serviceConfig??{};e.debugLogging=((r=t.logger)==null?void 0:r.isEnabled())===!0&&(e.debugLogging===!0||t.logger.isDebugEnabled()===!0),await _(),e.userServices=e.userServices??{};const n=e.userServices.configurationService??void 0,i=e.workspaceConfig??void 0;if(n===void 0){if(i)throw new Error("You provided a workspaceConfig without using the configurationServiceOverride");const a={...Se(),...ye(),...fe(),...Ae(),...xe()};z.mergeServices(a,e.userServices)}return i||(e.workspaceConfig={workspaceProvider:{trusted:!0,workspace:{workspaceUri:o.Uri.file("/workspace")},async open(){return!1}}}),e};class we extends V.WebSocketMessageReader{constructor(n,i){super(n);L(this,"onMessage");this.onMessage=i}readMessage(n){this.onMessage&&this.onMessage();const[,i]=n.split(`\r
|
|
87
87
|
\r
|
|
88
|
-
`);if(this.state==="initial")this.events.splice(0,0,{message:i});else if(this.state==="listening"){const r=JSON.parse(i);this.callback(r)}}}class
|
|
88
|
+
`);if(this.state==="initial")this.events.splice(0,0,{message:i});else if(this.state==="listening"){const r=JSON.parse(i);this.callback(r)}}}class Re extends V.WebSocketMessageWriter{constructor(n,i){super(n);L(this,"onSend");this.onSend=i}async write(n){try{const i=JSON.stringify(n);this.socket.send(i),this.onSend&&this.onSend()}catch(i){this.errorCount++,this.fireError(i,n,this.errorCount)}}}function F(t){return`file:///PACKAGE/Project/Sources/${t}`}function Y(t,e=0){setTimeout(t,e)}function ee(t,e){const n=new x.Selection(e.startLineNumber,e.startColumn,e.endLineNumber||e.startLineNumber,e.endColumn||e.startColumn);Y(()=>{t.setSelection(n),t.revealRangeInCenter(n),t.focus()})}function ne(t,e,n=0){n>0&&(e=n+e),Y(()=>{t.setPosition({lineNumber:e,column:1}),t.revealLineInCenter(e),t.focus()})}function Le(t,e,n){const r=t.getModel();if(r&&e){const a=r.getLineCount();for(let g=1;g<=a;g++){const I=r.getLineContent(g);if(new RegExp(`(?:Function|function) ${n}`).test(I))return g}}return 0}const je={provideCompletionItems:async(t,e)=>{const n=t.getWordUntilPosition(e);return{suggestions:[{label:"var",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["var ${1:var_name} : ${2:var_type}"].join(`
|
|
89
89
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"While",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["While(${1:expression})"," ${2:body}","End while"].join(`
|
|
90
90
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Case of",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["Case of"," :(${1:boolean_expression})"," ${2:body}","End case"].join(`
|
|
91
91
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Else",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["Else"," "].join(`
|
|
92
92
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"If",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["If (${1:expression})"," ${5:body}","End if"].join(`
|
|
93
93
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"For",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["For(${1:counter};${2:start};${3:end}${4:;increment})"," ${5:body}","End for"].join(`
|
|
94
94
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Function",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["Function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}"," ${5:body}"].join(`
|
|
95
|
-
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},
|
|
95
|
+
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},We={provideCompletionItems:async(t,e)=>{const n=t.getWordUntilPosition(e);return{suggestions:[{label:"var",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["var ${1:var_name} : ${2:var_type}"].join(`
|
|
96
96
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"while",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["while(${1:expression})"," ${2:body}","end"].join(`
|
|
97
97
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"switch",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["switch"," :(${1:boolean_expression})"," ${2:body}","end"].join(`
|
|
98
98
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"else",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["else"," "].join(`
|
|
99
99
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"if",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["if (${1:expression})"," ${5:body}","end"].join(`
|
|
100
100
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"for",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["for(${1:counter},${2:start},${3:end}${4:,increment})"," ${5:body}","end"].join(`
|
|
101
101
|
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"function",kind:o.languages.CompletionItemKind.Snippet,range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}"," ${5:body}"].join(`
|
|
102
|
-
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},
|
|
103
|
-
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},
|
|
102
|
+
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Fe=[{keybinding:x.KeyMod.CtrlCmd|x.KeyCode.NumpadAdd,command:"editor.action.fontZoomIn"},{keybinding:x.KeyMod.CtrlCmd|x.KeyCode.Equal,command:"editor.action.fontZoomIn"},{keybinding:x.KeyMod.CtrlCmd|x.KeyCode.NumpadSubtract,command:"editor.action.fontZoomOut"},{keybinding:x.KeyMod.CtrlCmd|x.KeyCode.Minus,command:"editor.action.fontZoomOut"},{keybinding:x.KeyMod.CtrlCmd|x.KeyCode.Numpad0,command:"editor.action.fontZoomReset"},{keybinding:x.KeyMod.CtrlCmd|x.KeyCode.Digit0,command:"editor.action.fontZoomReset"}],Ze=({defaultZoom:t})=>(f.useEffect(()=>{t!==void 0&&x.editor.EditorZoom.setZoomLevel(t)},[]),null);({}).VITE_DISABLE_MONACO_LOADER||D.loader.config({monaco:o});const te=f.createContext(void 0),Ke=({children:t,url:e,qodly:n,defaultZoom:i,openHandler:r,language:a="4d",defaultInited:g=!1})=>{const I=D.useMonaco(),[m,S]=f.useState(g),[K,N]=f.useState(null),b=f.useRef(),v=f.useRef(0);f.useEffect(()=>{e&&I&&y()},[e,I]);const y=async()=>{if(!I)return;const u=new be.Logger({enabled:process.env.NODE_ENV==="development",debugEnabled:process.env.NODE_ENV==="development"}),d=await Q({logger:u});await z.initServices({caller:"Qodly Code Editor",logger:u,serviceConfig:d}),r&&q.StandaloneServices.get(q.ICodeEditorService).registerCodeEditorOpenHandler(r),I.languages.registerCompletionItemProvider(a,n?We:je),x.editor.addKeybindingRules(Fe),h()},h=()=>{N(null);let u;try{u=new WebSocket(localStorage.LSP_SERVER||e)}catch{N(new Event("INVALID_URL"));return}u.onopen=w,u.onclose=A,u.onerror=c,v.current=0},w=async function(){const u=V.toSocket(this),d=new we(u),C=new Re(u),B=new Ce.MonacoLanguageClient({name:"4D Language Client",clientOptions:{workspaceFolder:{uri:x.Uri.parse("file:///PACKAGE")},documentSelector:[{scheme:"file",language:a}],errorHandler:{error:()=>({action:P.ErrorAction.Continue}),closed:()=>({action:P.CloseAction.DoNotRestart})}},connectionProvider:{get:()=>Promise.resolve({reader:d,writer:C})}});b.current=B;const ce=B.sendRequest.bind(B);b.current.sendRequest=function(J,M,ue){return typeof J=="object"&&J.method==="textDocument/diagnostic"&&/file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(M.textDocument.uri)?Promise.resolve():ce(J,M,ue)},d.onClose(()=>{B.stop(),v.current<3?setTimeout(()=>{v.current++,h()},1e3):N(new Event("WEBSOCKET_CLOSED"))}),B.needsStart()&&await B.start(),S(!0)},A=()=>{},c=u=>{N(u)};f.useEffect(()=>{const u=Z.lspSubject.subscribe(({action:d,payload:C})=>{switch(d){case Z.LspActions.WILL_SAVE:k(C.filePath);break;case Z.LspActions.DID_SAVE:s(C.filePath,C.content);break;case Z.LspActions.WILL_CREATE:l(C.filePath);break;case Z.LspActions.DID_CREATE:O(C.filePath);break;case Z.LspActions.WILL_RENAME:R(C.oldPath,C.newPath);break;case Z.LspActions.DID_RENAME:W(C.oldPath,C.newPath);break;case Z.LspActions.WILL_DELETE:j(C.filePath);break;case Z.LspActions.DID_DELETE:ge(C.filePath);break}});return()=>u.unsubscribe()},[]);const k=(u,d=E.TextDocumentSaveReason.Manual)=>{var C;(C=b.current)==null||C.sendNotification(E.WillSaveTextDocumentNotification.type,{textDocument:{uri:F(u)},reason:d})},s=(u,d)=>{var C;(C=b.current)==null||C.sendNotification(E.DidSaveTextDocumentNotification.type,{textDocument:{uri:F(u)},text:d})},l=u=>{var d;(d=b.current)==null||d.sendRequest(E.WillCreateFilesRequest.type,{files:[{uri:F(u)}]})},R=(u,d)=>{var C;(C=b.current)==null||C.sendRequest(E.WillRenameFilesRequest.type,{files:[{oldUri:F(u),newUri:F(d)}]})},j=u=>{var d;(d=b.current)==null||d.sendRequest(E.WillDeleteFilesRequest.type,{files:[{uri:F(u)}]})},O=u=>{var d;(d=b.current)==null||d.sendNotification(E.DidCreateFilesNotification.type,{files:[{uri:F(u)}]})},W=(u,d)=>{var C;(C=b.current)==null||C.sendNotification(E.DidRenameFilesNotification.type,{files:[{oldUri:F(u),newUri:F(d)}]})},ge=u=>{var d;(d=b.current)==null||d.sendNotification(E.DidDeleteFilesNotification.type,{files:[{uri:F(u)}]})};return p.jsxs(te.Provider,{value:{inited:m||!!K,clientRef:b,lastError:K,reload:h},children:[t,p.jsx(Ze,{defaultZoom:i})]})};function Ee(){const t=f.useContext(te);if(t===void 0)throw new Error("useLSP must be used within an LSPContext");return t}const ie=f.createContext(void 0),Xe=f.memo(({children:t})=>{const[e,n]=f.useState(null);return p.jsx(ie.Provider,{value:{editor:e,setEditor:n},children:t})});function oe(){const t=f.useContext(ie),e=f.useState(null);if(t===void 0){const[n,i]=e;return{editor:n,setEditor:i}}return t}var re={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},H=f.createContext&&f.createContext(re),X=globalThis&&globalThis.__assign||function(){return X=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},X.apply(this,arguments)},ke=globalThis&&globalThis.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n};function se(t){return t&&t.map(function(e,n){return f.createElement(e.tag,X({key:n},e.attr),se(e.child))})}function le(t){return function(e){return f.createElement(Oe,X({attr:X({},t.attr)},e),se(t.child))}}function Oe(t){var e=function(n){var i=t.attr,r=t.size,a=t.title,g=ke(t,["attr","size","title"]),I=r||n.size||"1em",m;return n.className&&(m=n.className),t.className&&(m=(m?m+" ":"")+t.className),f.createElement("svg",X({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,i,g,{className:m,style:X(X({color:t.color||n.color},n.style),t.style),height:I,width:I,xmlns:"http://www.w3.org/2000/svg"}),a&&f.createElement("title",null,a),t.children)};return H!==void 0?f.createElement(H.Consumer,null,function(n){return e(n)}):e(re)}function Be(t){return le({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}}]})(t)}function Ge(t){return le({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0080 446.25h340.89a32 32 0 0028.18-47.17zm-198.6-1.83a20 20 0 1120-20 20 20 0 01-20 20zm21.72-201.15l-5.74 122a16 16 0 01-32 0l-5.74-121.95a21.73 21.73 0 0121.5-22.69h.21a21.74 21.74 0 0121.73 22.7z"}}]})(t)}const ae=({lspProps:{lastError:t,reload:e}})=>{const[n,i]=f.useState(!1),r=()=>{e()},a=()=>{i(!1)};return f.useEffect(()=>{i(!!t)},[t]),n?p.jsxs("div",{className:"flex items-center border-b border-fd-gray-darker bg-grey-800 px-2 py-1.5 text-xs text-grey-50",children:[p.jsxs("span",{className:"flex flex-1 justify-center gap-1",children:[p.jsx(Ge,{className:"h-4 w-4 text-yellow-600"}),p.jsxs("span",{children:["LSP not loaded."," ",p.jsx("button",{className:"text-primary-dark underline",onClick:r,children:"Reload?"})]})]}),p.jsx("button",{className:"focus:outline-none",children:p.jsx(Be,{className:"h-4 w-4 text-white",onClick:a})})]}):null},Te={provideCompletionItems:(t,e)=>{const n=t.getWordUntilPosition(e);return{suggestions:[{label:"device:xs",kind:o.languages.CompletionItemKind.Snippet,documentation:"Media query for phone device",range:new o.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["@media screen and (max-width: ${1:365px}) {"," self {"," ${2:background-color}:${3:red};"," }","}"].join(`
|
|
103
|
+
`),insertTextRules:o.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Je="#/definitions/Condition",De={Base:{type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"]},Condition:{oneOf:[{$ref:"#/definitions/Datasource"},{$ref:"#/definitions/Privilege"},{$ref:"#/definitions/Combination"},{$ref:"#/definitions/CurrentState"},{$ref:"#/definitions/ParentState"},{$ref:"#/definitions/Reference"}]},Datasource:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"datasource"},path:{type:"string"},value:{type:["number","string","boolean","object","array","null"]},valueType:{enum:["datasource","hardCoded"]},dataType:{enum:["string","number","date","boolean","array","object"]},op:{enum:["eq","neq","regex","in","nin","gt","gte","lt","lte"]}},required:["name","type","path","value","op"]},Privilege:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"privilege"},value:{type:"string"},valueType:{enum:["datasource","hardCoded"]},op:{enum:["eq","neq","regex"]}},required:["name","type","value","op"]},Combination:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"combination"},op:{enum:["and","or"]},conditions:{type:"array",items:{$ref:"#/definitions/Condition"}}},required:["type","conditions","op"]},CurrentState:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"currentState"},value:{type:"string"},valueType:{enum:["datasource","hardCoded"]},dataType:{enum:["string","number","date","boolean","array","object"]},op:{enum:["eq","neq","regex"]}},required:["name","type","value","op"]},ParentState:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"parentState"},value:{type:"string"},valueType:{enum:["datasource","hardCoded"]},dataType:{enum:["string","number","date","boolean","array","object"]},op:{enum:["eq","neq","regex"]}},required:["name","type","value","op"]},Reference:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"reference"},ref:{type:"string"}},required:["type","ref"]}},Ve={$ref:Je,definitions:De};function Ye(t,e){const n=document.createElement("style");n.dataset.id=e,n.textContent=t,document.head.append(n)}function Me(t){return Array.from(document.styleSheets).find(e=>e.ownerNode.getAttribute("data-id")===t)}function Pe(t,e){const n=[];let i=[];const r=[],a=(s,l,R,j)=>{n.push({startLineNumber:s,endLineNumber:R,startColumn:l,endColumn:j}),S(),m()},g=s=>{r.indexOf(s)<0&&r.push(s)},I=s=>{const l=r.indexOf(s);l<0||r.splice(l,1)},m=()=>{for(const s of r)try{s(i)}catch(l){console.error(l)}},S=()=>{const s=t.getModel();s&&(i=He(n.map(l=>[s.getOffsetAt({lineNumber:l.startLineNumber,column:l.startColumn}),s.getOffsetAt({lineNumber:l.endLineNumber,column:l.endColumn})]),!0),i.length>0&&(i[0][0]<=0&&(i[0][0]=Number.NEGATIVE_INFINITY),i[i.length-1][1]>=s.getValueLength()&&(i[i.length-1][1]=Number.POSITIVE_INFINITY)))},K=s=>{const l={isDeletion:!1,isAddition:!1,isReplacement:!1};return s.text===""?l.isDeletion=!0:s.range.startLineNumber===s.range.endLineNumber&&s.range.startColumn===s.range.endColumn?l.isAddition=!0:l.isReplacement=!0,l},N=t.onDidChangeModel(s=>{S(),c()}),b=t.onDidChangeModelContent(s=>{if(!s.isUndoing)for(const l of s.changes){const R=K(l);if(R.isReplacement||R.isDeletion||R.isAddition){const j=n.some(W=>l.range.startLineNumber>=W.startLineNumber&&l.range.endLineNumber<=W.endLineNumber&&l.range.startColumn>=W.startColumn&&l.range.endColumn<=W.endColumn),O=!j&&e&&l.range.startLineNumber===1&&l.range.startColumn===1&&!Z.hasAttributesString(l.text);if(j||O){const W=t.getModel();if(W){W.undo();return}}}}}),v=()=>{N.dispose(),b.dispose()};let y=[],h=`
|
|
104
104
|
.idoc-readonly-mark {
|
|
105
105
|
cursor: not-allowed;
|
|
106
106
|
z-index: 1;
|
|
107
107
|
}
|
|
108
|
-
`;if(h){const s="monaco-read-only";Ve(s)||De(h,s),h=null}const w=()=>{g(c),c()},A=()=>{I(c),S=t.deltaDecorations(S,[])},c=()=>{const s=t.getModel();s&&(S=t.deltaDecorations(S,i.map(k(s))))},k=s=>l=>{const R=s.getPositionAt(l[0]),j=s.getPositionAt(l[1]);return{range:new o.Range(R.lineNumber,R.column,j.lineNumber,j.column),options:{className:"idoc-readonly-mark"}}};return{get buffer(){return i},exclude:a,attach:g,detach:I,dispose:v,show:w,hide:A}}function Me(t,e,n){let i=!1;const r=A=>A[1]<A[0]?(i=!0,[[A[1],A[0]]]):[[...A]],a=A=>i?A.map(c=>c[1]>c[0]?I(c):c).reverse():A;let g;const I=A=>(g=A[1],A[1]=A[0],A[0]=g,A),m=r(t);let y,K,N,b,v,S,h,w;N=m[0];for(K of e)for(h=K[0],w=K[1],b=0;b<m.length;b++){if(N=m[b],v=N[0],S=N[1],v<h)S<h?y=[N]:S<=w?y=[[v,h-1]]:y=[[v,h-1],[w+1,S]];else if(v<=w)if(h===Number.NEGATIVE_INFINITY){const A=w+1;y=n===0?[]:[[A,S>A?S:A]]}else w===Number.POSITIVE_INFINITY?y=n===0?[]:[[h-1,h-1]]:S<=w?y=n<0?[[h-1,h-1]]:n>0?[[w+1,w+1]]:[]:y=[[w+1,S]];else y=[N];if(m.splice(b,1,...y),m.length===1&&m[0][1]<h)return a(m)}return a(m)}function Pe(t,e){if(t.length<2)return t;const n=[];let i=null,r,a;t=t.map(g=>(g[1]<g[0]&&(r=g[1],g[1]=g[0],g[1]=r),g)).sort((g,I)=>g[0]-I[0]),n.push(t[0]);for(let g=1;g<t.length;g++)i=n[n.length-1],a=t[g],i[1]===a[0]&&!e?n.push(a):i[1]===a[0]-1&&e?(i[1]=a[1],n.splice(n.length-1,1,i)):i[1]<a[0]?n.push(a):i[1]<a[1]&&(i[1]=a[1],n.splice(n.length-1,1,i));return n}function G(t,e){return e.bind(t)}class qe{constructor(e,n){L(this,"editor");L(this,"intervals");L(this,"disposables",[]);L(this,"prefer",1);L(this,"lastPrefer",1);L(this,"onCursor",G(this,function(e){if(e.source==="api")return;const n=this.getApprovedSelections();n.length!==0&&this.editor.setSelections(n)}));L(this,"onRectangleSelectionStart",G(this,function({event:e}){e.middleButton&&(this.lastPrefer=this.prefer,this.prefer=0,window.addEventListener("pointerup",this.onRectangleSelectionStop))}));L(this,"onRectangleSelectionStop",G(this,function(){this.prefer=this.lastPrefer,window.removeEventListener("pointerup",this.onRectangleSelectionStop)}));L(this,"onKey",G(this,function(e){const n=e.keyCode,i=o.KeyCode;if(e.altKey||i.F1<=n&&n<=i.F19||e.ctrlKey&&n!==i.Backspace)return;if(n===i.UpArrow||n===i.LeftArrow||n===i.Home||n===i.PageUp){this.prefer=-1;return}if(n===i.DownArrow||n===i.RightArrow||n===i.End||n===i.PageDown){this.prefer=1;return}const r=this.getSelections(),a=this.intervals.buffer;let g;if(n===i.Delete)g=I=>I[0]===I[1]&&a.find(m=>I[1]+1===m[0])!=null;else if(n===i.Backspace)g=I=>I[0]===I[1]&&a.find(m=>m[1]+1===I[0])!=null;else return;r.findIndex(g)!==-1&&(e.stopPropagation(),e.preventDefault())}));L(this,"getOffsetAt",G(this,function(e){let n;for(let i=0;i<this.intervals.buffer.length;i++)if(n=this.intervals.buffer[i],e<=n[1])return n[0]-e<e-n[1]?n[0]:n[1]}));var i;this.editor=e,this.intervals=Ye(e,n),(i=this.editor.getModel())==null||i.setEOL(o.editor.EndOfLineSequence.LF)}enable(){this.disposables.push(this.editor.onDidChangeCursorPosition(this.onCursor),this.editor.onKeyDown(this.onKey),this.editor.onMouseDown(this.onRectangleSelectionStart)),this.intervals.show()}dispose(){for(const e of this.disposables)e.dispose();this.disposables.splice(0)}exclude(e,n,i,r){arguments.length===1?this.intervals.exclude(e,0,e,Number.MAX_SAFE_INTEGER):this.intervals.exclude(e,n,i,r)}getApprovedSelections(){const e=this.editor.getModel();return this.getSelections().map(i=>Me(i,this.intervals.buffer,this.prefer)).flat().map(i=>{const r=e.getPositionAt(i[0]),a=e.getPositionAt(i[1]);return new o.Selection(r.lineNumber,r.column,a.lineNumber,a.column)})}getSelections(){const e=this.editor.getModel();return(this.editor.getSelections()||[]).map(n=>[e.getOffsetAt({lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn}),e.getOffsetAt({lineNumber:n.positionLineNumber,column:n.positionColumn})])}}const He=new RegExp("^[ s]+(exposed|Function)","i"),$=()=>p.jsx("div",{className:"absolute inset-0 animate-pulse",children:p.jsx("div",{className:"w-full space-y-4 px-4 py-1",children:p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"h-3 w-3/4 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 w-5/6 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 rounded bg-grey-200"})]})})}),$e=({path:t,initialValue:e,theme:n="fd-dark",type:i,language:r,onChange:a,options:g={},extra:I={},showAlerts:m=!1,lspProps:y,...K})=>{const{initialLineInfo:N,initialSelectionInfo:b}=I,{editor:v,setEditor:S}=oe(),{inited:h}=y;function w(c){r==="css"&&c.languages.registerCompletionItemProvider("css",Oe),r==="json"&&c.languages.json&&c.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"condition-schema.json",fileMatch:["*.condition.json"],schema:Je}]})}function A(c,k){S(c);const s=c.getModel();if(s&&(s.updateOptions({insertSpaces:!1}),c.onKeyUp(()=>{var R;const l=(R=c.getPosition())==null?void 0:R.lineNumber;if(l){const j=s.getLineFirstNonWhitespaceColumn(l),B=s.getLineLength(l),W=s.getLineContent(l);He.test(W)&&c.executeEdits("edit-handler",[{range:new k.Range(l,0,l,B),text:W.substr(j-1,B-j)}])}})),i===Z.FileFolderType.METHOD&&Z.hasAttributesString(e)){const l=new qe(c,!0);l.exclude(1,1,1,Number.POSITIVE_INFINITY),l.enable()}}return f.useEffect(()=>{if(!v)return;const{line:c,offset:k}=N||{};c&&ne(v,c,k)},[N,v]),f.useEffect(()=>{if(!v)return;const{selection:c}=b||{};c&&ee(v,c)},[b,v]),h?p.jsxs(p.Fragment,{children:[m?p.jsx(ae,{lspProps:y}):null,p.jsx(D.Editor,{options:{readOnly:!0,fontSize:12,"semanticHighlighting.enabled":!0,padding:{top:10},...g},path:F(t),value:e,theme:"fd-dark",onChange:c=>a&&a(c||""),language:r,beforeMount:w,onMount:A,loading:p.jsx($,{}),...K})]}):p.jsx($,{})},ze={name:"4d",displayName:"%displayName%",description:"%description%",version:"1.0.0",publisher:"vscode",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"4d",aliases:["4D","4d"],extensions:[".4dm",".4qs"],configuration:"./language-configuration.json"}],grammars:[{language:"4d",scopeName:"source.4dm",path:"./syntaxes/4d.tmLanguage.json"}]}},{registerFileUrl:T,whenReady:_e}=be.registerExtension(ze,void 0,{system:!0});T("./syntaxes/4d.tmLanguage.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjREIiwKICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICJwYXR0ZXJucyI6IFsKICAgIHsKICAgICAgImluY2x1ZGUiOiAiI3N0YXRlbWVudHMiCiAgICB9CiAgXSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJzdGF0ZW1lbnRzIjogewogICAgICAicGF0dGVybnMiOiBbCiAgICAgICAgewogICAgICAgICAgImluY2x1ZGUiOiAiI2NvbW1lbnQiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgImNvbW1lbnQiOiB7CiAgICAgICJwYXR0ZXJucyI6IFsKICAgICAgICB7CiAgICAgICAgICAibmFtZSI6ICJjb21tZW50LmJsb2NrLjRkIiwKICAgICAgICAgICJiZWdpbiI6ICIoL1xcKikoPzpcXHMqKChAKWludGVybmFsKSg/PVxcc3woXFwqLykpKT8iLAogICAgICAgICAgImJlZ2luQ2FwdHVyZXMiOiB7CiAgICAgICAgICAgICIxIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlZmluaXRpb24uY29tbWVudC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAic3RvcmFnZS50eXBlLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICIzIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlY29yYXRvci5pbnRlcm5hbGRlY2xhcmF0aW9uLjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgImVuZCI6ICJcXCovIiwKICAgICAgICAgICJlbmRDYXB0dXJlcyI6IHsKICAgICAgICAgICAgIjAiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAiYmVnaW4iOiAiKF5bIFxcdF0rKT8oKC8vKSg/OlxccyooKEApaW50ZXJuYWwpKD89XFxzfCQpKT8pIiwKICAgICAgICAgICJiZWdpbkNhcHR1cmVzIjogewogICAgICAgICAgICAiMSI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJwdW5jdHVhdGlvbi53aGl0ZXNwYWNlLmNvbW1lbnQubGVhZGluZy40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiY29tbWVudC5saW5lLmRvdWJsZS1zbGFzaC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjMiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiNCI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJzdG9yYWdlLnR5cGUuaW50ZXJuYWxkZWNsYXJhdGlvbi40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjUiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVjb3JhdG9yLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiZW5kIjogIig/PSQpIiwKICAgICAgICAgICJjb250ZW50TmFtZSI6ICJjb21tZW50LmxpbmUuZG91YmxlLXNsYXNoLjRkIgogICAgICAgIH0KICAgICAgXQogICAgfQogIH0KfQo=",self.location).toString(),{mimeType:"application/json",size:1592});T("./language-configuration.json",new URL("data:application/json;base64,ewogICJjb21tZW50cyI6IHsKICAgICJsaW5lQ29tbWVudCI6ICIvLyIsCiAgICAiYmxvY2tDb21tZW50IjogWyIvKioiLCAiKiovIl0KICB9LAogIC8vIHN5bWJvbHMgdXNlZCBhcyBicmFja2V0cwogICJicmFja2V0cyI6IFsKICAgIFsieyIsICJ9Il0sCiAgICBbIigiLCAiKSJdLAogICAgWyJbIiwgIl0iXQogIF0sCiAgLy8gc3ltYm9scyB0aGF0IGFyZSBhdXRvIGNsb3NlZCB3aGVuIHR5cGluZwogIC8vIHN5bWJvbHMgdGhhdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHN1cnJvdW5kIGEgc2VsZWN0aW9uCiAgInN1cnJvdW5kaW5nUGFpcnMiOiBbCiAgICBbInsiLCAifSJdLAogICAgWyJbIiwgIl0iXSwKICAgIFsiKCIsICIpIl0sCiAgICBbIlwiIiwgIlwiIl0sCiAgICBbIiciLCAiJyJdCiAgXSwKICAiYXV0b0Nsb3NpbmdQYWlycyI6IFsKICAgIHsKICAgICAgIm9wZW4iOiAiKCIsCiAgICAgICJjbG9zZSI6ICIpIgogICAgfSwKICAgIHsgIm9wZW4iOiAieyIsICJjbG9zZSI6ICJ9IiB9LAogICAgeyAib3BlbiI6ICJbIiwgImNsb3NlIjogIl0iIH0sCiAgICB7ICJvcGVuIjogIiciLCAiY2xvc2UiOiAiJyIsICJub3RJbiI6IFsic3RyaW5nIiwgImNvbW1lbnQiXSB9LAogICAgeyAib3BlbiI6ICJcIiIsICJjbG9zZSI6ICJcIiIsICJub3RJbiI6IFsic3RyaW5nIl0gfSwKICAgIHsgIm9wZW4iOiAiYCIsICJjbG9zZSI6ICJgIiwgIm5vdEluIjogWyJzdHJpbmciLCAiY29tbWVudCJdIH0sCiAgICB7ICJvcGVuIjogIi8qKiIsICJjbG9zZSI6ICIgKiovIiwgIm5vdEluIjogWyJzdHJpbmciXSB9CiAgXSwKICAiYXV0b0Nsb3NlQmVmb3JlIjogIjs6Liw9fV0pPmAgXG5cdCIsCiAgIndvcmRQYXR0ZXJuIjogIigtP1xcZCpcXC5cXGRcXHcqKXwoW15cXGBcXH5cXCFcXEBcXCNcXCVcXF5cXCZcXCpcXChcXClcXC1cXD1cXCtcXFtcXHtcXF1cXH1cXFxcXFx8XFw7XFw6XFwnXFxcIlxcLFxcLlxcPFxcPlxcL1xcP1xcclxcblxcdFxcZlxcdiBdKyl8KD88PVthLXpBLVpdKSA/KD89W2EtekEtWl0pIiwKICAiaW5kZW50YXRpb25SdWxlcyI6IHsKICAgICJpbmNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGNsYXNzIGNvbnN0cnVjdG9yKSl8KF4oPyFbXlxcc10pKlxccyooZXhwb3NlZHxsb2NhbHxcXHMqKXsxfVxccypmdW5jdGlvbnsxfVxccypcXHcpfCheKD8hW15cXHNdKSpcXHMqKElmfEVsc2V8Rm9yfEZvciBlYWNofFdoaWxlfEJlZ2luIFNRTHxDYXNlIG9mfFVzZXxSZXBlYXR8OiAqXFwoLiopKS4qJCIsCiAgICAgICJmbGFncyI6ICJpIgogICAgfSwKICAgICJkZWNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGV4cG9zZWR8bG9jYWx8XFxzKil7MX1cXHMqZnVuY3Rpb257MX1cXHMqXFx3KXwoRW5kIElmfEVuZCBGb3J8RWxzZXxFbmQgZm9yIGVhY2h8RW5kIFdoaWxlfEVuZCBTUUx8RW5kIGNhc2V8RW5kIHVzZXxVbnRpbHw6ICpcXCguKikuKiQiLAogICAgICAiZmxhZ3MiOiAiaSIKICAgIH0KICB9LAogICJvbkVudGVyUnVsZXMiOiBbCiAgICB7CiAgICAgICJiZWZvcmVUZXh0IjogewogICAgICAgICJwYXR0ZXJuIjogIl5leHBvc2VkIiwKICAgICAgICAiZmxhZ3MiOiAiaSIKICAgICAgfSwKICAgICAgImFjdGlvbiI6IHsgImluZGVudCI6ICJpbmRlbnQiLCAiaW5kZW50QWN0aW9uIjogMSB9CiAgICB9CiAgXQp9Cg==",self.location).toString(),{mimeType:"application/json",size:1723});T("package.json",new URL("data:application/json;base64,ewogICAgIm5hbWUiOiAiNGQiLAogICAgImRpc3BsYXlOYW1lIjogIiVkaXNwbGF5TmFtZSUiLAogICAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICAgInZlcnNpb24iOiAiMS4wLjAiLAogICAgInB1Ymxpc2hlciI6ICJ2c2NvZGUiLAogICAgImxpY2Vuc2UiOiAiTUlUIiwKICAgICJlbmdpbmVzIjogewogICAgICAgICJ2c2NvZGUiOiAiMC4xMC54IgogICAgfSwKICAgICJzY3JpcHRzIjogewogICAgICAgICJ1cGRhdGUtZ3JhbW1hciI6ICJub2RlIC4uL25vZGVfbW9kdWxlcy92c2NvZGUtZ3JhbW1hci11cGRhdGVyL2JpbiBtaWNyb3NvZnQvdnNjb2RlLTRkIGdyYW1tYXJzLzRkLmNzb24gLi9zeW50YXhlcy80ZC50bUxhbmd1YWdlLmpzb24iCiAgICB9LAogICAgImNhdGVnb3JpZXMiOiBbCiAgICAgICAgIlByb2dyYW1taW5nIExhbmd1YWdlcyIKICAgIF0sCiAgICAiY29udHJpYnV0ZXMiOiB7CiAgICAgICAgImxhbmd1YWdlcyI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgICAgICAgImFsaWFzZXMiOiBbIjREIiwgIjRkIl0sCiAgICAgICAgICAgICAgImV4dGVuc2lvbnMiOiBbIi40ZG0iLCAiLjRxcyJdLAogICAgICAgICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICAgICAgICB9CiAgICAgICAgICBdLAogICAgICAgICAgImdyYW1tYXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICAgICAgICB9CiAgICAgICAgICBdCiAgICB9LAogICAgInJlcG9zaXRvcnkiOiB7CiAgICAgICAgInR5cGUiOiAiZ2l0IiwKICAgICAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICAgIH0KfQ==",self.location).toString(),{mimeType:"application/json",size:1006});T("package.nls.json",new URL("data:application/json;base64,ewogICJkaXNwbGF5TmFtZSI6ICI0RCBMYW5ndWFnZSBCYXNpY3MiLAogICJkZXNjcmlwdGlvbiI6ICJQcm92aWRlcyBzeW50YXggaGlnaGxpZ2h0aW5nIGFuZCBicmFja2V0IG1hdGNoaW5nIGZvciA0RE0gYW5kIDRRUyBmaWxlcy4iCn0K",self.location).toString(),{mimeType:"application/json",size:135});exports.Alerts=ae;exports.CodeEditor=$e;exports.CodeEditorProvider=Ke;exports.LSPProvider=Fe;exports._await=Y;exports.configureServices=Q;exports.getFileSystemPath=F;exports.getFunctionOffset=we;exports.initMonacoUserConfiguration=_;exports.jumpToLine=ne;exports.jumpToSelection=ee;exports.useCodeEditor=oe;exports.useLSP=Ze;
|
|
108
|
+
`;if(h){const s="monaco-read-only";Me(s)||Ye(h,s),h=null}const w=()=>{g(c),c()},A=()=>{I(c),y=t.deltaDecorations(y,[])},c=()=>{const s=t.getModel();s&&(y=t.deltaDecorations(y,i.map(k(s))))},k=s=>l=>{const R=s.getPositionAt(l[0]),j=s.getPositionAt(l[1]);return{range:new o.Range(R.lineNumber,R.column,j.lineNumber,j.column),options:{className:"idoc-readonly-mark"}}};return{get buffer(){return i},exclude:a,attach:g,detach:I,dispose:v,show:w,hide:A}}function qe(t,e,n){let i=!1;const r=A=>A[1]<A[0]?(i=!0,[[A[1],A[0]]]):[[...A]],a=A=>i?A.map(c=>c[1]>c[0]?I(c):c).reverse():A;let g;const I=A=>(g=A[1],A[1]=A[0],A[0]=g,A),m=r(t);let S,K,N,b,v,y,h,w;N=m[0];for(K of e)for(h=K[0],w=K[1],b=0;b<m.length;b++){if(N=m[b],v=N[0],y=N[1],v<h)y<h?S=[N]:y<=w?S=[[v,h-1]]:S=[[v,h-1],[w+1,y]];else if(v<=w)if(h===Number.NEGATIVE_INFINITY){const A=w+1;S=n===0?[]:[[A,y>A?y:A]]}else w===Number.POSITIVE_INFINITY?S=n===0?[]:[[h-1,h-1]]:y<=w?S=n<0?[[h-1,h-1]]:n>0?[[w+1,w+1]]:[]:S=[[w+1,y]];else S=[N];if(m.splice(b,1,...S),m.length===1&&m[0][1]<h)return a(m)}return a(m)}function He(t,e){if(t.length<2)return t;const n=[];let i=null,r,a;t=t.map(g=>(g[1]<g[0]&&(r=g[1],g[1]=g[0],g[1]=r),g)).sort((g,I)=>g[0]-I[0]),n.push(t[0]);for(let g=1;g<t.length;g++)i=n[n.length-1],a=t[g],i[1]===a[0]&&!e?n.push(a):i[1]===a[0]-1&&e?(i[1]=a[1],n.splice(n.length-1,1,i)):i[1]<a[0]?n.push(a):i[1]<a[1]&&(i[1]=a[1],n.splice(n.length-1,1,i));return n}function G(t,e){return e.bind(t)}class $e{constructor(e,n){L(this,"editor");L(this,"intervals");L(this,"disposables",[]);L(this,"prefer",1);L(this,"lastPrefer",1);L(this,"onCursor",G(this,function(e){if(e.source==="api")return;const n=this.getApprovedSelections();n.length!==0&&this.editor.setSelections(n)}));L(this,"onRectangleSelectionStart",G(this,function({event:e}){e.middleButton&&(this.lastPrefer=this.prefer,this.prefer=0,window.addEventListener("pointerup",this.onRectangleSelectionStop))}));L(this,"onRectangleSelectionStop",G(this,function(){this.prefer=this.lastPrefer,window.removeEventListener("pointerup",this.onRectangleSelectionStop)}));L(this,"onKey",G(this,function(e){const n=e.keyCode,i=o.KeyCode;if(e.altKey||i.F1<=n&&n<=i.F19||e.ctrlKey&&n!==i.Backspace)return;if(n===i.UpArrow||n===i.LeftArrow||n===i.Home||n===i.PageUp){this.prefer=-1;return}if(n===i.DownArrow||n===i.RightArrow||n===i.End||n===i.PageDown){this.prefer=1;return}const r=this.getSelections(),a=this.intervals.buffer;let g;if(n===i.Delete)g=I=>I[0]===I[1]&&a.find(m=>I[1]+1===m[0])!=null;else if(n===i.Backspace)g=I=>I[0]===I[1]&&a.find(m=>m[1]+1===I[0])!=null;else return;r.findIndex(g)!==-1&&(e.stopPropagation(),e.preventDefault())}));L(this,"getOffsetAt",G(this,function(e){let n;for(let i=0;i<this.intervals.buffer.length;i++)if(n=this.intervals.buffer[i],e<=n[1])return n[0]-e<e-n[1]?n[0]:n[1]}));var i;this.editor=e,this.intervals=Pe(e,n),(i=this.editor.getModel())==null||i.setEOL(o.editor.EndOfLineSequence.LF)}enable(){this.disposables.push(this.editor.onDidChangeCursorPosition(this.onCursor),this.editor.onKeyDown(this.onKey),this.editor.onMouseDown(this.onRectangleSelectionStart)),this.intervals.show()}dispose(){for(const e of this.disposables)e.dispose();this.disposables.splice(0)}exclude(e,n,i,r){arguments.length===1?this.intervals.exclude(e,0,e,Number.MAX_SAFE_INTEGER):this.intervals.exclude(e,n,i,r)}getApprovedSelections(){const e=this.editor.getModel();return this.getSelections().map(i=>qe(i,this.intervals.buffer,this.prefer)).flat().map(i=>{const r=e.getPositionAt(i[0]),a=e.getPositionAt(i[1]);return new o.Selection(r.lineNumber,r.column,a.lineNumber,a.column)})}getSelections(){const e=this.editor.getModel();return(this.editor.getSelections()||[]).map(n=>[e.getOffsetAt({lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn}),e.getOffsetAt({lineNumber:n.positionLineNumber,column:n.positionColumn})])}}const ze=new RegExp("^[ s]+(exposed|Function)","i"),$=()=>p.jsx("div",{className:"absolute inset-0 animate-pulse",children:p.jsx("div",{className:"w-full space-y-4 px-4 py-1",children:p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"h-3 w-3/4 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 w-5/6 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 rounded bg-grey-200"}),p.jsx("div",{className:"h-3 rounded bg-grey-200"})]})})}),Ue=({path:t,initialValue:e,theme:n="fd-dark",type:i,language:r,onChange:a,options:g={},extra:I={},showAlerts:m=!1,lspProps:S,...K})=>{const{initialLineInfo:N,initialSelectionInfo:b}=I,{editor:v,setEditor:y}=oe(),{inited:h}=S;function w(c){r==="css"&&c.languages.registerCompletionItemProvider("css",Te),r==="json"&&c.languages.json&&c.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"condition-schema.json",fileMatch:["*.condition.json"],schema:Ve}]})}function A(c,k){y(c);const s=c.getModel();if(s&&(s.updateOptions({insertSpaces:!1}),c.onKeyUp(()=>{var R;const l=(R=c.getPosition())==null?void 0:R.lineNumber;if(l){const j=s.getLineFirstNonWhitespaceColumn(l),O=s.getLineLength(l),W=s.getLineContent(l);ze.test(W)&&c.executeEdits("edit-handler",[{range:new k.Range(l,0,l,O),text:W.substr(j-1,O-j)}])}})),i===Z.FileFolderType.METHOD&&Z.hasAttributesString(e)){const l=new $e(c,!0);l.exclude(1,1,1,Number.POSITIVE_INFINITY),l.enable()}}return f.useEffect(()=>{if(!v)return;const{line:c,offset:k}=N||{};c&&ne(v,c,k)},[N,v]),f.useEffect(()=>{if(!v)return;const{selection:c}=b||{};c&&ee(v,c)},[b,v]),h?p.jsxs(p.Fragment,{children:[m?p.jsx(ae,{lspProps:S}):null,p.jsx(D.Editor,{options:{readOnly:!0,fontSize:12,"semanticHighlighting.enabled":!0,padding:{top:10},...g},path:F(t),value:e,theme:"fd-dark",onChange:c=>a&&a(c||""),language:r,beforeMount:w,onMount:A,loading:p.jsx($,{}),...K})]}):p.jsx($,{})},_e={name:"4d",displayName:"%displayName%",description:"%description%",version:"1.0.0",publisher:"vscode",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"4d",aliases:["4D","4d"],extensions:[".4dm",".4qs"],configuration:"./language-configuration.json"}],grammars:[{language:"4d",scopeName:"source.4dm",path:"./syntaxes/4d.tmLanguage.json"}]}},{registerFileUrl:T,whenReady:en}=he.registerExtension(_e,void 0,{system:!0});T("./syntaxes/4d.tmLanguage.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjREIiwKICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICJwYXR0ZXJucyI6IFsKICAgIHsKICAgICAgImluY2x1ZGUiOiAiI3N0YXRlbWVudHMiCiAgICB9CiAgXSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJzdGF0ZW1lbnRzIjogewogICAgICAicGF0dGVybnMiOiBbCiAgICAgICAgewogICAgICAgICAgImluY2x1ZGUiOiAiI2NvbW1lbnQiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgImNvbW1lbnQiOiB7CiAgICAgICJwYXR0ZXJucyI6IFsKICAgICAgICB7CiAgICAgICAgICAibmFtZSI6ICJjb21tZW50LmJsb2NrLjRkIiwKICAgICAgICAgICJiZWdpbiI6ICIoL1xcKikoPzpcXHMqKChAKWludGVybmFsKSg/PVxcc3woXFwqLykpKT8iLAogICAgICAgICAgImJlZ2luQ2FwdHVyZXMiOiB7CiAgICAgICAgICAgICIxIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlZmluaXRpb24uY29tbWVudC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAic3RvcmFnZS50eXBlLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICIzIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlY29yYXRvci5pbnRlcm5hbGRlY2xhcmF0aW9uLjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgImVuZCI6ICJcXCovIiwKICAgICAgICAgICJlbmRDYXB0dXJlcyI6IHsKICAgICAgICAgICAgIjAiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAiYmVnaW4iOiAiKF5bIFxcdF0rKT8oKC8vKSg/OlxccyooKEApaW50ZXJuYWwpKD89XFxzfCQpKT8pIiwKICAgICAgICAgICJiZWdpbkNhcHR1cmVzIjogewogICAgICAgICAgICAiMSI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJwdW5jdHVhdGlvbi53aGl0ZXNwYWNlLmNvbW1lbnQubGVhZGluZy40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiY29tbWVudC5saW5lLmRvdWJsZS1zbGFzaC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjMiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiNCI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJzdG9yYWdlLnR5cGUuaW50ZXJuYWxkZWNsYXJhdGlvbi40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjUiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVjb3JhdG9yLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiZW5kIjogIig/PSQpIiwKICAgICAgICAgICJjb250ZW50TmFtZSI6ICJjb21tZW50LmxpbmUuZG91YmxlLXNsYXNoLjRkIgogICAgICAgIH0KICAgICAgXQogICAgfQogIH0KfQo=",self.location).toString(),{mimeType:"application/json",size:1592});T("./language-configuration.json",new URL("data:application/json;base64,ewogICJjb21tZW50cyI6IHsKICAgICJsaW5lQ29tbWVudCI6ICIvLyIsCiAgICAiYmxvY2tDb21tZW50IjogWyIvKioiLCAiKiovIl0KICB9LAogIC8vIHN5bWJvbHMgdXNlZCBhcyBicmFja2V0cwogICJicmFja2V0cyI6IFsKICAgIFsieyIsICJ9Il0sCiAgICBbIigiLCAiKSJdLAogICAgWyJbIiwgIl0iXQogIF0sCiAgLy8gc3ltYm9scyB0aGF0IGFyZSBhdXRvIGNsb3NlZCB3aGVuIHR5cGluZwogIC8vIHN5bWJvbHMgdGhhdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHN1cnJvdW5kIGEgc2VsZWN0aW9uCiAgInN1cnJvdW5kaW5nUGFpcnMiOiBbCiAgICBbInsiLCAifSJdLAogICAgWyJbIiwgIl0iXSwKICAgIFsiKCIsICIpIl0sCiAgICBbIlwiIiwgIlwiIl0sCiAgICBbIiciLCAiJyJdCiAgXSwKICAiYXV0b0Nsb3NpbmdQYWlycyI6IFsKICAgIHsKICAgICAgIm9wZW4iOiAiKCIsCiAgICAgICJjbG9zZSI6ICIpIgogICAgfSwKICAgIHsgIm9wZW4iOiAieyIsICJjbG9zZSI6ICJ9IiB9LAogICAgeyAib3BlbiI6ICJbIiwgImNsb3NlIjogIl0iIH0sCiAgICB7ICJvcGVuIjogIiciLCAiY2xvc2UiOiAiJyIsICJub3RJbiI6IFsic3RyaW5nIiwgImNvbW1lbnQiXSB9LAogICAgeyAib3BlbiI6ICJcIiIsICJjbG9zZSI6ICJcIiIsICJub3RJbiI6IFsic3RyaW5nIl0gfSwKICAgIHsgIm9wZW4iOiAiYCIsICJjbG9zZSI6ICJgIiwgIm5vdEluIjogWyJzdHJpbmciLCAiY29tbWVudCJdIH0sCiAgICB7ICJvcGVuIjogIi8qKiIsICJjbG9zZSI6ICIgKiovIiwgIm5vdEluIjogWyJzdHJpbmciXSB9CiAgXSwKICAiYXV0b0Nsb3NlQmVmb3JlIjogIjs6Liw9fV0pPmAgXG5cdCIsCiAgIndvcmRQYXR0ZXJuIjogIigtP1xcZCpcXC5cXGRcXHcqKXwoW15cXGBcXH5cXCFcXEBcXCNcXCVcXF5cXCZcXCpcXChcXClcXC1cXD1cXCtcXFtcXHtcXF1cXH1cXFxcXFx8XFw7XFw6XFwnXFxcIlxcLFxcLlxcPFxcPlxcL1xcP1xcclxcblxcdFxcZlxcdiBdKyl8KD88PVthLXpBLVpdKSA/KD89W2EtekEtWl0pIiwKICAiaW5kZW50YXRpb25SdWxlcyI6IHsKICAgICJpbmNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGNsYXNzIGNvbnN0cnVjdG9yKSl8KF4oPyFbXlxcc10pKlxccyooZXhwb3NlZHxsb2NhbHxcXHMqKXsxfVxccypmdW5jdGlvbnsxfVxccypcXHcpfCheKD8hW15cXHNdKSpcXHMqKElmfEVsc2V8Rm9yfEZvciBlYWNofFdoaWxlfEJlZ2luIFNRTHxDYXNlIG9mfFVzZXxSZXBlYXR8OiAqXFwoLiopKS4qJCIsCiAgICAgICJmbGFncyI6ICJpIgogICAgfSwKICAgICJkZWNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGV4cG9zZWR8bG9jYWx8XFxzKil7MX1cXHMqZnVuY3Rpb257MX1cXHMqXFx3KXwoRW5kIElmfEVuZCBGb3J8RWxzZXxFbmQgZm9yIGVhY2h8RW5kIFdoaWxlfEVuZCBTUUx8RW5kIGNhc2V8RW5kIHVzZXxVbnRpbHw6ICpcXCguKikuKiQiLAogICAgICAiZmxhZ3MiOiAiaSIKICAgIH0KICB9LAogICJvbkVudGVyUnVsZXMiOiBbCiAgICB7CiAgICAgICJiZWZvcmVUZXh0IjogewogICAgICAgICJwYXR0ZXJuIjogIl5leHBvc2VkIiwKICAgICAgICAiZmxhZ3MiOiAiaSIKICAgICAgfSwKICAgICAgImFjdGlvbiI6IHsgImluZGVudCI6ICJpbmRlbnQiLCAiaW5kZW50QWN0aW9uIjogMSB9CiAgICB9CiAgXQp9Cg==",self.location).toString(),{mimeType:"application/json",size:1723});T("package.json",new URL("data:application/json;base64,ewogICAgIm5hbWUiOiAiNGQiLAogICAgImRpc3BsYXlOYW1lIjogIiVkaXNwbGF5TmFtZSUiLAogICAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICAgInZlcnNpb24iOiAiMS4wLjAiLAogICAgInB1Ymxpc2hlciI6ICJ2c2NvZGUiLAogICAgImxpY2Vuc2UiOiAiTUlUIiwKICAgICJlbmdpbmVzIjogewogICAgICAgICJ2c2NvZGUiOiAiMC4xMC54IgogICAgfSwKICAgICJzY3JpcHRzIjogewogICAgICAgICJ1cGRhdGUtZ3JhbW1hciI6ICJub2RlIC4uL25vZGVfbW9kdWxlcy92c2NvZGUtZ3JhbW1hci11cGRhdGVyL2JpbiBtaWNyb3NvZnQvdnNjb2RlLTRkIGdyYW1tYXJzLzRkLmNzb24gLi9zeW50YXhlcy80ZC50bUxhbmd1YWdlLmpzb24iCiAgICB9LAogICAgImNhdGVnb3JpZXMiOiBbCiAgICAgICAgIlByb2dyYW1taW5nIExhbmd1YWdlcyIKICAgIF0sCiAgICAiY29udHJpYnV0ZXMiOiB7CiAgICAgICAgImxhbmd1YWdlcyI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgICAgICAgImFsaWFzZXMiOiBbIjREIiwgIjRkIl0sCiAgICAgICAgICAgICAgImV4dGVuc2lvbnMiOiBbIi40ZG0iLCAiLjRxcyJdLAogICAgICAgICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICAgICAgICB9CiAgICAgICAgICBdLAogICAgICAgICAgImdyYW1tYXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICAgICAgICB9CiAgICAgICAgICBdCiAgICB9LAogICAgInJlcG9zaXRvcnkiOiB7CiAgICAgICAgInR5cGUiOiAiZ2l0IiwKICAgICAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICAgIH0KfQ==",self.location).toString(),{mimeType:"application/json",size:1006});T("package.nls.json",new URL("data:application/json;base64,ewogICJkaXNwbGF5TmFtZSI6ICI0RCBMYW5ndWFnZSBCYXNpY3MiLAogICJkZXNjcmlwdGlvbiI6ICJQcm92aWRlcyBzeW50YXggaGlnaGxpZ2h0aW5nIGFuZCBicmFja2V0IG1hdGNoaW5nIGZvciA0RE0gYW5kIDRRUyBmaWxlcy4iCn0K",self.location).toString(),{mimeType:"application/json",size:135});exports.Alerts=ae;exports.CodeEditor=Ue;exports.CodeEditorProvider=Xe;exports.LSPProvider=Ke;exports._await=Y;exports.configureServices=Q;exports.getFileSystemPath=F;exports.getFunctionOffset=Le;exports.initMonacoUserConfiguration=_;exports.jumpToLine=ne;exports.jumpToSelection=ee;exports.useCodeEditor=oe;exports.useLSP=Ee;
|
|
109
109
|
//# sourceMappingURL=index.cjs.js.map
|