@jarenjs/mermaid 0.34.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 (64) hide show
  1. package/README.md +282 -0
  2. package/dist/types/ast.d.ts +210 -0
  3. package/dist/types/component/index.d.ts +81 -0
  4. package/dist/types/errors.d.ts +27 -0
  5. package/dist/types/index.d.ts +97 -0
  6. package/dist/types/interactive.d.ts +36 -0
  7. package/dist/types/layout/flowchart.d.ts +12 -0
  8. package/dist/types/layout/sequence.d.ts +12 -0
  9. package/dist/types/layout/state.d.ts +19 -0
  10. package/dist/types/parser/class.d.ts +11 -0
  11. package/dist/types/parser/config.d.ts +61 -0
  12. package/dist/types/parser/er.d.ts +11 -0
  13. package/dist/types/parser/flowchart.d.ts +26 -0
  14. package/dist/types/parser/gantt.d.ts +11 -0
  15. package/dist/types/parser/index.d.ts +22 -0
  16. package/dist/types/parser/pie.d.ts +11 -0
  17. package/dist/types/parser/sequence.d.ts +16 -0
  18. package/dist/types/parser/state.d.ts +22 -0
  19. package/dist/types/plugin.d.ts +50 -0
  20. package/dist/types/render/error.d.ts +23 -0
  21. package/dist/types/render/flowchart.d.ts +18 -0
  22. package/dist/types/render/index.d.ts +23 -0
  23. package/dist/types/render/misc.d.ts +54 -0
  24. package/dist/types/render/sequence.d.ts +16 -0
  25. package/dist/types/styles.d.ts +81 -0
  26. package/dist/types/theme.d.ts +47 -0
  27. package/dist/types/to-mermaid.d.ts +20 -0
  28. package/dist/types/utils.d.ts +47 -0
  29. package/docs/MERMAID-FORMAT.md +242 -0
  30. package/package.json +84 -0
  31. package/schemas/jaren-mermaid-ast.schema.json +78 -0
  32. package/schemas/jaren-workflow.schema.json +28 -0
  33. package/src/ast.js +252 -0
  34. package/src/component/index.js +109 -0
  35. package/src/errors.js +35 -0
  36. package/src/index.js +155 -0
  37. package/src/interactive.js +244 -0
  38. package/src/layout/flowchart.js +352 -0
  39. package/src/layout/sequence.js +178 -0
  40. package/src/layout/state.js +65 -0
  41. package/src/parser/class.js +90 -0
  42. package/src/parser/config.js +215 -0
  43. package/src/parser/er.js +86 -0
  44. package/src/parser/flowchart.js +413 -0
  45. package/src/parser/gantt.js +49 -0
  46. package/src/parser/index.js +122 -0
  47. package/src/parser/pie.js +32 -0
  48. package/src/parser/sequence.js +156 -0
  49. package/src/parser/state.js +137 -0
  50. package/src/plugin.js +76 -0
  51. package/src/render/error.js +55 -0
  52. package/src/render/flowchart.js +249 -0
  53. package/src/render/index.js +93 -0
  54. package/src/render/misc.js +135 -0
  55. package/src/render/sequence.js +152 -0
  56. package/src/styles.js +181 -0
  57. package/src/theme.js +180 -0
  58. package/src/to-mermaid.js +317 -0
  59. package/src/utils.js +64 -0
  60. package/styles/mermaid.css +115 -0
  61. package/stylesheets/dag-to-flowchart.jslt.json +62 -0
  62. package/stylesheets/flowchart-to-dag.jslt.json +29 -0
  63. package/stylesheets/state-to-workflow.jslt.json +26 -0
  64. package/stylesheets/workflow-to-state.jslt.json +41 -0
