@aj-shadow/z-abs-complayer-markup-client 0.0.0-aj-beta.221

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 (208) hide show
  1. package/.gitattributes +26 -0
  2. package/LICENSE.txt +96 -0
  3. package/README.md +5 -0
  4. package/npm-shrinkwrap.json +13 -0
  5. package/package.json +10 -0
  6. package/project/client/_build/Bundle-CompLayer-Markup-client.bld +40 -0
  7. package/project/client/_build/Client-CompLayer-Markup-client-jsx.bld +10 -0
  8. package/project/client/_build/Client-CompLayer-Markup-client.bld +10 -0
  9. package/project/client/_build/Client-css-CompLayer-Markup-bundle.bld +9 -0
  10. package/project/client/_build/z-abs-complayer-markup-client.prj +36 -0
  11. package/project/client/actions/action-style.js +17 -0
  12. package/project/client/actions/data-action-style.js +13 -0
  13. package/project/client/css/markup_addressing.css +30 -0
  14. package/project/client/css/markup_flowchart.css +53 -0
  15. package/project/client/css/markup_general.css +4 -0
  16. package/project/client/css/markup_image.css +10 -0
  17. package/project/client/css/markup_license.css +107 -0
  18. package/project/client/css/markup_login.css +201 -0
  19. package/project/client/css/markup_node_diagram.css +51 -0
  20. package/project/client/css/markup_sequence_diagram.css +6 -0
  21. package/project/client/css/markup_state.css +5 -0
  22. package/project/client/css/markup_table.css +57 -0
  23. package/project/client/css/markup_tc.css +32 -0
  24. package/project/client/css/markup_ts.css +36 -0
  25. package/project/client/data/addresses/data-addresses-client-address-global.js +20 -0
  26. package/project/client/data/addresses/data-addresses-client-address-local.js +20 -0
  27. package/project/client/data/addresses/data-addresses-client-interface-global.js +17 -0
  28. package/project/client/data/addresses/data-addresses-client-interface-local.js +17 -0
  29. package/project/client/data/addresses/data-addresses-dns-global.js +18 -0
  30. package/project/client/data/addresses/data-addresses-dns-local.js +19 -0
  31. package/project/client/data/addresses/data-addresses-dst-global.js +20 -0
  32. package/project/client/data/addresses/data-addresses-dst-local.js +20 -0
  33. package/project/client/data/addresses/data-addresses-network-interface-global.js +17 -0
  34. package/project/client/data/addresses/data-addresses-network-interface-local.js +17 -0
  35. package/project/client/data/addresses/data-addresses-ports-global.js +18 -0
  36. package/project/client/data/addresses/data-addresses-ports-local.js +18 -0
  37. package/project/client/data/addresses/data-addresses-server-address-global.js +20 -0
  38. package/project/client/data/addresses/data-addresses-server-address-local.js +20 -0
  39. package/project/client/data/addresses/data-addresses-server-interface-global.js +17 -0
  40. package/project/client/data/addresses/data-addresses-server-interface-local.js +17 -0
  41. package/project/client/data/addresses/data-addresses-src-global.js +21 -0
  42. package/project/client/data/addresses/data-addresses-src-local.js +21 -0
  43. package/project/client/data/addresses/data-addresses-srv-global.js +20 -0
  44. package/project/client/data/addresses/data-addresses-srv-local.js +20 -0
  45. package/project/client/data/addresses/data-addresses-sut-address-global.js +20 -0
  46. package/project/client/data/addresses/data-addresses-sut-address-local.js +20 -0
  47. package/project/client/data/addresses/data-addresses-sut-interface-global.js +19 -0
  48. package/project/client/data/addresses/data-addresses-sut-interface-local.js +19 -0
  49. package/project/client/data/data-chart/data-chart-axis.js +13 -0
  50. package/project/client/data/data-chart/data-chart-grid.js +14 -0
  51. package/project/client/data/data-chart/data-chart-line/data-chart-line-config.js +17 -0
  52. package/project/client/data/data-chart/data-chart-line/data-chart-line.js +41 -0
  53. package/project/client/data/data-config.js +14 -0
  54. package/project/client/data/data-constructor.js +18 -0
  55. package/project/client/data/data-content/data-content-audio-global.js +18 -0
  56. package/project/client/data/data-content/data-content-audio-local.js +18 -0
  57. package/project/client/data/data-content/data-content-documents-global.js +18 -0
  58. package/project/client/data/data-content/data-content-documents-local.js +18 -0
  59. package/project/client/data/data-content/data-content-image-global.js +21 -0
  60. package/project/client/data/data-content/data-content-image-local.js +21 -0
  61. package/project/client/data/data-content/data-content-other-global.js +20 -0
  62. package/project/client/data/data-content/data-content-other-local.js +20 -0
  63. package/project/client/data/data-content/data-content-text-global.js +20 -0
  64. package/project/client/data/data-content/data-content-text-local.js +20 -0
  65. package/project/client/data/data-content/data-content-video-global.js +20 -0
  66. package/project/client/data/data-content/data-content-video-local.js +20 -0
  67. package/project/client/data/data-data.js +28 -0
  68. package/project/client/data/data-dependencies/data-dependencies.js +17 -0
  69. package/project/client/data/data-documentation/data-documentation-navigation.js +15 -0
  70. package/project/client/data/data-documentation/data-documentation.js +20 -0
  71. package/project/client/data/data-flowchart/data-flowchart-block.js +33 -0
  72. package/project/client/data/data-flowchart/data-flowchart-connection.js +17 -0
  73. package/project/client/data/data-flowchart/data-flowchart.js +30 -0
  74. package/project/client/data/data-html/data-html-anchor.js +12 -0
  75. package/project/client/data/data-html/data-html-br.js +11 -0
  76. package/project/client/data/data-html/data-html-button.js +15 -0
  77. package/project/client/data/data-html/data-html-log-start.js +12 -0
  78. package/project/client/data/data-html/data-html-log-stop.js +13 -0
  79. package/project/client/data/data-html/data-html-log.js +16 -0
  80. package/project/client/data/data-html/data-html-toolbar.js +19 -0
  81. package/project/client/data/data-image/data-image.js +20 -0
  82. package/project/client/data/data-lab/data-lab-interface-client.js +19 -0
  83. package/project/client/data/data-lab/data-lab-interface-server.js +19 -0
  84. package/project/client/data/data-lab/data-lab-interface-sut.js +20 -0
  85. package/project/client/data/data-lab/data-lab-network.js +31 -0
  86. package/project/client/data/data-lab/data-lab.js +21 -0
  87. package/project/client/data/data-licenses/data-licenses.js +16 -0
  88. package/project/client/data/data-node-diagram/data-node-diagram-config.js +21 -0
  89. package/project/client/data/data-node-diagram/data-node-diagram-connection.js +18 -0
  90. package/project/client/data/data-node-diagram/data-node-diagram-group.js +16 -0
  91. package/project/client/data/data-node-diagram/data-node-diagram-node.js +22 -0
  92. package/project/client/data/data-node-diagram/data-node-diagram.js +47 -0
  93. package/project/client/data/data-repos/data-repos-content-local.js +15 -0
  94. package/project/client/data/data-repos/data-repos-data-local.js +15 -0
  95. package/project/client/data/data-sequence-diagram/data-sequence-diagram-config.js +22 -0
  96. package/project/client/data/data-sequence-diagram/data-sequence-diagram-message.js +17 -0
  97. package/project/client/data/data-sequence-diagram/data-sequence-diagram-node.js +11 -0
  98. package/project/client/data/data-sequence-diagram/data-sequence-diagram.js +32 -0
  99. package/project/client/data/data-state-machine/data-state-machine-config.js +17 -0
  100. package/project/client/data/data-state-machine/data-state-machine-state.js +29 -0
  101. package/project/client/data/data-state-machine/data-state-machine-transition.js +18 -0
  102. package/project/client/data/data-state-machine/data-state-machine.js +37 -0
  103. package/project/client/data/data-system-under-test/data-system-under-test-instances.js +15 -0
  104. package/project/client/data/data-system-under-test/data-system-under-test-nodes.js +18 -0
  105. package/project/client/data/data-table/data-table-config.js +21 -0
  106. package/project/client/data/data-table-key-value.js +56 -0
  107. package/project/client/data/data-test-case/data-actor.js +282 -0
  108. package/project/client/data/data-test-case/data-test-case-settings.js +49 -0
  109. package/project/client/data/data-test-case/data-test-case.js +19 -0
  110. package/project/client/data/data-test-case/data-test-data-iteration.js +54 -0
  111. package/project/client/data/data-test-case/data-test-data-test-case.js +16 -0
  112. package/project/client/data/data-test-case/data-verification-test-case.js +24 -0
  113. package/project/client/data/data-test-data/data-test-data-environment-global.js +18 -0
  114. package/project/client/data/data-test-data/data-test-data-environment-local.js +18 -0
  115. package/project/client/data/data-test-data/data-test-data-environment-static.js +16 -0
  116. package/project/client/data/data-test-data/data-test-data-general-global.js +18 -0
  117. package/project/client/data/data-test-data/data-test-data-general-local.js +18 -0
  118. package/project/client/data/data-test-data/data-test-data-output-global.js +18 -0
  119. package/project/client/data/data-test-data/data-test-data-output-local.js +18 -0
  120. package/project/client/data/data-test-data/data-test-data-system-global.js +18 -0
  121. package/project/client/data/data-test-data/data-test-data-system-local.js +18 -0
  122. package/project/client/data/data-test-suite/data-test-suite-abstraction.js +72 -0
  123. package/project/client/data/data-test-suite/data-test-suite.js +15 -0
  124. package/project/client/data/data-tree/data-tree-node.js +17 -0
  125. package/project/client/data/data-tree/data-tree.js +13 -0
  126. package/project/client/markup/markup-addresses/markup-addresses-client-address.js +31 -0
  127. package/project/client/markup/markup-addresses/markup-addresses-client-interface.js +31 -0
  128. package/project/client/markup/markup-addresses/markup-addresses-dns.js +32 -0
  129. package/project/client/markup/markup-addresses/markup-addresses-dst.js +31 -0
  130. package/project/client/markup/markup-addresses/markup-addresses-network-interface.js +31 -0
  131. package/project/client/markup/markup-addresses/markup-addresses-ports.js +31 -0
  132. package/project/client/markup/markup-addresses/markup-addresses-server-address.js +31 -0
  133. package/project/client/markup/markup-addresses/markup-addresses-server-interface.js +31 -0
  134. package/project/client/markup/markup-addresses/markup-addresses-src.js +31 -0
  135. package/project/client/markup/markup-addresses/markup-addresses-srv.js +31 -0
  136. package/project/client/markup/markup-addresses/markup-addresses-sut-address.js +31 -0
  137. package/project/client/markup/markup-addresses/markup-addresses-sut-interface.js +31 -0
  138. package/project/client/markup/markup-chart/markup-chart-line.js +92 -0
  139. package/project/client/markup/markup-content/markup-content-audio.js +31 -0
  140. package/project/client/markup/markup-content/markup-content-documents.js +31 -0
  141. package/project/client/markup/markup-content/markup-content-image.js +31 -0
  142. package/project/client/markup/markup-content/markup-content-other.js +31 -0
  143. package/project/client/markup/markup-content/markup-content-text.js +31 -0
  144. package/project/client/markup/markup-content/markup-content-video.js +31 -0
  145. package/project/client/markup/markup-dependencies/markup-dependencies.js +30 -0
  146. package/project/client/markup/markup-documentation/markup-documentation-anchor.js +37 -0
  147. package/project/client/markup/markup-documentation/markup-documentation-api-status.js +67 -0
  148. package/project/client/markup/markup-documentation/markup-documentation-code.js +20 -0
  149. package/project/client/markup/markup-documentation/markup-documentation-div.js +34 -0
  150. package/project/client/markup/markup-documentation/markup-documentation-documentation-status.js +67 -0
  151. package/project/client/markup/markup-documentation/markup-documentation-embed.js +23 -0
  152. package/project/client/markup/markup-documentation/markup-documentation-html.js +139 -0
  153. package/project/client/markup/markup-documentation/markup-documentation-ie.js +21 -0
  154. package/project/client/markup/markup-documentation/markup-documentation-image.js +46 -0
  155. package/project/client/markup/markup-documentation/markup-documentation-lab.js +19 -0
  156. package/project/client/markup/markup-documentation/markup-documentation-local-note.js +33 -0
  157. package/project/client/markup/markup-documentation/markup-documentation-navigation.js +109 -0
  158. package/project/client/markup/markup-documentation/markup-documentation-page.js +262 -0
  159. package/project/client/markup/markup-documentation/markup-documentation-ref.js +28 -0
  160. package/project/client/markup/markup-documentation/markup-documentation-result.js +21 -0
  161. package/project/client/markup/markup-documentation/markup-documentation-state-machine.js +194 -0
  162. package/project/client/markup/markup-documentation/markup-documentation.js +74 -0
  163. package/project/client/markup/markup-flowchart.js +264 -0
  164. package/project/client/markup/markup-lab.js +116 -0
  165. package/project/client/markup/markup-licenses/markup-licenses.js +29 -0
  166. package/project/client/markup/markup-node-diagram.js +435 -0
  167. package/project/client/markup/markup-parse-helper.js +26 -0
  168. package/project/client/markup/markup-pattern-config.js +53 -0
  169. package/project/client/markup/markup-pattern-data.js +50 -0
  170. package/project/client/markup/markup-pattern-function.js +47 -0
  171. package/project/client/markup/markup-repos/markup-repos.js +31 -0
  172. package/project/client/markup/markup-sequence-diagram.js +466 -0
  173. package/project/client/markup/markup-system-under-test/markup-system-under-test-instances.js +29 -0
  174. package/project/client/markup/markup-system-under-test/markup-system-under-test-nodes.js +30 -0
  175. package/project/client/markup/markup-table-key-value-parse.js +25 -0
  176. package/project/client/markup/markup-table-key-value-stringify.js +91 -0
  177. package/project/client/markup/markup-table-key-value.js +18 -0
  178. package/project/client/markup/markup-table-name-value.js +101 -0
  179. package/project/client/markup/markup-table.js +85 -0
  180. package/project/client/markup/markup-tables-parser.js +122 -0
  181. package/project/client/markup/markup-test-case/markup-test-case.js +67 -0
  182. package/project/client/markup/markup-test-data/markup-test-data-environment.js +31 -0
  183. package/project/client/markup/markup-test-data/markup-test-data-general.js +31 -0
  184. package/project/client/markup/markup-test-data/markup-test-data-output.js +31 -0
  185. package/project/client/markup/markup-test-data/markup-test-data-system.js +31 -0
  186. package/project/client/markup/markup-test-suite/markup-test-suite.js +40 -0
  187. package/project/client/react-components/helper/line-data.js +16 -0
  188. package/project/client/react-components/helper/line-object.js +22 -0
  189. package/project/client/react-components/helper/scroll-data.js +74 -0
  190. package/project/client/react-components/markup/component-chart/component-image-chart-line.jsx +203 -0
  191. package/project/client/react-components/markup/component-code.jsx +50 -0
  192. package/project/client/react-components/markup/component-document.jsx +105 -0
  193. package/project/client/react-components/markup/component-documentation-anchor.jsx +47 -0
  194. package/project/client/react-components/markup/component-embed.jsx +48 -0
  195. package/project/client/react-components/markup/component-image-flowchart.jsx +389 -0
  196. package/project/client/react-components/markup/component-image-image.jsx +32 -0
  197. package/project/client/react-components/markup/component-image-lab.jsx +696 -0
  198. package/project/client/react-components/markup/component-image-node-diagram.jsx +506 -0
  199. package/project/client/react-components/markup/component-image-result.jsx +22 -0
  200. package/project/client/react-components/markup/component-image-sequence-diagram.jsx +645 -0
  201. package/project/client/react-components/markup/component-image-state-machine.jsx +633 -0
  202. package/project/client/react-components/markup/component-image-table.jsx +96 -0
  203. package/project/client/react-components/markup/component-local-note.jsx +99 -0
  204. package/project/client/react-components/markup/component-markup-remarkable.jsx +79 -0
  205. package/project/client/react-components/markup/component-markup.jsx +1036 -0
  206. package/project/client/react-components/markup/component-table-data-table.jsx +146 -0
  207. package/project/client/stores/style-store.js +96 -0
  208. package/project/z-abs-complayer-markup-client.tree +239 -0
