@hpcc-js/codemirror 2.64.0 → 3.1.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 (67) hide show
  1. package/README.md +10 -4
  2. package/dist/index.js +504 -17877
  3. package/dist/index.js.map +7 -1
  4. package/package.json +29 -33
  5. package/src/CSSEditor.ts +1 -1
  6. package/src/DOTEditor.ts +2 -2
  7. package/src/ECLEditor.ts +1 -1
  8. package/src/Editor.css +8 -3
  9. package/src/Editor.ts +1 -1
  10. package/src/HTMLEditor.ts +1 -1
  11. package/src/JSEditor.ts +1 -1
  12. package/src/JSONEditor.ts +1 -1
  13. package/src/MarkdownEditor.ts +1 -1
  14. package/src/ObservableMarkdownEditor.ts +1 -1
  15. package/src/SQLEditor.ts +1 -1
  16. package/src/XMLEditor.ts +1 -1
  17. package/src/__package__.ts +2 -2
  18. package/src/codemirror-shim.ts +31 -0
  19. package/src/index.ts +14 -12
  20. package/src/mode/dot/dot.ts +94 -0
  21. package/src/mode/markdown/markdown.ts +879 -0
  22. package/types/CSSEditor.d.ts +1 -2
  23. package/types/DOTEditor.d.ts +1 -2
  24. package/types/ECLEditor.d.ts +1 -2
  25. package/types/Editor.d.ts +0 -1
  26. package/types/HTMLEditor.d.ts +1 -2
  27. package/types/JSEditor.d.ts +1 -2
  28. package/types/JSONEditor.d.ts +1 -2
  29. package/types/MarkdownEditor.d.ts +1 -2
  30. package/types/ObservableMarkdownEditor.d.ts +1 -2
  31. package/types/SQLEditor.d.ts +1 -2
  32. package/types/XMLEditor.d.ts +1 -2
  33. package/types/__package__.d.ts +2 -3
  34. package/types/codemirror-shim.d.ts +26 -0
  35. package/types/index.d.ts +12 -13
  36. package/types/mode/dot/dot.d.ts +1 -0
  37. package/types/mode/markdown/markdown.d.ts +1 -0
  38. package/dist/index.es6.js +0 -17860
  39. package/dist/index.es6.js.map +0 -1
  40. package/dist/index.min.js +0 -2
  41. package/dist/index.min.js.map +0 -1
  42. package/types/CSSEditor.d.ts.map +0 -1
  43. package/types/DOTEditor.d.ts.map +0 -1
  44. package/types/ECLEditor.d.ts.map +0 -1
  45. package/types/Editor.d.ts.map +0 -1
  46. package/types/HTMLEditor.d.ts.map +0 -1
  47. package/types/JSEditor.d.ts.map +0 -1
  48. package/types/JSONEditor.d.ts.map +0 -1
  49. package/types/MarkdownEditor.d.ts.map +0 -1
  50. package/types/ObservableMarkdownEditor.d.ts.map +0 -1
  51. package/types/SQLEditor.d.ts.map +0 -1
  52. package/types/XMLEditor.d.ts.map +0 -1
  53. package/types/__package__.d.ts.map +0 -1
  54. package/types/index.d.ts.map +0 -1
  55. package/types-3.4/CSSEditor.d.ts +0 -7
  56. package/types-3.4/DOTEditor.d.ts +0 -7
  57. package/types-3.4/ECLEditor.d.ts +0 -8
  58. package/types-3.4/Editor.d.ts +0 -57
  59. package/types-3.4/HTMLEditor.d.ts +0 -7
  60. package/types-3.4/JSEditor.d.ts +0 -7
  61. package/types-3.4/JSONEditor.d.ts +0 -7
  62. package/types-3.4/MarkdownEditor.d.ts +0 -7
  63. package/types-3.4/ObservableMarkdownEditor.d.ts +0 -5
  64. package/types-3.4/SQLEditor.d.ts +0 -7
  65. package/types-3.4/XMLEditor.d.ts +0 -7
  66. package/types-3.4/__package__.d.ts +0 -4
  67. package/types-3.4/index.d.ts +0 -13
