miqro 7.2.7 → 7.2.8

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 (94) hide show
  1. package/build/esm/editor/auth.d.ts +6 -0
  2. package/build/esm/editor/auth.js +42 -0
  3. package/build/esm/editor/common/constants.d.ts +4 -0
  4. package/build/esm/editor/common/constants.js +20 -0
  5. package/build/esm/editor/common/constants.server.d.ts +2 -0
  6. package/build/esm/editor/common/constants.server.js +4 -0
  7. package/build/esm/editor/common/editor-index.d.ts +2 -0
  8. package/build/esm/editor/common/editor-index.js +14 -0
  9. package/build/esm/editor/common/html-encode.d.ts +1 -0
  10. package/build/esm/editor/common/html-encode.js +14 -0
  11. package/build/esm/editor/common/log-socket.d.ts +15 -0
  12. package/build/esm/editor/common/log-socket.js +71 -0
  13. package/build/esm/editor/common/templates.d.ts +11 -0
  14. package/build/esm/editor/common/templates.js +477 -0
  15. package/build/esm/editor/components/api-preview.d.ts +11 -0
  16. package/build/esm/editor/components/api-preview.js +92 -0
  17. package/build/esm/editor/components/editor.d.ts +16 -0
  18. package/build/esm/editor/components/editor.js +367 -0
  19. package/build/esm/editor/components/file-browser.d.ts +37 -0
  20. package/build/esm/editor/components/file-browser.js +127 -0
  21. package/build/esm/editor/components/file-editor-toolbar.d.ts +22 -0
  22. package/build/esm/editor/components/file-editor-toolbar.js +95 -0
  23. package/build/esm/editor/components/file-editor.d.ts +32 -0
  24. package/build/esm/editor/components/file-editor.js +61 -0
  25. package/build/esm/editor/components/filter-query.d.ts +1 -0
  26. package/build/esm/editor/components/filter-query.js +23 -0
  27. package/build/esm/editor/components/highlight-text-area.d.ts +11 -0
  28. package/build/esm/editor/components/highlight-text-area.js +127 -0
  29. package/build/esm/editor/components/log-viewer.d.ts +6 -0
  30. package/build/esm/editor/components/log-viewer.js +71 -0
  31. package/build/esm/editor/components/new-file.d.ts +10 -0
  32. package/build/esm/editor/components/new-file.js +119 -0
  33. package/build/esm/editor/components/scroll-query.d.ts +7 -0
  34. package/build/esm/editor/components/scroll-query.js +22 -0
  35. package/build/esm/editor/components/start-page.d.ts +13 -0
  36. package/build/esm/editor/components/start-page.js +32 -0
  37. package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +4 -0
  38. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +30 -0
  39. package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +7 -0
  40. package/build/esm/editor/http/admin/editor/api/fs/read.api.js +50 -0
  41. package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +7 -0
  42. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +40 -0
  43. package/build/esm/editor/http/admin/editor/api/fs/scan.api.d.ts +26 -0
  44. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +150 -0
  45. package/build/esm/editor/http/admin/editor/api/fs/write.api.d.ts +3 -0
  46. package/build/esm/editor/http/admin/editor/api/fs/write.api.js +39 -0
  47. package/build/esm/editor/http/admin/editor/api/server/reload.api.d.ts +10 -0
  48. package/build/esm/editor/http/admin/editor/api/server/reload.api.js +46 -0
  49. package/build/esm/editor/http/admin/editor/api/server/restart.api.d.ts +10 -0
  50. package/build/esm/editor/http/admin/editor/api/server/restart.api.js +46 -0
  51. package/build/esm/editor/http/admin/editor/editor.d.ts +1 -0
  52. package/build/esm/editor/http/admin/editor/editor.js +8 -0
  53. package/build/esm/editor/http/admin/editor/index.api.d.ts +3 -0
  54. package/build/esm/editor/http/admin/editor/index.api.js +23 -0
  55. package/build/esm/editor/server.d.ts +3 -0
  56. package/build/esm/editor/server.js +49 -0
  57. package/build/esm/editor/ws.d.ts +3 -0
  58. package/build/esm/editor/ws.js +12 -0
  59. package/build/esm/src/common/admin-interface.d.ts +36 -0
  60. package/build/esm/src/common/admin-interface.js +44 -0
  61. package/build/esm/src/services/app.d.ts +1 -1
  62. package/build/esm/src/services/editor.d.ts +1 -1
  63. package/build/esm/src/services/utils/admin-interface.d.ts +1 -1
  64. package/build/esm/src/services/utils/websocketmanager.d.ts +1 -1
  65. package/editor/auth.ts +52 -0
  66. package/editor/common/constants.server.ts +5 -0
  67. package/editor/common/constants.ts +21 -0
  68. package/editor/common/editor-index.tsx +17 -0
  69. package/editor/common/html-encode.ts +14 -0
  70. package/editor/common/log-socket.tsx +87 -0
  71. package/editor/common/templates.ts +481 -0
  72. package/editor/components/api-preview.tsx +118 -0
  73. package/editor/components/editor.tsx +496 -0
  74. package/editor/components/file-browser.tsx +311 -0
  75. package/editor/components/file-editor-toolbar.tsx +194 -0
  76. package/editor/components/file-editor.tsx +125 -0
  77. package/editor/components/filter-query.tsx +26 -0
  78. package/editor/components/highlight-text-area.tsx +148 -0
  79. package/editor/components/log-viewer.tsx +113 -0
  80. package/editor/components/new-file.tsx +172 -0
  81. package/editor/components/scroll-query.tsx +25 -0
  82. package/editor/components/start-page.tsx +52 -0
  83. package/editor/http/admin/editor/api/fs/delete.api.tsx +32 -0
  84. package/editor/http/admin/editor/api/fs/read.api.tsx +55 -0
  85. package/editor/http/admin/editor/api/fs/rename.api.tsx +41 -0
  86. package/editor/http/admin/editor/api/fs/scan.api.tsx +181 -0
  87. package/editor/http/admin/editor/api/fs/write.api.tsx +41 -0
  88. package/editor/http/admin/editor/api/server/reload.api.ts +53 -0
  89. package/editor/http/admin/editor/api/server/restart.api.tsx +52 -0
  90. package/editor/http/admin/editor/editor.tsx +10 -0
  91. package/editor/http/admin/editor/index.api.tsx +43 -0
  92. package/editor/server.ts +57 -0
  93. package/editor/ws.ts +17 -0
  94. package/package.json +1 -1