@@ -0,0 +1,33 @@
1
+
2
+ 'use strict';
3
+
4
+ import GuidGenerator from 'z-abs-corelayer-cs/clientServer/guid-generator';
5
+
6
+
7
+ class MarkupDocumentationLocalNote {
8
+ constructor() {
9
+ this.key = 'NOTE';
10
+ this.type = 'markup_local_note';
11
+ }
12
+
13
+ stringify(dataLocalNote) {
14
+ return `${this.key}={"guid":"${dataLocalNote.guid}"}`;
15
+ }
16
+
17
+ parse(markup) {
18
+ let dataLocalNote = null;
19
+ try {
20
+ dataLocalNote = JSON.parse(markup);
21
+ }
22
+ catch(err) {}
23
+ if(dataLocalNote && dataLocalNote.guid) {
24
+ return dataLocalNote;
25
+ }
26
+ return {
27
+ guid: GuidGenerator.create()
28
+ };
29
+ }
30
+ }
31
+
32
+
33
+ module.exports = new MarkupDocumentationLocalNote() ;
@@ -0,0 +1,109 @@
1
+
2
+ 'use strict';
3
+
4
+ const DataDocumentationNavigation = require('../../data/data-documentation/data-documentation-navigation');
5
+ const MarkupTableKeyValue = require('../markup-table-key-value');
6
+ const MarkupTablesParser = require('../markup-tables-parser');
7
+
8
+
9
+ class MarkupDocumentationNavigation {
10
+ stringify(navigations) {
11
+ this._handleStacks(navigations);
12
+ const navigation = navigations.map((navigation) => {
13
+ let nameLength = 0;
14
+ let linkLength = 0;
15
+ navigation.refs.forEach((ref) => {
16
+ nameLength = Math.max(nameLength, ref.name.length);
17
+ linkLength = Math.max(linkLength, ref.link.length);
18
+ });
19
+ const headingLength = Math.max(nameLength + linkLength + 1, navigation.heading.length);
20
+ const head = `|${navigation.heading}${' '.repeat(headingLength - navigation.heading.length)}|`;
21
+ const rows = navigation.refs.map((ref) => {
22
+ return `|${ref.name}${' '.repeat(nameLength - ref.name.length)}|${ref.link}${' '.repeat(linkLength - ref.link.length)}|`;
23
+ });
24
+ return `${head}\n${rows.join('\n')}`
25
+ });
26
+ return `${navigation.join('\n\n')}`;
27
+ }
28
+
29
+ parse(markup) {
30
+ const objectTables = MarkupTablesParser.parse(markup);
31
+ if(!objectTables.success) {
32
+ return {
33
+ success: false,
34
+ rows: objectTables.rows
35
+ };
36
+ }
37
+ const navigations = [];
38
+ const uniqueLinks = new Map();
39
+ let result = true;
40
+ objectTables.objects.forEach((objectTable) => {
41
+ if(1 <= objectTable.length) {
42
+ let heading;
43
+ if(1 === objectTable[0].columns.length) {
44
+ heading = objectTable[0].columns[0];
45
+ }
46
+ else {
47
+ return;
48
+ }
49
+ const navigation = {
50
+ heading: heading,
51
+ refs: []
52
+ };
53
+ navigations.push(navigation);
54
+ if(2 <= objectTable.length) {
55
+ for(let i = 1; i < objectTable.length; ++i) {
56
+ if(2 === objectTable[i].columns.length) {
57
+ const link = objectTable[i].columns[1];
58
+ if(uniqueLinks.has(link)) {
59
+ result = false;
60
+ objectTables.rows.forEach((row) => {
61
+ if(2 === row.columns.length) {
62
+ if(link === row.columns[1]) {
63
+ row.success = false;
64
+ }
65
+ }
66
+ });
67
+ }
68
+ else {
69
+ uniqueLinks.set(link);
70
+ }
71
+ navigation.refs.push({
72
+ name: objectTable[i].columns[0],
73
+ link: link
74
+ });
75
+ }
76
+ }
77
+ }
78
+ }
79
+ });
80
+ if(result) {
81
+ return {
82
+ success: true,
83
+ navigations: navigations
84
+ };
85
+ }
86
+ else {
87
+ return {
88
+ success: false,
89
+ rows: objectTables.rows
90
+ };
91
+ }
92
+ }
93
+
94
+ _handleStacks(navigations) {
95
+ navigations.findIndex((navigation) => {
96
+ const refIndex = navigation.refs.findIndex((ref) => {
97
+ return null !== ref.link.match(/^\[\[stack\-[a-z-]+\]\]/);
98
+ });
99
+ if(-1 !== refIndex) {
100
+ navigation.refs = [{
101
+ name: '[[stack]]',
102
+ link: ''
103
+ }];
104
+ }
105
+ });
106
+ }
107
+ }
108
+
109
+ module.exports = new MarkupDocumentationNavigation();
@@ -0,0 +1,262 @@
1
+
2
+ 'use strict';
3
+
4
+ const MarkupChartLine = require('../markup-chart/markup-chart-line');
5
+ const MarkupDocumentationAnchor = require('./markup-documentation-anchor');
6
+ const MarkupDocumentationCode = require('./markup-documentation-code');
7
+ const MarkupSequenceDiagram = require('../markup-sequence-diagram');
8
+ const MarkupLab = require('../markup-lab');
9
+ const MarkupFlowchart = require('../markup-flowchart');
10
+ const MarkupNodeDiagram = require('../markup-node-diagram');
11
+ const MarkupDocumentationApiStatus = require('./markup-documentation-api-status');
12
+ const MarkupDocumentationDiv = require('./markup-documentation-div');
13
+ const MarkupDocumentationStatus = require('./markup-documentation-documentation-status');
14
+ const MarkupDocumentationEmbed = require('./markup-documentation-embed');
15
+ const MarkupDocumentationIe = require('./markup-documentation-ie');
16
+ const MarkupDocumentationRef = require('./markup-documentation-ref');
17
+ const MarkupDocumentationResult = require('./markup-documentation-result');
18
+ const MarkupDocumentationHtml = require('./markup-documentation-html');
19
+ const MarkupDocumentationImage = require('./markup-documentation-image');
20
+ const MarkupDocumentationLab = require('./markup-documentation-lab');
21
+ const MarkupDocumentationLocalNote = require('./markup-documentation-local-note');
22
+ const MarkupDocumentationStateMachine = require('./markup-documentation-state-machine');
23
+ const MarkupTable = require('../markup-table');
24
+ const MarkupTestCase = require('../markup-test-case/markup-test-case');
25
+ const MarkupTestSuite = require('../markup-test-suite/markup-test-suite');
26
+
27
+
28
+ class MarkupDocumentationPage {
29
+ constructor() {
30
+ this.markups = new Map();
31
+ this.markupKeySimples = new Map();
32
+ this.markupTypeSimples = new Map();
33
+ this._addSimple(MarkupDocumentationApiStatus);
34
+ this._addSimple(MarkupDocumentationLocalNote);
35
+ this._addSimple(MarkupDocumentationAnchor);
36
+ this._addSimple(MarkupDocumentationStatus);
37
+ this._addSimple(MarkupDocumentationEmbed);
38
+ this._addSimple(MarkupDocumentationIe);
39
+ this._addSimple(MarkupDocumentationRef);
40
+ this._addSimple(MarkupDocumentationResult);
41
+ this._addSimple(MarkupDocumentationDiv);
42
+ this._addSimple(MarkupDocumentationImage);
43
+ this.markupTypeComplex = [];
44
+ this._addComplex(MarkupChartLine);
45
+ this._addComplex(MarkupDocumentationCode);
46
+ this._addComplex(MarkupFlowchart);
47
+ this._addComplex(MarkupDocumentationHtml);
48
+ this._addComplex(MarkupLab);
49
+ this._addComplex(MarkupNodeDiagram);
50
+ this._addComplex(MarkupSequenceDiagram);
51
+ this._addComplex(MarkupDocumentationStateMachine);
52
+ this._addComplex(MarkupTable);
53
+ this._addComplex(MarkupTestCase);
54
+ this._addComplex(MarkupTestSuite);
55
+ }
56
+
57
+ stringify(page) {
58
+ if(undefined !== page) {
59
+ const stringified = page.map((value) => {
60
+ if('markup' === value.type) {
61
+ return value.value;
62
+ }
63
+ else if(MarkupDocumentationPage.RAW_NAME === value.type) {
64
+ return `${MarkupDocumentationPage.RAW_START}${value.value.replace(new RegExp('```', 'g'), '\\`\\`\\`')}${MarkupDocumentationPage.PART}`
65
+ }
66
+ else if(MarkupDocumentationPage.ESCAPE_NAME === value.type) {
67
+ return `${MarkupDocumentationPage.ESCAPE_START}\n${this._removeLastLineBreak(this._escapeStringify(value.value))}\n${MarkupDocumentationPage.PART}`
68
+ }
69
+ else {
70
+ for(let i = 0; i < this.markupTypeComplex.length; ++i) {
71
+ const markupObject = this.markupTypeComplex[i];
72
+ const markupName = markupObject.markupName();
73
+ if(markupName === value.type) {
74
+ return `${MarkupDocumentationPage.PART}${markupName}\n${markupObject.stringify(value.value, false)}\n${MarkupDocumentationPage.PART}`
75
+ }
76
+ }
77
+ const markupObject = this.markupTypeSimples.get(value.type);
78
+ if(markupObject) {
79
+ return `${MarkupDocumentationPage.SIMPLE_START}${markupObject.stringify(value.value)}${MarkupDocumentationPage.SIMPLE_STOP}`;
80
+ }
81
+ }
82
+ });
83
+ return `${stringified.join('')}`;
84
+ }
85
+ else {
86
+ return '';
87
+ }
88
+ }
89
+
90
+ parse(markup) {
91
+ if(undefined !== markup) {
92
+ return this._getParse(markup);
93
+ }
94
+ else {
95
+ return [];
96
+ }
97
+ }
98
+
99
+ _getParse(markup, fromIndex = 0, searchIndex = 0, foundParts = []) {
100
+ const indexStart = markup.indexOf(MarkupDocumentationPage.PART, searchIndex);
101
+ const indexSimpleStart = markup.indexOf(MarkupDocumentationPage.SIMPLE_START, searchIndex);
102
+ if ((indexStart < indexSimpleStart && -1 !== indexStart) || (-1 !== indexStart && -1 === indexSimpleStart)) {
103
+ let indexStop = markup.indexOf(MarkupDocumentationPage.PART, indexStart + MarkupDocumentationPage.PART_LENGTH);
104
+ if(-1 === indexStop) {
105
+ indexStop = indexStart + MarkupDocumentationPage.PART_LENGTH;
106
+ }
107
+ if(markup.substr(indexStart, MarkupDocumentationPage.RAW_LENGTH, indexStop).startsWith(MarkupDocumentationPage.RAW_START)) {
108
+ if(fromIndex !== indexStart) {
109
+ this._setParseValue(foundParts, markup, fromIndex, indexStart);
110
+ }
111
+ const value = markup.substring(indexStart + MarkupDocumentationPage.RAW_START_LENGTH, indexStop);
112
+ foundParts.push({
113
+ type: MarkupDocumentationPage.RAW_NAME,
114
+ value: value,
115
+ lines: value.split('\n').length
116
+ });
117
+ fromIndex = indexStop + MarkupDocumentationPage.PART_LENGTH;
118
+ return this._getParse(markup, fromIndex, indexStop + MarkupDocumentationPage.PART_LENGTH, foundParts);
119
+ }
120
+ else if(markup.substr(indexStart, MarkupDocumentationPage.ESCAPE_START_LENGTH, indexStop).startsWith(MarkupDocumentationPage.ESCAPE_START)) {
121
+ if(fromIndex !== indexStart) {
122
+ this._setParseValue(foundParts, markup, fromIndex, indexStart);
123
+ }
124
+ const stringValue = markup.substring(indexStart + MarkupDocumentationPage.ESCAPE_START_LENGTH, indexStop);
125
+ const value = this._removeFirstLineBreak(this._regExpFixReplace(stringValue));
126
+ foundParts.push({
127
+ type: MarkupDocumentationPage.ESCAPE_NAME,
128
+ value: value,
129
+ lines: stringValue.split('\n').length
130
+ });
131
+ fromIndex = indexStop + MarkupDocumentationPage.PART_LENGTH;
132
+ return this._getParse(markup, fromIndex, indexStop + MarkupDocumentationPage.PART_LENGTH, foundParts);
133
+ }
134
+ else {
135
+ for(let i = 0; i < this.markupTypeComplex.length; ++i) {
136
+ const markupObject = this.markupTypeComplex[i];
137
+ const markupName = markupObject.markupName();
138
+ const startLength = MarkupDocumentationPage.PART_LENGTH + markupName.length;
139
+ if(markup.substr(indexStart, startLength).startsWith(MarkupDocumentationPage.PART + markupName)) {
140
+ if(fromIndex !== indexStart) {
141
+ this._setParseValue(foundParts, markup, fromIndex, indexStart);
142
+ }
143
+ const linesValue = markup.substring(indexStart, indexStop + MarkupDocumentationPage.PART_LENGTH);
144
+ const stringValue = markup.substring(indexStart + startLength + 1, indexStop - 1);
145
+ const value = markupObject.parse(stringValue);
146
+ foundParts.push({
147
+ type: markupName,
148
+ value: value,
149
+ lines: linesValue.split('\n').length
150
+ });
151
+ fromIndex = indexStop + MarkupDocumentationPage.PART_LENGTH;
152
+ return this._getParse(markup, fromIndex, indexStop + MarkupDocumentationPage.PART_LENGTH, foundParts);
153
+ }
154
+ }
155
+ }
156
+ return this._getParse(markup, fromIndex, indexStop + MarkupDocumentationPage.PART_LENGTH, foundParts);
157
+ }
158
+ else if ((indexSimpleStart < indexStart && -1 !== indexSimpleStart) || (-1 !== indexSimpleStart && -1 === indexStart)) {
159
+ let indexSimpleStop = markup.indexOf(MarkupDocumentationPage.SIMPLE_STOP, indexSimpleStart + MarkupDocumentationPage.SIMPLE_START_LENGTH);
160
+ let simple = markup.substring(indexSimpleStart + MarkupDocumentationPage.SIMPLE_START_LENGTH, indexSimpleStop);
161
+ let simpleKeyStopIndex = simple.indexOf('=');
162
+ let key = simple;
163
+ let json = '';
164
+ if(-1 !== simpleKeyStopIndex) {
165
+ key = simple.substring(0, simpleKeyStopIndex);
166
+ json = simple.substring(simpleKeyStopIndex + 1);
167
+ }
168
+ let markupObject = this.markupKeySimples.get(key);
169
+ if(markupObject) {
170
+ if(fromIndex !== indexSimpleStart) {
171
+ this._setParseValue(foundParts, markup, fromIndex, indexSimpleStart);
172
+ }
173
+ foundParts.push({
174
+ type: markupObject.type,
175
+ value: markupObject.parse(json, indexSimpleStop),
176
+ lines: 1
177
+ });
178
+ fromIndex = indexSimpleStop + MarkupDocumentationPage.SIMPLE_STOP_LENGTH;
179
+ return this._getParse(markup, fromIndex, fromIndex, foundParts);
180
+ }
181
+ return this._getParse(markup, fromIndex, indexSimpleStart + MarkupDocumentationPage.SIMPLE_START_LENGTH, foundParts);
182
+ }
183
+ else {
184
+ this._setParseValue(foundParts, markup, fromIndex);
185
+ return foundParts;
186
+ }
187
+ }
188
+
189
+ _setParseValue(foundParts, markup, start, stop) {
190
+ const value = markup.substring(start, stop);
191
+ if(0 !== value.length) {
192
+ foundParts.push({
193
+ type: 'markup',
194
+ value: value,
195
+ lines: value.split('\n').length
196
+ });
197
+ }
198
+ }
199
+
200
+ _regExpFixReplace(s, start = 0) {
201
+ let index = s.indexOf('\\`\\`\\`');
202
+ if(-1 == index) {
203
+ return s;
204
+ }
205
+ return this._regExpFixReplace(`${s.substr(0, index)}\`\`\`${s.substring(index + 6)}`, index + 6 + 1);
206
+ }
207
+
208
+ _escapeStringify(s, start=0) {
209
+ let index = s.indexOf('```');
210
+ if(-1 == index) {
211
+ return s;
212
+ }
213
+ return this._escapeStringify(`${s.substr(0, index)}\\\`\\\`\\\`${s.substring(index + 3)}`, index + 3 + 1);
214
+ }
215
+
216
+ _removeFirstLineBreak(s) {
217
+ if(s.startsWith('\n')) {
218
+ return s.substring(1);
219
+ }
220
+ else {
221
+ return s;
222
+ }
223
+ }
224
+
225
+ _removeLastLineBreak(s) {
226
+ if(s.endsWith('\n')) {
227
+ return s.substring(0, s.length - 1);
228
+ }
229
+ else {
230
+ return s;
231
+ }
232
+ }
233
+
234
+ _addSimple(markupObject) {
235
+ this.markupKeySimples.set(markupObject.key, markupObject);
236
+ this.markupTypeSimples.set(markupObject.type, markupObject);
237
+ }
238
+
239
+ _addComplex(markupObject) {
240
+ this.markupTypeComplex.push(markupObject);
241
+ }
242
+ }
243
+
244
+ MarkupDocumentationPage.PART = '```';
245
+ MarkupDocumentationPage.PART_LENGTH = MarkupDocumentationPage.PART.length;
246
+
247
+ MarkupDocumentationPage.SIMPLE_START = '[[';
248
+ MarkupDocumentationPage.SIMPLE_START_LENGTH = MarkupDocumentationPage.SIMPLE_START.length;
249
+
250
+ MarkupDocumentationPage.SIMPLE_STOP = ']]';
251
+ MarkupDocumentationPage.SIMPLE_STOP_LENGTH = MarkupDocumentationPage.SIMPLE_STOP.length;
252
+
253
+ MarkupDocumentationPage.RAW_NAME = 'raw';
254
+ MarkupDocumentationPage.RAW_START = MarkupDocumentationPage.PART + MarkupDocumentationPage.RAW_NAME;
255
+ MarkupDocumentationPage.RAW_START_LENGTH = MarkupDocumentationPage.RAW_START.length;
256
+
257
+ MarkupDocumentationPage.ESCAPE_NAME = 'escape';
258
+ MarkupDocumentationPage.ESCAPE_START = MarkupDocumentationPage.PART + MarkupDocumentationPage.ESCAPE_NAME;
259
+ MarkupDocumentationPage.ESCAPE_START_LENGTH = MarkupDocumentationPage.ESCAPE_START.length;
260
+
261
+
262
+ module.exports = new MarkupDocumentationPage();
@@ -0,0 +1,28 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class MarkupDocumentationRef {
6
+ constructor() {
7
+ this.key = 'REF';
8
+ this.type = 'markup_ref';
9
+ }
10
+
11
+ stringify(dataRef) {
12
+ return `${this.key}=${dataRef.text}, ${dataRef.refName}`;
13
+ }
14
+
15
+ parse(markup) {
16
+ const parameters = markup.split(',');
17
+ parameters.forEach((parameter, index) => {
18
+ parameters[index] = parameter.trim();
19
+ });
20
+ return {
21
+ text: 1 <= parameters.length ? parameters[0] : 'Unknown',
22
+ refName: 2 <= parameters.length ? parameters[1] : 'Unknown'
23
+ };
24
+ }
25
+ }
26
+
27
+
28
+ module.exports = new MarkupDocumentationRef() ;
@@ -0,0 +1,21 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class MarkupDocumentationResult {
6
+ constructor() {
7
+ this.key = 'RESULT';
8
+ this.type = 'markup_result';
9
+ }
10
+
11
+ stringify(dataResult) {
12
+ return `${this.key}=${dataResult}`;
13
+ }
14
+
15
+ parse(markup) {
16
+ return markup;
17
+ }
18
+ }
19
+
20
+
21
+ module.exports = new MarkupDocumentationResult() ;
@@ -0,0 +1,194 @@
1
+
2
+ 'use strict';
3
+
4
+ const MarkupParseHelper = require('../markup-parse-helper');
5
+ const DataStateMachineDiagramConfig = require('../../data/data-state-machine/data-state-machine-config');
6
+ const DataStateMachine = require('../../data/data-state-machine/data-state-machine');
7
+ const DataStateMachineState = require('../../data/data-state-machine/data-state-machine-state');
8
+ const DataStateMachineTransition = require('../../data/data-state-machine/data-state-machine-transition');
9
+ const MarkupPatternConfig = require('../markup-pattern-config');
10
+
11
+
12
+ class MarkupDocumentationStateMachine {
13
+ markupName() {
14
+ return 'state';
15
+ }
16
+
17
+ stringify(stateMachine) {
18
+ let stringified = '';
19
+ if('' !== stateMachine.title) {
20
+ stringified += `${MarkupDocumentationStateMachine.TAG_TITLE}${stateMachine.title}\n`;
21
+ }
22
+ stringified += MarkupPatternConfig.stringify(stateMachine.dataStateMachineDiagramConfig);
23
+ if(1 <= stateMachine.stateRows.length) {
24
+ for(let i = 0; i < stateMachine.stateRows.length; ++i) {
25
+ if(stateMachine.stateRows[i][0].comment) {
26
+ stringified += '// ';
27
+ }
28
+ stringified += 'States[';
29
+ const firstState = stateMachine.stateRows[i][0];
30
+ stringified += firstState.name;
31
+ for(let j = 1; j < stateMachine.stateRows[i].length; ++j) {
32
+ const block = stateMachine.stateRows[i][j];
33
+ stringified += `, ${block.name}`;
34
+ }
35
+ stringified += ']\n';
36
+ }
37
+ }
38
+ else {
39
+ stringified += 'States[]';
40
+ }
41
+ for(let i = 0; i < stateMachine.transitions.length; ++i) {
42
+ const transition = stateMachine.transitions[i];
43
+ if(-1 !== transition.fromXIndex && -1 !== transition.fromYIndex && -1 !== transition.toXIndex && -1 !== transition.toYIndex) {
44
+ const fromState = this._getStateFromName(stateMachine, transition.fromStateName);
45
+ const toState = this._getStateFromName(stateMachine, transition.toStateName);
46
+ if(null !== fromState && null !== toState) {
47
+ stringified += '\n';
48
+ if(transition.comment) {
49
+ stringified += '// ';
50
+ }
51
+ stringified += `${fromState.name} ${this._stringifyTransitionType(transition)} ${toState.name}[${transition.type}]: ${transition.data}`;
52
+ continue;
53
+ }
54
+ }
55
+ stringified += `\n${transition.data}`
56
+ }
57
+ return stringified;
58
+ }
59
+
60
+ parse(markup) {
61
+ let rows = MarkupParseHelper.getRows(markup);
62
+ let dataStateMachine = new DataStateMachine();
63
+ rows.forEach((row) => {
64
+ this._parseRow(dataStateMachine, row);
65
+ });
66
+ return dataStateMachine;
67
+ }
68
+
69
+ _parseRow(dataStateMachine, row, comment = false) {
70
+ const trimRow = row.trim();
71
+ if(trimRow.startsWith('//')) {
72
+ this._parseRow(dataStateMachine, trimRow.substring(2), true);
73
+ }
74
+ else if(trimRow.startsWith(MarkupDocumentationStateMachine.TAG_TITLE)) {
75
+ dataStateMachine.setTitle(trimRow.substr(MarkupDocumentationStateMachine.TAG_TITLE_LENGTH));
76
+ }
77
+ else if(trimRow.startsWith('States')) {
78
+ let index = 0;
79
+ while(true) {
80
+ const start = trimRow.indexOf('[', index);
81
+ if(-1 === start) {
82
+ break;
83
+ }
84
+ const stop = trimRow.indexOf(']', start + 1);
85
+ const stateNames = trimRow.substring(start + 1, -1 !== stop ? stop : undefined).split(',');
86
+ if(null !== stateNames) {
87
+ dataStateMachine.addStateRow();
88
+ stateNames.forEach((stateName) => {
89
+ let trimState = '';
90
+ if(stateName.startsWith(',') && stateName.endsWith(',')) {
91
+ trimState = stateName.substring(1, stateName.length - 1).trim();
92
+ }
93
+ else {
94
+ trimState = stateName.trim();
95
+ }
96
+ dataStateMachine.addState(new DataStateMachineState(trimState, comment));
97
+ });
98
+ }
99
+ if(-1 === stop) {
100
+ break;
101
+ }
102
+ else {
103
+ index = stop;
104
+ }
105
+ }
106
+ }
107
+ else if(trimRow.startsWith('Config')) {
108
+ MarkupPatternConfig.parse(trimRow, dataStateMachine);
109
+ }
110
+ else {
111
+ let type = 'normal';
112
+ let data = '';
113
+ let typeStartIndex = trimRow.indexOf('[');
114
+ let typeStopIndex = trimRow.indexOf(']');
115
+ if(-1 !== typeStartIndex && -1 !== typeStopIndex) {
116
+ let types = trimRow.slice(typeStartIndex + 1, typeStopIndex).match(/([^\s,]+)/g);
117
+ if(types && 1 === types.length) {
118
+ type = types[0];
119
+ }
120
+ }
121
+ let dataIndex = trimRow.indexOf(':');
122
+ if(-1 !== dataIndex) {
123
+ data = trimRow.substring(dataIndex + 1, trimRow.length).trim();
124
+ }
125
+ let transitionTypeIndex = this._parseTransitionTypeIndex(trimRow);
126
+ if(-1 !== transitionTypeIndex) {
127
+ const transitionType = this._parseTransitionType(trimRow, transitionTypeIndex);
128
+ const from = trimRow.substring(0, transitionTypeIndex).trim();
129
+ const to = trimRow.substring(transitionTypeIndex + transitionType.size, typeStartIndex).trim();
130
+ const fromState = this._getStateFromName(dataStateMachine, from);
131
+ const toState = this._getStateFromName(dataStateMachine, to);
132
+ if(null !== fromState && null !== toState) {
133
+ dataStateMachine.addTransition(new DataStateMachineTransition(data, type, transitionType.type, fromState, toState, comment));
134
+ }
135
+ /*else if(-1 !== fromIndex) {
136
+ dataStateMachine.addTransition(new DataStateMachineTransition(trimRow, type, transitionType.type, fromState, toState));
137
+ }*/
138
+ }
139
+ }
140
+ }
141
+
142
+ _stringifyTransitionType(transition) {
143
+ if('simplex' === transition.transitionType) {
144
+ return '->';
145
+ }
146
+ else if('duplex' === transition.transitionType) {
147
+ return '<->';
148
+ }
149
+ }
150
+
151
+ _parseTransitionTypeIndex(row) {
152
+ let index = row.indexOf('<->');
153
+ if(-1 !== index) {
154
+ return index;
155
+ }
156
+ index = row.indexOf('->');
157
+ if(-1 !== index) {
158
+ return index;
159
+ }
160
+ return -1;
161
+ }
162
+
163
+ _parseTransitionType(row, index) {
164
+ if('->' === row.substr(index, 2)) {
165
+ return {
166
+ type: 'simplex',
167
+ size: 2
168
+ };
169
+ }
170
+ else if('<->' === row.substr(index, 3)) {
171
+ return {
172
+ type: 'duplex',
173
+ size: 3
174
+ };
175
+ }
176
+ return '';
177
+ }
178
+
179
+ _getStateFromName(dataStateMachine, stateName) {
180
+ for(let i = 0; i < dataStateMachine.stateRows.length; ++i) {
181
+ for(let j = 0; j < dataStateMachine.stateRows[i].length; ++j) {
182
+ if(dataStateMachine.stateRows[i][j].name === stateName) {
183
+ return dataStateMachine.stateRows[i][j];
184
+ }
185
+ }
186
+ }
187
+ return null;
188
+ }
189
+ }
190
+
191
+ MarkupDocumentationStateMachine.TAG_TITLE = 'Title: ';
192
+ MarkupDocumentationStateMachine.TAG_TITLE_LENGTH = MarkupDocumentationStateMachine.TAG_TITLE.length;
193
+
194
+ module.exports = new MarkupDocumentationStateMachine();