@kumologica/sdk 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (540) hide show
  1. package/README.md +1 -0
  2. package/bin/kl.js +3 -0
  3. package/cli/cli.js +6 -0
  4. package/cli/commands/build-commands/aws.js +49 -0
  5. package/cli/commands/build-commands/azure.js +43 -0
  6. package/cli/commands/build-commands/kumohub.js +7 -0
  7. package/cli/commands/build.js +6 -0
  8. package/cli/commands/create.js +32 -0
  9. package/cli/commands/deploy-commands/kumohub.js +114 -0
  10. package/cli/commands/deploy.js +6 -0
  11. package/cli/commands/doc-commands/html.js +61 -0
  12. package/cli/commands/doc.js +6 -0
  13. package/cli/commands/export-commands/cloudformation.js +338 -0
  14. package/cli/commands/export-commands/serverless.js +164 -0
  15. package/cli/commands/export-commands/terraform-commands/aws.js +193 -0
  16. package/cli/commands/export-commands/terraform-commands/azure.js +148 -0
  17. package/cli/commands/export-commands/terraform.js +6 -0
  18. package/cli/commands/export-commands/utils/validator.js +152 -0
  19. package/cli/commands/export.js +6 -0
  20. package/cli/commands/import-commands/mulesoft.js +61 -0
  21. package/cli/commands/import.js +6 -0
  22. package/cli/commands/open.js +46 -0
  23. package/cli/commands/test-utils/TestSuiteController.js +359 -0
  24. package/cli/commands/test-utils/TestSuiteController.test.js +171 -0
  25. package/cli/commands/test-utils/fixtures/example3-flow.json +148 -0
  26. package/cli/commands/test-utils/fixtures/package.json +6 -0
  27. package/cli/commands/test-utils/fixtures/s3-event.js +43 -0
  28. package/cli/commands/test-utils/util/output.js +14 -0
  29. package/cli/commands/test-utils/util/updates/index.js +17 -0
  30. package/cli/commands/test-utils/util/updates/pkg.js +13 -0
  31. package/cli/commands/test-utils/util/updates/templates/default-settings.js +209 -0
  32. package/cli/commands/test.js +66 -0
  33. package/cli/commands/utils.js +14 -0
  34. package/package.json +158 -0
  35. package/src/app/lib/aws/aws-profile.js +43 -0
  36. package/src/app/lib/aws/ca-alexa-api.js +29 -0
  37. package/src/app/lib/aws/ca-apigw-api.js +216 -0
  38. package/src/app/lib/aws/ca-cloudwatch-api.js +78 -0
  39. package/src/app/lib/aws/ca-codecommit-api.js +63 -0
  40. package/src/app/lib/aws/ca-dynamodb-api.js +27 -0
  41. package/src/app/lib/aws/ca-elb-api.js +44 -0
  42. package/src/app/lib/aws/ca-events-api.js +27 -0
  43. package/src/app/lib/aws/ca-iot-api.js +105 -0
  44. package/src/app/lib/aws/ca-s3-api.js +115 -0
  45. package/src/app/lib/aws/ca-sns-api.js +38 -0
  46. package/src/app/lib/aws/ca-sqs-api.js +51 -0
  47. package/src/app/lib/aws/cf.js +439 -0
  48. package/src/app/lib/aws/index.js +970 -0
  49. package/src/app/lib/aws/kl-iam-api.js +27 -0
  50. package/src/app/lib/aws/kl-rekognition-api.js +66 -0
  51. package/src/app/lib/aws/kl-ssm-api.js +24 -0
  52. package/src/app/lib/azure/index.js +80 -0
  53. package/src/app/lib/dependencies.js +50 -0
  54. package/src/app/lib/kumohub/index.js +201 -0
  55. package/src/app/lib/runtime-loader/index.js +42 -0
  56. package/src/app/lib/serverless/index.js +318 -0
  57. package/src/app/lib/stores/aws-cloud-config-store.js +35 -0
  58. package/src/app/lib/stores/azure-config-store.js +24 -0
  59. package/src/app/lib/stores/kumohub-config-store.js +24 -0
  60. package/src/app/lib/stores/project-info-config-store.js +26 -0
  61. package/src/app/lib/stores/settings-cloud-store.js +117 -0
  62. package/src/app/lib/stores/settings-cloud-store.spec.js +26 -0
  63. package/src/app/lib/stores/settings-network-store.js +119 -0
  64. package/src/app/lib/stores/settings-network-store.spec.js +27 -0
  65. package/src/app/lib/stores/store.js +97 -0
  66. package/src/app/lib/stores/test-config-store.js +26 -0
  67. package/src/app/lib/stores/user-preference-store.js +44 -0
  68. package/src/app/lib/utils/editor.js +98 -0
  69. package/src/app/lib/utils/fix-path.js +15 -0
  70. package/src/app/main-process/favicon.ico +0 -0
  71. package/src/app/main-process/main-window.js +209 -0
  72. package/src/app/main-process/menu.js +219 -0
  73. package/src/app/main-process/modal-home.js +118 -0
  74. package/src/app/main-process/modal-newproject.js +119 -0
  75. package/src/app/main-process/modal-nodelibrary.js +90 -0
  76. package/src/app/main-process/modal-welcome.js +114 -0
  77. package/src/app/main-process/runtime-manager.js +141 -0
  78. package/src/app/main.js +590 -0
  79. package/src/app/preload.js +633 -0
  80. package/src/app/ui/editor-api/lib/admin/context.js +42 -0
  81. package/src/app/ui/editor-api/lib/admin/flow.js +55 -0
  82. package/src/app/ui/editor-api/lib/admin/flows.js +53 -0
  83. package/src/app/ui/editor-api/lib/admin/index.js +155 -0
  84. package/src/app/ui/editor-api/lib/admin/nodes.js +164 -0
  85. package/src/app/ui/editor-api/lib/auth/clients.js +17 -0
  86. package/src/app/ui/editor-api/lib/auth/index.js +267 -0
  87. package/src/app/ui/editor-api/lib/auth/permissions.js +51 -0
  88. package/src/app/ui/editor-api/lib/auth/strategies.js +144 -0
  89. package/src/app/ui/editor-api/lib/auth/tokens.js +138 -0
  90. package/src/app/ui/editor-api/lib/auth/users.js +122 -0
  91. package/src/app/ui/editor-api/lib/editor/comms.js +247 -0
  92. package/src/app/ui/editor-api/lib/editor/credentials.js +22 -0
  93. package/src/app/ui/editor-api/lib/editor/index.js +234 -0
  94. package/src/app/ui/editor-api/lib/editor/library.js +69 -0
  95. package/src/app/ui/editor-api/lib/editor/locales.js +37 -0
  96. package/src/app/ui/editor-api/lib/editor/projects.js +497 -0
  97. package/src/app/ui/editor-api/lib/editor/settings.js +118 -0
  98. package/src/app/ui/editor-api/lib/editor/sshkeys.js +87 -0
  99. package/src/app/ui/editor-api/lib/editor/theme.js +184 -0
  100. package/src/app/ui/editor-api/lib/editor/ui.js +149 -0
  101. package/src/app/ui/editor-api/lib/index.js +149 -0
  102. package/src/app/ui/editor-api/lib/runner/index.js +81 -0
  103. package/src/app/ui/editor-api/lib/util.js +51 -0
  104. package/src/app/ui/editor-client/README.md +10 -0
  105. package/src/app/ui/editor-client/constants.js +5 -0
  106. package/src/app/ui/editor-client/index.js +3 -0
  107. package/src/app/ui/editor-client/public/favicon.ico +0 -0
  108. package/src/app/ui/editor-client/public/red/images/bolt.png +0 -0
  109. package/src/app/ui/editor-client/public/red/images/debugger/continue-full.png +0 -0
  110. package/src/app/ui/editor-client/public/red/images/debugger/continue-outline.png +0 -0
  111. package/src/app/ui/editor-client/public/red/images/debugger/pause.png +0 -0
  112. package/src/app/ui/editor-client/public/red/images/debugger/restart.png +0 -0
  113. package/src/app/ui/editor-client/public/red/images/debugger/stepover.png +0 -0
  114. package/src/app/ui/editor-client/public/red/images/debugger/stop.png +0 -0
  115. package/src/app/ui/editor-client/public/red/images/deploy-flows-o.png +0 -0
  116. package/src/app/ui/editor-client/public/red/images/deploy-flows.png +0 -0
  117. package/src/app/ui/editor-client/public/red/images/deploy-full-o.png +0 -0
  118. package/src/app/ui/editor-client/public/red/images/deploy-full.png +0 -0
  119. package/src/app/ui/editor-client/public/red/images/deploy-nodes-o.png +0 -0
  120. package/src/app/ui/editor-client/public/red/images/deploy-nodes.png +0 -0
  121. package/src/app/ui/editor-client/public/red/images/deploy-reload.png +0 -0
  122. package/src/app/ui/editor-client/public/red/images/grip.png +0 -0
  123. package/src/app/ui/editor-client/public/red/images/icons/arrow-in.png +0 -0
  124. package/src/app/ui/editor-client/public/red/images/icons/bolt.png +0 -0
  125. package/src/app/ui/editor-client/public/red/images/icons/node-changed.png +0 -0
  126. package/src/app/ui/editor-client/public/red/images/icons/node-error.png +0 -0
  127. package/src/app/ui/editor-client/public/red/images/icons/node-play.png +0 -0
  128. package/src/app/ui/editor-client/public/red/images/kumologica-app.png +0 -0
  129. package/src/app/ui/editor-client/public/red/images/node-red-256.png +0 -0
  130. package/src/app/ui/editor-client/public/red/images/node-red-icon-black.svg +9 -0
  131. package/src/app/ui/editor-client/public/red/images/node-red-icon.svg +33 -0
  132. package/src/app/ui/editor-client/public/red/images/node-red.png +0 -0
  133. package/src/app/ui/editor-client/public/red/images/pw_maze_white.png +0 -0
  134. package/src/app/ui/editor-client/public/red/images/spin.svg +41 -0
  135. package/src/app/ui/editor-client/public/red/images/spinner.gif +0 -0
  136. package/src/app/ui/editor-client/public/red/images/subflow_tab.png +0 -0
  137. package/src/app/ui/editor-client/public/red/images/test-icon.png +0 -0
  138. package/src/app/ui/editor-client/public/red/images/typedInput/09.png +0 -0
  139. package/src/app/ui/editor-client/public/red/images/typedInput/az.png +0 -0
  140. package/src/app/ui/editor-client/public/red/images/typedInput/bin.png +0 -0
  141. package/src/app/ui/editor-client/public/red/images/typedInput/bool.png +0 -0
  142. package/src/app/ui/editor-client/public/red/images/typedInput/env.png +0 -0
  143. package/src/app/ui/editor-client/public/red/images/typedInput/expr.png +0 -0
  144. package/src/app/ui/editor-client/public/red/images/typedInput/json.png +0 -0
  145. package/src/app/ui/editor-client/public/red/images/typedInput/re.png +0 -0
  146. package/src/app/ui/editor-client/public/red/keymap.json +54 -0
  147. package/src/app/ui/editor-client/public/red/main-modals.js +14 -0
  148. package/src/app/ui/editor-client/public/red/main-modals.min.js +16 -0
  149. package/src/app/ui/editor-client/public/red/main.js +10 -0
  150. package/src/app/ui/editor-client/public/red/main.min.js +16 -0
  151. package/src/app/ui/editor-client/public/red/red.js +44903 -0
  152. package/src/app/ui/editor-client/public/red/red.min.js +16 -0
  153. package/src/app/ui/editor-client/public/red/style.min.css +24 -0
  154. package/src/app/ui/editor-client/public/vendor/ace/LICENSE +24 -0
  155. package/src/app/ui/editor-client/public/vendor/ace/ace.js +17 -0
  156. package/src/app/ui/editor-client/public/vendor/ace/ext-language_tools.js +8 -0
  157. package/src/app/ui/editor-client/public/vendor/ace/ext-searchbox.js +8 -0
  158. package/src/app/ui/editor-client/public/vendor/ace/mode-css.js +8 -0
  159. package/src/app/ui/editor-client/public/vendor/ace/mode-handlebars.js +8 -0
  160. package/src/app/ui/editor-client/public/vendor/ace/mode-html.js +8 -0
  161. package/src/app/ui/editor-client/public/vendor/ace/mode-javascript.js +8 -0
  162. package/src/app/ui/editor-client/public/vendor/ace/mode-json.js +8 -0
  163. package/src/app/ui/editor-client/public/vendor/ace/mode-jsonata.js +1 -0
  164. package/src/app/ui/editor-client/public/vendor/ace/mode-markdown.js +8 -0
  165. package/src/app/ui/editor-client/public/vendor/ace/mode-properties.js +8 -0
  166. package/src/app/ui/editor-client/public/vendor/ace/mode-python.js +8 -0
  167. package/src/app/ui/editor-client/public/vendor/ace/mode-sql.js +8 -0
  168. package/src/app/ui/editor-client/public/vendor/ace/mode-swift.js +8 -0
  169. package/src/app/ui/editor-client/public/vendor/ace/mode-text.js +8 -0
  170. package/src/app/ui/editor-client/public/vendor/ace/mode-xml.js +8 -0
  171. package/src/app/ui/editor-client/public/vendor/ace/mode-yaml.js +8 -0
  172. package/src/app/ui/editor-client/public/vendor/ace/snippets/css.js +8 -0
  173. package/src/app/ui/editor-client/public/vendor/ace/snippets/handlebars.js +8 -0
  174. package/src/app/ui/editor-client/public/vendor/ace/snippets/html.js +8 -0
  175. package/src/app/ui/editor-client/public/vendor/ace/snippets/javascript.js +8 -0
  176. package/src/app/ui/editor-client/public/vendor/ace/snippets/json.js +8 -0
  177. package/src/app/ui/editor-client/public/vendor/ace/snippets/jsonata.js +1 -0
  178. package/src/app/ui/editor-client/public/vendor/ace/snippets/markdown.js +8 -0
  179. package/src/app/ui/editor-client/public/vendor/ace/snippets/properties.js +8 -0
  180. package/src/app/ui/editor-client/public/vendor/ace/snippets/python.js +8 -0
  181. package/src/app/ui/editor-client/public/vendor/ace/snippets/sql.js +8 -0
  182. package/src/app/ui/editor-client/public/vendor/ace/snippets/swift.js +8 -0
  183. package/src/app/ui/editor-client/public/vendor/ace/snippets/text.js +8 -0
  184. package/src/app/ui/editor-client/public/vendor/ace/snippets/xml.js +8 -0
  185. package/src/app/ui/editor-client/public/vendor/ace/snippets/yaml.js +8 -0
  186. package/src/app/ui/editor-client/public/vendor/ace/theme-chrome.js +8 -0
  187. package/src/app/ui/editor-client/public/vendor/ace/theme-tomorrow.js +8 -0
  188. package/src/app/ui/editor-client/public/vendor/ace/worker-css.js +1 -0
  189. package/src/app/ui/editor-client/public/vendor/ace/worker-html.js +1 -0
  190. package/src/app/ui/editor-client/public/vendor/ace/worker-javascript.js +1 -0
  191. package/src/app/ui/editor-client/public/vendor/ace/worker-json.js +1 -0
  192. package/src/app/ui/editor-client/public/vendor/ace/worker-jsonata.js +2140 -0
  193. package/src/app/ui/editor-client/public/vendor/ace/worker-xml.js +1 -0
  194. package/src/app/ui/editor-client/public/vendor/beautifyjs/beautify.min.js +1 -0
  195. package/src/app/ui/editor-client/public/vendor/bootstrap/css/bootstrap.min.css +9 -0
  196. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  197. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  198. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/active-line.js +72 -0
  199. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
  200. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-hint.js +157 -0
  201. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-lint.js +63 -0
  202. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/jshint.js +29591 -0
  203. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.css +73 -0
  204. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.js +252 -0
  205. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.css +36 -0
  206. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.js +460 -0
  207. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/sql-hint.js +304 -0
  208. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.css +350 -0
  209. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.js +9800 -0
  210. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/javascript.js +927 -0
  211. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/sql.js +494 -0
  212. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/base16-dark.css +38 -0
  213. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/monokai.css +42 -0
  214. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/solarized.css +168 -0
  215. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.css +43 -0
  216. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.js +87 -0
  217. package/src/app/ui/editor-client/public/vendor/easy-json-schema/index.js +88 -0
  218. package/src/app/ui/editor-client/public/vendor/font-awesome/css/font-awesome.min.css +4 -0
  219. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  220. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  221. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  222. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  223. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  224. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  225. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.eot +0 -0
  226. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.svg +2105 -0
  227. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.ttf +0 -0
  228. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff +0 -0
  229. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff2 +0 -0
  230. package/src/app/ui/editor-client/public/vendor/icofont/icofont.min.css +7 -0
  231. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  232. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  233. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  234. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  235. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  236. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  237. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  238. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  239. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  240. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  241. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  242. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  243. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  244. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  245. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
  246. package/src/app/ui/editor-client/public/vendor/jsonata/jsonata.min.js +183 -0
  247. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.css +181 -0
  248. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.js +48 -0
  249. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +7 -0
  250. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +15 -0
  251. package/src/app/ui/editor-client/public/vendor/vendor.css +0 -0
  252. package/src/app/ui/editor-client/public/vendor/vendor.js +125 -0
  253. package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +2 -0
  254. package/src/app/ui/editor-client/src/ace/README.md +50 -0
  255. package/src/app/ui/editor-client/src/ace/mode/nrjavascript.js +35 -0
  256. package/src/app/ui/editor-client/src/ace/mode/nrjavascript_worker.js +189 -0
  257. package/src/app/ui/editor-client/src/favicon.ico +0 -0
  258. package/src/app/ui/editor-client/src/images/bolt.png +0 -0
  259. package/src/app/ui/editor-client/src/images/debugger/continue-full.png +0 -0
  260. package/src/app/ui/editor-client/src/images/debugger/continue-outline.png +0 -0
  261. package/src/app/ui/editor-client/src/images/debugger/pause.png +0 -0
  262. package/src/app/ui/editor-client/src/images/debugger/restart.png +0 -0
  263. package/src/app/ui/editor-client/src/images/debugger/stepover.png +0 -0
  264. package/src/app/ui/editor-client/src/images/debugger/stop.png +0 -0
  265. package/src/app/ui/editor-client/src/images/deploy-flows-o.png +0 -0
  266. package/src/app/ui/editor-client/src/images/deploy-flows.png +0 -0
  267. package/src/app/ui/editor-client/src/images/deploy-full-o.png +0 -0
  268. package/src/app/ui/editor-client/src/images/deploy-full.png +0 -0
  269. package/src/app/ui/editor-client/src/images/deploy-nodes-o.png +0 -0
  270. package/src/app/ui/editor-client/src/images/deploy-nodes.png +0 -0
  271. package/src/app/ui/editor-client/src/images/deploy-reload.png +0 -0
  272. package/src/app/ui/editor-client/src/images/grip.png +0 -0
  273. package/src/app/ui/editor-client/src/images/icons/arrow-in.png +0 -0
  274. package/src/app/ui/editor-client/src/images/icons/bolt.png +0 -0
  275. package/src/app/ui/editor-client/src/images/icons/node-changed.png +0 -0
  276. package/src/app/ui/editor-client/src/images/icons/node-error.png +0 -0
  277. package/src/app/ui/editor-client/src/images/icons/node-play.png +0 -0
  278. package/src/app/ui/editor-client/src/images/kumologica-app.png +0 -0
  279. package/src/app/ui/editor-client/src/images/node-red-256.png +0 -0
  280. package/src/app/ui/editor-client/src/images/node-red-icon-black.svg +9 -0
  281. package/src/app/ui/editor-client/src/images/node-red-icon.svg +33 -0
  282. package/src/app/ui/editor-client/src/images/node-red.png +0 -0
  283. package/src/app/ui/editor-client/src/images/pw_maze_white.png +0 -0
  284. package/src/app/ui/editor-client/src/images/spin.svg +41 -0
  285. package/src/app/ui/editor-client/src/images/spinner.gif +0 -0
  286. package/src/app/ui/editor-client/src/images/subflow_tab.png +0 -0
  287. package/src/app/ui/editor-client/src/images/test-icon.png +0 -0
  288. package/src/app/ui/editor-client/src/images/typedInput/09.png +0 -0
  289. package/src/app/ui/editor-client/src/images/typedInput/az.png +0 -0
  290. package/src/app/ui/editor-client/src/images/typedInput/bin.png +0 -0
  291. package/src/app/ui/editor-client/src/images/typedInput/bool.png +0 -0
  292. package/src/app/ui/editor-client/src/images/typedInput/env.png +0 -0
  293. package/src/app/ui/editor-client/src/images/typedInput/expr.png +0 -0
  294. package/src/app/ui/editor-client/src/images/typedInput/json.png +0 -0
  295. package/src/app/ui/editor-client/src/images/typedInput/re.png +0 -0
  296. package/src/app/ui/editor-client/src/js/comms.js +174 -0
  297. package/src/app/ui/editor-client/src/js/events.js +39 -0
  298. package/src/app/ui/editor-client/src/js/font-awesome.js +818 -0
  299. package/src/app/ui/editor-client/src/js/history.js +337 -0
  300. package/src/app/ui/editor-client/src/js/i18n.js +81 -0
  301. package/src/app/ui/editor-client/src/js/jquery-addons.js +21 -0
  302. package/src/app/ui/editor-client/src/js/keymap.json +54 -0
  303. package/src/app/ui/editor-client/src/js/main-modals.js +14 -0
  304. package/src/app/ui/editor-client/src/js/main.js +10 -0
  305. package/src/app/ui/editor-client/src/js/modals/modal-home.js +162 -0
  306. package/src/app/ui/editor-client/src/js/modals/modal-new-project.js +86 -0
  307. package/src/app/ui/editor-client/src/js/modals/modal-node-library.js +255 -0
  308. package/src/app/ui/editor-client/src/js/modals/modal-welcome.js +102 -0
  309. package/src/app/ui/editor-client/src/js/nodes.js +1736 -0
  310. package/src/app/ui/editor-client/src/js/red.js +704 -0
  311. package/src/app/ui/editor-client/src/js/settings.js +275 -0
  312. package/src/app/ui/editor-client/src/js/text/bidi.js +116 -0
  313. package/src/app/ui/editor-client/src/js/text/format.js +1316 -0
  314. package/src/app/ui/editor-client/src/js/ui/actions.js +39 -0
  315. package/src/app/ui/editor-client/src/js/ui/clipboard.js +510 -0
  316. package/src/app/ui/editor-client/src/js/ui/common/checkboxSet.js +117 -0
  317. package/src/app/ui/editor-client/src/js/ui/common/editableList.js +322 -0
  318. package/src/app/ui/editor-client/src/js/ui/common/menu.js +277 -0
  319. package/src/app/ui/editor-client/src/js/ui/common/panels.js +104 -0
  320. package/src/app/ui/editor-client/src/js/ui/common/popover.js +268 -0
  321. package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +98 -0
  322. package/src/app/ui/editor-client/src/js/ui/common/stack.js +184 -0
  323. package/src/app/ui/editor-client/src/js/ui/common/tabs.js +730 -0
  324. package/src/app/ui/editor-client/src/js/ui/common/treeList.js +170 -0
  325. package/src/app/ui/editor-client/src/js/ui/common/typedInput.js +819 -0
  326. package/src/app/ui/editor-client/src/js/ui/common/typedInputLong.js +829 -0
  327. package/src/app/ui/editor-client/src/js/ui/deploy.js +422 -0
  328. package/src/app/ui/editor-client/src/js/ui/diff.js +2225 -0
  329. package/src/app/ui/editor-client/src/js/ui/editor.js +3020 -0
  330. package/src/app/ui/editor-client/src/js/ui/editors/buffer.js +195 -0
  331. package/src/app/ui/editor-client/src/js/ui/editors/expression.js +627 -0
  332. package/src/app/ui/editor-client/src/js/ui/editors/js.js +89 -0
  333. package/src/app/ui/editor-client/src/js/ui/editors/json.js +107 -0
  334. package/src/app/ui/editor-client/src/js/ui/editors/markdown.js +267 -0
  335. package/src/app/ui/editor-client/src/js/ui/editors/string.js +75 -0
  336. package/src/app/ui/editor-client/src/js/ui/event-log.js +107 -0
  337. package/src/app/ui/editor-client/src/js/ui/header.js +372 -0
  338. package/src/app/ui/editor-client/src/js/ui/keyboard.js +565 -0
  339. package/src/app/ui/editor-client/src/js/ui/library.js +570 -0
  340. package/src/app/ui/editor-client/src/js/ui/logviewer.js +116 -0
  341. package/src/app/ui/editor-client/src/js/ui/notifications.js +282 -0
  342. package/src/app/ui/editor-client/src/js/ui/palette-editor.js +1061 -0
  343. package/src/app/ui/editor-client/src/js/ui/palette.js +788 -0
  344. package/src/app/ui/editor-client/src/js/ui/project-info.js +232 -0
  345. package/src/app/ui/editor-client/src/js/ui/projects/projectSettings.js +1651 -0
  346. package/src/app/ui/editor-client/src/js/ui/projects/projectUserSettings.js +404 -0
  347. package/src/app/ui/editor-client/src/js/ui/projects/projects.js +2395 -0
  348. package/src/app/ui/editor-client/src/js/ui/projects/tab-versionControl.js +1383 -0
  349. package/src/app/ui/editor-client/src/js/ui/search.js +366 -0
  350. package/src/app/ui/editor-client/src/js/ui/sidebar.js +409 -0
  351. package/src/app/ui/editor-client/src/js/ui/state.js +14 -0
  352. package/src/app/ui/editor-client/src/js/ui/subflow.js +748 -0
  353. package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +1427 -0
  354. package/src/app/ui/editor-client/src/js/ui/tab-azure.js +852 -0
  355. package/src/app/ui/editor-client/src/js/ui/tab-config.js +452 -0
  356. package/src/app/ui/editor-client/src/js/ui/tab-context.js +406 -0
  357. package/src/app/ui/editor-client/src/js/ui/tab-info.js +661 -0
  358. package/src/app/ui/editor-client/src/js/ui/tab-kumohub.js +800 -0
  359. package/src/app/ui/editor-client/src/js/ui/tab-nodeInfo.js +60 -0
  360. package/src/app/ui/editor-client/src/js/ui/tab-test.js +915 -0
  361. package/src/app/ui/editor-client/src/js/ui/terminal.js +240 -0
  362. package/src/app/ui/editor-client/src/js/ui/touch/radialMenu.js +170 -0
  363. package/src/app/ui/editor-client/src/js/ui/tray.js +411 -0
  364. package/src/app/ui/editor-client/src/js/ui/typeSearch.js +411 -0
  365. package/src/app/ui/editor-client/src/js/ui/ui-settings.js +422 -0
  366. package/src/app/ui/editor-client/src/js/ui/update-panel.js +84 -0
  367. package/src/app/ui/editor-client/src/js/ui/userSettings.js +673 -0
  368. package/src/app/ui/editor-client/src/js/ui/utils.js +1287 -0
  369. package/src/app/ui/editor-client/src/js/ui/view-navigator.js +169 -0
  370. package/src/app/ui/editor-client/src/js/ui/view-tools.js +123 -0
  371. package/src/app/ui/editor-client/src/js/ui/view.js +5333 -0
  372. package/src/app/ui/editor-client/src/js/ui/workspaces.js +498 -0
  373. package/src/app/ui/editor-client/src/js/user.js +282 -0
  374. package/src/app/ui/editor-client/src/js/validators.js +54 -0
  375. package/src/app/ui/editor-client/src/kumologica-app.png +0 -0
  376. package/src/app/ui/editor-client/src/sass/ace.scss +29 -0
  377. package/src/app/ui/editor-client/src/sass/bootstrap.scss +21 -0
  378. package/src/app/ui/editor-client/src/sass/colors.scss +76 -0
  379. package/src/app/ui/editor-client/src/sass/debug.scss +383 -0
  380. package/src/app/ui/editor-client/src/sass/diff.scss +695 -0
  381. package/src/app/ui/editor-client/src/sass/dragdrop.scss +37 -0
  382. package/src/app/ui/editor-client/src/sass/dropdownMenu.scss +93 -0
  383. package/src/app/ui/editor-client/src/sass/editor.scss +683 -0
  384. package/src/app/ui/editor-client/src/sass/flow.scss +330 -0
  385. package/src/app/ui/editor-client/src/sass/forms.scss +1093 -0
  386. package/src/app/ui/editor-client/src/sass/header.scss +502 -0
  387. package/src/app/ui/editor-client/src/sass/jquery.scss +152 -0
  388. package/src/app/ui/editor-client/src/sass/keyboard.scss +136 -0
  389. package/src/app/ui/editor-client/src/sass/library.scss +54 -0
  390. package/src/app/ui/editor-client/src/sass/mixins.scss +283 -0
  391. package/src/app/ui/editor-client/src/sass/modals/modalHome.scss +138 -0
  392. package/src/app/ui/editor-client/src/sass/modals/modalNewProject.scss +96 -0
  393. package/src/app/ui/editor-client/src/sass/modals/modalNodeLibrary.scss +131 -0
  394. package/src/app/ui/editor-client/src/sass/modals/modalWelcome.scss +102 -0
  395. package/src/app/ui/editor-client/src/sass/notifications.scss +118 -0
  396. package/src/app/ui/editor-client/src/sass/palette-editor.scss +275 -0
  397. package/src/app/ui/editor-client/src/sass/palette.scss +279 -0
  398. package/src/app/ui/editor-client/src/sass/panels.scss +61 -0
  399. package/src/app/ui/editor-client/src/sass/popover.scss +166 -0
  400. package/src/app/ui/editor-client/src/sass/project-info.scss +74 -0
  401. package/src/app/ui/editor-client/src/sass/projects.scss +875 -0
  402. package/src/app/ui/editor-client/src/sass/search.scss +201 -0
  403. package/src/app/ui/editor-client/src/sass/sidebar.scss +201 -0
  404. package/src/app/ui/editor-client/src/sass/style.scss +170 -0
  405. package/src/app/ui/editor-client/src/sass/tab-azure.scss +68 -0
  406. package/src/app/ui/editor-client/src/sass/tab-cloud.scss +67 -0
  407. package/src/app/ui/editor-client/src/sass/tab-config.scss +100 -0
  408. package/src/app/ui/editor-client/src/sass/tab-context.scss +54 -0
  409. package/src/app/ui/editor-client/src/sass/tab-info.scss +307 -0
  410. package/src/app/ui/editor-client/src/sass/tab-kumohub.scss +68 -0
  411. package/src/app/ui/editor-client/src/sass/tab-test.scss +257 -0
  412. package/src/app/ui/editor-client/src/sass/tabs.scss +395 -0
  413. package/src/app/ui/editor-client/src/sass/terminal.scss +246 -0
  414. package/src/app/ui/editor-client/src/sass/ui/common/checkboxSet.scss +29 -0
  415. package/src/app/ui/editor-client/src/sass/ui/common/editableList.scss +81 -0
  416. package/src/app/ui/editor-client/src/sass/ui/common/nodeList.scss +65 -0
  417. package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +77 -0
  418. package/src/app/ui/editor-client/src/sass/ui/common/stack.scss +26 -0
  419. package/src/app/ui/editor-client/src/sass/ui/common/treeList.scss +108 -0
  420. package/src/app/ui/editor-client/src/sass/ui/common/typedInput.scss +181 -0
  421. package/src/app/ui/editor-client/src/sass/ui/common/typedInputLong.scss +183 -0
  422. package/src/app/ui/editor-client/src/sass/ui-settings.scss +119 -0
  423. package/src/app/ui/editor-client/src/sass/update-panel.scss +18 -0
  424. package/src/app/ui/editor-client/src/sass/userSettings.scss +93 -0
  425. package/src/app/ui/editor-client/src/sass/widgetStyle.scss +23 -0
  426. package/src/app/ui/editor-client/src/sass/workspace.scss +123 -0
  427. package/src/app/ui/editor-client/src/sass/workspaceToolbar.scss +85 -0
  428. package/src/app/ui/editor-client/src/vendor/ace/LICENSE +24 -0
  429. package/src/app/ui/editor-client/src/vendor/ace/ace.js +17 -0
  430. package/src/app/ui/editor-client/src/vendor/ace/ext-language_tools.js +8 -0
  431. package/src/app/ui/editor-client/src/vendor/ace/ext-searchbox.js +8 -0
  432. package/src/app/ui/editor-client/src/vendor/ace/mode-css.js +8 -0
  433. package/src/app/ui/editor-client/src/vendor/ace/mode-handlebars.js +8 -0
  434. package/src/app/ui/editor-client/src/vendor/ace/mode-html.js +8 -0
  435. package/src/app/ui/editor-client/src/vendor/ace/mode-javascript.js +8 -0
  436. package/src/app/ui/editor-client/src/vendor/ace/mode-json.js +8 -0
  437. package/src/app/ui/editor-client/src/vendor/ace/mode-markdown.js +8 -0
  438. package/src/app/ui/editor-client/src/vendor/ace/mode-properties.js +8 -0
  439. package/src/app/ui/editor-client/src/vendor/ace/mode-python.js +8 -0
  440. package/src/app/ui/editor-client/src/vendor/ace/mode-sql.js +8 -0
  441. package/src/app/ui/editor-client/src/vendor/ace/mode-swift.js +8 -0
  442. package/src/app/ui/editor-client/src/vendor/ace/mode-text.js +8 -0
  443. package/src/app/ui/editor-client/src/vendor/ace/mode-xml.js +8 -0
  444. package/src/app/ui/editor-client/src/vendor/ace/mode-yaml.js +8 -0
  445. package/src/app/ui/editor-client/src/vendor/ace/snippets/css.js +8 -0
  446. package/src/app/ui/editor-client/src/vendor/ace/snippets/handlebars.js +8 -0
  447. package/src/app/ui/editor-client/src/vendor/ace/snippets/html.js +8 -0
  448. package/src/app/ui/editor-client/src/vendor/ace/snippets/javascript.js +8 -0
  449. package/src/app/ui/editor-client/src/vendor/ace/snippets/json.js +8 -0
  450. package/src/app/ui/editor-client/src/vendor/ace/snippets/markdown.js +8 -0
  451. package/src/app/ui/editor-client/src/vendor/ace/snippets/properties.js +8 -0
  452. package/src/app/ui/editor-client/src/vendor/ace/snippets/python.js +8 -0
  453. package/src/app/ui/editor-client/src/vendor/ace/snippets/sql.js +8 -0
  454. package/src/app/ui/editor-client/src/vendor/ace/snippets/swift.js +8 -0
  455. package/src/app/ui/editor-client/src/vendor/ace/snippets/text.js +8 -0
  456. package/src/app/ui/editor-client/src/vendor/ace/snippets/xml.js +8 -0
  457. package/src/app/ui/editor-client/src/vendor/ace/snippets/yaml.js +8 -0
  458. package/src/app/ui/editor-client/src/vendor/ace/theme-chrome.js +8 -0
  459. package/src/app/ui/editor-client/src/vendor/ace/theme-tomorrow.js +8 -0
  460. package/src/app/ui/editor-client/src/vendor/ace/worker-css.js +1 -0
  461. package/src/app/ui/editor-client/src/vendor/ace/worker-html.js +1 -0
  462. package/src/app/ui/editor-client/src/vendor/ace/worker-javascript.js +1 -0
  463. package/src/app/ui/editor-client/src/vendor/ace/worker-json.js +1 -0
  464. package/src/app/ui/editor-client/src/vendor/ace/worker-xml.js +1 -0
  465. package/src/app/ui/editor-client/src/vendor/beautifyjs/beautify.min.js +1 -0
  466. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.css +5406 -0
  467. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.min.css +9 -0
  468. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  469. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  470. package/src/app/ui/editor-client/src/vendor/bootstrap/js/bootstrap.min.js +6 -0
  471. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/active-line.js +72 -0
  472. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
  473. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-hint.js +157 -0
  474. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-lint.js +63 -0
  475. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/jshint.js +29591 -0
  476. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.css +73 -0
  477. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.js +252 -0
  478. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.css +36 -0
  479. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.js +460 -0
  480. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/sql-hint.js +304 -0
  481. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.css +350 -0
  482. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.js +9800 -0
  483. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/javascript.js +927 -0
  484. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/sql.js +494 -0
  485. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/base16-dark.css +38 -0
  486. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/monokai.css +42 -0
  487. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/solarized.css +168 -0
  488. package/src/app/ui/editor-client/src/vendor/d3/d3.v3.min.js +4 -0
  489. package/src/app/ui/editor-client/src/vendor/d3/d3.v4.min.js +2 -0
  490. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.css +43 -0
  491. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.js +87 -0
  492. package/src/app/ui/editor-client/src/vendor/easy-json-schema/index.js +88 -0
  493. package/src/app/ui/editor-client/src/vendor/font-awesome/css/font-awesome.min.css +4 -0
  494. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  495. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  496. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  497. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  498. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  499. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  500. package/src/app/ui/editor-client/src/vendor/i18next/i18next.min.js +5 -0
  501. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.eot +0 -0
  502. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.svg +2105 -0
  503. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.ttf +0 -0
  504. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff +0 -0
  505. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff2 +0 -0
  506. package/src/app/ui/editor-client/src/vendor/icofont/icofont.min.css +7 -0
  507. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  508. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  509. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  510. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  511. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  512. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  513. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  514. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  515. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  516. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  517. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  518. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  519. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  520. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  521. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
  522. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js +5 -0
  523. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js +7 -0
  524. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js +11 -0
  525. package/src/app/ui/editor-client/src/vendor/jsonata/formatter.js +183 -0
  526. package/src/app/ui/editor-client/src/vendor/jsonata/mode-jsonata.js +134 -0
  527. package/src/app/ui/editor-client/src/vendor/jsonata/snippets-jsonata.js +11 -0
  528. package/src/app/ui/editor-client/src/vendor/jsonata/worker-jsonata.js +2140 -0
  529. package/src/app/ui/editor-client/src/vendor/marked/marked.min.js +6 -0
  530. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.css +181 -0
  531. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.js +48 -0
  532. package/src/app/ui/editor-client/templates/index.mst +314 -0
  533. package/src/app/ui/editor-client/templates/modals/modalHome.mst +107 -0
  534. package/src/app/ui/editor-client/templates/modals/modalNewProject.mst +104 -0
  535. package/src/app/ui/editor-client/templates/modals/modalNodeLibrary.mst +72 -0
  536. package/src/app/ui/editor-client/templates/modals/modalWelcome.mst +111 -0
  537. package/src/assets/eula.txt +170 -0
  538. package/src/assets/icon.icns +0 -0
  539. package/src/assets/kumologica-app.png +0 -0
  540. package/src/assets/license_en.txt +170 -0