@@ -0,0 +1,477 @@
1
+ export const TEMPLATES = {
2
+ EMPTY: {
3
+ displayName: "empty file",
4
+ //template: () => "",
5
+ sufix: "",
6
+ language: "text",
7
+ prefix: ""
8
+ },
9
+ JSON: {
10
+ displayName: "a .json.ts file",
11
+ template: () => `import { ServerRequest, ServerResponse } from "miqro";
12
+
13
+ export default async (req: ServerRequest | null, res: ServerResponse | null) => {
14
+ return {
15
+ count: 1
16
+ }
17
+ }`,
18
+ sufix: ".json.ts",
19
+ language: "typescript",
20
+ prefix: ""
21
+ },
22
+ API: {
23
+ prefix: "http",
24
+ sufix: ".api.ts",
25
+ displayName: ".api.ts file",
26
+ language: "typescript",
27
+ template: () => `import { ServerRequest, ServerResponse, APIRoute } from "miqro";
28
+
29
+ export default {
30
+ path: "/health",
31
+ description: "checks the health of the service",
32
+ method: "GET",
33
+ //middleware: [server.middleware.json()],
34
+ request: {
35
+ /*body: {
36
+ someAttr: "string",
37
+ optionalArray: "number[]?"
38
+ }*/
39
+ },
40
+ response: {
41
+ status: [200, 400],
42
+ body: {
43
+ status: {
44
+ type: "enum",
45
+ enumValues: ["OK", "NOK"]
46
+ },
47
+ message: "string?"
48
+ }
49
+ },
50
+ handler: async (req: ServerRequest, res: ServerResponse) => {
51
+ try {
52
+ const [{ c }] = await req?.server?.db?.get("MyDB")?.query("SELECT 1+1 as c") as [{ c: number }];
53
+ const statusText = String(c) === "2" ? "OK" : "NOK";
54
+ return {
55
+ status: statusText === "OK" ? 200 : 400,
56
+ body: {
57
+ status: statusText
58
+ }
59
+ }
60
+ } catch (e) {
61
+ req.logger.error(e);
62
+ return {
63
+ status: 400,
64
+ body: {
65
+ status: "NOK",
66
+ message: e.message
67
+ }
68
+ };
69
+ }
70
+ }
71
+ } as APIRoute`
72
+ },
73
+ MIGRATION: {
74
+ prefix: "migration",
75
+ sufix: ".ts",
76
+ displayName: "migration file",
77
+ language: "typescript",
78
+ template: () => `import { Migration } from "miqro";
79
+
80
+ export default {
81
+ up: async (db, logger) => {
82
+ await db.createTable("mytable", {
83
+ id: {
84
+ type: "bigint",
85
+ autoIncrement: true,
86
+ primaryKey: true
87
+ },
88
+ name: {
89
+ type: "string"
90
+ }
91
+ }).yield(logger);
92
+ },
93
+ down: async (db, logger) => {
94
+ await db.dropTable("mytable").yield(logger);
95
+ }
96
+ } as Migration;`
97
+ },
98
+ TEST: {
99
+ prefix: "test",
100
+ sufix: ".test.tsx",
101
+ displayName: "a test file",
102
+ language: "typescript",
103
+ template: () => `import JSX from "@miqro/jsx";
104
+ import { strictEqual } from "node:assert";
105
+
106
+ describe("test group", () => {
107
+ it("sample test1", async () => {
108
+ const response = await test.request({
109
+ url: "/index.html"
110
+ });
111
+ strictEqual(response.status, 200);
112
+ });
113
+
114
+ it("sample test2", async () => {
115
+ await test.jsx.test(async (container, root, runtime) => {
116
+ function SomeComponent() {
117
+ return <p id="test-id">HelloWorld</p>
118
+ }
119
+ container.render(<SomeComponent />);
120
+ strictEqual(runtime.getElementById("test-id")?.textContent, "HelloWorld");
121
+ });
122
+ });
123
+ });
124
+ `
125
+ },
126
+ HTMLTSX: {
127
+ prefix: "http",
128
+ sufix: ".html.tsx",
129
+ displayName: ".html.tsx file",
130
+ language: "typescript",
131
+ template: () => `import JSX from "@miqro/jsx";
132
+ import { ServerRequest, ServerResponse, APIOptions } from "miqro";
133
+
134
+ /*export const apiOptions: APIOptions = {
135
+ path: ["/", "/index.html"],
136
+ method: ["GET"]
137
+ };*/
138
+
139
+ export default async (req: ServerRequest | null, res: ServerResponse | null) => {
140
+ return <html>
141
+ <head></head>
142
+ <body>
143
+ <h1>hello world!</h1>
144
+ </body>
145
+ </html>;
146
+ }`
147
+ },
148
+ AUTHCONFIG: {
149
+ prefix: "",
150
+ sufix: ".ts",
151
+ filename: "auth",
152
+ displayName: "auth.ts file",
153
+ language: "typescript",
154
+ template: () => `import { AuthConfig } from "miqro";
155
+
156
+ export default {
157
+ //path: ["/api/"], //optionaly specify a custom path list
158
+ /*options: {
159
+ tokenLocation: "free",// "query"//"cookie" //"header"
160
+ tokenLocationName: "x-auth"
161
+ },*/
162
+ authService: {
163
+ verify: async ({ token, req, res }) => {
164
+ // TODO Implement logic
165
+ return null;
166
+ /*return {
167
+ username: "username",
168
+ groups: ["someapi"],
169
+ account: "account",
170
+ token: ""
171
+ };*/
172
+ }
173
+ }
174
+ } as AuthConfig;
175
+ `
176
+ },
177
+ DOCCONFIG: {
178
+ prefix: "",
179
+ sufix: ".ts",
180
+ filename: "doc",
181
+ displayName: "doc.ts file",
182
+ language: "typescript",
183
+ template: () => `import { DocConfig } from "miqro";
184
+
185
+ export default {
186
+ // auto publish API documentation
187
+ publish: {
188
+ "/api/doc.html": {
189
+ type: "HTML", // can be "MD" | "JSON" | "HTML"
190
+ //all: true, // enable to show .html and other static resources
191
+ }
192
+ }
193
+ } as DocConfig;`
194
+ },
195
+ WSCONFIG: {
196
+ prefix: "",
197
+ sufix: ".ts",
198
+ filename: "ws",
199
+ displayName: "ws.ts file",
200
+ language: "typescript",
201
+ template: () => `import { WSConfig } from "miqro";
202
+
203
+ export default {
204
+ path: "/socket",
205
+ //disabled: true,
206
+ //maxConnections: 100,
207
+ /*onConnection(req) {
208
+
209
+ },*/
210
+ /*onDisconnect: (req) => {
211
+
212
+ },*/
213
+ /*onError: (req, error) => {
214
+
215
+ },*/
216
+ /*onMessage: (req, data) => {
217
+
218
+ },*/
219
+ validate(req) {
220
+ // TODO implement logic
221
+ return false;
222
+ },
223
+ } as WSConfig;
224
+ `
225
+ },
226
+ SERVERCONFIG: {
227
+ prefix: "",
228
+ sufix: ".ts",
229
+ filename: "server",
230
+ displayName: "server.ts file",
231
+ language: "typescript",
232
+ template: () => `import { ServerConfig } from "miqro";
233
+
234
+ export default {
235
+ preload: async (server) => {
236
+ server.logger.info("server preload");
237
+ /* uncomment code below to migrate-up the database "MyDB" before loading */
238
+ /*if (server?.isPrimaryWorker()) {
239
+ await server.db.migrate({ direction: "up", dbName: "MyDB" });
240
+ }*/
241
+ },
242
+ load: async (server) => {
243
+ server.logger.info("server loaded");
244
+ },
245
+ start: async (server) => {
246
+ server.logger.info("server started");
247
+ if (server.isPrimaryWorker()) {
248
+ try {
249
+ server.openBrowser("/index.html");
250
+ } catch (e) {
251
+ server.logger.error(e.message);
252
+ }
253
+ }
254
+ },
255
+ unload: (server) => {
256
+ server.logger.info("server unload");
257
+ },
258
+ stop: (server) => {
259
+ server.logger.info("server stop");
260
+ }
261
+ } as ServerConfig;
262
+ `
263
+ },
264
+ TSCONFIGJSON: {
265
+ prefix: "",
266
+ sufix: ".json",
267
+ filename: "tsconfig",
268
+ displayName: "tsconfig.json file",
269
+ language: "json",
270
+ template: () => `{
271
+ "compilerOptions": {
272
+ "target": "es2022",
273
+ "noEmit": true,
274
+ "module": "NodeNext",
275
+ "moduleResolution": "nodenext",
276
+ "lib": ["es2021", "dom"],
277
+ "jsx": "react",
278
+ "jsxFactory": "JSX.createElement",
279
+ "jsxFragmentFactory": "JSX.Fragment"
280
+ }
281
+ }
282
+ `
283
+ },
284
+ MIQROJSON: {
285
+ prefix: "",
286
+ sufix: ".json",
287
+ filename: "miqro",
288
+ displayName: "miqro.json file",
289
+ language: "json",
290
+ template: () => `{
291
+ "services": ["src/"],
292
+ "inflateDir": "build/",
293
+ "name": "server",
294
+ "browser": true,
295
+ "logFile": false,
296
+ "port": "3000"
297
+ }
298
+ `
299
+ },
300
+ MINIFIEDJSX: {
301
+ prefix: "http",
302
+ sufix: ".min.tsx",
303
+ displayName: "min.tsx file",
304
+ language: "typescript",
305
+ template: () => `import JSX from "@miqro/jsx";
306
+ import { define } from "@miqro/jsx-dom";
307
+
308
+ export function MyComponent() {
309
+ return <p>HelloWorld</p>
310
+ }
311
+ window.addEventListener("load", (event) => {
312
+ define("my-tag", MyComponent, {
313
+ shadowInit: false,
314
+ observedAttributes: []
315
+ });
316
+ });
317
+ `
318
+ },
319
+ JSX: {
320
+ prefix: "http",
321
+ sufix: ".tsx",
322
+ displayName: ".tsx file",
323
+ language: "typescript",
324
+ template: () => `import JSX from "@miqro/jsx";
325
+ import { define } from "@miqro/jsx-dom";
326
+
327
+ export function MyComponent() {
328
+ return <p>HelloWorld</p>
329
+ }
330
+ window.addEventListener("load", (event) => {
331
+ define("my-tag", MyComponent, {
332
+ shadowInit: false,
333
+ observedAttributes: []
334
+ });
335
+ });
336
+ `
337
+ },
338
+ /*SSRTSX: {
339
+ prefix: "http",
340
+ sufix: ".tsx",
341
+ displayName: "an ssr component example using webcomponents",
342
+ language: "typescript",
343
+ httpSufix: ".js",
344
+ template: (_filename: string, httpPath: string) => `import { } from "miqro";
345
+
346
+ // TODO change this accordingly
347
+ const TAG = "my-tag";
348
+
349
+ function MyComponent(props, children) {
350
+ const [count, setcount] = jsx.useState(0);
351
+ jsx.useEffect(()=>{
352
+ const timeout = setTimeout(()=>{
353
+ setcount(count+1);
354
+ }, 1000);
355
+ return ()=>{
356
+ clearTimeout(timeout);
357
+ }
358
+ });
359
+ return <p>Count: {count}</p>
360
+ }
361
+
362
+ window.addEventListener("load", (event) => {
363
+ jsx.define(TAG, MyComponent, {
364
+ shadowInit: false,
365
+ observedAttributes: []
366
+ });
367
+ });
368
+
369
+ export function SSRComponent(props, children) {
370
+ return JSX.createElement(
371
+ JSX.Fragment, null,
372
+ JSX.createElement(TAG, props,
373
+ JSX.createElement(MyComponent, props, ...children)
374
+ ),
375
+ JSX.createElement("script", { type: "module", src: "/${httpPath}" })
376
+ );
377
+ }
378
+ `
379
+ },
380
+ SSRMINTSX: {
381
+ prefix: "http",
382
+ sufix: ".min.tsx",
383
+ displayName: "a minified ssr component example using webcomponents",
384
+ language: "typescript",
385
+ httpSufix: ".min.js",
386
+ template: (filename: string, httpPath: string) => `import { } from "miqro";
387
+
388
+ // TODO change this accordingly
389
+ const TAG = "my-tag";
390
+
391
+ function MyComponent(props, children) {
392
+ const [count, setcount] = jsx.useState(0);
393
+ jsx.useEffect(()=>{
394
+ const timeout = setTimeout(()=>{
395
+ setcount(count+1);
396
+ }, 1000);
397
+ return ()=>{
398
+ clearTimeout(timeout);
399
+ }
400
+ });
401
+ return <p>Count: {count}</p>
402
+ }
403
+
404
+ window.addEventListener("load", (event) => {
405
+ jsx.define(TAG, MyComponent, {
406
+ shadowInit: false,
407
+ observedAttributes: []
408
+ });
409
+ });
410
+
411
+ export function SSRComponent(props, children) {
412
+ return JSX.createElement(
413
+ JSX.Fragment, null,
414
+ JSX.createElement(TAG, props,
415
+ JSX.createElement(MyComponent, props, ...children)
416
+ ),
417
+ JSX.createElement("script", { type: "module", src: "/${httpPath}" })
418
+ );
419
+ }
420
+ `
421
+ },*/
422
+ JS: {
423
+ prefix: "http",
424
+ sufix: ".js",
425
+ displayName: ".js file",
426
+ language: "typescript",
427
+ template: () => `window.addEventListener("load", (event) => {
428
+
429
+ });
430
+ `
431
+ },
432
+ CSS: {
433
+ prefix: "http",
434
+ sufix: ".css",
435
+ displayName: ".css file",
436
+ language: "css",
437
+ template: () => `* {
438
+ font-family: "Menlo" !important;
439
+ font-size: 11px;
440
+ }
441
+ `
442
+ },
443
+ DBCONFIG: {
444
+ prefix: "",
445
+ filename: "db",
446
+ sufix: ".ts",
447
+ displayName: "db.ts file",
448
+ language: "typescript",
449
+ template: () => `import { DBConfig } from "miqro";
450
+
451
+ export default {
452
+ //dialect: "node:sqlite"
453
+ //storage: "./db.sqlite3"
454
+ //url: "..."
455
+ //disabled: false,
456
+ name: "MyDB"
457
+ } as DBConfig`
458
+ },
459
+ CORS: {
460
+ prefix: "",
461
+ filename: "cors",
462
+ sufix: ".ts",
463
+ displayName: "cors.ts file",
464
+ language: "typescript",
465
+ template: () => `import { CORSConfig } from "miqro";
466
+
467
+ export default {
468
+ origins: "*",
469
+ /*validate: (origin: string, origins: string | string[]) => {
470
+ return false
471
+ },
472
+ methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
473
+ preflightContinue: false*/
474
+ } as CORSConfig;
475
+ `
476
+ }
477
+ };
@@ -0,0 +1,11 @@
1
+ export declare function APIPReview(props: {
2
+ apiPreview?: {
3
+ path: string;
4
+ method: string;
5
+ }[];
6
+ isPanelVisible: (panel: string) => boolean;
7
+ }): JSX.Element;
8
+ export declare namespace APIPReview {
9
+ var asFragment: boolean;
10
+ var shadowInit: boolean;
11
+ }
@@ -0,0 +1,92 @@
1
+ import { HighlightTextArea } from "./highlight-text-area.js";
2
+ import * as jsx from "@miqro/jsx";
3
+ import JSX from "@miqro/jsx";
4
+ const DEFAULT_HEADERS = `{"content-type": "application/json"}`;
5
+ const DEFAULT_BODY = `{}`;
6
+ export function APIPReview(props) {
7
+ const pathRef = jsx.useRef();
8
+ const methodRef = jsx.useRef();
9
+ const headersRef = jsx.useRef();
10
+ const bodyRef = jsx.useRef();
11
+ const [headers, setHeaders] = jsx.useState(DEFAULT_HEADERS);
12
+ const [body, setBody] = jsx.useState(DEFAULT_BODY);
13
+ const [responseStatus, setresponseStatus] = jsx.useState(null);
14
+ const [responseHeaders, setresponseHeaders] = jsx.useState(null);
15
+ const [responseBody, setresponseBody] = jsx.useState(null);
16
+ const { path, method } = props.apiPreview ? props.apiPreview[0] : { path: "", method: "" };
17
+ jsx.useEffect(() => {
18
+ setresponseStatus(null);
19
+ setresponseHeaders(null);
20
+ setresponseBody(null);
21
+ /*setHeaders(DEFAULT_HEADERS);
22
+ setBody(DEFAULT_BODY);*/
23
+ }, [path]);
24
+ const useBody = String(method).toLocaleLowerCase() !== "get";
25
+ function submit() {
26
+ try {
27
+ if (methodRef.current && pathRef.current && headersRef.current) {
28
+ setHeaders(headersRef.current.value);
29
+ if (bodyRef.current) {
30
+ setBody(bodyRef.current.value);
31
+ }
32
+ fetch(pathRef.current.value, useBody && bodyRef.current ? {
33
+ method: methodRef.current.value,
34
+ headers: JSON.parse(headersRef.current.value),
35
+ body: bodyRef.current.value
36
+ } : {
37
+ method: methodRef.current.value,
38
+ headers: JSON.parse(headersRef.current.value),
39
+ }).then(async (r) => {
40
+ setresponseStatus(r.status);
41
+ const headers = {};
42
+ r.headers.forEach((value, key) => {
43
+ headers[key] = value;
44
+ });
45
+ setresponseHeaders(JSON.stringify(headers, undefined, 2));
46
+ const text = await r.text();
47
+ setresponseBody(text);
48
+ try {
49
+ setresponseBody(JSON.stringify(JSON.parse(text), undefined, 2));
50
+ }
51
+ catch (e) {
52
+ // ignore
53
+ }
54
+ }).catch(e => {
55
+ console.error(e);
56
+ });
57
+ }
58
+ }
59
+ catch (e) {
60
+ console.error(e);
61
+ }
62
+ }
63
+ return JSX.createElement("div", { style: `${!props.isPanelVisible("right") ? "display: none;" : ""}${props.apiPreview ? "" : " display: none; "}margin:0; padding: 0; overflow: auto; max-height: 100%; width:100%;` },
64
+ JSX.createElement("form", { onsubmit: ev => {
65
+ ev.preventDefault();
66
+ submit();
67
+ } },
68
+ JSX.createElement("p", null, "path"),
69
+ JSX.createElement("input", { style: "width: calc(100% - 4 * var(--file-browser-separation));", type: "text", value: path, ref: pathRef }),
70
+ JSX.createElement("p", null, "method"),
71
+ JSX.createElement("input", { style: "width: calc(100% - 4 * var(--file-browser-separation));", type: "text", value: method, ref: methodRef }),
72
+ JSX.createElement("p", null, "headers"),
73
+ JSX.createElement("input", { style: "width: calc(100% - 4 * var(--file-browser-separation));", type: "text", value: headers, ref: headersRef }),
74
+ useBody ?
75
+ JSX.createElement(JSX.Fragment, null,
76
+ JSX.createElement("p", null, "body"),
77
+ JSX.createElement("input", { style: "width: calc(100% - 4 * var(--file-browser-separation));", type: "text", value: body, ref: bodyRef })) :
78
+ JSX.createElement(JSX.Fragment, null),
79
+ JSX.createElement("button", { style: "margin-top: var(--file-browser-separation); width: 100%;", class: "btn", onclick: ev => {
80
+ ev.preventDefault();
81
+ submit();
82
+ } }, "submit"),
83
+ JSX.createElement("div", null,
84
+ JSX.createElement("p", null, "response status"),
85
+ JSX.createElement("p", null, responseStatus),
86
+ JSX.createElement("p", null, "response headers"),
87
+ JSX.createElement(HighlightTextArea, { content: responseHeaders ? responseHeaders : "null", language: "json", disabled: "true" }),
88
+ JSX.createElement("p", null, "response body"),
89
+ JSX.createElement(HighlightTextArea, { content: responseBody ? responseBody : "null", language: "json", disabled: "true" }))));
90
+ }
91
+ APIPReview.asFragment = true;
92
+ APIPReview.shadowInit = false;
@@ -0,0 +1,16 @@
1
+ export declare function Editor(props: {
2
+ disablelog?: boolean;
3
+ disablepreview?: boolean;
4
+ disablereload?: boolean;
5
+ migrations: string;
6
+ services: string;
7
+ reloadstring: string;
8
+ files: string;
9
+ initialcurrent: string;
10
+ classname?: string;
11
+ errors: string;
12
+ }): JSX.Element;
13
+ export declare namespace Editor {
14
+ var asFragment: boolean;
15
+ var shadowInit: boolean;
16
+ }