miqro 6.0.14 → 6.1.2

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 (318) hide show
  1. package/README.md +12 -0
  2. package/build/editor.bundle.js +37 -50409
  3. package/build/esm/src/bin/compile.js +0 -1
  4. package/build/esm/src/bin/doc-md.js +0 -1
  5. package/build/esm/src/bin/generate-doc.d.ts +3 -1
  6. package/build/esm/src/bin/generate-doc.js +16 -12
  7. package/build/esm/src/bin/test.js +0 -1
  8. package/build/esm/src/bin/types.js +0 -1
  9. package/build/esm/src/cluster.js +0 -1
  10. package/build/esm/src/common/arguments.d.ts +12 -0
  11. package/build/esm/src/common/arguments.js +111 -10
  12. package/build/esm/src/common/assets.js +2 -3
  13. package/build/esm/src/common/checksum.js +0 -1
  14. package/build/esm/src/common/constants.js +0 -1
  15. package/build/esm/src/common/content-type.js +0 -1
  16. package/build/esm/src/common/esbuild.js +0 -1
  17. package/build/esm/src/common/exit.js +0 -1
  18. package/build/esm/src/common/fs.js +0 -1
  19. package/build/esm/src/common/help.d.ts +1 -1
  20. package/build/esm/src/common/help.js +4 -1
  21. package/build/esm/src/common/jsx.d.ts +8 -1
  22. package/build/esm/src/common/jsx.js +84 -2
  23. package/build/esm/src/common/paths.d.ts +4 -0
  24. package/build/esm/src/common/paths.js +41 -2
  25. package/build/esm/src/common/watch.js +0 -1
  26. package/build/esm/src/inflate/inflate-sea.js +27 -16
  27. package/build/esm/src/inflate/inflate.js +2 -1
  28. package/build/esm/src/inflate/md.d.ts +1 -0
  29. package/build/esm/src/inflate/md.js +9 -6
  30. package/build/esm/src/inflate/setup-auth.js +0 -1
  31. package/build/esm/src/inflate/setup-cors.js +0 -1
  32. package/build/esm/src/inflate/setup-db.js +0 -1
  33. package/build/esm/src/inflate/setup-error.d.ts +3 -0
  34. package/build/esm/src/inflate/setup-error.js +40 -0
  35. package/build/esm/src/inflate/setup-http.js +13 -4
  36. package/build/esm/src/inflate/setup-log.js +0 -1
  37. package/build/esm/src/inflate/setup-middleware.d.ts +4 -0
  38. package/build/esm/src/inflate/setup-middleware.js +42 -0
  39. package/build/esm/src/inflate/setup-server-config.js +0 -1
  40. package/build/esm/src/inflate/setup-test.js +0 -1
  41. package/build/esm/src/inflate/setup-ws.js +0 -1
  42. package/build/esm/src/inflate/setup.doc.d.ts +4 -0
  43. package/build/esm/src/inflate/setup.doc.js +62 -0
  44. package/build/esm/src/inflate/utils/sea-utils.js +0 -1
  45. package/build/esm/src/lib.js +0 -1
  46. package/build/esm/src/main.js +3 -4
  47. package/build/esm/src/services/app.d.ts +1 -0
  48. package/build/esm/src/services/app.js +18 -2
  49. package/build/esm/src/services/editor.js +0 -1
  50. package/build/esm/src/services/globals.js +0 -1
  51. package/build/esm/src/services/hot-reload.js +0 -1
  52. package/build/esm/src/services/migrations.js +0 -1
  53. package/build/esm/src/services/utils/admin-interface.js +0 -1
  54. package/build/esm/src/services/utils/cache.js +0 -1
  55. package/build/esm/src/services/utils/cluster-cache.js +0 -1
  56. package/build/esm/src/services/utils/cluster-ws.js +0 -1
  57. package/build/esm/src/services/utils/db-manager.js +0 -1
  58. package/build/esm/src/services/utils/get-route.js +0 -1
  59. package/build/esm/src/services/utils/log-transport.js +0 -1
  60. package/build/esm/src/services/utils/log.js +2 -2
  61. package/build/esm/src/services/utils/server-interface.js +0 -1
  62. package/build/esm/src/services/utils/websocketmanager.js +0 -1
  63. package/build/esm/src/types.d.ts +16 -1
  64. package/build/esm/src/types.js +0 -1
  65. package/build/lib.cjs +890 -322
  66. package/package.json +4 -2
  67. package/sea/types.json +1 -1
  68. package/tsconfig.json +1 -1
  69. package/bin/miqro +0 -34
  70. package/build/esm/editor/auth.d.ts +0 -6
  71. package/build/esm/editor/auth.js +0 -42
  72. package/build/esm/editor/auth.js.map +0 -1
  73. package/build/esm/editor/common/admin-interface.d.ts +0 -36
  74. package/build/esm/editor/common/admin-interface.js +0 -45
  75. package/build/esm/editor/common/admin-interface.js.map +0 -1
  76. package/build/esm/editor/common/constants.d.ts +0 -4
  77. package/build/esm/editor/common/constants.js +0 -21
  78. package/build/esm/editor/common/constants.js.map +0 -1
  79. package/build/esm/editor/common/constants.server.d.ts +0 -2
  80. package/build/esm/editor/common/constants.server.js +0 -5
  81. package/build/esm/editor/common/constants.server.js.map +0 -1
  82. package/build/esm/editor/common/editor-index.d.ts +0 -2
  83. package/build/esm/editor/common/editor-index.js +0 -15
  84. package/build/esm/editor/common/editor-index.js.map +0 -1
  85. package/build/esm/editor/common/html-encode.d.ts +0 -1
  86. package/build/esm/editor/common/html-encode.js +0 -15
  87. package/build/esm/editor/common/html-encode.js.map +0 -1
  88. package/build/esm/editor/common/log-socket.d.ts +0 -15
  89. package/build/esm/editor/common/log-socket.js +0 -71
  90. package/build/esm/editor/common/log-socket.js.map +0 -1
  91. package/build/esm/editor/common/templates.d.ts +0 -11
  92. package/build/esm/editor/common/templates.js +0 -444
  93. package/build/esm/editor/common/templates.js.map +0 -1
  94. package/build/esm/editor/components/api-preview.d.ts +0 -11
  95. package/build/esm/editor/components/api-preview.js +0 -91
  96. package/build/esm/editor/components/api-preview.js.map +0 -1
  97. package/build/esm/editor/components/editor.d.ts +0 -16
  98. package/build/esm/editor/components/editor.js +0 -358
  99. package/build/esm/editor/components/editor.js.map +0 -1
  100. package/build/esm/editor/components/file-browser.d.ts +0 -37
  101. package/build/esm/editor/components/file-browser.js +0 -127
  102. package/build/esm/editor/components/file-browser.js.map +0 -1
  103. package/build/esm/editor/components/file-editor-toolbar.d.ts +0 -22
  104. package/build/esm/editor/components/file-editor-toolbar.js +0 -94
  105. package/build/esm/editor/components/file-editor-toolbar.js.map +0 -1
  106. package/build/esm/editor/components/file-editor.d.ts +0 -32
  107. package/build/esm/editor/components/file-editor.js +0 -60
  108. package/build/esm/editor/components/file-editor.js.map +0 -1
  109. package/build/esm/editor/components/filter-query.d.ts +0 -1
  110. package/build/esm/editor/components/filter-query.js +0 -23
  111. package/build/esm/editor/components/filter-query.js.map +0 -1
  112. package/build/esm/editor/components/highlight-text-area.d.ts +0 -11
  113. package/build/esm/editor/components/highlight-text-area.js +0 -139
  114. package/build/esm/editor/components/highlight-text-area.js.map +0 -1
  115. package/build/esm/editor/components/log-viewer.d.ts +0 -6
  116. package/build/esm/editor/components/log-viewer.js +0 -70
  117. package/build/esm/editor/components/log-viewer.js.map +0 -1
  118. package/build/esm/editor/components/new-file.d.ts +0 -10
  119. package/build/esm/editor/components/new-file.js +0 -118
  120. package/build/esm/editor/components/new-file.js.map +0 -1
  121. package/build/esm/editor/components/scroll-query.d.ts +0 -7
  122. package/build/esm/editor/components/scroll-query.js +0 -22
  123. package/build/esm/editor/components/scroll-query.js.map +0 -1
  124. package/build/esm/editor/components/start-page.d.ts +0 -13
  125. package/build/esm/editor/components/start-page.js +0 -31
  126. package/build/esm/editor/components/start-page.js.map +0 -1
  127. package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +0 -3
  128. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +0 -30
  129. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js.map +0 -1
  130. package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +0 -5
  131. package/build/esm/editor/http/admin/editor/api/fs/read.api.js +0 -50
  132. package/build/esm/editor/http/admin/editor/api/fs/read.api.js.map +0 -1
  133. package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +0 -4
  134. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +0 -40
  135. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js.map +0 -1
  136. package/build/esm/editor/http/admin/editor/api/fs/scan.api.d.ts +0 -26
  137. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +0 -150
  138. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js.map +0 -1
  139. package/build/esm/editor/http/admin/editor/api/fs/write.api.d.ts +0 -3
  140. package/build/esm/editor/http/admin/editor/api/fs/write.api.js +0 -39
  141. package/build/esm/editor/http/admin/editor/api/fs/write.api.js.map +0 -1
  142. package/build/esm/editor/http/admin/editor/api/server/reload.api.d.ts +0 -10
  143. package/build/esm/editor/http/admin/editor/api/server/reload.api.js +0 -47
  144. package/build/esm/editor/http/admin/editor/api/server/reload.api.js.map +0 -1
  145. package/build/esm/editor/http/admin/editor/api/server/restart.api.d.ts +0 -10
  146. package/build/esm/editor/http/admin/editor/api/server/restart.api.js +0 -46
  147. package/build/esm/editor/http/admin/editor/api/server/restart.api.js.map +0 -1
  148. package/build/esm/editor/http/admin/editor/editor.d.ts +0 -1
  149. package/build/esm/editor/http/admin/editor/editor.js +0 -8
  150. package/build/esm/editor/http/admin/editor/editor.js.map +0 -1
  151. package/build/esm/editor/http/admin/editor/index.api.d.ts +0 -3
  152. package/build/esm/editor/http/admin/editor/index.api.js +0 -22
  153. package/build/esm/editor/http/admin/editor/index.api.js.map +0 -1
  154. package/build/esm/editor/server.d.ts +0 -3
  155. package/build/esm/editor/server.js +0 -50
  156. package/build/esm/editor/server.js.map +0 -1
  157. package/build/esm/editor/ws.d.ts +0 -3
  158. package/build/esm/editor/ws.js +0 -12
  159. package/build/esm/editor/ws.js.map +0 -1
  160. package/build/esm/src/bin/compile.js.map +0 -1
  161. package/build/esm/src/bin/doc-md.js.map +0 -1
  162. package/build/esm/src/bin/generate-doc.js.map +0 -1
  163. package/build/esm/src/bin/test.js.map +0 -1
  164. package/build/esm/src/bin/types.js.map +0 -1
  165. package/build/esm/src/cluster.js.map +0 -1
  166. package/build/esm/src/common/arguments.js.map +0 -1
  167. package/build/esm/src/common/assets.js.map +0 -1
  168. package/build/esm/src/common/checksum.js.map +0 -1
  169. package/build/esm/src/common/constants.js.map +0 -1
  170. package/build/esm/src/common/content-type.js.map +0 -1
  171. package/build/esm/src/common/esbuild.js.map +0 -1
  172. package/build/esm/src/common/exit.js.map +0 -1
  173. package/build/esm/src/common/fs.js.map +0 -1
  174. package/build/esm/src/common/help.js.map +0 -1
  175. package/build/esm/src/common/jsx.js.map +0 -1
  176. package/build/esm/src/common/paths.js.map +0 -1
  177. package/build/esm/src/common/watch.js.map +0 -1
  178. package/build/esm/src/inflate/inflate-sea.js.map +0 -1
  179. package/build/esm/src/inflate/inflate.js.map +0 -1
  180. package/build/esm/src/inflate/md.js.map +0 -1
  181. package/build/esm/src/inflate/setup-auth.js.map +0 -1
  182. package/build/esm/src/inflate/setup-cors.js.map +0 -1
  183. package/build/esm/src/inflate/setup-db.js.map +0 -1
  184. package/build/esm/src/inflate/setup-http.js.map +0 -1
  185. package/build/esm/src/inflate/setup-log.js.map +0 -1
  186. package/build/esm/src/inflate/setup-server-config.js.map +0 -1
  187. package/build/esm/src/inflate/setup-test.js.map +0 -1
  188. package/build/esm/src/inflate/setup-ws.js.map +0 -1
  189. package/build/esm/src/inflate/utils/sea-utils.js.map +0 -1
  190. package/build/esm/src/lib.js.map +0 -1
  191. package/build/esm/src/main.js.map +0 -1
  192. package/build/esm/src/services/app.js.map +0 -1
  193. package/build/esm/src/services/editor.js.map +0 -1
  194. package/build/esm/src/services/globals.js.map +0 -1
  195. package/build/esm/src/services/hot-reload.js.map +0 -1
  196. package/build/esm/src/services/migrations.js.map +0 -1
  197. package/build/esm/src/services/utils/admin-interface.js.map +0 -1
  198. package/build/esm/src/services/utils/cache.js.map +0 -1
  199. package/build/esm/src/services/utils/cluster-cache.js.map +0 -1
  200. package/build/esm/src/services/utils/cluster-ws.js.map +0 -1
  201. package/build/esm/src/services/utils/db-manager.js.map +0 -1
  202. package/build/esm/src/services/utils/get-route.js.map +0 -1
  203. package/build/esm/src/services/utils/log-transport.js.map +0 -1
  204. package/build/esm/src/services/utils/log.js.map +0 -1
  205. package/build/esm/src/services/utils/server-interface.js.map +0 -1
  206. package/build/esm/src/services/utils/websocketmanager.js.map +0 -1
  207. package/build/esm/src/types.js.map +0 -1
  208. package/editor/auth.ts +0 -51
  209. package/editor/common/admin-interface.ts +0 -84
  210. package/editor/common/constants.server.ts +0 -5
  211. package/editor/common/constants.ts +0 -21
  212. package/editor/common/editor-index.tsx +0 -17
  213. package/editor/common/html-encode.ts +0 -14
  214. package/editor/common/log-socket.tsx +0 -85
  215. package/editor/common/templates.ts +0 -448
  216. package/editor/components/api-preview.tsx +0 -116
  217. package/editor/components/editor.tsx +0 -486
  218. package/editor/components/file-browser.tsx +0 -308
  219. package/editor/components/file-editor-toolbar.tsx +0 -191
  220. package/editor/components/file-editor.tsx +0 -122
  221. package/editor/components/filter-query.tsx +0 -22
  222. package/editor/components/highlight-text-area.tsx +0 -159
  223. package/editor/components/log-viewer.tsx +0 -110
  224. package/editor/components/new-file.tsx +0 -169
  225. package/editor/components/scroll-query.tsx +0 -22
  226. package/editor/components/start-page.tsx +0 -49
  227. package/editor/http/admin/editor/api/fs/delete.api.tsx +0 -32
  228. package/editor/http/admin/editor/api/fs/read.api.tsx +0 -55
  229. package/editor/http/admin/editor/api/fs/rename.api.tsx +0 -41
  230. package/editor/http/admin/editor/api/fs/scan.api.tsx +0 -181
  231. package/editor/http/admin/editor/api/fs/write.api.tsx +0 -41
  232. package/editor/http/admin/editor/api/server/reload.api.ts +0 -53
  233. package/editor/http/admin/editor/api/server/restart.api.tsx +0 -52
  234. package/editor/http/admin/editor/editor.tsx +0 -8
  235. package/editor/http/admin/editor/index.api.tsx +0 -39
  236. package/editor/server.ts +0 -57
  237. package/editor/static/android-chrome-192x192.png +0 -0
  238. package/editor/static/android-chrome-512x512.png +0 -0
  239. package/editor/static/apple-touch-icon.png +0 -0
  240. package/editor/static/editor.bundle.in.mjs +0 -20
  241. package/editor/static/favicon-16x16.png +0 -0
  242. package/editor/static/favicon-32x32.png +0 -0
  243. package/editor/static/favicon.ico +0 -0
  244. package/editor/static/site.webmanifest +0 -19
  245. package/editor/ws.ts +0 -15
  246. package/sea/base64.js +0 -3
  247. package/sea/compile.sh +0 -127
  248. package/sea/copy-types.sh +0 -46
  249. package/sea/editor-assets/editor.bundle.in.mjs +0 -19
  250. package/sea/generate-global-types-asset-json.js +0 -34
  251. package/sea/release-tar.sh +0 -5
  252. package/sea/tsc.sh +0 -1
  253. package/sea/version.tag.js +0 -11
  254. package/src/bin/compile.ts +0 -35
  255. package/src/bin/doc-md.ts +0 -210
  256. package/src/bin/generate-doc.ts +0 -58
  257. package/src/bin/test.ts +0 -92
  258. package/src/bin/types.ts +0 -22
  259. package/src/cluster.ts +0 -27
  260. package/src/common/arguments.ts +0 -382
  261. package/src/common/assets.ts +0 -128
  262. package/src/common/checksum.ts +0 -58
  263. package/src/common/constants.ts +0 -18
  264. package/src/common/content-type.ts +0 -84
  265. package/src/common/esbuild.ts +0 -94
  266. package/src/common/exit.ts +0 -91
  267. package/src/common/fs.ts +0 -17
  268. package/src/common/help.ts +0 -47
  269. package/src/common/jsx.ts +0 -426
  270. package/src/common/paths.ts +0 -117
  271. package/src/common/watch.ts +0 -85
  272. package/src/inflate/inflate-sea.ts +0 -194
  273. package/src/inflate/inflate.ts +0 -96
  274. package/src/inflate/md.ts +0 -20
  275. package/src/inflate/setup-auth.ts +0 -40
  276. package/src/inflate/setup-cors.ts +0 -40
  277. package/src/inflate/setup-db.ts +0 -113
  278. package/src/inflate/setup-http.ts +0 -643
  279. package/src/inflate/setup-log.ts +0 -44
  280. package/src/inflate/setup-server-config.ts +0 -47
  281. package/src/inflate/setup-test.ts +0 -23
  282. package/src/inflate/setup-ws.ts +0 -48
  283. package/src/inflate/utils/sea-utils.ts +0 -14
  284. package/src/lib.ts +0 -19
  285. package/src/main.ts +0 -87
  286. package/src/services/app.ts +0 -640
  287. package/src/services/editor.tsx +0 -101
  288. package/src/services/globals.ts +0 -143
  289. package/src/services/hot-reload.ts +0 -48
  290. package/src/services/migrations.ts +0 -66
  291. package/src/services/utils/admin-interface.ts +0 -37
  292. package/src/services/utils/cache.ts +0 -88
  293. package/src/services/utils/cluster-cache.ts +0 -230
  294. package/src/services/utils/cluster-ws.ts +0 -197
  295. package/src/services/utils/db-manager.ts +0 -92
  296. package/src/services/utils/get-route.ts +0 -70
  297. package/src/services/utils/log-transport.ts +0 -75
  298. package/src/services/utils/log.ts +0 -91
  299. package/src/services/utils/server-interface.ts +0 -172
  300. package/src/services/utils/websocketmanager.ts +0 -149
  301. package/src/types/@esbuild.d.ts +0 -1
  302. package/src/types/@miqro/core.d.ts +0 -2
  303. package/src/types/@miqro/jsx.d.ts +0 -2
  304. package/src/types/@miqro/parser.d.ts +0 -2
  305. package/src/types/@miqro/query.d.ts +0 -2
  306. package/src/types/@miqro/request.d.ts +0 -2
  307. package/src/types/@miqro/test.d.ts +0 -2
  308. package/src/types/@miqro.d.ts +0 -1
  309. package/src/types/@types.d.ts +0 -1
  310. package/src/types/browser.globals.d.ts +0 -9
  311. package/src/types/globals.d.ts +0 -2
  312. package/src/types/jsx.globals.d.ts +0 -37
  313. package/src/types/miqro.d.ts +0 -111
  314. package/src/types/postject.d.ts +0 -1
  315. package/src/types/server.globals.d.ts +0 -72
  316. package/src/types.ts +0 -204
  317. /package/{editor/http/admin/editor → build}/font.ttf +0 -0
  318. /package/{editor/http/admin/editor → build}/style.css +0 -0
