@webiny/app-sdk-playground 0.0.0-unstable.3c5210ad37

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/index.d.ts +2 -0
  4. package/index.js +32 -0
  5. package/index.js.map +1 -0
  6. package/package.json +33 -0
  7. package/plugins/Playground.d.ts +3 -0
  8. package/plugins/Playground.js +53 -0
  9. package/plugins/Playground.js.map +1 -0
  10. package/plugins/components/CodeEditor.d.ts +13 -0
  11. package/plugins/components/CodeEditor.js +62 -0
  12. package/plugins/components/CodeEditor.js.map +1 -0
  13. package/plugins/components/OutputLine.d.ts +5 -0
  14. package/plugins/components/OutputLine.js +18 -0
  15. package/plugins/components/OutputLine.js.map +1 -0
  16. package/plugins/components/OutputPanel.d.ts +7 -0
  17. package/plugins/components/OutputPanel.js +26 -0
  18. package/plugins/components/OutputPanel.js.map +1 -0
  19. package/plugins/components/PlaygroundToolbar.d.ts +8 -0
  20. package/plugins/components/PlaygroundToolbar.js +31 -0
  21. package/plugins/components/PlaygroundToolbar.js.map +1 -0
  22. package/plugins/consoleCapture.d.ts +8 -0
  23. package/plugins/consoleCapture.js +70 -0
  24. package/plugins/consoleCapture.js.map +1 -0
  25. package/plugins/defaultCode.d.ts +1 -0
  26. package/plugins/defaultCode.js +23 -0
  27. package/plugins/defaultCode.js.map +1 -0
  28. package/plugins/sdkGlobalDeclaration.d.ts +1 -0
  29. package/plugins/sdkGlobalDeclaration.js +230 -0
  30. package/plugins/sdkGlobalDeclaration.js.map +1 -0
  31. package/plugins/types.d.ts +6 -0
  32. package/plugins/types.js +4 -0
  33. package/plugins/types.js.map +1 -0
  34. package/plugins/useCodeExecution.d.ts +8 -0
  35. package/plugins/useCodeExecution.js +79 -0
  36. package/plugins/useCodeExecution.js.map +1 -0
  37. package/plugins/useMonacoEditor.d.ts +8 -0
  38. package/plugins/useMonacoEditor.js +54 -0
  39. package/plugins/useMonacoEditor.js.map +1 -0
  40. package/plugins/useResizableSplit.d.ts +5 -0
  41. package/plugins/useResizableSplit.js +44 -0
  42. package/plugins/useResizableSplit.js.map +1 -0
  43. package/routes.d.ts +4 -0
  44. package/routes.js +9 -0
  45. package/routes.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @webiny/app-sdk-playground