package/package.json CHANGED
@@ -1,49 +1,45 @@
1
1
  {
2
2
  "name": "@hpcc-js/codemirror",
3
- "version": "2.64.0",
3
+ "version": "3.1.0",
4
4
  "description": "hpcc-js - Viz Code Mirror",
5
- "main": "dist/index.js",
6
- "module": "dist/index.es6",
7
- "unpkg": "dist/index.min.js",
8
- "jsdelivr": "dist/index.min.js",
9
- "types": "types/index.d.ts",
10
- "typesVersions": {
11
- "<3.8": {
12
- "*": [
13
- "types-3.4/index.d.ts"
14
- ]
15
- }
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./types/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./dist/*": "./dist/*"
16
12
  },
13
+ "module": "./dist/index.js",
14
+ "browser": "./dist/index.js",
15
+ "types": "./types/index.d.ts",
17
16
  "files": [
18
17
  "dist/*",
19
- "types/*",
20
- "types-3.4/*",
21
- "src/*"
18
+ "src/*",
19
+ "types/*"
22
20
  ],
23
21
  "scripts": {
24
- "clean": "rimraf --glob lib* types dist *.tsbuildinfo",
25
- "compile-es6": "tsc --module es6 --outDir ./lib-es6",
26
- "compile-es6-watch": "npm run compile-es6 -- -w",
27
- "compile-umd": "tsc --module umd --outDir ./lib-umd",
28
- "compile-umd-watch": "npm run compile-umd -- -w",
29
- "bundle": "rollup -c",
30
- "bundle-watch": "npm run bundle -- -w",
31
- "minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
32
- "gen-legacy-types": "downlevel-dts ./types ./types-3.4",
33
- "build": "npm run compile-es6 && npm run bundle",
34
- "watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
35
- "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
22
+ "clean": "rimraf --glob lib* types dist *.tsbuildinfo .turbo",
23
+ "bundle": "node esbuild.js",
24
+ "bundle-watch": "npm run bundle -- --development --watch",
25
+ "gen-types": "tsc --project tsconfig.json",
26
+ "gen-types-watch": "npm run gen-types -- --watch",
27
+ "build": "run-p gen-types bundle",
36
28
  "lint": "eslint ./src",
29
+ "lint-fix": "eslint --fix src/**/*.ts",
37
30
  "docs": "typedoc --options tdoptions.json .",
38
- "update": "npx --yes npm-check-updates -u -t minor"
31
+ "test-browser": "vitest run --project browser",
32
+ "test": "vitest run",
33
+ "coverage": "vitest run --coverage",
34
+ "update": "npx --yes npm-check-updates -u -t minor",
35
+ "update-major": "npx --yes npm-check-updates -u"
39
36
  },
40
37
  "dependencies": {
41
- "@hpcc-js/common": "^2.73.0"
38
+ "@hpcc-js/common": "^3.2.0"
42
39
  },
43
40
  "devDependencies": {
44
- "@hpcc-js/bundle": "^2.12.0",
45
- "@hpcc-js/codemirror-shim": "^2.37.0",
46
- "tslib": "2.7.0"
41
+ "@hpcc-js/esbuild-plugins": "^1.3.0",
42
+ "codemirror": "5.65.18"
47
43
  },
48
44
  "repository": {
49
45
  "type": "git",
@@ -56,5 +52,5 @@
56
52
  "url": "https://github.com/hpcc-systems/Visualization/issues"
57
53
  },
58
54
  "homepage": "https://github.com/hpcc-systems/Visualization",
59
- "gitHead": "fbbef050700b0e9d76ef99714856383d95155149"
55
+ "gitHead": "658c50fd965a7744ba8db675ba6878607c44d5e2"
60
56
  }