@@ -1,159 +0,0 @@
1
- //import hljs from "../lib/highlight/core.min.js"
2
- import hljs from 'highlight.js';
3
- import javascript from 'highlight.js/lib/languages/javascript';
4
- import xml from "highlight.js/lib/languages/xml.js";
5
- import css from "highlight.js/lib/languages/css.js";
6
- import scss from "highlight.js/lib/languages/scss.js";
7
- import markdown from "highlight.js/lib/languages/markdown.js";
8
- import dockerfile from "highlight.js/lib/languages/dockerfile.js";
9
- import yaml from "highlight.js/lib/languages/yaml.js";
10
- import typescript from "highlight.js/lib/languages/typescript.js";
11
- import c from "highlight.js/lib/languages/c.js";
12
- import cpp from "highlight.js/lib/languages/cpp.js";
13
- import bash from "highlight.js/lib/languages/bash.js";
14
- import python from "highlight.js/lib/languages/python.js";
15
- import text from "highlight.js/lib/languages/plaintext.js";
16
- import json from "highlight.js/lib/languages/json.js";
17
-
18
- /*import javascript from "../lib/highlight/languages/javascript.js";
19
- import xml from "../lib/highlight/languages/xml.js";
20
- import css from "../lib/highlight/languages/css.js";
21
- import scss from "../lib/highlight/languages/scss.js";
22
- import markdown from "../lib/highlight/languages/markdown.js";
23
- import dockerfile from "../lib/highlight/languages/dockerfile.js";
24
- import yaml from "../lib/highlight/languages/yaml.js";
25
- import typescript from "../lib/highlight/languages/typescript.js";
26
- import c from "../lib/highlight/languages/c.js";
27
- import cpp from "../lib/highlight/languages/cpp.js";
28
- import bash from "../lib/highlight/languages/bash.js";
29
- import python from "../lib/highlight/languages/python.js";
30
- import text from "../lib/highlight/languages/plaintext.js";
31
- import json from "../lib/highlight/languages/json.js";*/
32
-
33
- // Then register the languages you need
34
- hljs.registerLanguage('text', text);
35
- hljs.registerLanguage('dockerfile', dockerfile);
36
- hljs.registerLanguage('yaml', yaml);
37
- hljs.registerLanguage('javascript', javascript);
38
- hljs.registerLanguage('xml', xml);
39
- hljs.registerLanguage('html', xml);
40
- hljs.registerLanguage('css', css);
41
- hljs.registerLanguage('scss', scss);
42
- hljs.registerLanguage('markdown', markdown);
43
- hljs.registerLanguage('typescript', typescript);
44
- hljs.registerLanguage('c', c);
45
- hljs.registerLanguage('cpp', cpp);
46
- hljs.registerLanguage('bash', bash);
47
- hljs.registerLanguage('python', python);
48
- hljs.registerLanguage('json', json);
49
-
50
- /*!
51
- Theme: GitHub Dark
52
- Description: Dark theme as seen on github.com
53
- Author: github.com
54
- Maintainer: @Hirse
55
- Updated: 2021-05-15
56
-
57
- Outdated base version: https://github.com/primer/github-syntax-dark
58
- Current colors taken from GitHub's CSS
59
- */
60
- const STYLE = `pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}code{outline: 0px solid rgba(0, 0, 0, 0.263);caret-color: red;}.hljs-name{color: #e8910d;}.hljs-tag .hljs-attr, .hljs-tag .hljs-name{color: #e8910d;}`;
61
- const POSTTYLE = "pre{padding:0; margin:0;} code { background-color: #000000; color: #ffffff; }";
62
- const TAG_NAME = "HIGHLIGHT-TEXT-AREA";
63
-
64
- function runHighlight(content: string | null, language: string) {
65
- const now = Date.now();
66
- console.log("runHighlight [%s]", language);
67
- const value = hljs.highlight(String(content), {
68
- language,
69
- ignoreIllegals: true
70
- }).value;
71
- console.log("runHighlight [%s] took [%s]ms", language, Date.now() - now);
72
- return value;
73
- }
74
-
75
- function emitEvents(elementRef: any, topMost: any, content: string, oncontentchange?: (ev: CustomEvent) => void) {
76
- if (elementRef.current && topMost.current) {
77
- const currentContent = elementRef.current.textContent as any;
78
- const webComponentElement = (topMost.current as HTMLElement).parentNode as HTMLElement;
79
- const event = new CustomEvent("contentchange", { detail: currentContent });
80
- if (webComponentElement && webComponentElement instanceof HTMLElement && webComponentElement.tagName === TAG_NAME) {
81
- try {
82
- webComponentElement.dispatchEvent(event);
83
- } catch (e) {
84
- console.error(e);
85
- }
86
- }
87
- if (typeof oncontentchange === "function") {
88
- try {
89
- oncontentchange(event);
90
- } catch (e) {
91
- console.error(e);
92
- }
93
- }
94
- }
95
- }
96
-
97
- export function HighlightTextArea({ content, language, oncontentchange, tabChar, disabled }:
98
- { language: string; content: string; disabled?: string; tabChar?: string; oncontentchange?: (ev: CustomEvent) => void }
99
- ) {
100
- const elementRef = jsx.useRef();
101
- const topMost = jsx.useRef();
102
- const [lastLanguage, setlastLanguage] = jsx.useState(language);
103
-
104
- // effect to watch changes to language
105
- jsx.useEffect(() => {
106
- if (elementRef.current && (lastLanguage !== language || elementRef.current.textContent !== content)) {
107
- setlastLanguage(language);
108
- elementRef.current.innerHTML = runHighlight(content, language);
109
- }
110
- }, [lastLanguage, language, elementRef.current, content])
111
-
112
- return <pre ref={topMost}>
113
- <style innerHTML={STYLE + POSTTYLE} />
114
- <code
115
- autocomplete="off"
116
- autocorrect="off"
117
- autocapitalize="off"
118
- spellcheck="false"
119
- contenteditable={disabled ? "false" : "true"}
120
- ref={elementRef}
121
- tabindex="0"
122
- innerHTML={!elementRef.current ? runHighlight(content, language) : null}
123
- onfocusout={async (ev) => {
124
- ev.preventDefault();
125
- if (elementRef.current) {
126
- if (content !== elementRef.current.textContent) {
127
- //setlastContent(String(elementRef.current.textContent));
128
- elementRef.current.innerHTML = runHighlight(elementRef.current.textContent, language);
129
- }
130
- }
131
- }}
132
- onkeydown={ev => {
133
- if (ev.keyCode === 9) {
134
- ev.preventDefault();
135
- // now insert four non-breaking spaces for the tab key
136
- const sel = document.getSelection();
137
- if (sel && topMost.current) {
138
- if ((topMost.current as any).contains(sel.anchorNode)) {
139
- const range = sel.getRangeAt(0);
140
- const tabNode = document.createTextNode(tabChar ? tabChar : "\t");
141
- range.insertNode(tabNode);
142
- range.setStartAfter(tabNode);
143
- range.setEndAfter(tabNode);
144
- sel.removeAllRanges();
145
- sel.addRange(range);
146
- }
147
- }
148
- emitEvents(elementRef, topMost, content, oncontentchange);
149
- }
150
- }}
151
- oninput={ev => {
152
- ev.preventDefault();
153
- emitEvents(elementRef, topMost, content, oncontentchange);
154
- }} />
155
- </pre>
156
- }
157
-
158
- HighlightTextArea.asFragment = true;
159
- HighlightTextArea.shadowInit = false;
@@ -1,110 +0,0 @@
1
- import { LogSocket } from "../common/log-socket.js";
2
-
3
- function getUniqueIdentifiers(lines: {
4
- out: string;
5
- identifier: string;
6
- }[]) {
7
- const identifiersCache = {};
8
- return lines.map(l => l.identifier).filter(identifier => {
9
- const filter = !identifiersCache[identifier];
10
- identifiersCache[identifier] = true;
11
- return filter;
12
- });
13
- }
14
-
15
- const LOG_LEVEL_MAP =
16
- {
17
- "none": 0,
18
- "error": 1,
19
- "warn": 2,
20
- "info": 3,
21
- "debug": 4,
22
- "trace": 5,
23
- };
24
-
25
- interface LogViewerProps {
26
- socket: LogSocket;
27
- }
28
-
29
- export function LogViewer(props: LogViewerProps) {
30
- const { lines, clearLog, getMaxlogsize, setMaxLogSize } = props.socket;
31
-
32
- const maxLogSize = getMaxlogsize();
33
-
34
- const refresh = jsx.useRefresh();
35
-
36
- jsx.useEffect(() => {
37
- refresh();
38
- }, [maxLogSize]);
39
-
40
- const [identifier, setidentifier] = jsx.useState<string>("");
41
- const [level, setlevel] = jsx.useState<string>("debug");
42
- const [filter, setfilter] = jsx.useState<string>("");
43
- const identifiers = getUniqueIdentifiers(lines).sort();
44
- //console.log(identifiers);
45
-
46
- return <div class="log-viewer">
47
- <div class="log-viewer-toolbar">
48
- <button
49
- class="btn"
50
- onclick={e => {
51
- e.preventDefault();
52
- clearLog();
53
- }}>clear log</button>
54
- <select
55
- value={maxLogSize}
56
- oninput={ev => {
57
- ev.preventDefault();
58
- if (ev.target.value === "unlimited") {
59
- setMaxLogSize("unlimited");
60
- } else {
61
- setMaxLogSize(parseInt(ev.target.value, 10));
62
- }
63
- }}
64
- style="margin: 0; padding: 0; margin-left:auto; margin-right: 0;">
65
- {["10", "1000", "5000", "10000", "15000", "20000", "25000", "50000", "100000", "500000", "1000000", "1500000", "5000000"].map(l => <option value={l}>{l}</option>)}
66
- <option value="unlimited">unlimited</option>
67
- </select>
68
- <select
69
- value={level}
70
- oninput={ev => {
71
- ev.preventDefault();
72
- setlevel(ev.target.value);
73
- }}
74
- style="margin: 0; padding: 0; margin-left:var(--file-browser-separation); margin-right: 0;">
75
- {["error", "warn", "info", "debug", "trace"].map(l => <option value={l}>{l}</option>)}
76
- <option value="">all</option>
77
- </select>
78
- <select
79
- value={identifier}
80
- oninput={ev => {
81
- ev.preventDefault();
82
- setidentifier(ev.target.value);
83
- }}
84
- style="margin: 0; padding: 0; margin-left:var(--file-browser-separation); margin-right: 0;">
85
- {identifiers.map(identifier => <option value={identifier}>{identifier}</option>)}
86
- <option value=""></option>
87
- </select>
88
- <input
89
- style="margin: 0; padding: 0; margin-left:var(--file-browser-separation); margin-right: 0;"
90
- value={filter}
91
- oninput={ev => {
92
- ev.preventDefault();
93
- setfilter(ev.target.value);
94
- }}
95
- type="text"
96
- placeholder="..filter.." />
97
- </div>
98
- <div class="log-viewer-log">
99
- {lines
100
- .filter(line => identifier === "" || line.identifier === identifier)
101
- .filter(line => filter === "" || line.out.indexOf(filter) !== -1)
102
- .filter(line => {
103
- return (level === "" || LOG_LEVEL_MAP[level] >= LOG_LEVEL_MAP[line.level]);
104
- })
105
- .map(line =>
106
- <p style="margin: 0; padding: 0; border-radius: 0; font-size: 12px;" class={line.level === "error" ? "info-danger" : line.level === "warn" ? "info-warn" : line.level === "trace" ? "info-success" : line.level === "debug" ? "info-info" : ""}>{line.out}</p>
107
- ).reverse()}
108
- </div>
109
- </div>
110
- }
@@ -1,169 +0,0 @@
1
- import { BASEEDITOR_PATH } from "../common/constants.js";
2
- import { TEMPLATES } from "../common/templates.js";
3
- import { HighlightTextArea } from "./highlight-text-area.js";
4
-
5
- export function NewFile(props: { migrations: string[]; services: string[]; open: boolean; ondone: (file?: string) => void; }) {
6
-
7
- const [template, settemplate] = jsx.useState("EMPTY");
8
-
9
- const refresh = jsx.useRefresh();
10
-
11
- const [service, setservice] = jsx.useState(props.services[0]);
12
-
13
- const nameInput = jsx.useRef();
14
- //const open = dialog ? dialog.open : false;
15
-
16
- /*jsx.useEffect(() => {
17
- if (dialog) {
18
- //console.log((dialogRef.current as any).open);
19
- if (open !== props.open) {
20
- if (nameInput.current) {
21
- nameInput.current.value = "";
22
- nameInput.current.focus();
23
- }
24
- if (props.open) {
25
- console.log("showModal");
26
- dialog.showModal();
27
- //(dialogRef.current as any).show();
28
- } else {
29
- console.log("closeModal");
30
- //dialog.close();
31
- }
32
- }
33
- }
34
- }, [dialog, open, props.open]);*/
35
- jsx.useEffect(() => {
36
-
37
- if (nameInput.current) {
38
- nameInput.current.value = "";
39
- nameInput.current.focus();
40
- }
41
- }, [nameInput.current]);
42
-
43
- function close(file?: string) {
44
- //console.log("closeModal");
45
- if (props.ondone) {
46
- props.ondone(file);
47
- }
48
- }
49
-
50
-
51
- let nextMigrationNumber = 1;
52
- if (props.migrations.length > 0) {
53
- const lastMigration = props.migrations[props.migrations.length - 1];
54
- const indexOfDash = lastMigration.indexOf("-");
55
- if (indexOfDash !== -1) {
56
- nextMigrationNumber = parseInt(lastMigration.substring(0, indexOfDash), 10) + 1;
57
- }
58
- }
59
-
60
- const httpPath = (TEMPLATES[template].filename ? TEMPLATES[template].filename : nameInput.current?.value) + (TEMPLATES[template].httpSufix ? TEMPLATES[template].httpSufix : "");
61
-
62
- const filename = (service ? service + "/" : "") + (service && TEMPLATES[template].prefix ? TEMPLATES[template].prefix + "/" : "") + (template === "MIGRATION" ? nextMigrationNumber + "-" : "") + (TEMPLATES[template].filename ? TEMPLATES[template].filename : nameInput.current?.value) + (TEMPLATES[template].sufix ? TEMPLATES[template].sufix : "");
63
-
64
- async function createNewFile() {
65
- if ((nameInput.current && nameInput.current.value) || TEMPLATES[template].filename) {
66
- const t = TEMPLATES[template];
67
- await fetch(BASEEDITOR_PATH + "/api/fs/write", {
68
- method: "POST",
69
- headers: {
70
- ["content-type"]: "application/json"
71
- },
72
- body: JSON.stringify({
73
- path: filename,
74
- contents: t.template ? t.template(filename, httpPath) : ""
75
- })
76
- });
77
- return filename;
78
- }
79
- }
80
-
81
- return <>
82
- {props.open ? <dialog
83
- class="new-dialog"
84
- open="">
85
- <div class="dialog-header">
86
- <h1>Create new File</h1>
87
- </div>
88
- <div class="dialog-body">
89
- <select
90
- value={service}
91
- oninput={ev => {
92
- ev.preventDefault();
93
- ev.stopPropagation();
94
- console.log(ev.target.value);
95
- setservice(ev.target.value);
96
- }}
97
- style="margin: 0; padding: 0; margin-left:auto; margin-right: var(--file-browser-separation); width: 100%; margin-top: var(--file-browser-separation); margin-bottom: var(--file-browser-separation);">
98
- <option value={""}></option>
99
- {props.services.map(service => <option value={service}>{service}</option>)}
100
- </select>
101
- <p
102
- style="margin: 0; margin-bottom: var(--file-browser-separation);"
103
- >{filename}</p>
104
- {!TEMPLATES[template].filename ? <form
105
- style="width: 100%;"
106
- onsubmit={async (ev) => {
107
- ev.preventDefault();
108
- ev.stopPropagation();
109
- const path = await createNewFile();
110
- close(path);
111
- }}>
112
- <input
113
- style="width: 100%;"
114
- onkeydown={ev => {
115
- if (ev.keyCode === 27) {
116
- // catch esc
117
- ev.stopPropagation();
118
- ev.preventDefault();
119
- close();
120
- }
121
- refresh();
122
- }}
123
- ref={nameInput}
124
- type="text"
125
- placeholder="...filename..." />
126
- </form> : <></>}
127
- <select
128
- value={template}
129
- oninput={ev => {
130
- ev.preventDefault();
131
- ev.stopPropagation();
132
- console.log(ev.target.value);
133
- settemplate(ev.target.value);
134
- }}
135
- style="margin: 0; padding: 0; margin-left:auto; margin-right: var(--file-browser-separation); width: 100%; margin-top: var(--file-browser-separation);">
136
- {Object.keys(TEMPLATES).map(templateName => <option value={templateName}>{TEMPLATES[templateName].displayName}</option>)}
137
- </select>
138
- {TEMPLATES[template].template ? <div
139
- class="new-dialog-preview">
140
- <HighlightTextArea
141
- content={TEMPLATES[template].template(filename, httpPath)}
142
- language={TEMPLATES[template].language}
143
- disabled="true" />
144
- </div> : <></>}
145
- </div>
146
- <div class="dialog-footer">
147
- <button
148
- class="btn danger"
149
- onclick={ev => {
150
- ev.preventDefault();
151
- ev.stopPropagation();
152
- close();
153
- }}>cancel</button>
154
- <button
155
- style="margin-left: auto;"
156
- class="btn active"
157
- onclick={async (ev) => {
158
- ev.preventDefault();
159
- ev.stopPropagation();
160
- const path = await createNewFile();
161
- close(path);
162
- }}>create</button>
163
- </div>
164
- </dialog> : <></>}
165
- </>
166
- }
167
-
168
- NewFile.asFragment = true;
169
- NewFile.shadowInit = false;
@@ -1,22 +0,0 @@
1
- let scrollTimeout2: any = null;
2
-
3
- export function useScroll(): [{ scrollTop: string; scrollLeft: string }, (newScroll: { scrollTop: number; scrollLeft: number; }, inmediate?: boolean) => void] {
4
- const [scrollTop, setscrollTop] = jsx.useQuery("scrollTop", "0");
5
- const [scrollLeft, setscrollLeft] = jsx.useQuery("scrollLeft", "0");
6
-
7
- return [{
8
- scrollTop: scrollTop as string,
9
- scrollLeft: scrollLeft as string
10
- }, (newScroll: { scrollTop: number; scrollLeft: number; }, inmediate?: boolean) => {
11
- clearTimeout(scrollTimeout2);
12
- if (inmediate) {
13
- setscrollTop(String(newScroll.scrollTop));
14
- setscrollLeft(String(newScroll.scrollLeft));
15
- } else {
16
- scrollTimeout2 = setTimeout(() => {
17
- setscrollTop(String(newScroll.scrollTop));
18
- setscrollLeft(String(newScroll.scrollLeft));
19
- }, 1000);
20
- }
21
- }]
22
- }
@@ -1,49 +0,0 @@
1
- interface StartPageProps {
2
- togglePanel: (panel: string) => void;
3
- isPanelVisible: (panel: string) => boolean;
4
- disableLog?: boolean; disablePreview?: boolean; disableReload?: boolean;
5
- }
6
-
7
- export function StartPage(props: StartPageProps) {
8
-
9
- jsx.useEffect(() => {
10
- if (!props.isPanelVisible("left")) {
11
- props.togglePanel("left");
12
- }
13
- }, []);
14
-
15
- return <div class={`start-page`}>
16
- <div class="row center">
17
- <h1>Start Page</h1>
18
- </div>
19
- <br />
20
- <div class="row center">
21
- <div class="row">
22
- <div class={`toggle-panel-button left-side-panel-button ${props.isPanelVisible("left") ? "active" : ""}`}
23
- onclick={ev => {
24
- ev.preventDefault();
25
- props.togglePanel("left");
26
- }}
27
- ></div>
28
- <br />
29
- {props.disableLog ? <></> : <div class={`toggle-panel-button bottom-side-panel-button ${props.isPanelVisible("bottom") ? "active" : ""}`}
30
- onclick={ev => {
31
- ev.preventDefault();
32
- props.togglePanel("bottom");
33
- }}
34
- ></div>}
35
- <br />
36
- {props.disablePreview ? <></> : <div class={`toggle-panel-button right-side-panel-button ${props.isPanelVisible("right") ? "active" : ""}`}
37
- onclick={ev => {
38
- ev.preventDefault();
39
- props.togglePanel("right");
40
- }}
41
- ></div>}
42
- </div>
43
- </div>
44
- <br />
45
- </div>;
46
- }
47
-
48
- StartPage.asFragment = true;
49
- StartPage.shadowInit = false;
@@ -1,32 +0,0 @@
1
- import { APIRoute } from "@miqro/core";
2
- import { unlinkSync } from "node:fs";
3
- import { getPath } from "./read.api.js";
4
-
5
- export default {
6
- description: "admin editor file deletion endpoint",
7
- method: "POST",
8
- path: "/delete",
9
- middleware: [server.middleware.json()],
10
- request: {
11
- body: {
12
- path: "string"
13
- }
14
- },
15
- response: {
16
- status: [200, 400],
17
- body: {
18
- message: "string"
19
- }
20
- },
21
- handler: async (req, res) => {
22
- const { path } = req.body;
23
- await deleteFile(path);
24
- return res?.json({
25
- message: "OK"
26
- });
27
- }
28
- } as APIRoute;
29
-
30
- function deleteFile(path: string) {
31
- unlinkSync(getPath(path));
32
- }
@@ -1,55 +0,0 @@
1
- import { APIRoute } from "@miqro/core";
2
- import { readFileSync } from "node:fs";
3
- import { SUPPORTED_LANGUAGES } from "../../../../../common/constants.js";
4
- import { relative, resolve } from "node:path";
5
- import { getLanguage } from "./scan.api.js";
6
- import { BASE_PATH } from "../../../../../common/constants.server.js";
7
-
8
- export default {
9
- method: "POST",
10
- path: "/read",
11
- description: "admin editor file read endpoint",
12
- middleware: [server.middleware.json()],
13
- request: {
14
- body: {
15
- path: "string"
16
- }
17
- },
18
- response: {
19
- status: [200, 400],
20
- body: {
21
- contents: "string",
22
- path: "string"
23
- }
24
- },
25
- handler: async (req, res) => {
26
- const { path } = req.body;
27
- const contents = readFile(path);
28
- return res?.json({
29
- contents,
30
- path
31
- });
32
- }
33
- } as APIRoute;
34
-
35
- export function readFile(path: string) {
36
- const filePath = getPath(path);
37
- const language = getLanguage(filePath);
38
- if (SUPPORTED_LANGUAGES.includes(language)) {
39
- const contents = readFileSync(filePath).toString();
40
- return contents;
41
- } else {
42
- throw new Error("unsupported file format");
43
- }
44
-
45
- }
46
-
47
- export function getPath(path: string) {
48
- const realPath = resolve(BASE_PATH, path);
49
-
50
- if (relative(BASE_PATH, realPath).startsWith("..")) {
51
- throw new Error("invalid path! [" + path + "]");
52
- }
53
-
54
- return realPath;
55
- }
@@ -1,41 +0,0 @@
1
- import { APIRoute } from "@miqro/core";
2
- import { existsSync, mkdirSync, renameSync } from "node:fs";
3
- import { getPath } from "./read.api.js";
4
- import { dirname } from "node:path";
5
-
6
- export default {
7
- middleware: [server.middleware.json()],
8
- method: "POST",
9
- description: "admin editor file rename endpoint",
10
- path: "/rename",
11
- request: {
12
- body: {
13
- path: "string",
14
- newName: "string"
15
- }
16
- },
17
- response: {
18
- status: [200, 400],
19
- body: {
20
- message: "string"
21
- }
22
- },
23
- handler: async (req, res) => {
24
- const { path, newName } = req.body;
25
- await rename(path, newName);
26
- return res?.json({
27
- message: "OK"
28
- });
29
- }
30
- } as APIRoute;
31
-
32
- export async function rename(path: string, newName: string) {
33
- if (existsSync(path) && !existsSync(newName)) {
34
- mkdirSync(dirname(getPath(newName)), {
35
- recursive: true
36
- });
37
- renameSync(getPath(path), getPath(newName));
38
- } else {
39
- throw new Error("invalid paths");
40
- }
41
- }