@@ -0,0 +1,62 @@
1
+ {
2
+ "$jslt": "0.1",
3
+ "rules": [
4
+ {
5
+ "match": "$",
6
+ "body": {
7
+ "direction": "TD",
8
+ "nodes": [
9
+ {
10
+ "$for": { "e": { "$entries": "$.nodes" } },
11
+ "$return": {
12
+ "id": "$e.key",
13
+ "label": "$e.key",
14
+ "shape": {
15
+ "$if": [{ "$eq": ["$e.value.kind", "input"] }, "stadium",
16
+ { "$if": [{ "$eq": ["$e.value.kind", "output"] }, "doublecircle",
17
+ { "$if": [{ "$eq": ["$e.value.kind", "const"] }, "circle",
18
+ { "$if": [{ "$eq": ["$e.value.kind", "query"] }, "rect",
19
+ { "$if": [{ "$eq": ["$e.value.kind", "jslt"] }, "round",
20
+ "subroutine"] }] }] }] }]
21
+ }
22
+ }
23
+ }
24
+ ],
25
+ "edges": [
26
+ {
27
+ "$for": { "g": "$.edges[*]" },
28
+ "$return": {
29
+ "$let": {
30
+ "portText": { "$if": ["$g.port", "$g.port"] },
31
+ "selectText": {
32
+ "$if": [
33
+ { "$and": [{ "$exists": "$g.select" }, { "$not": { "$is-null": "$g.select" } }] },
34
+ { "$if": [{ "$is-string": "$g.select" }, "$g.select", "…"] }
35
+ ]
36
+ }
37
+ },
38
+ "$return": {
39
+ "$let": {
40
+ "pieces": { "$seq": ["$portText", "$selectText"] }
41
+ },
42
+ "$return": {
43
+ "from": "$g.from",
44
+ "to": "$g.to",
45
+ "stroke": "solid",
46
+ "head": "arrow",
47
+ "tail": "none",
48
+ "length": 2,
49
+ "label": { "$coalesce": [{ "$if": [{ "$exists": "$pieces" }, { "$string-join": ["$pieces", " · "] }] }, null] }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ ],
55
+ "subgraphs": [],
56
+ "classDefs": [],
57
+ "classes": [],
58
+ "styles": []
59
+ }
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$jslt": "0.1",
3
+ "rules": [
4
+ {
5
+ "match": "$",
6
+ "body": {
7
+ "$map": [
8
+ ["$$dag", "0.1"],
9
+ ["nodes", {
10
+ "$from-entries": {
11
+ "$for": { "n": "$.ast.nodes[*]" },
12
+ "$return": { "key": "$n.id", "value": { "kind": "task", "run": "$n.id" } }
13
+ }
14
+ }],
15
+ ["edges", [
16
+ {
17
+ "$for": { "g": "$.ast.edges[*]" },
18
+ "$return": {
19
+ "from": "$g.from",
20
+ "to": "$g.to",
21
+ "port": { "$if": ["$g.label", "$g.label"] }
22
+ }
23
+ }
24
+ ]]
25
+ ]
26
+ }
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$jslt": "0.1",
3
+ "rules": [
4
+ {
5
+ "match": "$",
6
+ "body": {
7
+ "initial": "$.ast.transitions[?(@.from == \"[*]\")].to",
8
+ "states": [
9
+ { "$for": { "s": "$.ast.states[*]" }, "$return": "$s.id" }
10
+ ],
11
+ "transitions": [
12
+ {
13
+ "$for": { "t": "$.ast.transitions[?(@.to != \"[*]\" && @.from != \"[*]\")]" },
14
+ "$return": {
15
+ "from": "$t.from",
16
+ "event": "$t.event",
17
+ "guard": { "$if": ["$t.guard", "$t.guard"] },
18
+ "to": "$t.to",
19
+ "effects": { "$if": ["$t.effect", [{ "run": "$t.effect" }]] }
20
+ }
21
+ }
22
+ ]
23
+ }
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$jslt": "0.1",
3
+ "rules": [
4
+ {
5
+ "match": "$",
6
+ "body": {
7
+ "states": [
8
+ { "$for": { "s": "$.states[*]" }, "$return": { "id": { "$if": [{ "$is-string": "$s" }, "$s", "$s.id"] }, "label": { "$if": [{ "$is-string": "$s" }, "$s", "$s.id"] } } }
9
+ ],
10
+ "transitions": [
11
+ {
12
+ "$if": ["$.initial", { "from": "[*]", "to": "$.initial", "label": null, "event": null, "guard": null, "effect": null, "parent": null }]
13
+ },
14
+ {
15
+ "$for": { "t": "$.transitions[*]" },
16
+ "$return": {
17
+ "$let": {
18
+ "guardText": { "$if": ["$t.guard", { "$concat": ["[", { "$if": [{ "$is-string": "$t.guard" }, "$t.guard", "…"] }, "]"] }] },
19
+ "effectText": { "$if": [{ "$exists": "$t.effects[*]" }, { "$concat": ["/ ", { "$string-join": ["$t.effects[*].run", ", "] }] }] }
20
+ },
21
+ "$return": {
22
+ "$let": {
23
+ "pieces": { "$seq": [{ "$if": ["$t.event", "$t.event"] }, "$guardText", "$effectText"] }
24
+ },
25
+ "$return": {
26
+ "from": "$t.from",
27
+ "to": "$t.to",
28
+ "label": { "$coalesce": [{ "$if": [{ "$exists": "$pieces" }, { "$string-join": ["$pieces", " "] }] }, null] },
29
+ "event": { "$coalesce": ["$t.event", null] },
30
+ "guard": { "$coalesce": [{ "$if": ["$t.guard", { "$if": [{ "$is-string": "$t.guard" }, "$t.guard", "…"] }] }, null] },
31
+ "effect": { "$coalesce": [{ "$if": [{ "$exists": "$t.effects[*]" }, { "$string-join": ["$t.effects[*].run", ", "] }] }, null] },
32
+ "parent": null
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ ]
41
+ }