@@ -0,0 +1,927 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("javascript", function(config, parserConfig) {
15
+ var indentUnit = config.indentUnit;
16
+ var statementIndent = parserConfig.statementIndent;
17
+ var jsonldMode = parserConfig.jsonld;
18
+ var jsonMode = parserConfig.json || jsonldMode;
19
+ var isTS = parserConfig.typescript;
20
+ var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
21
+
22
+ // Tokenizer
23
+
24
+ var keywords = function(){
25
+ function kw(type) {return {type: type, style: "keyword"};}
26
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
27
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"};
28
+
29
+ return {
30
+ "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
31
+ "return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
32
+ "debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
33
+ "function": kw("function"), "catch": kw("catch"),
34
+ "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
35
+ "in": operator, "typeof": operator, "instanceof": operator,
36
+ "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
37
+ "this": kw("this"), "class": kw("class"), "super": kw("atom"),
38
+ "yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
39
+ "await": C
40
+ };
41
+ }();
42
+
43
+ var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
44
+ var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
45
+
46
+ function readRegexp(stream) {
47
+ var escaped = false, next, inSet = false;
48
+ while ((next = stream.next()) != null) {
49
+ if (!escaped) {
50
+ if (next == "/" && !inSet) return;
51
+ if (next == "[") inSet = true;
52
+ else if (inSet && next == "]") inSet = false;
53
+ }
54
+ escaped = !escaped && next == "\\";
55
+ }
56
+ }
57
+
58
+ // Used as scratch variables to communicate multiple values without
59
+ // consing up tons of objects.
60
+ var type, content;
61
+ function ret(tp, style, cont) {
62
+ type = tp; content = cont;
63
+ return style;
64
+ }
65
+ function tokenBase(stream, state) {
66
+ var ch = stream.next();
67
+ if (ch == '"' || ch == "'") {
68
+ state.tokenize = tokenString(ch);
69
+ return state.tokenize(stream, state);
70
+ } else if (ch == "." && stream.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/)) {
71
+ return ret("number", "number");
72
+ } else if (ch == "." && stream.match("..")) {
73
+ return ret("spread", "meta");
74
+ } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
75
+ return ret(ch);
76
+ } else if (ch == "=" && stream.eat(">")) {
77
+ return ret("=>", "operator");
78
+ } else if (ch == "0" && stream.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {
79
+ return ret("number", "number");
80
+ } else if (/\d/.test(ch)) {
81
+ stream.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/);
82
+ return ret("number", "number");
83
+ } else if (ch == "/") {
84
+ if (stream.eat("*")) {
85
+ state.tokenize = tokenComment;
86
+ return tokenComment(stream, state);
87
+ } else if (stream.eat("/")) {
88
+ stream.skipToEnd();
89
+ return ret("comment", "comment");
90
+ } else if (expressionAllowed(stream, state, 1)) {
91
+ readRegexp(stream);
92
+ stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
93
+ return ret("regexp", "string-2");
94
+ } else {
95
+ stream.eat("=");
96
+ return ret("operator", "operator", stream.current());
97
+ }
98
+ } else if (ch == "`") {
99
+ state.tokenize = tokenQuasi;
100
+ return tokenQuasi(stream, state);
101
+ } else if (ch == "#") {
102
+ stream.skipToEnd();
103
+ return ret("error", "error");
104
+ } else if (isOperatorChar.test(ch)) {
105
+ if (ch != ">" || !state.lexical || state.lexical.type != ">") {
106
+ if (stream.eat("=")) {
107
+ if (ch == "!" || ch == "=") stream.eat("=")
108
+ } else if (/[<>*+\-]/.test(ch)) {
109
+ stream.eat(ch)
110
+ if (ch == ">") stream.eat(ch)
111
+ }
112
+ }
113
+ return ret("operator", "operator", stream.current());
114
+ } else if (wordRE.test(ch)) {
115
+ stream.eatWhile(wordRE);
116
+ var word = stream.current()
117
+ if (state.lastType != ".") {
118
+ if (keywords.propertyIsEnumerable(word)) {
119
+ var kw = keywords[word]
120
+ return ret(kw.type, kw.style, word)
121
+ }
122
+ if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
123
+ return ret("async", "keyword", word)
124
+ }
125
+ return ret("variable", "variable", word)
126
+ }
127
+ }
128
+
129
+ function tokenString(quote) {
130
+ return function(stream, state) {
131
+ var escaped = false, next;
132
+ if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
133
+ state.tokenize = tokenBase;
134
+ return ret("jsonld-keyword", "meta");
135
+ }
136
+ while ((next = stream.next()) != null) {
137
+ if (next == quote && !escaped) break;
138
+ escaped = !escaped && next == "\\";
139
+ }
140
+ if (!escaped) state.tokenize = tokenBase;
141
+ return ret("string", "string");
142
+ };
143
+ }
144
+
145
+ function tokenComment(stream, state) {
146
+ var maybeEnd = false, ch;
147
+ while (ch = stream.next()) {
148
+ if (ch == "/" && maybeEnd) {
149
+ state.tokenize = tokenBase;
150
+ break;
151
+ }
152
+ maybeEnd = (ch == "*");
153
+ }
154
+ return ret("comment", "comment");
155
+ }
156
+
157
+ function tokenQuasi(stream, state) {
158
+ var escaped = false, next;
159
+ while ((next = stream.next()) != null) {
160
+ if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
161
+ state.tokenize = tokenBase;
162
+ break;
163
+ }
164
+ escaped = !escaped && next == "\\";
165
+ }
166
+ return ret("quasi", "string-2", stream.current());
167
+ }
168
+
169
+ var brackets = "([{}])";
170
+ // This is a crude lookahead trick to try and notice that we're
171
+ // parsing the argument patterns for a fat-arrow function before we
172
+ // actually hit the arrow token. It only works if the arrow is on
173
+ // the same line as the arguments and there's no strange noise
174
+ // (comments) in between. Fallback is to only notice when we hit the
175
+ // arrow, and not declare the arguments as locals for the arrow
176
+ // body.
177
+ function findFatArrow(stream, state) {
178
+ if (state.fatArrowAt) state.fatArrowAt = null;
179
+ var arrow = stream.string.indexOf("=>", stream.start);
180
+ if (arrow < 0) return;
181
+
182
+ if (isTS) { // Try to skip TypeScript return type declarations after the arguments
183
+ var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
184
+ if (m) arrow = m.index
185
+ }
186
+
187
+ var depth = 0, sawSomething = false;
188
+ for (var pos = arrow - 1; pos >= 0; --pos) {
189
+ var ch = stream.string.charAt(pos);
190
+ var bracket = brackets.indexOf(ch);
191
+ if (bracket >= 0 && bracket < 3) {
192
+ if (!depth) { ++pos; break; }
193
+ if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
194
+ } else if (bracket >= 3 && bracket < 6) {
195
+ ++depth;
196
+ } else if (wordRE.test(ch)) {
197
+ sawSomething = true;
198
+ } else if (/["'\/`]/.test(ch)) {
199
+ for (;; --pos) {
200
+ if (pos == 0) return
201
+ var next = stream.string.charAt(pos - 1)
202
+ if (next == ch && stream.string.charAt(pos - 2) != "\\") { pos--; break }
203
+ }
204
+ } else if (sawSomething && !depth) {
205
+ ++pos;
206
+ break;
207
+ }
208
+ }
209
+ if (sawSomething && !depth) state.fatArrowAt = pos;
210
+ }
211
+
212
+ // Parser
213
+
214
+ var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
215
+
216
+ function JSLexical(indented, column, type, align, prev, info) {
217
+ this.indented = indented;
218
+ this.column = column;
219
+ this.type = type;
220
+ this.prev = prev;
221
+ this.info = info;
222
+ if (align != null) this.align = align;
223
+ }
224
+
225
+ function inScope(state, varname) {
226
+ for (var v = state.localVars; v; v = v.next)
227
+ if (v.name == varname) return true;
228
+ for (var cx = state.context; cx; cx = cx.prev) {
229
+ for (var v = cx.vars; v; v = v.next)
230
+ if (v.name == varname) return true;
231
+ }
232
+ }
233
+
234
+ function parseJS(state, style, type, content, stream) {
235
+ var cc = state.cc;
236
+ // Communicate our context to the combinators.
237
+ // (Less wasteful than consing up a hundred closures on every call.)
238
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
239
+
240
+ if (!state.lexical.hasOwnProperty("align"))
241
+ state.lexical.align = true;
242
+
243
+ while(true) {
244
+ var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
245
+ if (combinator(type, content)) {
246
+ while(cc.length && cc[cc.length - 1].lex)
247
+ cc.pop()();
248
+ if (cx.marked) return cx.marked;
249
+ if (type == "variable" && inScope(state, content)) return "variable-2";
250
+ return style;
251
+ }
252
+ }
253
+ }
254
+
255
+ // Combinator utils
256
+
257
+ var cx = {state: null, column: null, marked: null, cc: null};
258
+ function pass() {
259
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
260
+ }
261
+ function cont() {
262
+ pass.apply(null, arguments);
263
+ return true;
264
+ }
265
+ function inList(name, list) {
266
+ for (var v = list; v; v = v.next) if (v.name == name) return true
267
+ return false;
268
+ }
269
+ function register(varname) {
270
+ var state = cx.state;
271
+ cx.marked = "def";
272
+ if (state.context) {
273
+ if (state.lexical.info == "var" && state.context && state.context.block) {
274
+ // FIXME function decls are also not block scoped
275
+ var newContext = registerVarScoped(varname, state.context)
276
+ if (newContext != null) {
277
+ state.context = newContext
278
+ return
279
+ }
280
+ } else if (!inList(varname, state.localVars)) {
281
+ state.localVars = new Var(varname, state.localVars)
282
+ return
283
+ }
284
+ }
285
+ // Fall through means this is global
286
+ if (parserConfig.globalVars && !inList(varname, state.globalVars))
287
+ state.globalVars = new Var(varname, state.globalVars)
288
+ }
289
+ function registerVarScoped(varname, context) {
290
+ if (!context) {
291
+ return null
292
+ } else if (context.block) {
293
+ var inner = registerVarScoped(varname, context.prev)
294
+ if (!inner) return null
295
+ if (inner == context.prev) return context
296
+ return new Context(inner, context.vars, true)
297
+ } else if (inList(varname, context.vars)) {
298
+ return context
299
+ } else {
300
+ return new Context(context.prev, new Var(varname, context.vars), false)
301
+ }
302
+ }
303
+
304
+ function isModifier(name) {
305
+ return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly"
306
+ }
307
+
308
+ // Combinators
309
+
310
+ function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
311
+ function Var(name, next) { this.name = name; this.next = next }
312
+
313
+ var defaultVars = new Var("this", new Var("arguments", null))
314
+ function pushcontext() {
315
+ cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
316
+ cx.state.localVars = defaultVars
317
+ }
318
+ function pushblockcontext() {
319
+ cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
320
+ cx.state.localVars = null
321
+ }
322
+ function popcontext() {
323
+ cx.state.localVars = cx.state.context.vars
324
+ cx.state.context = cx.state.context.prev
325
+ }
326
+ popcontext.lex = true
327
+ function pushlex(type, info) {
328
+ var result = function() {
329
+ var state = cx.state, indent = state.indented;
330
+ if (state.lexical.type == "stat") indent = state.lexical.indented;
331
+ else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
332
+ indent = outer.indented;
333
+ state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
334
+ };
335
+ result.lex = true;
336
+ return result;
337
+ }
338
+ function poplex() {
339
+ var state = cx.state;
340
+ if (state.lexical.prev) {
341
+ if (state.lexical.type == ")")
342
+ state.indented = state.lexical.indented;
343
+ state.lexical = state.lexical.prev;
344
+ }
345
+ }
346
+ poplex.lex = true;
347
+
348
+ function expect(wanted) {
349
+ function exp(type) {
350
+ if (type == wanted) return cont();
351
+ else if (wanted == ";" || type == "}" || type == ")" || type == "]") return pass();
352
+ else return cont(exp);
353
+ };
354
+ return exp;
355
+ }
356
+
357
+ function statement(type, value) {
358
+ if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
359
+ if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
360
+ if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
361
+ if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
362
+ if (type == "debugger") return cont(expect(";"));
363
+ if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
364
+ if (type == ";") return cont();
365
+ if (type == "if") {
366
+ if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
367
+ cx.state.cc.pop()();
368
+ return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
369
+ }
370
+ if (type == "function") return cont(functiondef);
371
+ if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
372
+ if (type == "class" || (isTS && value == "interface")) {
373
+ cx.marked = "keyword"
374
+ return cont(pushlex("form", type == "class" ? type : value), className, poplex)
375
+ }
376
+ if (type == "variable") {
377
+ if (isTS && value == "declare") {
378
+ cx.marked = "keyword"
379
+ return cont(statement)
380
+ } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
381
+ cx.marked = "keyword"
382
+ if (value == "enum") return cont(enumdef);
383
+ else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));
384
+ else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
385
+ } else if (isTS && value == "namespace") {
386
+ cx.marked = "keyword"
387
+ return cont(pushlex("form"), expression, statement, poplex)
388
+ } else if (isTS && value == "abstract") {
389
+ cx.marked = "keyword"
390
+ return cont(statement)
391
+ } else {
392
+ return cont(pushlex("stat"), maybelabel);
393
+ }
394
+ }
395
+ if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
396
+ block, poplex, poplex, popcontext);
397
+ if (type == "case") return cont(expression, expect(":"));
398
+ if (type == "default") return cont(expect(":"));
399
+ if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
400
+ if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
401
+ if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
402
+ if (type == "async") return cont(statement)
403
+ if (value == "@") return cont(expression, statement)
404
+ return pass(pushlex("stat"), expression, expect(";"), poplex);
405
+ }
406
+ function maybeCatchBinding(type) {
407
+ if (type == "(") return cont(funarg, expect(")"))
408
+ }
409
+ function expression(type, value) {
410
+ return expressionInner(type, value, false);
411
+ }
412
+ function expressionNoComma(type, value) {
413
+ return expressionInner(type, value, true);
414
+ }
415
+ function parenExpr(type) {
416
+ if (type != "(") return pass()
417
+ return cont(pushlex(")"), expression, expect(")"), poplex)
418
+ }
419
+ function expressionInner(type, value, noComma) {
420
+ if (cx.state.fatArrowAt == cx.stream.start) {
421
+ var body = noComma ? arrowBodyNoComma : arrowBody;
422
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
423
+ else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
424
+ }
425
+
426
+ var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
427
+ if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
428
+ if (type == "function") return cont(functiondef, maybeop);
429
+ if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }
430
+ if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);
431
+ if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
432
+ if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
433
+ if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
434
+ if (type == "{") return contCommasep(objprop, "}", null, maybeop);
435
+ if (type == "quasi") return pass(quasi, maybeop);
436
+ if (type == "new") return cont(maybeTarget(noComma));
437
+ if (type == "import") return cont(expression);
438
+ return cont();
439
+ }
440
+ function maybeexpression(type) {
441
+ if (type.match(/[;\}\)\],]/)) return pass();
442
+ return pass(expression);
443
+ }
444
+
445
+ function maybeoperatorComma(type, value) {
446
+ if (type == ",") return cont(expression);
447
+ return maybeoperatorNoComma(type, value, false);
448
+ }
449
+ function maybeoperatorNoComma(type, value, noComma) {
450
+ var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
451
+ var expr = noComma == false ? expression : expressionNoComma;
452
+ if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
453
+ if (type == "operator") {
454
+ if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
455
+ if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false))
456
+ return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
457
+ if (value == "?") return cont(expression, expect(":"), expr);
458
+ return cont(expr);
459
+ }
460
+ if (type == "quasi") { return pass(quasi, me); }
461
+ if (type == ";") return;
462
+ if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
463
+ if (type == ".") return cont(property, me);
464
+ if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
465
+ if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }
466
+ if (type == "regexp") {
467
+ cx.state.lastType = cx.marked = "operator"
468
+ cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)
469
+ return cont(expr)
470
+ }
471
+ }
472
+ function quasi(type, value) {
473
+ if (type != "quasi") return pass();
474
+ if (value.slice(value.length - 2) != "${") return cont(quasi);
475
+ return cont(expression, continueQuasi);
476
+ }
477
+ function continueQuasi(type) {
478
+ if (type == "}") {
479
+ cx.marked = "string-2";
480
+ cx.state.tokenize = tokenQuasi;
481
+ return cont(quasi);
482
+ }
483
+ }
484
+ function arrowBody(type) {
485
+ findFatArrow(cx.stream, cx.state);
486
+ return pass(type == "{" ? statement : expression);
487
+ }
488
+ function arrowBodyNoComma(type) {
489
+ findFatArrow(cx.stream, cx.state);
490
+ return pass(type == "{" ? statement : expressionNoComma);
491
+ }
492
+ function maybeTarget(noComma) {
493
+ return function(type) {
494
+ if (type == ".") return cont(noComma ? targetNoComma : target);
495
+ else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)
496
+ else return pass(noComma ? expressionNoComma : expression);
497
+ };
498
+ }
499
+ function target(_, value) {
500
+ if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
501
+ }
502
+ function targetNoComma(_, value) {
503
+ if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
504
+ }
505
+ function maybelabel(type) {
506
+ if (type == ":") return cont(poplex, statement);
507
+ return pass(maybeoperatorComma, expect(";"), poplex);
508
+ }
509
+ function property(type) {
510
+ if (type == "variable") {cx.marked = "property"; return cont();}
511
+ }
512
+ function objprop(type, value) {
513
+ if (type == "async") {
514
+ cx.marked = "property";
515
+ return cont(objprop);
516
+ } else if (type == "variable" || cx.style == "keyword") {
517
+ cx.marked = "property";
518
+ if (value == "get" || value == "set") return cont(getterSetter);
519
+ var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params
520
+ if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
521
+ cx.state.fatArrowAt = cx.stream.pos + m[0].length
522
+ return cont(afterprop);
523
+ } else if (type == "number" || type == "string") {
524
+ cx.marked = jsonldMode ? "property" : (cx.style + " property");
525
+ return cont(afterprop);
526
+ } else if (type == "jsonld-keyword") {
527
+ return cont(afterprop);
528
+ } else if (isTS && isModifier(value)) {
529
+ cx.marked = "keyword"
530
+ return cont(objprop)
531
+ } else if (type == "[") {
532
+ return cont(expression, maybetype, expect("]"), afterprop);
533
+ } else if (type == "spread") {
534
+ return cont(expressionNoComma, afterprop);
535
+ } else if (value == "*") {
536
+ cx.marked = "keyword";
537
+ return cont(objprop);
538
+ } else if (type == ":") {
539
+ return pass(afterprop)
540
+ }
541
+ }
542
+ function getterSetter(type) {
543
+ if (type != "variable") return pass(afterprop);
544
+ cx.marked = "property";
545
+ return cont(functiondef);
546
+ }
547
+ function afterprop(type) {
548
+ if (type == ":") return cont(expressionNoComma);
549
+ if (type == "(") return pass(functiondef);
550
+ }
551
+ function commasep(what, end, sep) {
552
+ function proceed(type, value) {
553
+ if (sep ? sep.indexOf(type) > -1 : type == ",") {
554
+ var lex = cx.state.lexical;
555
+ if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
556
+ return cont(function(type, value) {
557
+ if (type == end || value == end) return pass()
558
+ return pass(what)
559
+ }, proceed);
560
+ }
561
+ if (type == end || value == end) return cont();
562
+ if (sep && sep.indexOf(";") > -1) return pass(what)
563
+ return cont(expect(end));
564
+ }
565
+ return function(type, value) {
566
+ if (type == end || value == end) return cont();
567
+ return pass(what, proceed);
568
+ };
569
+ }
570
+ function contCommasep(what, end, info) {
571
+ for (var i = 3; i < arguments.length; i++)
572
+ cx.cc.push(arguments[i]);
573
+ return cont(pushlex(end, info), commasep(what, end), poplex);
574
+ }
575
+ function block(type) {
576
+ if (type == "}") return cont();
577
+ return pass(statement, block);
578
+ }
579
+ function maybetype(type, value) {
580
+ if (isTS) {
581
+ if (type == ":") return cont(typeexpr);
582
+ if (value == "?") return cont(maybetype);
583
+ }
584
+ }
585
+ function maybetypeOrIn(type, value) {
586
+ if (isTS && (type == ":" || value == "in")) return cont(typeexpr)
587
+ }
588
+ function mayberettype(type) {
589
+ if (isTS && type == ":") {
590
+ if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
591
+ else return cont(typeexpr)
592
+ }
593
+ }
594
+ function isKW(_, value) {
595
+ if (value == "is") {
596
+ cx.marked = "keyword"
597
+ return cont()
598
+ }
599
+ }
600
+ function typeexpr(type, value) {
601
+ if (value == "keyof" || value == "typeof" || value == "infer") {
602
+ cx.marked = "keyword"
603
+ return cont(value == "typeof" ? expressionNoComma : typeexpr)
604
+ }
605
+ if (type == "variable" || value == "void") {
606
+ cx.marked = "type"
607
+ return cont(afterType)
608
+ }
609
+ if (value == "|" || value == "&") return cont(typeexpr)
610
+ if (type == "string" || type == "number" || type == "atom") return cont(afterType);
611
+ if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
612
+ if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
613
+ if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)
614
+ if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
615
+ }
616
+ function maybeReturnType(type) {
617
+ if (type == "=>") return cont(typeexpr)
618
+ }
619
+ function typeprop(type, value) {
620
+ if (type == "variable" || cx.style == "keyword") {
621
+ cx.marked = "property"
622
+ return cont(typeprop)
623
+ } else if (value == "?" || type == "number" || type == "string") {
624
+ return cont(typeprop)
625
+ } else if (type == ":") {
626
+ return cont(typeexpr)
627
+ } else if (type == "[") {
628
+ return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
629
+ } else if (type == "(") {
630
+ return pass(functiondecl, typeprop)
631
+ }
632
+ }
633
+ function typearg(type, value) {
634
+ if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
635
+ if (type == ":") return cont(typeexpr)
636
+ if (type == "spread") return cont(typearg)
637
+ return pass(typeexpr)
638
+ }
639
+ function afterType(type, value) {
640
+ if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
641
+ if (value == "|" || type == "." || value == "&") return cont(typeexpr)
642
+ if (type == "[") return cont(typeexpr, expect("]"), afterType)
643
+ if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) }
644
+ if (value == "?") return cont(typeexpr, expect(":"), typeexpr)
645
+ }
646
+ function maybeTypeArgs(_, value) {
647
+ if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
648
+ }
649
+ function typeparam() {
650
+ return pass(typeexpr, maybeTypeDefault)
651
+ }
652
+ function maybeTypeDefault(_, value) {
653
+ if (value == "=") return cont(typeexpr)
654
+ }
655
+ function vardef(_, value) {
656
+ if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)}
657
+ return pass(pattern, maybetype, maybeAssign, vardefCont);
658
+ }
659
+ function pattern(type, value) {
660
+ if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
661
+ if (type == "variable") { register(value); return cont(); }
662
+ if (type == "spread") return cont(pattern);
663
+ if (type == "[") return contCommasep(eltpattern, "]");
664
+ if (type == "{") return contCommasep(proppattern, "}");
665
+ }
666
+ function proppattern(type, value) {
667
+ if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
668
+ register(value);
669
+ return cont(maybeAssign);
670
+ }
671
+ if (type == "variable") cx.marked = "property";
672
+ if (type == "spread") return cont(pattern);
673
+ if (type == "}") return pass();
674
+ if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern);
675
+ return cont(expect(":"), pattern, maybeAssign);
676
+ }
677
+ function eltpattern() {
678
+ return pass(pattern, maybeAssign)
679
+ }
680
+ function maybeAssign(_type, value) {
681
+ if (value == "=") return cont(expressionNoComma);
682
+ }
683
+ function vardefCont(type) {
684
+ if (type == ",") return cont(vardef);
685
+ }
686
+ function maybeelse(type, value) {
687
+ if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
688
+ }
689
+ function forspec(type, value) {
690
+ if (value == "await") return cont(forspec);
691
+ if (type == "(") return cont(pushlex(")"), forspec1, poplex);
692
+ }
693
+ function forspec1(type) {
694
+ if (type == "var") return cont(vardef, forspec2);
695
+ if (type == "variable") return cont(forspec2);
696
+ return pass(forspec2)
697
+ }
698
+ function forspec2(type, value) {
699
+ if (type == ")") return cont()
700
+ if (type == ";") return cont(forspec2)
701
+ if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression, forspec2) }
702
+ return pass(expression, forspec2)
703
+ }
704
+ function functiondef(type, value) {
705
+ if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
706
+ if (type == "variable") {register(value); return cont(functiondef);}
707
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
708
+ if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef)
709
+ }
710
+ function functiondecl(type, value) {
711
+ if (value == "*") {cx.marked = "keyword"; return cont(functiondecl);}
712
+ if (type == "variable") {register(value); return cont(functiondecl);}
713
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, popcontext);
714
+ if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondecl)
715
+ }
716
+ function typename(type, value) {
717
+ if (type == "keyword" || type == "variable") {
718
+ cx.marked = "type"
719
+ return cont(typename)
720
+ } else if (value == "<") {
721
+ return cont(pushlex(">"), commasep(typeparam, ">"), poplex)
722
+ }
723
+ }
724
+ function funarg(type, value) {
725
+ if (value == "@") cont(expression, funarg)
726
+ if (type == "spread") return cont(funarg);
727
+ if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
728
+ if (isTS && type == "this") return cont(maybetype, maybeAssign)
729
+ return pass(pattern, maybetype, maybeAssign);
730
+ }
731
+ function classExpression(type, value) {
732
+ // Class expressions may have an optional name.
733
+ if (type == "variable") return className(type, value);
734
+ return classNameAfter(type, value);
735
+ }
736
+ function className(type, value) {
737
+ if (type == "variable") {register(value); return cont(classNameAfter);}
738
+ }
739
+ function classNameAfter(type, value) {
740
+ if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
741
+ if (value == "extends" || value == "implements" || (isTS && type == ",")) {
742
+ if (value == "implements") cx.marked = "keyword";
743
+ return cont(isTS ? typeexpr : expression, classNameAfter);
744
+ }
745
+ if (type == "{") return cont(pushlex("}"), classBody, poplex);
746
+ }
747
+ function classBody(type, value) {
748
+ if (type == "async" ||
749
+ (type == "variable" &&
750
+ (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
751
+ cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
752
+ cx.marked = "keyword";
753
+ return cont(classBody);
754
+ }
755
+ if (type == "variable" || cx.style == "keyword") {
756
+ cx.marked = "property";
757
+ return cont(isTS ? classfield : functiondef, classBody);
758
+ }
759
+ if (type == "number" || type == "string") return cont(isTS ? classfield : functiondef, classBody);
760
+ if (type == "[")
761
+ return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody)
762
+ if (value == "*") {
763
+ cx.marked = "keyword";
764
+ return cont(classBody);
765
+ }
766
+ if (isTS && type == "(") return pass(functiondecl, classBody)
767
+ if (type == ";" || type == ",") return cont(classBody);
768
+ if (type == "}") return cont();
769
+ if (value == "@") return cont(expression, classBody)
770
+ }
771
+ function classfield(type, value) {
772
+ if (value == "?") return cont(classfield)
773
+ if (type == ":") return cont(typeexpr, maybeAssign)
774
+ if (value == "=") return cont(expressionNoComma)
775
+ var context = cx.state.lexical.prev, isInterface = context && context.info == "interface"
776
+ return pass(isInterface ? functiondecl : functiondef)
777
+ }
778
+ function afterExport(type, value) {
779
+ if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
780
+ if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
781
+ if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
782
+ return pass(statement);
783
+ }
784
+ function exportField(type, value) {
785
+ if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
786
+ if (type == "variable") return pass(expressionNoComma, exportField);
787
+ }
788
+ function afterImport(type) {
789
+ if (type == "string") return cont();
790
+ if (type == "(") return pass(expression);
791
+ return pass(importSpec, maybeMoreImports, maybeFrom);
792
+ }
793
+ function importSpec(type, value) {
794
+ if (type == "{") return contCommasep(importSpec, "}");
795
+ if (type == "variable") register(value);
796
+ if (value == "*") cx.marked = "keyword";
797
+ return cont(maybeAs);
798
+ }
799
+ function maybeMoreImports(type) {
800
+ if (type == ",") return cont(importSpec, maybeMoreImports)
801
+ }
802
+ function maybeAs(_type, value) {
803
+ if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
804
+ }
805
+ function maybeFrom(_type, value) {
806
+ if (value == "from") { cx.marked = "keyword"; return cont(expression); }
807
+ }
808
+ function arrayLiteral(type) {
809
+ if (type == "]") return cont();
810
+ return pass(commasep(expressionNoComma, "]"));
811
+ }
812
+ function enumdef() {
813
+ return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex)
814
+ }
815
+ function enummember() {
816
+ return pass(pattern, maybeAssign);
817
+ }
818
+
819
+ function isContinuedStatement(state, textAfter) {
820
+ return state.lastType == "operator" || state.lastType == "," ||
821
+ isOperatorChar.test(textAfter.charAt(0)) ||
822
+ /[,.]/.test(textAfter.charAt(0));
823
+ }
824
+
825
+ function expressionAllowed(stream, state, backUp) {
826
+ return state.tokenize == tokenBase &&
827
+ /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
828
+ (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
829
+ }
830
+
831
+ // Interface
832
+
833
+ return {
834
+ startState: function(basecolumn) {
835
+ var state = {
836
+ tokenize: tokenBase,
837
+ lastType: "sof",
838
+ cc: [],
839
+ lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
840
+ localVars: parserConfig.localVars,
841
+ context: parserConfig.localVars && new Context(null, null, false),
842
+ indented: basecolumn || 0
843
+ };
844
+ if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
845
+ state.globalVars = parserConfig.globalVars;
846
+ return state;
847
+ },
848
+
849
+ token: function(stream, state) {
850
+ if (stream.sol()) {
851
+ if (!state.lexical.hasOwnProperty("align"))
852
+ state.lexical.align = false;
853
+ state.indented = stream.indentation();
854
+ findFatArrow(stream, state);
855
+ }
856
+ if (state.tokenize != tokenComment && stream.eatSpace()) return null;
857
+ var style = state.tokenize(stream, state);
858
+ if (type == "comment") return style;
859
+ state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
860
+ return parseJS(state, style, type, content, stream);
861
+ },
862
+
863
+ indent: function(state, textAfter) {
864
+ if (state.tokenize == tokenComment) return CodeMirror.Pass;
865
+ if (state.tokenize != tokenBase) return 0;
866
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
867
+ // Kludge to prevent 'maybelse' from blocking lexical scope pops
868
+ if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
869
+ var c = state.cc[i];
870
+ if (c == poplex) lexical = lexical.prev;
871
+ else if (c != maybeelse) break;
872
+ }
873
+ while ((lexical.type == "stat" || lexical.type == "form") &&
874
+ (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
875
+ (top == maybeoperatorComma || top == maybeoperatorNoComma) &&
876
+ !/^[,\.=+\-*:?[\(]/.test(textAfter))))
877
+ lexical = lexical.prev;
878
+ if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
879
+ lexical = lexical.prev;
880
+ var type = lexical.type, closing = firstChar == type;
881
+
882
+ if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
883
+ else if (type == "form" && firstChar == "{") return lexical.indented;
884
+ else if (type == "form") return lexical.indented + indentUnit;
885
+ else if (type == "stat")
886
+ return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
887
+ else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
888
+ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
889
+ else if (lexical.align) return lexical.column + (closing ? 0 : 1);
890
+ else return lexical.indented + (closing ? 0 : indentUnit);
891
+ },
892
+
893
+ electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
894
+ blockCommentStart: jsonMode ? null : "/*",
895
+ blockCommentEnd: jsonMode ? null : "*/",
896
+ blockCommentContinue: jsonMode ? null : " * ",
897
+ lineComment: jsonMode ? null : "//",
898
+ fold: "brace",
899
+ closeBrackets: "()[]{}''\"\"``",
900
+
901
+ helperType: jsonMode ? "json" : "javascript",
902
+ jsonldMode: jsonldMode,
903
+ jsonMode: jsonMode,
904
+
905
+ expressionAllowed: expressionAllowed,
906
+
907
+ skipExpression: function(state) {
908
+ var top = state.cc[state.cc.length - 1]
909
+ if (top == expression || top == expressionNoComma) state.cc.pop()
910
+ }
911
+ };
912
+ });
913
+
914
+ CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
915
+
916
+ CodeMirror.defineMIME("text/javascript", "javascript");
917
+ CodeMirror.defineMIME("text/ecmascript", "javascript");
918
+ CodeMirror.defineMIME("application/javascript", "javascript");
919
+ CodeMirror.defineMIME("application/x-javascript", "javascript");
920
+ CodeMirror.defineMIME("application/ecmascript", "javascript");
921
+ CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
922
+ CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
923
+ CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
924
+ CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
925
+ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
926
+
927
+ });