package/src/CSSEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class CSSEditor extends Editor {
4
4
  options(): any {
package/src/DOTEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class DOTEditor extends Editor {
4
4
  options(): any {
@@ -17,4 +17,4 @@ export class DOTEditor extends Editor {
17
17
  }
18
18
 
19
19
  }
20
- DOTEditor.prototype._class += " codemirror_JSEditor";
20
+ DOTEditor.prototype._class += " codemirror_DOTEditor";
package/src/ECLEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  import "../src/ECLEditor.css";
4
4
 
package/src/Editor.css CHANGED
@@ -3,23 +3,28 @@
3
3
  border-width: 1px;
4
4
  border-color: lightgray;
5
5
  }
6
- .codemirror_Editor .cm-marked-text{
6
+
7
+ .codemirror_Editor .cm-marked-text {
7
8
  background-color: yellow;
8
9
  }
10
+
9
11
  .codemirror_Editor .cm-marked-info,
10
12
  .codemirror_Editor .cm-marked-error,
11
- .codemirror_Editor .cm-marked-warning{
13
+ .codemirror_Editor .cm-marked-warning {
12
14
  display: inline-block;
13
15
  position: relative;
14
16
  background-position: left bottom;
15
17
  background-repeat: repeat-x;
16
18
  }
19
+
17
20
  .codemirror_Editor .cm-marked-info {
18
21
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAHElEQVQYV2NkgIP//xkYGBkZIXwIB0SDCQgHAgDEXAgCKU2DPwAAAABJRU5ErkJggg==");
19
22
  }
20
- .codemirror_Editor .cm-marked-error{
23
+
24
+ .codemirror_Editor .cm-marked-error {
21
25
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAHUlEQVQYV2NkgIL/DAz/GRkYGBlBfBgHTMM4MJUAzFoIAuwf4BEAAAAASUVORK5CYII=");
22
26
  }
27
+
23
28
  .codemirror_Editor .cm-marked-warning {
24
29
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAHUlEQVQYV2NkgIL/Sxn+M0YzMDKC+DAOmIZxYCoBKQkLp8ga+UwAAAAASUVORK5CYII=");
25
30
  }
package/src/Editor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CodeMirror } from "@hpcc-js/codemirror-shim";
1
+ import { CodeMirror } from "./codemirror-shim.ts";
2
2
  import { HTMLWidget, Palette } from "@hpcc-js/common";
3
3
 
4
4
  import "../src/Editor.css";
package/src/HTMLEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class HTMLEditor extends Editor {
4
4
  options(): any {
package/src/JSEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class JSEditor extends Editor {
4
4
  options(): any {
package/src/JSONEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class JSONEditor extends Editor {
4
4
  options(): any {
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class MarkdownEditor extends Editor {
4
4
  options(): any {
@@ -1,4 +1,4 @@
1
- import { MarkdownEditor } from "./MarkdownEditor";
1
+ import { MarkdownEditor } from "./MarkdownEditor.ts";
2
2
 
3
3
  export class ObservableMarkdownEditor extends MarkdownEditor {
4
4
  options(): any {
package/src/SQLEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class SQLEditor extends Editor {
4
4
  options(): any {
package/src/XMLEditor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from "./Editor";
1
+ import { Editor } from "./Editor.ts";
2
2
 
3
3
  export class XMLEditor extends Editor {
4
4
  options(): any {
@@ -1,3 +1,3 @@
1
1
  export const PKG_NAME = "@hpcc-js/codemirror";
2
- export const PKG_VERSION = "2.64.0";
3
- export const BUILD_VERSION = "2.107.0";
2
+ export const PKG_VERSION = "3.1.0";
3
+ export const BUILD_VERSION = "3.2.0";
@@ -0,0 +1,31 @@
1
+ import "codemirror/mode/css/css";
2
+ import "codemirror/mode/ecl/ecl";
3
+ import "codemirror/mode/gfm/gfm";
4
+ import "codemirror/mode/htmlmixed/htmlmixed";
5
+ import "codemirror/mode/javascript/javascript";
6
+ import "codemirror/mode/xml/xml";
7
+ import "codemirror/mode/sql/sql";
8
+ import "./mode/dot/dot.ts";
9
+ import "./mode/markdown/markdown.ts";
10
+
11
+ import "codemirror/lib/codemirror.css";
12
+
13
+ import "codemirror/addon/fold/brace-fold";
14
+ import "codemirror/addon/fold/comment-fold";
15
+ import "codemirror/addon/fold/foldcode";
16
+ import "codemirror/addon/fold/foldgutter";
17
+ import "codemirror/addon/fold/indent-fold";
18
+ import "codemirror/addon/fold/xml-fold";
19
+
20
+ import "codemirror/addon/fold/foldgutter.css";
21
+
22
+ import "codemirror/addon/dialog/dialog.js";
23
+ import "codemirror/addon/dialog/dialog.css";
24
+ import "codemirror/addon/search/jump-to-line.js";
25
+ import "codemirror/addon/search/search.js";
26
+ import "codemirror/addon/search/searchcursor.js";
27
+ import "codemirror/addon/hint/show-hint.js";
28
+ import "codemirror/addon/hint/show-hint.css";
29
+
30
+ import CodeMirror from "codemirror";
31
+ export { CodeMirror };
package/src/index.ts CHANGED
@@ -1,12 +1,14 @@
1
- export * from "./__package__";
2
- export * from "./CSSEditor";
3
- export * from "./DOTEditor";
4
- export * from "./ECLEditor";
5
- export * from "./Editor";
6
- export * from "./HTMLEditor";
7
- export * from "./JSEditor";
8
- export * from "./JSONEditor";
9
- export * from "./MarkdownEditor";
10
- export * from "./ObservableMarkdownEditor";
11
- export * from "./XMLEditor";
12
- export * from "./SQLEditor";
1
+ export * from "./__package__.ts";
2
+
3
+ export * from "./CSSEditor.ts";
4
+ export * from "./DOTEditor.ts";
5
+ export * from "./ECLEditor.ts";
6
+ export * from "./Editor.ts";
7
+ export * from "./HTMLEditor.ts";
8
+ export * from "./JSEditor.ts";
9
+ export * from "./JSONEditor.ts";
10
+ export * from "./MarkdownEditor.ts";
11
+ export * from "./ObservableMarkdownEditor.ts";
12
+ export * from "./XMLEditor.ts";
13
+ export * from "./SQLEditor.ts";
14
+
@@ -0,0 +1,94 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+ // Orig source from: https://raw.githubusercontent.com/inaimathi/CodeMirror/dot-mode/mode/dot/dot.js
4
+
5
+ /* eslint-disable */
6
+
7
+ import CodeMirror from "codemirror";
8
+
9
+ CodeMirror.defineMode("dot", function (config) {
10
+ const ops = /--|->|=|;/;
11
+ const brackets = /[\[\]{}]/;
12
+ return {
13
+ startState() {
14
+ return { indent_level: 0 };
15
+ },
16
+
17
+ token(stream, state) {
18
+ stream.eatSpace();
19
+
20
+ switch (state.looking_for) {
21
+ case "multiline-comment":
22
+ if (stream.match(/.*\*\//)) {
23
+ state.looking_for = null;
24
+ } else {
25
+ stream.skipToEnd();
26
+ }
27
+ return "comment";
28
+ case "property":
29
+ if (stream.match("=")) {
30
+ return "variable-3";
31
+ } else {
32
+ stream.match(/\w+/);
33
+ state.looking_for = null;
34
+ return "string-2";
35
+ }
36
+ case "graphname":
37
+ state.looking_for = null;
38
+ if (stream.match(/{\W*$/)) {
39
+ state.indent_level += 1;
40
+ return "bracket";
41
+ } else if (stream.match("{")) {
42
+ return "bracket";
43
+ } else if (stream.match(/[^\W]+/)) {
44
+ return "variable-2";
45
+ }
46
+ default:
47
+ if (stream.match(/{\W*$/)) {
48
+ state.indent_level += 1;
49
+ return "bracket";
50
+ } else if (stream.match(/}\W*$/)) {
51
+ state.indent_level -= 1;
52
+ return "bracket";
53
+ } else if (stream.match(brackets)) {
54
+ return "bracket";
55
+ } else if (stream.match(/".*"/)) {
56
+ return "string";
57
+ } else if (stream.match(/\w+=[\"\w]+/, false)) {
58
+ state.looking_for = "property";
59
+ stream.match(/[^=]+/);
60
+ return "attribute";
61
+ } else if (stream.match(ops)) {
62
+ return "variable-3";
63
+ } else if (stream.match(/(di)?graph[^{\w]+/)) {
64
+ state.looking_for = "graphname";
65
+ return "keyword";
66
+ } else if (stream.match(/\/\/|#/)) {
67
+ stream.skipToEnd();
68
+ return "comment";
69
+ } else if (stream.match(/\/\*.*\*\//)) {
70
+ return "comment";
71
+ } else if (stream.match("/*")) {
72
+ state.looking_for = "multiline-comment";
73
+ return "comment";
74
+ } else if (stream.match(/\w+/)) {
75
+ return "variable";
76
+ } else {
77
+ stream.skipToEnd();
78
+ return "variable";
79
+ }
80
+ }
81
+ },
82
+
83
+ indent(state, _textAfter) {
84
+ return state.indent_level * (config.indentUnit || 2);
85
+ },
86
+
87
+ closeBrackets: { pairs: "[]{}\"\"" },
88
+ lineComment: /(\/\/|#)/,
89
+ blockCommentStart: "/*",
90
+ blockCommentEnd: "*/"
91
+ };
92
+ });
93
+
94
+ CodeMirror.defineMIME("text/x-dot", "dot");