2
+
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
6
+
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
8
+
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const SdkPlayground: React.MemoExoticComponent<() => React.JSX.Element>;
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ import React, { memo } from "react";
2
+ import { useRouter, AdminConfig, AdminLayout } from "@webiny/app-admin";
3
+ import { ReactComponent as CodeIcon } from "@webiny/icons/code.svg";
4
+ import Playground from "./plugins/Playground.js";
5
+ import { Routes } from "./routes.js";
6
+ const {
7
+ Route,
8
+ Menu
9
+ } = AdminConfig;
10
+ const SdkPlaygroundExtension = () => {
11
+ const router = useRouter();
12
+ return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Menu.Support, {
13
+ pin: "start",
14
+ name: "sdk-playground",
15
+ element: /*#__PURE__*/React.createElement(Menu.Support.Link, {
16
+ text: "SDK Playground",
17
+ icon: /*#__PURE__*/React.createElement(Menu.Support.Link.Icon, {
18
+ label: "SDK Playground",
19
+ element: /*#__PURE__*/React.createElement(CodeIcon, null)
20
+ }),
21
+ to: router.getLink(Routes.SdkPlayground)
22
+ })
23
+ }), /*#__PURE__*/React.createElement(Route, {
24
+ route: Routes.SdkPlayground,
25
+ element: /*#__PURE__*/React.createElement(AdminLayout, {
26
+ title: "SDK Playground"
27
+ }, /*#__PURE__*/React.createElement(Playground, null))
28
+ }));
29
+ };
30
+ export const SdkPlayground = /*#__PURE__*/memo(SdkPlaygroundExtension);
31
+
32
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","memo","useRouter","AdminConfig","AdminLayout","ReactComponent","CodeIcon","Playground","Routes","Route","Menu","SdkPlaygroundExtension","router","createElement","Support","pin","name","element","Link","text","icon","Icon","label","to","getLink","SdkPlayground","route","title"],"sources":["index.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport { useRouter, AdminConfig, AdminLayout } from \"@webiny/app-admin\";\nimport { ReactComponent as CodeIcon } from \"@webiny/icons/code.svg\";\nimport Playground from \"./plugins/Playground.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Route, Menu } = AdminConfig;\n\nconst SdkPlaygroundExtension = () => {\n const router = useRouter();\n\n return (\n <AdminConfig>\n <Menu.Support\n pin={\"start\"}\n name={\"sdk-playground\"}\n element={\n <Menu.Support.Link\n text={\"SDK Playground\"}\n icon={\n <Menu.Support.Link.Icon label=\"SDK Playground\" element={<CodeIcon />} />\n }\n to={router.getLink(Routes.SdkPlayground)}\n />\n }\n />\n\n <Route\n route={Routes.SdkPlayground}\n element={\n <AdminLayout title={\"SDK Playground\"}>\n <Playground />\n </AdminLayout>\n }\n />\n </AdminConfig>\n );\n};\n\nexport const SdkPlayground = memo(SdkPlaygroundExtension);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,SAAS,EAAEC,WAAW,EAAEC,WAAW,QAAQ,mBAAmB;AACvE,SAASC,cAAc,IAAIC,QAAQ,QAAQ,wBAAwB;AACnE,OAAOC,UAAU;AACjB,SAASC,MAAM;AAEf,MAAM;EAAEC,KAAK;EAAEC;AAAK,CAAC,GAAGP,WAAW;AAEnC,MAAMQ,sBAAsB,GAAGA,CAAA,KAAM;EACjC,MAAMC,MAAM,GAAGV,SAAS,CAAC,CAAC;EAE1B,oBACIF,KAAA,CAAAa,aAAA,CAACV,WAAW,qBACRH,KAAA,CAAAa,aAAA,CAACH,IAAI,CAACI,OAAO;IACTC,GAAG,EAAE,OAAQ;IACbC,IAAI,EAAE,gBAAiB;IACvBC,OAAO,eACHjB,KAAA,CAAAa,aAAA,CAACH,IAAI,CAACI,OAAO,CAACI,IAAI;MACdC,IAAI,EAAE,gBAAiB;MACvBC,IAAI,eACApB,KAAA,CAAAa,aAAA,CAACH,IAAI,CAACI,OAAO,CAACI,IAAI,CAACG,IAAI;QAACC,KAAK,EAAC,gBAAgB;QAACL,OAAO,eAAEjB,KAAA,CAAAa,aAAA,CAACP,QAAQ,MAAE;MAAE,CAAE,CAC1E;MACDiB,EAAE,EAAEX,MAAM,CAACY,OAAO,CAAChB,MAAM,CAACiB,aAAa;IAAE,CAC5C;EACJ,CACJ,CAAC,eAEFzB,KAAA,CAAAa,aAAA,CAACJ,KAAK;IACFiB,KAAK,EAAElB,MAAM,CAACiB,aAAc;IAC5BR,OAAO,eACHjB,KAAA,CAAAa,aAAA,CAACT,WAAW;MAACuB,KAAK,EAAE;IAAiB,gBACjC3B,KAAA,CAAAa,aAAA,CAACN,UAAU,MAAE,CACJ;EAChB,CACJ,CACQ,CAAC;AAEtB,CAAC;AAED,OAAO,MAAMkB,aAAa,gBAAGxB,IAAI,CAACU,sBAAsB,CAAC","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@webiny/app-sdk-playground",
3
+ "version": "0.0.0-unstable.3c5210ad37",
4
+ "type": "module",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/webiny/webiny-js.git"
9
+ },
10
+ "author": "Webiny Ltd",
11
+ "license": "MIT",
12
+ "dependencies": {
13
+ "@monaco-editor/react": "4.7.0",
14
+ "@webiny/admin-ui": "0.0.0-unstable.3c5210ad37",
15
+ "@webiny/app": "0.0.0-unstable.3c5210ad37",
16
+ "@webiny/app-admin": "0.0.0-unstable.3c5210ad37",
17
+ "@webiny/icons": "0.0.0-unstable.3c5210ad37",
18
+ "@webiny/sdk": "0.0.0-unstable.3c5210ad37",
19
+ "monaco-editor": "0.53.0",
20
+ "react": "18.2.0",
21
+ "react-dom": "18.2.0"
22
+ },
23
+ "devDependencies": {
24
+ "@webiny/build-tools": "0.0.0-unstable.3c5210ad37",
25
+ "rimraf": "6.1.3",
26
+ "typescript": "5.9.3"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "directory": "dist"
31
+ },
32
+ "gitHead": "3c5210ad37c29bfabfeb8a91d3220115352b2ea9"
33
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Playground: React.FC;
3
+ export default Playground;
@@ -0,0 +1,53 @@
1
+ import React, { useState } from "react";
2
+ import { defaultSdkCode } from "./defaultCode.js";
3
+ import { useCodeExecution } from "./useCodeExecution.js";
4
+ import { useMonacoEditor } from "./useMonacoEditor.js";
5
+ import { useResizableSplit } from "./useResizableSplit.js";
6
+ import { PlaygroundToolbar } from "./components/PlaygroundToolbar.js";
7
+ import { CodeEditor } from "./components/CodeEditor.js";
8
+ import { OutputPanel } from "./components/OutputPanel.js";
9
+ const Playground = () => {
10
+ const [code, setCode] = useState(defaultSdkCode);
11
+ const {
12
+ splitRef,
13
+ editorPct,
14
+ handleDividerMouseDown
15
+ } = useResizableSplit();
16
+ const {
17
+ editorRef,
18
+ handleBeforeMount,
19
+ handleEditorDidMount,
20
+ handleFormat
21
+ } = useMonacoEditor(() => handleRun());
22
+ const {
23
+ output,
24
+ isRunning,
25
+ handleRun
26
+ } = useCodeExecution(code, editorRef);
27
+ return /*#__PURE__*/React.createElement("div", {
28
+ className: "flex flex-col bg-gray-100",
29
+ style: {
30
+ height: "calc(100vh - 45px)"
31
+ }
32
+ }, /*#__PURE__*/React.createElement(PlaygroundToolbar, {
33
+ isRunning: isRunning,
34
+ onRun: handleRun,
35
+ onFormat: handleFormat
36
+ }), /*#__PURE__*/React.createElement("div", {
37
+ className: "flex flex-1 overflow-hidden",
38
+ ref: splitRef
39
+ }, /*#__PURE__*/React.createElement(CodeEditor, {
40
+ code: code,
41
+ editorPct: editorPct,
42
+ isRunning: isRunning,
43
+ onCodeChange: setCode,
44
+ onBeforeMount: handleBeforeMount,
45
+ onMount: handleEditorDidMount,
46
+ onDividerMouseDown: handleDividerMouseDown
47
+ }), /*#__PURE__*/React.createElement(OutputPanel, {
48
+ output: output
49
+ })));
50
+ };
51
+ export default Playground;
52
+
53
+ //# sourceMappingURL=Playground.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","defaultSdkCode","useCodeExecution","useMonacoEditor","useResizableSplit","PlaygroundToolbar","CodeEditor","OutputPanel","Playground","code","setCode","splitRef","editorPct","handleDividerMouseDown","editorRef","handleBeforeMount","handleEditorDidMount","handleFormat","handleRun","output","isRunning","createElement","className","style","height","onRun","onFormat","ref","onCodeChange","onBeforeMount","onMount","onDividerMouseDown"],"sources":["Playground.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { defaultSdkCode } from \"./defaultCode.js\";\nimport { useCodeExecution } from \"./useCodeExecution.js\";\nimport { useMonacoEditor } from \"./useMonacoEditor.js\";\nimport { useResizableSplit } from \"./useResizableSplit.js\";\nimport { PlaygroundToolbar } from \"./components/PlaygroundToolbar.js\";\nimport { CodeEditor } from \"./components/CodeEditor.js\";\nimport { OutputPanel } from \"./components/OutputPanel.js\";\n\nconst Playground: React.FC = () => {\n const [code, setCode] = useState(defaultSdkCode);\n const { splitRef, editorPct, handleDividerMouseDown } = useResizableSplit();\n const { editorRef, handleBeforeMount, handleEditorDidMount, handleFormat } = useMonacoEditor(\n () => handleRun()\n );\n const { output, isRunning, handleRun } = useCodeExecution(code, editorRef);\n\n return (\n <div className=\"flex flex-col bg-gray-100\" style={{ height: \"calc(100vh - 45px)\" }}>\n <PlaygroundToolbar isRunning={isRunning} onRun={handleRun} onFormat={handleFormat} />\n <div className=\"flex flex-1 overflow-hidden\" ref={splitRef}>\n <CodeEditor\n code={code}\n editorPct={editorPct}\n isRunning={isRunning}\n onCodeChange={setCode}\n onBeforeMount={handleBeforeMount}\n onMount={handleEditorDidMount}\n onDividerMouseDown={handleDividerMouseDown}\n />\n <OutputPanel output={output} />\n </div>\n </div>\n );\n};\n\nexport default Playground;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,cAAc;AACvB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,UAAU;AACnB,SAASC,WAAW;AAEpB,MAAMC,UAAoB,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGV,QAAQ,CAACC,cAAc,CAAC;EAChD,MAAM;IAAEU,QAAQ;IAAEC,SAAS;IAAEC;EAAuB,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EAC3E,MAAM;IAAEU,SAAS;IAAEC,iBAAiB;IAAEC,oBAAoB;IAAEC;EAAa,CAAC,GAAGd,eAAe,CACxF,MAAMe,SAAS,CAAC,CACpB,CAAC;EACD,MAAM;IAAEC,MAAM;IAAEC,SAAS;IAAEF;EAAU,CAAC,GAAGhB,gBAAgB,CAACO,IAAI,EAAEK,SAAS,CAAC;EAE1E,oBACIf,KAAA,CAAAsB,aAAA;IAAKC,SAAS,EAAC,2BAA2B;IAACC,KAAK,EAAE;MAAEC,MAAM,EAAE;IAAqB;EAAE,gBAC/EzB,KAAA,CAAAsB,aAAA,CAAChB,iBAAiB;IAACe,SAAS,EAAEA,SAAU;IAACK,KAAK,EAAEP,SAAU;IAACQ,QAAQ,EAAET;EAAa,CAAE,CAAC,eACrFlB,KAAA,CAAAsB,aAAA;IAAKC,SAAS,EAAC,6BAA6B;IAACK,GAAG,EAAEhB;EAAS,gBACvDZ,KAAA,CAAAsB,aAAA,CAACf,UAAU;IACPG,IAAI,EAAEA,IAAK;IACXG,SAAS,EAAEA,SAAU;IACrBQ,SAAS,EAAEA,SAAU;IACrBQ,YAAY,EAAElB,OAAQ;IACtBmB,aAAa,EAAEd,iBAAkB;IACjCe,OAAO,EAAEd,oBAAqB;IAC9Be,kBAAkB,EAAElB;EAAuB,CAC9C,CAAC,eACFd,KAAA,CAAAsB,aAAA,CAACd,WAAW;IAACY,MAAM,EAAEA;EAAO,CAAE,CAC7B,CACJ,CAAC;AAEd,CAAC;AAED,eAAeX,UAAU","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import type { OnMount, BeforeMount } from "@monaco-editor/react";
3
+ interface CodeEditorProps {
4
+ code: string;
5
+ editorPct: number;
6
+ isRunning: boolean;
7
+ onCodeChange: (value: string) => void;
8
+ onBeforeMount: BeforeMount;
9
+ onMount: OnMount;
10
+ onDividerMouseDown: (e: React.MouseEvent) => void;
11
+ }
12
+ export declare const CodeEditor: React.FC<CodeEditorProps>;
13
+ export {};
@@ -0,0 +1,62 @@
1
+ import React from "react";
2
+ import Editor from "@monaco-editor/react";
3
+ import { OverlayLoader } from "@webiny/admin-ui";
4
+ export const CodeEditor = ({
5
+ code,
6
+ editorPct,
7
+ isRunning,
8
+ onCodeChange,
9
+ onBeforeMount,
10
+ onMount,
11
+ onDividerMouseDown
12
+ }) => {
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ className: "relative overflow-hidden border-r border-gray-200",
15
+ style: {
16
+ flex: "none",
17
+ width: `${editorPct}%`
18
+ },
19
+ onMouseMove: e => {
20
+ const rect = e.currentTarget.getBoundingClientRect();
21
+ e.currentTarget.style.cursor = e.clientX >= rect.right - 4 ? "col-resize" : "";
22
+ },
23
+ onMouseLeave: e => {
24
+ e.currentTarget.style.cursor = "";
25
+ },
26
+ onMouseDown: e => {
27
+ const rect = e.currentTarget.getBoundingClientRect();
28
+ if (e.clientX >= rect.right - 4) {
29
+ onDividerMouseDown(e);
30
+ }
31
+ }
32
+ }, isRunning && /*#__PURE__*/React.createElement(OverlayLoader, {
33
+ text: "Running code..."
34
+ }), /*#__PURE__*/React.createElement(Editor, {
35
+ height: "100%",
36
+ defaultLanguage: "typescript",
37
+ value: code,
38
+ onChange: value => value && onCodeChange(value),
39
+ beforeMount: onBeforeMount,
40
+ onMount: onMount,
41
+ options: {
42
+ minimap: {
43
+ enabled: false
44
+ },
45
+ renderLineHighlight: "none",
46
+ fontSize: 14,
47
+ automaticLayout: true,
48
+ scrollBeyondLastLine: false,
49
+ wordWrap: "on",
50
+ tabSize: 4,
51
+ insertSpaces: true,
52
+ formatOnPaste: true,
53
+ formatOnType: true,
54
+ suggest: {
55
+ showKeywords: true,
56
+ showSnippets: true
57
+ }
58
+ }
59
+ }));
60
+ };
61
+
62
+ //# sourceMappingURL=CodeEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Editor","OverlayLoader","CodeEditor","code","editorPct","isRunning","onCodeChange","onBeforeMount","onMount","onDividerMouseDown","createElement","className","style","flex","width","onMouseMove","e","rect","currentTarget","getBoundingClientRect","cursor","clientX","right","onMouseLeave","onMouseDown","text","height","defaultLanguage","value","onChange","beforeMount","options","minimap","enabled","renderLineHighlight","fontSize","automaticLayout","scrollBeyondLastLine","wordWrap","tabSize","insertSpaces","formatOnPaste","formatOnType","suggest","showKeywords","showSnippets"],"sources":["CodeEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport Editor from \"@monaco-editor/react\";\nimport type { OnMount, BeforeMount } from \"@monaco-editor/react\";\nimport { OverlayLoader } from \"@webiny/admin-ui\";\n\ninterface CodeEditorProps {\n code: string;\n editorPct: number;\n isRunning: boolean;\n onCodeChange: (value: string) => void;\n onBeforeMount: BeforeMount;\n onMount: OnMount;\n onDividerMouseDown: (e: React.MouseEvent) => void;\n}\n\nexport const CodeEditor: React.FC<CodeEditorProps> = ({\n code,\n editorPct,\n isRunning,\n onCodeChange,\n onBeforeMount,\n onMount,\n onDividerMouseDown\n}) => {\n return (\n <div\n className=\"relative overflow-hidden border-r border-gray-200\"\n style={{ flex: \"none\", width: `${editorPct}%` }}\n onMouseMove={e => {\n const rect = e.currentTarget.getBoundingClientRect();\n e.currentTarget.style.cursor = e.clientX >= rect.right - 4 ? \"col-resize\" : \"\";\n }}\n onMouseLeave={e => {\n e.currentTarget.style.cursor = \"\";\n }}\n onMouseDown={e => {\n const rect = e.currentTarget.getBoundingClientRect();\n if (e.clientX >= rect.right - 4) {\n onDividerMouseDown(e);\n }\n }}\n >\n {isRunning && <OverlayLoader text=\"Running code...\" />}\n <Editor\n height=\"100%\"\n defaultLanguage=\"typescript\"\n value={code}\n onChange={value => value && onCodeChange(value)}\n beforeMount={onBeforeMount}\n onMount={onMount}\n options={{\n minimap: { enabled: false },\n renderLineHighlight: \"none\",\n fontSize: 14,\n automaticLayout: true,\n scrollBeyondLastLine: false,\n wordWrap: \"on\",\n tabSize: 4,\n insertSpaces: true,\n formatOnPaste: true,\n formatOnType: true,\n suggest: {\n showKeywords: true,\n showSnippets: true\n }\n }}\n />\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,sBAAsB;AAEzC,SAASC,aAAa,QAAQ,kBAAkB;AAYhD,OAAO,MAAMC,UAAqC,GAAGA,CAAC;EAClDC,IAAI;EACJC,SAAS;EACTC,SAAS;EACTC,YAAY;EACZC,aAAa;EACbC,OAAO;EACPC;AACJ,CAAC,KAAK;EACF,oBACIV,KAAA,CAAAW,aAAA;IACIC,SAAS,EAAC,mDAAmD;IAC7DC,KAAK,EAAE;MAAEC,IAAI,EAAE,MAAM;MAAEC,KAAK,EAAE,GAAGV,SAAS;IAAI,CAAE;IAChDW,WAAW,EAAEC,CAAC,IAAI;MACd,MAAMC,IAAI,GAAGD,CAAC,CAACE,aAAa,CAACC,qBAAqB,CAAC,CAAC;MACpDH,CAAC,CAACE,aAAa,CAACN,KAAK,CAACQ,MAAM,GAAGJ,CAAC,CAACK,OAAO,IAAIJ,IAAI,CAACK,KAAK,GAAG,CAAC,GAAG,YAAY,GAAG,EAAE;IAClF,CAAE;IACFC,YAAY,EAAEP,CAAC,IAAI;MACfA,CAAC,CAACE,aAAa,CAACN,KAAK,CAACQ,MAAM,GAAG,EAAE;IACrC,CAAE;IACFI,WAAW,EAAER,CAAC,IAAI;MACd,MAAMC,IAAI,GAAGD,CAAC,CAACE,aAAa,CAACC,qBAAqB,CAAC,CAAC;MACpD,IAAIH,CAAC,CAACK,OAAO,IAAIJ,IAAI,CAACK,KAAK,GAAG,CAAC,EAAE;QAC7Bb,kBAAkB,CAACO,CAAC,CAAC;MACzB;IACJ;EAAE,GAEDX,SAAS,iBAAIN,KAAA,CAAAW,aAAA,CAACT,aAAa;IAACwB,IAAI,EAAC;EAAiB,CAAE,CAAC,eACtD1B,KAAA,CAAAW,aAAA,CAACV,MAAM;IACH0B,MAAM,EAAC,MAAM;IACbC,eAAe,EAAC,YAAY;IAC5BC,KAAK,EAAEzB,IAAK;IACZ0B,QAAQ,EAAED,KAAK,IAAIA,KAAK,IAAItB,YAAY,CAACsB,KAAK,CAAE;IAChDE,WAAW,EAAEvB,aAAc;IAC3BC,OAAO,EAAEA,OAAQ;IACjBuB,OAAO,EAAE;MACLC,OAAO,EAAE;QAAEC,OAAO,EAAE;MAAM,CAAC;MAC3BC,mBAAmB,EAAE,MAAM;MAC3BC,QAAQ,EAAE,EAAE;MACZC,eAAe,EAAE,IAAI;MACrBC,oBAAoB,EAAE,KAAK;MAC3BC,QAAQ,EAAE,IAAI;MACdC,OAAO,EAAE,CAAC;MACVC,YAAY,EAAE,IAAI;MAClBC,aAAa,EAAE,IAAI;MACnBC,YAAY,EAAE,IAAI;MAClBC,OAAO,EAAE;QACLC,YAAY,EAAE,IAAI;QAClBC,YAAY,EAAE;MAClB;IACJ;EAAE,CACL,CACA,CAAC;AAEd,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import type { ConsoleMessage } from "../types.js";
3
+ export declare const OutputLine: React.FC<{
4
+ message: ConsoleMessage;
5
+ }>;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ export const OutputLine = ({
3
+ message
4
+ }) => {
5
+ const colorClasses = {
6
+ log: "text-gray-800",
7
+ error: "text-red-700",
8
+ warn: "text-orange-600",
9
+ info: "text-blue-600"
10
+ };
11
+ return /*#__PURE__*/React.createElement("div", {
12
+ className: `font-mono text-[13px] mb-1 whitespace-pre-wrap break-words ${colorClasses[message.type]}`
13
+ }, /*#__PURE__*/React.createElement("span", {
14
+ className: "text-gray-400 text-[11px]"
15
+ }, "[", new Date(message.timestamp).toLocaleTimeString(), "]"), " ", message.message);
16
+ };
17
+
18
+ //# sourceMappingURL=OutputLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","OutputLine","message","colorClasses","log","error","warn","info","createElement","className","type","Date","timestamp","toLocaleTimeString"],"sources":["OutputLine.tsx"],"sourcesContent":["import React from \"react\";\nimport type { ConsoleMessage } from \"../types.js\";\n\nexport const OutputLine: React.FC<{ message: ConsoleMessage }> = ({ message }) => {\n const colorClasses: Record<ConsoleMessage[\"type\"], string> = {\n log: \"text-gray-800\",\n error: \"text-red-700\",\n warn: \"text-orange-600\",\n info: \"text-blue-600\"\n };\n\n return (\n <div\n className={`font-mono text-[13px] mb-1 whitespace-pre-wrap break-words ${colorClasses[message.type]}`}\n >\n <span className=\"text-gray-400 text-[11px]\">\n [{new Date(message.timestamp).toLocaleTimeString()}]\n </span>{\" \"}\n {message.message}\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAO,MAAMC,UAAiD,GAAGA,CAAC;EAAEC;AAAQ,CAAC,KAAK;EAC9E,MAAMC,YAAoD,GAAG;IACzDC,GAAG,EAAE,eAAe;IACpBC,KAAK,EAAE,cAAc;IACrBC,IAAI,EAAE,iBAAiB;IACvBC,IAAI,EAAE;EACV,CAAC;EAED,oBACIP,KAAA,CAAAQ,aAAA;IACIC,SAAS,EAAE,8DAA8DN,YAAY,CAACD,OAAO,CAACQ,IAAI,CAAC;EAAG,gBAEtGV,KAAA,CAAAQ,aAAA;IAAMC,SAAS,EAAC;EAA2B,GAAC,GACvC,EAAC,IAAIE,IAAI,CAACT,OAAO,CAACU,SAAS,CAAC,CAACC,kBAAkB,CAAC,CAAC,EAAC,GACjD,CAAC,EAAC,GAAG,EACVX,OAAO,CAACA,OACR,CAAC;AAEd,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { ConsoleMessage } from "../types.js";
3
+ interface OutputPanelProps {
4
+ output: ConsoleMessage[];
5
+ }
6
+ export declare const OutputPanel: React.FC<OutputPanelProps>;
7
+ export {};
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { OutputLine } from "./OutputLine.js";
3
+ import { MIN_PANE_PCT } from "../types.js";
4
+ export const OutputPanel = ({
5
+ output
6
+ }) => {
7
+ return /*#__PURE__*/React.createElement("div", {
8
+ className: "bg-white flex flex-col overflow-hidden",
9
+ style: {
10
+ flex: 1,
11
+ width: "auto",
12
+ minWidth: `${MIN_PANE_PCT}%`
13
+ }
14
+ }, /*#__PURE__*/React.createElement("div", {
15
+ className: "p-2 border-b border-gray-200 font-bold"
16
+ }, "Output"), /*#__PURE__*/React.createElement("div", {
17
+ className: "p-2 overflow-auto flex-1"
18
+ }, output.length === 0 ? /*#__PURE__*/React.createElement("div", {
19
+ className: "text-gray-400 italic"
20
+ }, "Click \"Run Code\" to see output here...") : output.map((msg, index) => /*#__PURE__*/React.createElement(OutputLine, {
21
+ key: index,
22
+ message: msg
23
+ }))));
24
+ };
25
+
26
+ //# sourceMappingURL=OutputPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","OutputLine","MIN_PANE_PCT","OutputPanel","output","createElement","className","style","flex","width","minWidth","length","map","msg","index","key","message"],"sources":["OutputPanel.tsx"],"sourcesContent":["import React from \"react\";\nimport type { ConsoleMessage } from \"../types.js\";\nimport { OutputLine } from \"./OutputLine.js\";\nimport { MIN_PANE_PCT } from \"../types.js\";\n\ninterface OutputPanelProps {\n output: ConsoleMessage[];\n}\n\nexport const OutputPanel: React.FC<OutputPanelProps> = ({ output }) => {\n return (\n <div\n className=\"bg-white flex flex-col overflow-hidden\"\n style={{ flex: 1, width: \"auto\", minWidth: `${MIN_PANE_PCT}%` }}\n >\n <div className=\"p-2 border-b border-gray-200 font-bold\">Output</div>\n <div className=\"p-2 overflow-auto flex-1\">\n {output.length === 0 ? (\n <div className=\"text-gray-400 italic\">\n Click &quot;Run Code&quot; to see output here...\n </div>\n ) : (\n output.map((msg, index) => <OutputLine key={index} message={msg} />)\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU;AACnB,SAASC,YAAY;AAMrB,OAAO,MAAMC,WAAuC,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EACnE,oBACIJ,KAAA,CAAAK,aAAA;IACIC,SAAS,EAAC,wCAAwC;IAClDC,KAAK,EAAE;MAAEC,IAAI,EAAE,CAAC;MAAEC,KAAK,EAAE,MAAM;MAAEC,QAAQ,EAAE,GAAGR,YAAY;IAAI;EAAE,gBAEhEF,KAAA,CAAAK,aAAA;IAAKC,SAAS,EAAC;EAAwC,GAAC,QAAW,CAAC,eACpEN,KAAA,CAAAK,aAAA;IAAKC,SAAS,EAAC;EAA0B,GACpCF,MAAM,CAACO,MAAM,KAAK,CAAC,gBAChBX,KAAA,CAAAK,aAAA;IAAKC,SAAS,EAAC;EAAsB,GAAC,0CAEjC,CAAC,GAENF,MAAM,CAACQ,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,kBAAKd,KAAA,CAAAK,aAAA,CAACJ,UAAU;IAACc,GAAG,EAAED,KAAM;IAACE,OAAO,EAAEH;EAAI,CAAE,CAAC,CAEtE,CACJ,CAAC;AAEd,CAAC","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface PlaygroundToolbarProps {
3
+ isRunning: boolean;
4
+ onRun: () => void;
5
+ onFormat: () => void;
6
+ }
7
+ export declare const PlaygroundToolbar: React.FC<PlaygroundToolbarProps>;
8
+ export {};
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { Button } from "@webiny/admin-ui";
3
+ import { ReactComponent as PlayArrowIcon } from "@webiny/icons/play_arrow.svg";
4
+ import { ReactComponent as AutoFixHighIcon } from "@webiny/icons/auto_fix_high.svg";
5
+ import { Loader } from "@webiny/admin-ui";
6
+ export const PlaygroundToolbar = ({
7
+ isRunning,
8
+ onRun,
9
+ onFormat
10
+ }) => {
11
+ return /*#__PURE__*/React.createElement("div", {
12
+ className: "flex justify-between items-center px-4 py-2 bg-white border-b border-gray-200 shadow-sm"
13
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "SDK Playground"), /*#__PURE__*/React.createElement("span", {
14
+ className: "ml-4 text-xs text-gray-600"
15
+ }, "Use ", navigator.platform.startsWith("Mac") ? "Cmd" : "Ctrl", "+Enter to run code")), /*#__PURE__*/React.createElement("div", {
16
+ className: "flex gap-2 items-center"
17
+ }, /*#__PURE__*/React.createElement(Button, {
18
+ onClick: onFormat,
19
+ icon: /*#__PURE__*/React.createElement(AutoFixHighIcon, null),
20
+ variant: "secondary"
21
+ }, "Format"), /*#__PURE__*/React.createElement(Button, {
22
+ onClick: onRun,
23
+ disabled: isRunning,
24
+ icon: isRunning ? /*#__PURE__*/React.createElement(Loader, {
25
+ size: "xs",
26
+ variant: "negative"
27
+ }) : /*#__PURE__*/React.createElement(PlayArrowIcon, null)
28
+ }, isRunning ? "Running..." : "Run Code")));
29
+ };
30
+
31
+ //# sourceMappingURL=PlaygroundToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Button","ReactComponent","PlayArrowIcon","AutoFixHighIcon","Loader","PlaygroundToolbar","isRunning","onRun","onFormat","createElement","className","navigator","platform","startsWith","onClick","icon","variant","disabled","size"],"sources":["PlaygroundToolbar.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { ReactComponent as PlayArrowIcon } from \"@webiny/icons/play_arrow.svg\";\nimport { ReactComponent as AutoFixHighIcon } from \"@webiny/icons/auto_fix_high.svg\";\nimport { Loader } from \"@webiny/admin-ui\";\n\ninterface PlaygroundToolbarProps {\n isRunning: boolean;\n onRun: () => void;\n onFormat: () => void;\n}\n\nexport const PlaygroundToolbar: React.FC<PlaygroundToolbarProps> = ({\n isRunning,\n onRun,\n onFormat\n}) => {\n return (\n <div className=\"flex justify-between items-center px-4 py-2 bg-white border-b border-gray-200 shadow-sm\">\n <div>\n <strong>SDK Playground</strong>\n <span className=\"ml-4 text-xs text-gray-600\">\n Use {navigator.platform.startsWith(\"Mac\") ? \"Cmd\" : \"Ctrl\"}+Enter to run code\n </span>\n </div>\n <div className=\"flex gap-2 items-center\">\n <Button onClick={onFormat} icon={<AutoFixHighIcon />} variant={\"secondary\"}>\n Format\n </Button>\n <Button\n onClick={onRun}\n disabled={isRunning}\n icon={\n isRunning ? <Loader size={\"xs\"} variant={\"negative\"} /> : <PlayArrowIcon />\n }\n >\n {isRunning ? \"Running...\" : \"Run Code\"}\n </Button>\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,cAAc,IAAIC,aAAa,QAAQ,8BAA8B;AAC9E,SAASD,cAAc,IAAIE,eAAe,QAAQ,iCAAiC;AACnF,SAASC,MAAM,QAAQ,kBAAkB;AAQzC,OAAO,MAAMC,iBAAmD,GAAGA,CAAC;EAChEC,SAAS;EACTC,KAAK;EACLC;AACJ,CAAC,KAAK;EACF,oBACIT,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAC;EAAyF,gBACpGX,KAAA,CAAAU,aAAA,2BACIV,KAAA,CAAAU,aAAA,iBAAQ,gBAAsB,CAAC,eAC/BV,KAAA,CAAAU,aAAA;IAAMC,SAAS,EAAC;EAA4B,GAAC,MACrC,EAACC,SAAS,CAACC,QAAQ,CAACC,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,MAAM,EAAC,oBACzD,CACL,CAAC,eACNd,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAC;EAAyB,gBACpCX,KAAA,CAAAU,aAAA,CAACT,MAAM;IAACc,OAAO,EAAEN,QAAS;IAACO,IAAI,eAAEhB,KAAA,CAAAU,aAAA,CAACN,eAAe,MAAE,CAAE;IAACa,OAAO,EAAE;EAAY,GAAC,QAEpE,CAAC,eACTjB,KAAA,CAAAU,aAAA,CAACT,MAAM;IACHc,OAAO,EAAEP,KAAM;IACfU,QAAQ,EAAEX,SAAU;IACpBS,IAAI,EACAT,SAAS,gBAAGP,KAAA,CAAAU,aAAA,CAACL,MAAM;MAACc,IAAI,EAAE,IAAK;MAACF,OAAO,EAAE;IAAW,CAAE,CAAC,gBAAGjB,KAAA,CAAAU,aAAA,CAACP,aAAa,MAAE;EAC7E,GAEAI,SAAS,GAAG,YAAY,GAAG,UACxB,CACP,CACJ,CAAC;AAEd,CAAC","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { ConsoleMessage } from "./types.js";
2
+ export declare function formatValue(value: any): string;
3
+ export declare function createCustomConsole(messages: ConsoleMessage[], onUpdate: (messages: ConsoleMessage[]) => void): {
4
+ log: (...args: any[]) => void;
5
+ error: (...args: any[]) => void;
6
+ warn: (...args: any[]) => void;
7
+ info: (...args: any[]) => void;
8
+ };
@@ -0,0 +1,70 @@
1
+ export function formatValue(value) {
2
+ if (value === null) {
3
+ return "null";
4
+ }
5
+ if (value === undefined) {
6
+ return "undefined";
7
+ }
8
+ if (typeof value === "string") {
9
+ return value;
10
+ }
11
+ if (typeof value === "number") {
12
+ return String(value);
13
+ }
14
+ if (typeof value === "boolean") {
15
+ return String(value);
16
+ }
17
+ if (value instanceof Error) {
18
+ return `${value.name}: ${value.message}`;
19
+ }
20
+ if (typeof value === "function") {
21
+ return `[Function]`;
22
+ }
23
+ try {
24
+ return JSON.stringify(value, null, 2);
25
+ } catch {
26
+ return String(value);
27
+ }
28
+ }
29
+ export function createCustomConsole(messages, onUpdate) {
30
+ return {
31
+ log: (...args) => {
32
+ const message = args.map(arg => formatValue(arg)).join(" ");
33
+ messages.push({
34
+ type: "log",
35
+ message,
36
+ timestamp: new Date().toISOString()
37
+ });
38
+ onUpdate([...messages]);
39
+ },
40
+ error: (...args) => {
41
+ const message = args.map(arg => formatValue(arg)).join(" ");
42
+ messages.push({
43
+ type: "error",
44
+ message,
45
+ timestamp: new Date().toISOString()
46
+ });
47
+ onUpdate([...messages]);
48
+ },
49
+ warn: (...args) => {
50
+ const message = args.map(arg => formatValue(arg)).join(" ");
51
+ messages.push({
52
+ type: "warn",
53
+ message,
54
+ timestamp: new Date().toISOString()
55
+ });
56
+ onUpdate([...messages]);
57
+ },
58
+ info: (...args) => {
59
+ const message = args.map(arg => formatValue(arg)).join(" ");
60
+ messages.push({
61
+ type: "info",
62
+ message,
63
+ timestamp: new Date().toISOString()
64
+ });
65
+ onUpdate([...messages]);
66
+ }
67
+ };
68
+ }
69
+
70
+ //# sourceMappingURL=consoleCapture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatValue","value","undefined","String","Error","name","message","JSON","stringify","createCustomConsole","messages","onUpdate","log","args","map","arg","join","push","type","timestamp","Date","toISOString","error","warn","info"],"sources":["consoleCapture.ts"],"sourcesContent":["import type { ConsoleMessage } from \"./types.js\";\n\nexport function formatValue(value: any): string {\n if (value === null) {\n return \"null\";\n }\n if (value === undefined) {\n return \"undefined\";\n }\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n if (typeof value === \"boolean\") {\n return String(value);\n }\n if (value instanceof Error) {\n return `${value.name}: ${value.message}`;\n }\n if (typeof value === \"function\") {\n return `[Function]`;\n }\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n\nexport function createCustomConsole(\n messages: ConsoleMessage[],\n onUpdate: (messages: ConsoleMessage[]) => void\n) {\n return {\n log: (...args: any[]) => {\n const message = args.map(arg => formatValue(arg)).join(\" \");\n messages.push({ type: \"log\", message, timestamp: new Date().toISOString() });\n onUpdate([...messages]);\n },\n error: (...args: any[]) => {\n const message = args.map(arg => formatValue(arg)).join(\" \");\n messages.push({ type: \"error\", message, timestamp: new Date().toISOString() });\n onUpdate([...messages]);\n },\n warn: (...args: any[]) => {\n const message = args.map(arg => formatValue(arg)).join(\" \");\n messages.push({ type: \"warn\", message, timestamp: new Date().toISOString() });\n onUpdate([...messages]);\n },\n info: (...args: any[]) => {\n const message = args.map(arg => formatValue(arg)).join(\" \");\n messages.push({ type: \"info\", message, timestamp: new Date().toISOString() });\n onUpdate([...messages]);\n }\n };\n}\n"],"mappings":"AAEA,OAAO,SAASA,WAAWA,CAACC,KAAU,EAAU;EAC5C,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,MAAM;EACjB;EACA,IAAIA,KAAK,KAAKC,SAAS,EAAE;IACrB,OAAO,WAAW;EACtB;EACA,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EACA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOE,MAAM,CAACF,KAAK,CAAC;EACxB;EACA,IAAI,OAAOA,KAAK,KAAK,SAAS,EAAE;IAC5B,OAAOE,MAAM,CAACF,KAAK,CAAC;EACxB;EACA,IAAIA,KAAK,YAAYG,KAAK,EAAE;IACxB,OAAO,GAAGH,KAAK,CAACI,IAAI,KAAKJ,KAAK,CAACK,OAAO,EAAE;EAC5C;EACA,IAAI,OAAOL,KAAK,KAAK,UAAU,EAAE;IAC7B,OAAO,YAAY;EACvB;EACA,IAAI;IACA,OAAOM,IAAI,CAACC,SAAS,CAACP,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;EACzC,CAAC,CAAC,MAAM;IACJ,OAAOE,MAAM,CAACF,KAAK,CAAC;EACxB;AACJ;AAEA,OAAO,SAASQ,mBAAmBA,CAC/BC,QAA0B,EAC1BC,QAA8C,EAChD;EACE,OAAO;IACHC,GAAG,EAAEA,CAAC,GAAGC,IAAW,KAAK;MACrB,MAAMP,OAAO,GAAGO,IAAI,CAACC,GAAG,CAACC,GAAG,IAAIf,WAAW,CAACe,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAC3DN,QAAQ,CAACO,IAAI,CAAC;QAAEC,IAAI,EAAE,KAAK;QAAEZ,OAAO;QAAEa,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC;MAAE,CAAC,CAAC;MAC5EV,QAAQ,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACDY,KAAK,EAAEA,CAAC,GAAGT,IAAW,KAAK;MACvB,MAAMP,OAAO,GAAGO,IAAI,CAACC,GAAG,CAACC,GAAG,IAAIf,WAAW,CAACe,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAC3DN,QAAQ,CAACO,IAAI,CAAC;QAAEC,IAAI,EAAE,OAAO;QAAEZ,OAAO;QAAEa,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC;MAAE,CAAC,CAAC;MAC9EV,QAAQ,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACDa,IAAI,EAAEA,CAAC,GAAGV,IAAW,KAAK;MACtB,MAAMP,OAAO,GAAGO,IAAI,CAACC,GAAG,CAACC,GAAG,IAAIf,WAAW,CAACe,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAC3DN,QAAQ,CAACO,IAAI,CAAC;QAAEC,IAAI,EAAE,MAAM;QAAEZ,OAAO;QAAEa,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC;MAAE,CAAC,CAAC;MAC7EV,QAAQ,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACDc,IAAI,EAAEA,CAAC,GAAGX,IAAW,KAAK;MACtB,MAAMP,OAAO,GAAGO,IAAI,CAACC,GAAG,CAACC,GAAG,IAAIf,WAAW,CAACe,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAC3DN,QAAQ,CAACO,IAAI,CAAC;QAAEC,IAAI,EAAE,MAAM;QAAEZ,OAAO;QAAEa,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC;MAAE,CAAC,CAAC;MAC7EV,QAAQ,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC;IAC3B;EACJ,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const defaultSdkCode = "// SDK Playground - Try out the Webiny SDK\n// SDK is available as a global 'sdk' variable\n\nasync function run() {\n // List entries from a CMS model\n const result = await sdk.cms.listEntries({\n modelId: \"article\",\n fields: [\"id\", \"createdOn\", \"values.title\"]\n });\n\n // Handle the result\n if (result.isOk()) {\n console.log(\"Entries:\", result.value);\n } else {\n console.error(\"Error:\", result.error);\n }\n}\n\nrun();\n";
@@ -0,0 +1,23 @@
1
+ // Default code template shown in the SDK Playground.
2
+ export const defaultSdkCode = `// SDK Playground - Try out the Webiny SDK
3
+ // SDK is available as a global 'sdk' variable
4
+
5
+ async function run() {
6
+ // List entries from a CMS model
7
+ const result = await sdk.cms.listEntries({
8
+ modelId: "article",
9
+ fields: ["id", "createdOn", "values.title"]
10
+ });
11
+
12
+ // Handle the result
13
+ if (result.isOk()) {
14
+ console.log("Entries:", result.value);
15
+ } else {
16
+ console.error("Error:", result.error);
17
+ }
18
+ }
19
+
20
+ run();
21
+ `;
22
+
23
+ //# sourceMappingURL=defaultCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["defaultSdkCode"],"sources":["defaultCode.ts"],"sourcesContent":["// Default code template shown in the SDK Playground.\nexport const defaultSdkCode = `// SDK Playground - Try out the Webiny SDK\n// SDK is available as a global 'sdk' variable\n\nasync function run() {\n // List entries from a CMS model\n const result = await sdk.cms.listEntries({\n modelId: \"article\",\n fields: [\"id\", \"createdOn\", \"values.title\"]\n });\n\n // Handle the result\n if (result.isOk()) {\n console.log(\"Entries:\", result.value);\n } else {\n console.error(\"Error:\", result.error);\n }\n}\n\nrun();\n`;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,cAAc,GAAG;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const SDK_GLOBAL_DECLARATION = "\ninterface SdkIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\ntype SdkEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\ninterface SdkEntryValues {\n [key: string]: any;\n}\n\ninterface SdkEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n id?: string;\n entryId?: string;\n status?: SdkEntryStatus;\n createdOn?: string;\n modifiedOn?: string | null;\n savedOn?: string;\n deletedOn?: string | null;\n restoredOn?: string | null;\n createdBy?: SdkIdentity;\n modifiedBy?: SdkIdentity;\n savedBy?: SdkIdentity;\n firstPublishedOn?: string;\n lastPublishedOn?: string;\n firstPublishedBy?: SdkIdentity;\n lastPublishedBy?: SdkIdentity;\n revisionCreatedOn?: string;\n revisionModifiedOn?: string | null;\n revisionSavedOn?: string;\n revisionCreatedBy?: SdkIdentity;\n revisionModifiedBy?: SdkIdentity | null;\n revisionSavedBy?: SdkIdentity;\n revisionFirstPublishedOn?: string;\n revisionLastPublishedOn?: string;\n revisionFirstPublishedBy?: SdkIdentity;\n revisionLastPublishedBy?: SdkIdentity;\n location?: { folderId?: string | null };\n values?: TValues;\n}\n\ninterface SdkListEntriesResult<TValues extends SdkEntryValues = SdkEntryValues> {\n data: SdkEntryData<TValues>[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\ninterface SdkResult<TValue, TError = unknown> {\n isOk(): boolean;\n isFail(): boolean;\n readonly value: TValue;\n readonly error: TError;\n}\n\ndeclare class SdkBaseError extends Error {\n readonly code: string;\n readonly message: string;\n}\n\ndeclare class SdkHttpError extends SdkBaseError {\n readonly code: \"HTTP_ERROR\";\n readonly data: { status: number };\n}\n\ndeclare class SdkGraphQLError extends SdkBaseError {\n readonly code: \"GRAPHQL_ERROR\";\n readonly data: { code?: string };\n}\n\ndeclare class SdkNetworkError extends SdkBaseError {\n readonly code: \"NETWORK_ERROR\";\n}\n\ntype SdkCmsError = SdkHttpError | SdkGraphQLError | SdkNetworkError;\n\ninterface SdkGetEntryParams {\n /** The model ID to query. */\n modelId: string;\n where: {\n /** Revision ID, e.g. \"abc#0001\". */\n id?: string;\n /** Entry ID, e.g. \"abc\". */\n entryId?: string;\n /** Filter by entry field values. */\n values?: Record<string, unknown>;\n };\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkListEntriesParams {\n /** The model ID to query. */\n modelId: string;\n /** Filter conditions. */\n where?: Record<string, unknown>;\n /** Sort order per field, e.g. { createdOn: \"desc\" }. */\n sort?: Record<string, \"asc\" | \"desc\">;\n /** Maximum number of entries to return. Defaults to 10. */\n limit?: number;\n /** Pagination cursor from a previous response. */\n after?: string;\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkCreateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values: TValues | undefined;\n status?: SdkEntryStatus;\n location?: { folderId?: string | null };\n}\n\ninterface SdkCreateEntryParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The entry data to create. */\n data: SdkCreateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUpdateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values?: Partial<TValues>;\n location?: { folderId?: string | null };\n}\n\ninterface SdkUpdateEntryRevisionParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** The fields to update. */\n data: SdkUpdateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkDeleteEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** When true, permanently deletes the entry. Defaults to false. */\n permanent?: boolean;\n}\n\ninterface SdkPublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUnpublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkCms {\n /** Get a single entry by ID or field values. */\n getEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkGetEntryParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** List entries with optional filtering, sorting, and pagination. */\n listEntries<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkListEntriesParams\n ): Promise<SdkResult<SdkListEntriesResult<TValues>, SdkCmsError>>;\n\n /** Create a new entry. */\n createEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkCreateEntryParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** Update an existing entry revision. */\n updateEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUpdateEntryRevisionParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** Delete an entry revision. */\n deleteEntryRevision(\n params: SdkDeleteEntryRevisionParams\n ): Promise<SdkResult<boolean, SdkCmsError>>;\n\n /** Publish an entry revision. */\n publishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkPublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** Unpublish an entry revision. */\n unpublishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUnpublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n}\n\ninterface SdkWebiny {\n /** CMS operations: list, get, create, update, delete, publish entries. */\n readonly cms: SdkCms;\n}\n\ndeclare const sdk: SdkWebiny;\ndeclare interface Window { sdk: SdkWebiny; }\n";
@@ -0,0 +1,230 @@
1
+ // Global ambient declaration injected into Monaco's TypeScript language service.
2
+ //
3
+ // NOTE: This file contains TypeScript type declarations as a string literal.
4
+ // In the future, this can be auto-generated from a real .d.ts file.
5
+ //
6
+ // RULES (do not break these):
7
+ // 1. This string must contain NO top-level `import` or `export` statements.
8
+ // Any import/export makes TypeScript treat the file as a module, scoping
9
+ // all declarations locally instead of globally.
10
+ // 2. All types must be declared inline — no cross-file references.
11
+ // 3. Register this with addExtraLib using a "file:///" URI.
12
+ export const SDK_GLOBAL_DECLARATION = `
13
+ interface SdkIdentity {
14
+ id: string;
15
+ displayName: string;
16
+ type: string;
17
+ }
18
+
19
+ type SdkEntryStatus = "published" | "unpublished" | "draft";
20
+
21
+ interface SdkEntryValues {
22
+ [key: string]: any;
23
+ }
24
+
25
+ interface SdkEntryData<TValues extends SdkEntryValues = SdkEntryValues> {
26
+ id?: string;
27
+ entryId?: string;
28
+ status?: SdkEntryStatus;
29
+ createdOn?: string;
30
+ modifiedOn?: string | null;
31
+ savedOn?: string;
32
+ deletedOn?: string | null;
33
+ restoredOn?: string | null;
34
+ createdBy?: SdkIdentity;
35
+ modifiedBy?: SdkIdentity;
36
+ savedBy?: SdkIdentity;
37
+ firstPublishedOn?: string;
38
+ lastPublishedOn?: string;
39
+ firstPublishedBy?: SdkIdentity;
40
+ lastPublishedBy?: SdkIdentity;
41
+ revisionCreatedOn?: string;
42
+ revisionModifiedOn?: string | null;
43
+ revisionSavedOn?: string;
44
+ revisionCreatedBy?: SdkIdentity;
45
+ revisionModifiedBy?: SdkIdentity | null;
46
+ revisionSavedBy?: SdkIdentity;
47
+ revisionFirstPublishedOn?: string;
48
+ revisionLastPublishedOn?: string;
49
+ revisionFirstPublishedBy?: SdkIdentity;
50
+ revisionLastPublishedBy?: SdkIdentity;
51
+ location?: { folderId?: string | null };
52
+ values?: TValues;
53
+ }
54
+
55
+ interface SdkListEntriesResult<TValues extends SdkEntryValues = SdkEntryValues> {
56
+ data: SdkEntryData<TValues>[];
57
+ meta: {
58
+ cursor: string | null;
59
+ hasMoreItems: boolean;
60
+ totalCount: number;
61
+ };
62
+ }
63
+
64
+ interface SdkResult<TValue, TError = unknown> {
65
+ isOk(): boolean;
66
+ isFail(): boolean;
67
+ readonly value: TValue;
68
+ readonly error: TError;
69
+ }
70
+
71
+ declare class SdkBaseError extends Error {
72
+ readonly code: string;
73
+ readonly message: string;
74
+ }
75
+
76
+ declare class SdkHttpError extends SdkBaseError {
77
+ readonly code: "HTTP_ERROR";
78
+ readonly data: { status: number };
79
+ }
80
+
81
+ declare class SdkGraphQLError extends SdkBaseError {
82
+ readonly code: "GRAPHQL_ERROR";
83
+ readonly data: { code?: string };
84
+ }
85
+
86
+ declare class SdkNetworkError extends SdkBaseError {
87
+ readonly code: "NETWORK_ERROR";
88
+ }
89
+
90
+ type SdkCmsError = SdkHttpError | SdkGraphQLError | SdkNetworkError;
91
+
92
+ interface SdkGetEntryParams {
93
+ /** The model ID to query. */
94
+ modelId: string;
95
+ where: {
96
+ /** Revision ID, e.g. "abc#0001". */
97
+ id?: string;
98
+ /** Entry ID, e.g. "abc". */
99
+ entryId?: string;
100
+ /** Filter by entry field values. */
101
+ values?: Record<string, unknown>;
102
+ };
103
+ /** Fields to include in the response. Use "values.fieldName" for entry values. */
104
+ fields: string[];
105
+ /** When true, returns unpublished/draft content. Defaults to false. */
106
+ preview?: boolean;
107
+ }
108
+
109
+ interface SdkListEntriesParams {
110
+ /** The model ID to query. */
111
+ modelId: string;
112
+ /** Filter conditions. */
113
+ where?: Record<string, unknown>;
114
+ /** Sort order per field, e.g. { createdOn: "desc" }. */
115
+ sort?: Record<string, "asc" | "desc">;
116
+ /** Maximum number of entries to return. Defaults to 10. */
117
+ limit?: number;
118
+ /** Pagination cursor from a previous response. */
119
+ after?: string;
120
+ /** Fields to include in the response. Use "values.fieldName" for entry values. */
121
+ fields: string[];
122
+ /** When true, returns unpublished/draft content. Defaults to false. */
123
+ preview?: boolean;
124
+ }
125
+
126
+ interface SdkCreateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {
127
+ values: TValues | undefined;
128
+ status?: SdkEntryStatus;
129
+ location?: { folderId?: string | null };
130
+ }
131
+
132
+ interface SdkCreateEntryParams<TValues extends SdkEntryValues = SdkEntryValues> {
133
+ /** The model ID. */
134
+ modelId: string;
135
+ /** The entry data to create. */
136
+ data: SdkCreateEntryData<TValues>;
137
+ /** Fields to include in the response. */
138
+ fields: string[];
139
+ }
140
+
141
+ interface SdkUpdateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {
142
+ values?: Partial<TValues>;
143
+ location?: { folderId?: string | null };
144
+ }
145
+
146
+ interface SdkUpdateEntryRevisionParams<TValues extends SdkEntryValues = SdkEntryValues> {
147
+ /** The model ID. */
148
+ modelId: string;
149
+ /** The revision ID, e.g. "abc#0001". */
150
+ revisionId: string;
151
+ /** The fields to update. */
152
+ data: SdkUpdateEntryData<TValues>;
153
+ /** Fields to include in the response. */
154
+ fields: string[];
155
+ }
156
+
157
+ interface SdkDeleteEntryRevisionParams {
158
+ /** The model ID. */
159
+ modelId: string;
160
+ /** The revision ID, e.g. "abc#0001". */
161
+ revisionId: string;
162
+ /** When true, permanently deletes the entry. Defaults to false. */
163
+ permanent?: boolean;
164
+ }
165
+
166
+ interface SdkPublishEntryRevisionParams {
167
+ /** The model ID. */
168
+ modelId: string;
169
+ /** The revision ID, e.g. "abc#0001". */
170
+ revisionId: string;
171
+ /** Fields to include in the response. */
172
+ fields: string[];
173
+ }
174
+
175
+ interface SdkUnpublishEntryRevisionParams {
176
+ /** The model ID. */
177
+ modelId: string;
178
+ /** The revision ID, e.g. "abc#0001". */
179
+ revisionId: string;
180
+ /** Fields to include in the response. */
181
+ fields: string[];
182
+ }
183
+
184
+ interface SdkCms {
185
+ /** Get a single entry by ID or field values. */
186
+ getEntry<TValues extends SdkEntryValues = SdkEntryValues>(
187
+ params: SdkGetEntryParams
188
+ ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;
189
+
190
+ /** List entries with optional filtering, sorting, and pagination. */
191
+ listEntries<TValues extends SdkEntryValues = SdkEntryValues>(
192
+ params: SdkListEntriesParams
193
+ ): Promise<SdkResult<SdkListEntriesResult<TValues>, SdkCmsError>>;
194
+
195
+ /** Create a new entry. */
196
+ createEntry<TValues extends SdkEntryValues = SdkEntryValues>(
197
+ params: SdkCreateEntryParams<TValues>
198
+ ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;
199
+
200
+ /** Update an existing entry revision. */
201
+ updateEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(
202
+ params: SdkUpdateEntryRevisionParams<TValues>
203
+ ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;
204
+
205
+ /** Delete an entry revision. */
206
+ deleteEntryRevision(
207
+ params: SdkDeleteEntryRevisionParams
208
+ ): Promise<SdkResult<boolean, SdkCmsError>>;
209
+
210
+ /** Publish an entry revision. */
211
+ publishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(
212
+ params: SdkPublishEntryRevisionParams
213
+ ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;
214
+
215
+ /** Unpublish an entry revision. */
216
+ unpublishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(
217
+ params: SdkUnpublishEntryRevisionParams
218
+ ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;
219
+ }
220
+
221
+ interface SdkWebiny {
222
+ /** CMS operations: list, get, create, update, delete, publish entries. */
223
+ readonly cms: SdkCms;
224
+ }
225
+
226
+ declare const sdk: SdkWebiny;
227
+ declare interface Window { sdk: SdkWebiny; }
228
+ `;
229
+
230
+ //# sourceMappingURL=sdkGlobalDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SDK_GLOBAL_DECLARATION"],"sources":["sdkGlobalDeclaration.ts"],"sourcesContent":["// Global ambient declaration injected into Monaco's TypeScript language service.\n//\n// NOTE: This file contains TypeScript type declarations as a string literal.\n// In the future, this can be auto-generated from a real .d.ts file.\n//\n// RULES (do not break these):\n// 1. This string must contain NO top-level `import` or `export` statements.\n// Any import/export makes TypeScript treat the file as a module, scoping\n// all declarations locally instead of globally.\n// 2. All types must be declared inline — no cross-file references.\n// 3. Register this with addExtraLib using a \"file:///\" URI.\nexport const SDK_GLOBAL_DECLARATION = `\ninterface SdkIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\ntype SdkEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\ninterface SdkEntryValues {\n [key: string]: any;\n}\n\ninterface SdkEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n id?: string;\n entryId?: string;\n status?: SdkEntryStatus;\n createdOn?: string;\n modifiedOn?: string | null;\n savedOn?: string;\n deletedOn?: string | null;\n restoredOn?: string | null;\n createdBy?: SdkIdentity;\n modifiedBy?: SdkIdentity;\n savedBy?: SdkIdentity;\n firstPublishedOn?: string;\n lastPublishedOn?: string;\n firstPublishedBy?: SdkIdentity;\n lastPublishedBy?: SdkIdentity;\n revisionCreatedOn?: string;\n revisionModifiedOn?: string | null;\n revisionSavedOn?: string;\n revisionCreatedBy?: SdkIdentity;\n revisionModifiedBy?: SdkIdentity | null;\n revisionSavedBy?: SdkIdentity;\n revisionFirstPublishedOn?: string;\n revisionLastPublishedOn?: string;\n revisionFirstPublishedBy?: SdkIdentity;\n revisionLastPublishedBy?: SdkIdentity;\n location?: { folderId?: string | null };\n values?: TValues;\n}\n\ninterface SdkListEntriesResult<TValues extends SdkEntryValues = SdkEntryValues> {\n data: SdkEntryData<TValues>[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\ninterface SdkResult<TValue, TError = unknown> {\n isOk(): boolean;\n isFail(): boolean;\n readonly value: TValue;\n readonly error: TError;\n}\n\ndeclare class SdkBaseError extends Error {\n readonly code: string;\n readonly message: string;\n}\n\ndeclare class SdkHttpError extends SdkBaseError {\n readonly code: \"HTTP_ERROR\";\n readonly data: { status: number };\n}\n\ndeclare class SdkGraphQLError extends SdkBaseError {\n readonly code: \"GRAPHQL_ERROR\";\n readonly data: { code?: string };\n}\n\ndeclare class SdkNetworkError extends SdkBaseError {\n readonly code: \"NETWORK_ERROR\";\n}\n\ntype SdkCmsError = SdkHttpError | SdkGraphQLError | SdkNetworkError;\n\ninterface SdkGetEntryParams {\n /** The model ID to query. */\n modelId: string;\n where: {\n /** Revision ID, e.g. \"abc#0001\". */\n id?: string;\n /** Entry ID, e.g. \"abc\". */\n entryId?: string;\n /** Filter by entry field values. */\n values?: Record<string, unknown>;\n };\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkListEntriesParams {\n /** The model ID to query. */\n modelId: string;\n /** Filter conditions. */\n where?: Record<string, unknown>;\n /** Sort order per field, e.g. { createdOn: \"desc\" }. */\n sort?: Record<string, \"asc\" | \"desc\">;\n /** Maximum number of entries to return. Defaults to 10. */\n limit?: number;\n /** Pagination cursor from a previous response. */\n after?: string;\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkCreateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values: TValues | undefined;\n status?: SdkEntryStatus;\n location?: { folderId?: string | null };\n}\n\ninterface SdkCreateEntryParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The entry data to create. */\n data: SdkCreateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUpdateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values?: Partial<TValues>;\n location?: { folderId?: string | null };\n}\n\ninterface SdkUpdateEntryRevisionParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** The fields to update. */\n data: SdkUpdateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkDeleteEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** When true, permanently deletes the entry. Defaults to false. */\n permanent?: boolean;\n}\n\ninterface SdkPublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUnpublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkCms {\n /** Get a single entry by ID or field values. */\n getEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkGetEntryParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** List entries with optional filtering, sorting, and pagination. */\n listEntries<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkListEntriesParams\n ): Promise<SdkResult<SdkListEntriesResult<TValues>, SdkCmsError>>;\n\n /** Create a new entry. */\n createEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkCreateEntryParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** Update an existing entry revision. */\n updateEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUpdateEntryRevisionParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** Delete an entry revision. */\n deleteEntryRevision(\n params: SdkDeleteEntryRevisionParams\n ): Promise<SdkResult<boolean, SdkCmsError>>;\n\n /** Publish an entry revision. */\n publishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkPublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n\n /** Unpublish an entry revision. */\n unpublishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUnpublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkCmsError>>;\n}\n\ninterface SdkWebiny {\n /** CMS operations: list, get, create, update, delete, publish entries. */\n readonly cms: SdkCms;\n}\n\ndeclare const sdk: SdkWebiny;\ndeclare interface Window { sdk: SdkWebiny; }\n`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,sBAAsB,GAAG;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export interface ConsoleMessage {
2
+ type: "log" | "error" | "warn" | "info";
3
+ message: string;
4
+ timestamp: string;
5
+ }
6
+ export declare const MIN_PANE_PCT = 20;
@@ -0,0 +1,4 @@
1
+ // Minimum width for each pane as a percentage of total split width.
2
+ export const MIN_PANE_PCT = 20;
3
+
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MIN_PANE_PCT"],"sources":["types.ts"],"sourcesContent":["export interface ConsoleMessage {\n type: \"log\" | \"error\" | \"warn\" | \"info\";\n message: string;\n timestamp: string;\n}\n\n// Minimum width for each pane as a percentage of total split width.\nexport const MIN_PANE_PCT = 20;\n"],"mappings":"AAMA;AACA,OAAO,MAAMA,YAAY,GAAG,EAAE","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { MutableRefObject } from "react";
2
+ import type { editor } from "monaco-editor";
3
+ import type { ConsoleMessage } from "./types.js";
4
+ export declare function useCodeExecution(code: string, editorRef: MutableRefObject<editor.IStandaloneCodeEditor | null>): {
5
+ output: ConsoleMessage[];
6
+ isRunning: boolean;
7
+ handleRun: () => Promise<void>;
8
+ };
@@ -0,0 +1,79 @@
1
+ import { useCallback, useState } from "react";
2
+ import { useSnackbar, useTenantContext } from "@webiny/app-admin";
3
+ import { config as appConfig } from "@webiny/app/config.js";
4
+ import { Webiny } from "@webiny/sdk";
5
+ import { createCustomConsole } from "./consoleCapture.js";
6
+ export function useCodeExecution(code, editorRef) {
7
+ const [output, setOutput] = useState([]);
8
+ const [isRunning, setIsRunning] = useState(false);
9
+ const {
10
+ showSnackbar
11
+ } = useSnackbar();
12
+ const {
13
+ tenant
14
+ } = useTenantContext();
15
+ const handleRun = useCallback(async () => {
16
+ const apiUrl = appConfig.getKey("API_URL", process.env.REACT_APP_API_URL);
17
+ if (!apiUrl) {
18
+ showSnackbar("API URL is not configured");
19
+ return;
20
+ }
21
+ const currentCode = editorRef.current?.getValue() || code;
22
+ setIsRunning(true);
23
+ setOutput([]);
24
+ const messages = [];
25
+
26
+ // Create custom console for capturing output.
27
+ const customConsole = createCustomConsole(messages, setOutput);
28
+ try {
29
+ // Create SDK instance with current tenant and API endpoint.
30
+ // Note: The SDK will use cookie-based authentication (credentials: "include")
31
+ // when running in the browser, as the admin app sets up the necessary cookies.
32
+ const sdk = new Webiny({
33
+ endpoint: apiUrl,
34
+ tenant: tenant || undefined,
35
+ headers: {
36
+ // Add any additional headers if needed.
37
+ // The Authorization header with Bearer token is handled via cookies
38
+ // when running within the admin app context.
39
+ }
40
+ });
41
+
42
+ // Wrap code in async function to allow top-level await.
43
+ const wrappedCode = `
44
+ (async () => {
45
+ try {
46
+ ${currentCode}
47
+ } catch (error) {
48
+ console.error("Runtime error:", error);
49
+ throw error;
50
+ }
51
+ })()
52
+ `;
53
+
54
+ // Create function with injected dependencies.
55
+ const fn = new Function("console", "sdk", "window", wrappedCode);
56
+
57
+ // Execute with custom console and SDK.
58
+ const result = fn(customConsole, sdk, {
59
+ sdk
60
+ });
61
+
62
+ // Handle async results.
63
+ if (result && typeof result.then === "function") {
64
+ await result;
65
+ }
66
+ } catch (error) {
67
+ customConsole.error("Execution error:", error);
68
+ } finally {
69
+ setIsRunning(false);
70
+ }
71
+ }, [code, editorRef, showSnackbar, tenant]);
72
+ return {
73
+ output,
74
+ isRunning,
75
+ handleRun
76
+ };
77
+ }
78
+
79
+ //# sourceMappingURL=useCodeExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useState","useSnackbar","useTenantContext","config","appConfig","Webiny","createCustomConsole","useCodeExecution","code","editorRef","output","setOutput","isRunning","setIsRunning","showSnackbar","tenant","handleRun","apiUrl","getKey","process","env","REACT_APP_API_URL","currentCode","current","getValue","messages","customConsole","sdk","endpoint","undefined","headers","wrappedCode","fn","Function","result","then","error"],"sources":["useCodeExecution.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport type { MutableRefObject } from \"react\";\nimport type { editor } from \"monaco-editor\";\nimport { useSnackbar, useTenantContext } from \"@webiny/app-admin\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\nimport { Webiny } from \"@webiny/sdk\";\nimport type { ConsoleMessage } from \"./types.js\";\nimport { createCustomConsole } from \"./consoleCapture.js\";\n\nexport function useCodeExecution(\n code: string,\n editorRef: MutableRefObject<editor.IStandaloneCodeEditor | null>\n) {\n const [output, setOutput] = useState<ConsoleMessage[]>([]);\n const [isRunning, setIsRunning] = useState(false);\n const { showSnackbar } = useSnackbar();\n const { tenant } = useTenantContext();\n\n const handleRun = useCallback(async () => {\n const apiUrl = appConfig.getKey(\"API_URL\", process.env.REACT_APP_API_URL) as string;\n if (!apiUrl) {\n showSnackbar(\"API URL is not configured\");\n return;\n }\n\n const currentCode = editorRef.current?.getValue() || code;\n setIsRunning(true);\n setOutput([]);\n\n const messages: ConsoleMessage[] = [];\n\n // Create custom console for capturing output.\n const customConsole = createCustomConsole(messages, setOutput);\n\n try {\n // Create SDK instance with current tenant and API endpoint.\n // Note: The SDK will use cookie-based authentication (credentials: \"include\")\n // when running in the browser, as the admin app sets up the necessary cookies.\n const sdk = new Webiny({\n endpoint: apiUrl,\n tenant: tenant || undefined,\n headers: {\n // Add any additional headers if needed.\n // The Authorization header with Bearer token is handled via cookies\n // when running within the admin app context.\n }\n });\n\n // Wrap code in async function to allow top-level await.\n const wrappedCode = `\n (async () => {\n try {\n ${currentCode}\n } catch (error) {\n console.error(\"Runtime error:\", error);\n throw error;\n }\n })()\n `;\n\n // Create function with injected dependencies.\n const fn = new Function(\"console\", \"sdk\", \"window\", wrappedCode);\n\n // Execute with custom console and SDK.\n const result = fn(customConsole, sdk, { sdk });\n\n // Handle async results.\n if (result && typeof result.then === \"function\") {\n await result;\n }\n } catch (error) {\n customConsole.error(\"Execution error:\", error);\n } finally {\n setIsRunning(false);\n }\n }, [code, editorRef, showSnackbar, tenant]);\n\n return {\n output,\n isRunning,\n handleRun\n };\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAG7C,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,mBAAmB;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,uBAAuB;AAC3D,SAASC,MAAM,QAAQ,aAAa;AAEpC,SAASC,mBAAmB;AAE5B,OAAO,SAASC,gBAAgBA,CAC5BC,IAAY,EACZC,SAAgE,EAClE;EACE,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGX,QAAQ,CAAmB,EAAE,CAAC;EAC1D,MAAM,CAACY,SAAS,EAAEC,YAAY,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM;IAAEc;EAAa,CAAC,GAAGb,WAAW,CAAC,CAAC;EACtC,MAAM;IAAEc;EAAO,CAAC,GAAGb,gBAAgB,CAAC,CAAC;EAErC,MAAMc,SAAS,GAAGjB,WAAW,CAAC,YAAY;IACtC,MAAMkB,MAAM,GAAGb,SAAS,CAACc,MAAM,CAAC,SAAS,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,CAAW;IACnF,IAAI,CAACJ,MAAM,EAAE;MACTH,YAAY,CAAC,2BAA2B,CAAC;MACzC;IACJ;IAEA,MAAMQ,WAAW,GAAGb,SAAS,CAACc,OAAO,EAAEC,QAAQ,CAAC,CAAC,IAAIhB,IAAI;IACzDK,YAAY,CAAC,IAAI,CAAC;IAClBF,SAAS,CAAC,EAAE,CAAC;IAEb,MAAMc,QAA0B,GAAG,EAAE;;IAErC;IACA,MAAMC,aAAa,GAAGpB,mBAAmB,CAACmB,QAAQ,EAAEd,SAAS,CAAC;IAE9D,IAAI;MACA;MACA;MACA;MACA,MAAMgB,GAAG,GAAG,IAAItB,MAAM,CAAC;QACnBuB,QAAQ,EAAEX,MAAM;QAChBF,MAAM,EAAEA,MAAM,IAAIc,SAAS;QAC3BC,OAAO,EAAE;UACL;UACA;UACA;QAAA;MAER,CAAC,CAAC;;MAEF;MACA,MAAMC,WAAW,GAAG;AAChC;AACA;AACA,0BAA0BT,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA,aAAa;;MAED;MACA,MAAMU,EAAE,GAAG,IAAIC,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAEF,WAAW,CAAC;;MAEhE;MACA,MAAMG,MAAM,GAAGF,EAAE,CAACN,aAAa,EAAEC,GAAG,EAAE;QAAEA;MAAI,CAAC,CAAC;;MAE9C;MACA,IAAIO,MAAM,IAAI,OAAOA,MAAM,CAACC,IAAI,KAAK,UAAU,EAAE;QAC7C,MAAMD,MAAM;MAChB;IACJ,CAAC,CAAC,OAAOE,KAAK,EAAE;MACZV,aAAa,CAACU,KAAK,CAAC,kBAAkB,EAAEA,KAAK,CAAC;IAClD,CAAC,SAAS;MACNvB,YAAY,CAAC,KAAK,CAAC;IACvB;EACJ,CAAC,EAAE,CAACL,IAAI,EAAEC,SAAS,EAAEK,YAAY,EAAEC,MAAM,CAAC,CAAC;EAE3C,OAAO;IACHL,MAAM;IACNE,SAAS;IACTI;EACJ,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { OnMount, BeforeMount } from "@monaco-editor/react";
2
+ import type { editor } from "monaco-editor";
3
+ export declare function useMonacoEditor(handleRun: () => void): {
4
+ editorRef: import("react").MutableRefObject<editor.IStandaloneCodeEditor | null>;
5
+ handleBeforeMount: BeforeMount;
6
+ handleEditorDidMount: OnMount;
7
+ handleFormat: () => void;
8
+ };
@@ -0,0 +1,54 @@
1
+ import { useCallback, useRef } from "react";
2
+ import { SDK_GLOBAL_DECLARATION } from "./sdkGlobalDeclaration.js";
3
+ import { defaultSdkCode } from "./defaultCode.js";
4
+ export function useMonacoEditor(handleRun) {
5
+ const editorRef = useRef(null);
6
+
7
+ // Configure Monaco editor with SDK types.
8
+ const handleBeforeMount = useCallback(monaco => {
9
+ monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
10
+ target: monaco.languages.typescript.ScriptTarget.ES2020,
11
+ allowNonTsExtensions: true,
12
+ moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
13
+ module: monaco.languages.typescript.ModuleKind.CommonJS,
14
+ noEmit: true,
15
+ esModuleInterop: true,
16
+ allowJs: true
17
+ });
18
+
19
+ // Single addExtraLib call with a pure script-mode string (no import/export).
20
+ // This makes TypeScript treat the file as an ambient script, so all
21
+ // declare statements become true globals visible to user code.
22
+ monaco.languages.typescript.typescriptDefaults.addExtraLib(SDK_GLOBAL_DECLARATION, "file:///sdk-globals.d.ts");
23
+ }, []);
24
+ const handleEditorDidMount = useCallback((ed, monaco) => {
25
+ editorRef.current = ed;
26
+
27
+ // Re-create the model with a file:/// URI so it lives in the same
28
+ // virtual FS namespace as the addExtraLib file, giving the TS
29
+ // language service full visibility into the ambient declarations.
30
+ const existingModel = ed.getModel();
31
+ const newModel = monaco.editor.createModel(existingModel?.getValue() ?? defaultSdkCode, "typescript", monaco.Uri.parse("file:///user-script.ts"));
32
+ ed.setModel(newModel);
33
+ existingModel?.dispose();
34
+ ed.addAction({
35
+ id: "run-code",
36
+ label: "Run Code",
37
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],
38
+ run: () => {
39
+ void handleRun();
40
+ }
41
+ });
42
+ }, [handleRun]);
43
+ const handleFormat = useCallback(() => {
44
+ editorRef.current?.getAction("editor.action.formatDocument")?.run();
45
+ }, []);
46
+ return {
47
+ editorRef,
48
+ handleBeforeMount,
49
+ handleEditorDidMount,
50
+ handleFormat
51
+ };
52
+ }
53
+
54
+ //# sourceMappingURL=useMonacoEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useRef","SDK_GLOBAL_DECLARATION","defaultSdkCode","useMonacoEditor","handleRun","editorRef","handleBeforeMount","monaco","languages","typescript","typescriptDefaults","setCompilerOptions","target","ScriptTarget","ES2020","allowNonTsExtensions","moduleResolution","ModuleResolutionKind","NodeJs","module","ModuleKind","CommonJS","noEmit","esModuleInterop","allowJs","addExtraLib","handleEditorDidMount","ed","current","existingModel","getModel","newModel","editor","createModel","getValue","Uri","parse","setModel","dispose","addAction","id","label","keybindings","KeyMod","CtrlCmd","KeyCode","Enter","run","handleFormat","getAction"],"sources":["useMonacoEditor.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\nimport type { OnMount, BeforeMount } from \"@monaco-editor/react\";\nimport type { editor } from \"monaco-editor\";\nimport { SDK_GLOBAL_DECLARATION } from \"./sdkGlobalDeclaration.js\";\nimport { defaultSdkCode } from \"./defaultCode.js\";\n\nexport function useMonacoEditor(handleRun: () => void) {\n const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null);\n\n // Configure Monaco editor with SDK types.\n const handleBeforeMount: BeforeMount = useCallback(monaco => {\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n target: monaco.languages.typescript.ScriptTarget.ES2020,\n allowNonTsExtensions: true,\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n module: monaco.languages.typescript.ModuleKind.CommonJS,\n noEmit: true,\n esModuleInterop: true,\n allowJs: true\n });\n\n // Single addExtraLib call with a pure script-mode string (no import/export).\n // This makes TypeScript treat the file as an ambient script, so all\n // declare statements become true globals visible to user code.\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n SDK_GLOBAL_DECLARATION,\n \"file:///sdk-globals.d.ts\"\n );\n }, []);\n\n const handleEditorDidMount: OnMount = useCallback(\n (ed, monaco) => {\n editorRef.current = ed;\n\n // Re-create the model with a file:/// URI so it lives in the same\n // virtual FS namespace as the addExtraLib file, giving the TS\n // language service full visibility into the ambient declarations.\n const existingModel = ed.getModel();\n const newModel = monaco.editor.createModel(\n existingModel?.getValue() ?? defaultSdkCode,\n \"typescript\",\n monaco.Uri.parse(\"file:///user-script.ts\")\n );\n ed.setModel(newModel);\n existingModel?.dispose();\n\n ed.addAction({\n id: \"run-code\",\n label: \"Run Code\",\n keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],\n run: () => {\n void handleRun();\n }\n });\n },\n [handleRun]\n );\n\n const handleFormat = useCallback(() => {\n editorRef.current?.getAction(\"editor.action.formatDocument\")?.run();\n }, []);\n\n return {\n editorRef,\n handleBeforeMount,\n handleEditorDidMount,\n handleFormat\n };\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAG3C,SAASC,sBAAsB;AAC/B,SAASC,cAAc;AAEvB,OAAO,SAASC,eAAeA,CAACC,SAAqB,EAAE;EACnD,MAAMC,SAAS,GAAGL,MAAM,CAAsC,IAAI,CAAC;;EAEnE;EACA,MAAMM,iBAA8B,GAAGP,WAAW,CAACQ,MAAM,IAAI;IACzDA,MAAM,CAACC,SAAS,CAACC,UAAU,CAACC,kBAAkB,CAACC,kBAAkB,CAAC;MAC9DC,MAAM,EAAEL,MAAM,CAACC,SAAS,CAACC,UAAU,CAACI,YAAY,CAACC,MAAM;MACvDC,oBAAoB,EAAE,IAAI;MAC1BC,gBAAgB,EAAET,MAAM,CAACC,SAAS,CAACC,UAAU,CAACQ,oBAAoB,CAACC,MAAM;MACzEC,MAAM,EAAEZ,MAAM,CAACC,SAAS,CAACC,UAAU,CAACW,UAAU,CAACC,QAAQ;MACvDC,MAAM,EAAE,IAAI;MACZC,eAAe,EAAE,IAAI;MACrBC,OAAO,EAAE;IACb,CAAC,CAAC;;IAEF;IACA;IACA;IACAjB,MAAM,CAACC,SAAS,CAACC,UAAU,CAACC,kBAAkB,CAACe,WAAW,CACtDxB,sBAAsB,EACtB,0BACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMyB,oBAA6B,GAAG3B,WAAW,CAC7C,CAAC4B,EAAE,EAAEpB,MAAM,KAAK;IACZF,SAAS,CAACuB,OAAO,GAAGD,EAAE;;IAEtB;IACA;IACA;IACA,MAAME,aAAa,GAAGF,EAAE,CAACG,QAAQ,CAAC,CAAC;IACnC,MAAMC,QAAQ,GAAGxB,MAAM,CAACyB,MAAM,CAACC,WAAW,CACtCJ,aAAa,EAAEK,QAAQ,CAAC,CAAC,IAAIhC,cAAc,EAC3C,YAAY,EACZK,MAAM,CAAC4B,GAAG,CAACC,KAAK,CAAC,wBAAwB,CAC7C,CAAC;IACDT,EAAE,CAACU,QAAQ,CAACN,QAAQ,CAAC;IACrBF,aAAa,EAAES,OAAO,CAAC,CAAC;IAExBX,EAAE,CAACY,SAAS,CAAC;MACTC,EAAE,EAAE,UAAU;MACdC,KAAK,EAAE,UAAU;MACjBC,WAAW,EAAE,CAACnC,MAAM,CAACoC,MAAM,CAACC,OAAO,GAAGrC,MAAM,CAACsC,OAAO,CAACC,KAAK,CAAC;MAC3DC,GAAG,EAAEA,CAAA,KAAM;QACP,KAAK3C,SAAS,CAAC,CAAC;MACpB;IACJ,CAAC,CAAC;EACN,CAAC,EACD,CAACA,SAAS,CACd,CAAC;EAED,MAAM4C,YAAY,GAAGjD,WAAW,CAAC,MAAM;IACnCM,SAAS,CAACuB,OAAO,EAAEqB,SAAS,CAAC,8BAA8B,CAAC,EAAEF,GAAG,CAAC,CAAC;EACvE,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH1C,SAAS;IACTC,iBAAiB;IACjBoB,oBAAoB;IACpBsB;EACJ,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export declare function useResizableSplit(): {
2
+ splitRef: import("react").MutableRefObject<HTMLDivElement | null>;
3
+ editorPct: number;
4
+ handleDividerMouseDown: (e: React.MouseEvent) => void;
5
+ };
@@ -0,0 +1,44 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { MIN_PANE_PCT } from "./types.js";
3
+ export function useResizableSplit() {
4
+ const splitRef = useRef(null);
5
+ const [editorPct, setEditorPct] = useState(60);
6
+ const isDragging = useRef(false);
7
+ const handleDividerMouseDown = useCallback(e => {
8
+ e.preventDefault();
9
+ isDragging.current = true;
10
+ document.body.style.cursor = "col-resize";
11
+ document.body.style.userSelect = "none";
12
+ }, []);
13
+ useEffect(() => {
14
+ const onMouseMove = e => {
15
+ if (!isDragging.current || !splitRef.current) {
16
+ return;
17
+ }
18
+ const rect = splitRef.current.getBoundingClientRect();
19
+ const pct = (e.clientX - rect.left) / rect.width * 100;
20
+ setEditorPct(Math.min(100 - MIN_PANE_PCT, Math.max(MIN_PANE_PCT, pct)));
21
+ };
22
+ const onMouseUp = () => {
23
+ if (!isDragging.current) {
24
+ return;
25
+ }
26
+ isDragging.current = false;
27
+ document.body.style.cursor = "";
28
+ document.body.style.userSelect = "";
29
+ };
30
+ document.addEventListener("mousemove", onMouseMove);
31
+ document.addEventListener("mouseup", onMouseUp);
32
+ return () => {
33
+ document.removeEventListener("mousemove", onMouseMove);
34
+ document.removeEventListener("mouseup", onMouseUp);
35
+ };
36
+ }, []);
37
+ return {
38
+ splitRef,
39
+ editorPct,
40
+ handleDividerMouseDown
41
+ };
42
+ }
43
+
44
+ //# sourceMappingURL=useResizableSplit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useState","MIN_PANE_PCT","useResizableSplit","splitRef","editorPct","setEditorPct","isDragging","handleDividerMouseDown","e","preventDefault","current","document","body","style","cursor","userSelect","onMouseMove","rect","getBoundingClientRect","pct","clientX","left","width","Math","min","max","onMouseUp","addEventListener","removeEventListener"],"sources":["useResizableSplit.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { MIN_PANE_PCT } from \"./types.js\";\n\nexport function useResizableSplit() {\n const splitRef = useRef<HTMLDivElement | null>(null);\n const [editorPct, setEditorPct] = useState(60);\n const isDragging = useRef(false);\n\n const handleDividerMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n isDragging.current = true;\n document.body.style.cursor = \"col-resize\";\n document.body.style.userSelect = \"none\";\n }, []);\n\n useEffect(() => {\n const onMouseMove = (e: MouseEvent) => {\n if (!isDragging.current || !splitRef.current) {\n return;\n }\n const rect = splitRef.current.getBoundingClientRect();\n const pct = ((e.clientX - rect.left) / rect.width) * 100;\n setEditorPct(Math.min(100 - MIN_PANE_PCT, Math.max(MIN_PANE_PCT, pct)));\n };\n\n const onMouseUp = () => {\n if (!isDragging.current) {\n return;\n }\n isDragging.current = false;\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n };\n\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n return () => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n }, []);\n\n return {\n splitRef,\n editorPct,\n handleDividerMouseDown\n };\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,YAAY;AAErB,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAChC,MAAMC,QAAQ,GAAGJ,MAAM,CAAwB,IAAI,CAAC;EACpD,MAAM,CAACK,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAQ,CAAC,EAAE,CAAC;EAC9C,MAAMM,UAAU,GAAGP,MAAM,CAAC,KAAK,CAAC;EAEhC,MAAMQ,sBAAsB,GAAGV,WAAW,CAAEW,CAAmB,IAAK;IAChEA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClBH,UAAU,CAACI,OAAO,GAAG,IAAI;IACzBC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,MAAM,GAAG,YAAY;IACzCH,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACE,UAAU,GAAG,MAAM;EAC3C,CAAC,EAAE,EAAE,CAAC;EAENjB,SAAS,CAAC,MAAM;IACZ,MAAMkB,WAAW,GAAIR,CAAa,IAAK;MACnC,IAAI,CAACF,UAAU,CAACI,OAAO,IAAI,CAACP,QAAQ,CAACO,OAAO,EAAE;QAC1C;MACJ;MACA,MAAMO,IAAI,GAAGd,QAAQ,CAACO,OAAO,CAACQ,qBAAqB,CAAC,CAAC;MACrD,MAAMC,GAAG,GAAI,CAACX,CAAC,CAACY,OAAO,GAAGH,IAAI,CAACI,IAAI,IAAIJ,IAAI,CAACK,KAAK,GAAI,GAAG;MACxDjB,YAAY,CAACkB,IAAI,CAACC,GAAG,CAAC,GAAG,GAAGvB,YAAY,EAAEsB,IAAI,CAACE,GAAG,CAACxB,YAAY,EAAEkB,GAAG,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,MAAMO,SAAS,GAAGA,CAAA,KAAM;MACpB,IAAI,CAACpB,UAAU,CAACI,OAAO,EAAE;QACrB;MACJ;MACAJ,UAAU,CAACI,OAAO,GAAG,KAAK;MAC1BC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,MAAM,GAAG,EAAE;MAC/BH,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACE,UAAU,GAAG,EAAE;IACvC,CAAC;IAEDJ,QAAQ,CAACgB,gBAAgB,CAAC,WAAW,EAAEX,WAAW,CAAC;IACnDL,QAAQ,CAACgB,gBAAgB,CAAC,SAAS,EAAED,SAAS,CAAC;IAC/C,OAAO,MAAM;MACTf,QAAQ,CAACiB,mBAAmB,CAAC,WAAW,EAAEZ,WAAW,CAAC;MACtDL,QAAQ,CAACiB,mBAAmB,CAAC,SAAS,EAAEF,SAAS,CAAC;IACtD,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHvB,QAAQ;IACRC,SAAS;IACTG;EACJ,CAAC;AACL","ignoreList":[]}
package/routes.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Route } from "@webiny/app-admin";
2
+ export declare const Routes: {
3
+ SdkPlayground: Route<undefined>;
4
+ };
package/routes.js ADDED
@@ -0,0 +1,9 @@
1
+ import { Route } from "@webiny/app-admin";
2
+ export const Routes = {
3
+ SdkPlayground: new Route({
4
+ name: "SdkPlayground",
5
+ path: "/sdk-playground"
6
+ })
7
+ };
8
+
9
+ //# sourceMappingURL=routes.js.map
package/routes.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Route","Routes","SdkPlayground","name","path"],"sources":["routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n SdkPlayground: new Route({\n name: \"SdkPlayground\",\n path: \"/sdk-playground\"\n })\n};\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,mBAAmB;AAEzC,OAAO,MAAMC,MAAM,GAAG;EAClBC,aAAa,EAAE,IAAIF,KAAK,CAAC;IACrBG,IAAI,EAAE,eAAe;IACrBC,IAAI,EAAE;EACV,CAAC;AACL,CAAC","ignoreList":[]}