@bptlab/openbpt-modeler-typed-pn-variants 1.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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/assets/icons/pn-fire-transition.svg +6 -0
  4. package/assets/icons/pn-inhibitor-arc.svg +30 -0
  5. package/assets/icons/pn-place.svg +62 -0
  6. package/assets/icons/pn-transition.svg +46 -0
  7. package/assets/icons/pn-unfire-transition.svg +6 -0
  8. package/assets/icons/reset.svg +1 -0
  9. package/assets/icons/toggle-off.svg +1 -0
  10. package/assets/icons/toggle-on.svg +1 -0
  11. package/assets/simulation.css +265 -0
  12. package/assets/tpn-js.css +101 -0
  13. package/dist/lib/BaseViewer.js +181 -0
  14. package/dist/lib/BaseViewer.js.map +1 -0
  15. package/dist/lib/CustomModeler.js +100 -0
  16. package/dist/lib/CustomModeler.js.map +1 -0
  17. package/dist/lib/NavigatedViewer.js +14 -0
  18. package/dist/lib/NavigatedViewer.js.map +1 -0
  19. package/dist/lib/Viewer.js +53 -0
  20. package/dist/lib/Viewer.js.map +1 -0
  21. package/dist/lib/auto-place/CustomAutoPlace.js +10 -0
  22. package/dist/lib/auto-place/CustomAutoPlace.js.map +1 -0
  23. package/dist/lib/auto-place/CustomAutoPlaceUtil.js +51 -0
  24. package/dist/lib/auto-place/CustomAutoPlaceUtil.js.map +1 -0
  25. package/dist/lib/auto-place/index.js +9 -0
  26. package/dist/lib/auto-place/index.js.map +1 -0
  27. package/dist/lib/common/copy-paste/CommonCopyPaste.js +58 -0
  28. package/dist/lib/common/copy-paste/CommonCopyPaste.js.map +1 -0
  29. package/dist/lib/common/copy-paste/ModdleCopy.js +168 -0
  30. package/dist/lib/common/copy-paste/ModdleCopy.js.map +1 -0
  31. package/dist/lib/common/copy-paste/index.js +10 -0
  32. package/dist/lib/common/copy-paste/index.js.map +1 -0
  33. package/dist/lib/common/editor-actions/EditorActions.js +110 -0
  34. package/dist/lib/common/editor-actions/EditorActions.js.map +1 -0
  35. package/dist/lib/common/editor-actions/index.js +7 -0
  36. package/dist/lib/common/editor-actions/index.js.map +1 -0
  37. package/dist/lib/common/keyboard/KeyboardBindings.js +101 -0
  38. package/dist/lib/common/keyboard/KeyboardBindings.js.map +1 -0
  39. package/dist/lib/common/keyboard/index.js +8 -0
  40. package/dist/lib/common/keyboard/index.js.map +1 -0
  41. package/dist/lib/common/search/CommonSearchProvider.js +72 -0
  42. package/dist/lib/common/search/CommonSearchProvider.js.map +1 -0
  43. package/dist/lib/common/search/index.js +9 -0
  44. package/dist/lib/common/search/index.js.map +1 -0
  45. package/dist/lib/core/index.js +6 -0
  46. package/dist/lib/core/index.js.map +1 -0
  47. package/dist/lib/declarations-panel/Util.js +32 -0
  48. package/dist/lib/declarations-panel/Util.js.map +1 -0
  49. package/dist/lib/declarations-panel/cmd/IdentifierCommitHandler.js +34 -0
  50. package/dist/lib/declarations-panel/cmd/IdentifierCommitHandler.js.map +1 -0
  51. package/dist/lib/declarations-panel/cmd/MultiCommandHandler.js +24 -0
  52. package/dist/lib/declarations-panel/cmd/MultiCommandHandler.js.map +1 -0
  53. package/dist/lib/declarations-panel/cmd/index.js +19 -0
  54. package/dist/lib/declarations-panel/cmd/index.js.map +1 -0
  55. package/dist/lib/declarations-panel/context/DeclarationsPanelContext.js +10 -0
  56. package/dist/lib/declarations-panel/context/DeclarationsPanelContext.js.map +1 -0
  57. package/dist/lib/declarations-panel/context/index.js +2 -0
  58. package/dist/lib/declarations-panel/context/index.js.map +1 -0
  59. package/dist/lib/declarations-panel/hooks/index.js +2 -0
  60. package/dist/lib/declarations-panel/hooks/index.js.map +1 -0
  61. package/dist/lib/declarations-panel/hooks/useService.js +7 -0
  62. package/dist/lib/declarations-panel/hooks/useService.js.map +1 -0
  63. package/dist/lib/declarations-panel/provider/DeclarationsProvider.js +107 -0
  64. package/dist/lib/declarations-panel/provider/DeclarationsProvider.js.map +1 -0
  65. package/dist/lib/declarations-panel/provider/IdentifierService.js +107 -0
  66. package/dist/lib/declarations-panel/provider/IdentifierService.js.map +1 -0
  67. package/dist/lib/declarations-panel/provider/SimulationModeService.js +14 -0
  68. package/dist/lib/declarations-panel/provider/SimulationModeService.js.map +1 -0
  69. package/dist/lib/declarations-panel/provider/index.js +14 -0
  70. package/dist/lib/declarations-panel/provider/index.js.map +1 -0
  71. package/dist/lib/declarations-panel/provider/properties/ArcProps.js +123 -0
  72. package/dist/lib/declarations-panel/provider/properties/ArcProps.js.map +1 -0
  73. package/dist/lib/declarations-panel/provider/properties/IdProps.js +47 -0
  74. package/dist/lib/declarations-panel/provider/properties/IdProps.js.map +1 -0
  75. package/dist/lib/declarations-panel/provider/properties/ModelDeclarations.js +193 -0
  76. package/dist/lib/declarations-panel/provider/properties/ModelDeclarations.js.map +1 -0
  77. package/dist/lib/declarations-panel/provider/properties/NameProps.js +43 -0
  78. package/dist/lib/declarations-panel/provider/properties/NameProps.js.map +1 -0
  79. package/dist/lib/declarations-panel/provider/properties/PlaceProps.js +135 -0
  80. package/dist/lib/declarations-panel/provider/properties/PlaceProps.js.map +1 -0
  81. package/dist/lib/declarations-panel/provider/properties/ReferenceSelect.js +21 -0
  82. package/dist/lib/declarations-panel/provider/properties/ReferenceSelect.js.map +1 -0
  83. package/dist/lib/declarations-panel/provider/properties/TokenProps.js +116 -0
  84. package/dist/lib/declarations-panel/provider/properties/TokenProps.js.map +1 -0
  85. package/dist/lib/declarations-panel/provider/properties/Util.js +112 -0
  86. package/dist/lib/declarations-panel/provider/properties/Util.js.map +1 -0
  87. package/dist/lib/declarations-panel/provider/properties/VariableArcProps.js +107 -0
  88. package/dist/lib/declarations-panel/provider/properties/VariableArcProps.js.map +1 -0
  89. package/dist/lib/declarations-panel/provider/properties/index.js +8 -0
  90. package/dist/lib/declarations-panel/provider/properties/index.js.map +1 -0
  91. package/dist/lib/declarations-panel/render/DeclarationsPanel.js +197 -0
  92. package/dist/lib/declarations-panel/render/DeclarationsPanel.js.map +1 -0
  93. package/dist/lib/declarations-panel/render/DeclarationsPanelRenderer.js +154 -0
  94. package/dist/lib/declarations-panel/render/DeclarationsPanelRenderer.js.map +1 -0
  95. package/dist/lib/declarations-panel/render/PanelHeaderProvider.js +55 -0
  96. package/dist/lib/declarations-panel/render/PanelHeaderProvider.js.map +1 -0
  97. package/dist/lib/declarations-panel/render/PanelPlaceholderProvider.js +17 -0
  98. package/dist/lib/declarations-panel/render/PanelPlaceholderProvider.js.map +1 -0
  99. package/dist/lib/declarations-panel/render/index.js +9 -0
  100. package/dist/lib/declarations-panel/render/index.js.map +1 -0
  101. package/dist/lib/draw/CustomRenderer.js +361 -0
  102. package/dist/lib/draw/CustomRenderer.js.map +1 -0
  103. package/dist/lib/draw/TextRenderer.js +52 -0
  104. package/dist/lib/draw/TextRenderer.js.map +1 -0
  105. package/dist/lib/draw/index.js +8 -0
  106. package/dist/lib/draw/index.js.map +1 -0
  107. package/dist/lib/import/CustomImporter.js +177 -0
  108. package/dist/lib/import/CustomImporter.js.map +1 -0
  109. package/dist/lib/import/CustomTreeWalker.js +178 -0
  110. package/dist/lib/import/CustomTreeWalker.js.map +1 -0
  111. package/dist/lib/import/Importer.js +47 -0
  112. package/dist/lib/import/Importer.js.map +1 -0
  113. package/dist/lib/import/index.js +7 -0
  114. package/dist/lib/import/index.js.map +1 -0
  115. package/dist/lib/moddle/CustomModdle.js +86 -0
  116. package/dist/lib/moddle/CustomModdle.js.map +1 -0
  117. package/dist/lib/moddle/index.js +15 -0
  118. package/dist/lib/moddle/index.js.map +1 -0
  119. package/dist/lib/moddle/resources/dc.json +99 -0
  120. package/dist/lib/moddle/resources/diagramSchema.js +210 -0
  121. package/dist/lib/moddle/resources/diagramSchema.js.map +1 -0
  122. package/dist/lib/moddle/resources/modelSchema.js +254 -0
  123. package/dist/lib/moddle/resources/modelSchema.js.map +1 -0
  124. package/dist/lib/modeling/CustomElementFactory.js +66 -0
  125. package/dist/lib/modeling/CustomElementFactory.js.map +1 -0
  126. package/dist/lib/modeling/CustomLabelEditing.js +177 -0
  127. package/dist/lib/modeling/CustomLabelEditing.js.map +1 -0
  128. package/dist/lib/modeling/CustomModeling.js +40 -0
  129. package/dist/lib/modeling/CustomModeling.js.map +1 -0
  130. package/dist/lib/modeling/CustomUpdater.js +291 -0
  131. package/dist/lib/modeling/CustomUpdater.js.map +1 -0
  132. package/dist/lib/modeling/CustomVerification.js +111 -0
  133. package/dist/lib/modeling/CustomVerification.js.map +1 -0
  134. package/dist/lib/modeling/ElementFactory.js +56 -0
  135. package/dist/lib/modeling/ElementFactory.js.map +1 -0
  136. package/dist/lib/modeling/LabelUtil.js +151 -0
  137. package/dist/lib/modeling/LabelUtil.js.map +1 -0
  138. package/dist/lib/modeling/UpdateLabelHandler.js +86 -0
  139. package/dist/lib/modeling/UpdateLabelHandler.js.map +1 -0
  140. package/dist/lib/modeling/UpdateModdlePropertiesHandler.js +88 -0
  141. package/dist/lib/modeling/UpdateModdlePropertiesHandler.js.map +1 -0
  142. package/dist/lib/modeling/UpdatePropertiesHandler.js +136 -0
  143. package/dist/lib/modeling/UpdatePropertiesHandler.js.map +1 -0
  144. package/dist/lib/modeling/behavior/AdaptiveLabelPositioningBehavior.js +169 -0
  145. package/dist/lib/modeling/behavior/AdaptiveLabelPositioningBehavior.js.map +1 -0
  146. package/dist/lib/modeling/behavior/LabelBehavior.js +255 -0
  147. package/dist/lib/modeling/behavior/LabelBehavior.js.map +1 -0
  148. package/dist/lib/modeling/behavior/index.js +8 -0
  149. package/dist/lib/modeling/behavior/index.js.map +1 -0
  150. package/dist/lib/modeling/behavior/util/GeometricUtil.js +99 -0
  151. package/dist/lib/modeling/behavior/util/GeometricUtil.js.map +1 -0
  152. package/dist/lib/modeling/behavior/util/LabelLayoutUtil.js +178 -0
  153. package/dist/lib/modeling/behavior/util/LabelLayoutUtil.js.map +1 -0
  154. package/dist/lib/modeling/behavior/util/LineAttachmentUtil.js +175 -0
  155. package/dist/lib/modeling/behavior/util/LineAttachmentUtil.js.map +1 -0
  156. package/dist/lib/modeling/index.js +36 -0
  157. package/dist/lib/modeling/index.js.map +1 -0
  158. package/dist/lib/palette/CustomContextPadProvider.js +182 -0
  159. package/dist/lib/palette/CustomContextPadProvider.js.map +1 -0
  160. package/dist/lib/palette/CustomPaletteProvider.js +93 -0
  161. package/dist/lib/palette/CustomPaletteProvider.js.map +1 -0
  162. package/dist/lib/palette/TokenModals.js +105 -0
  163. package/dist/lib/palette/TokenModals.js.map +1 -0
  164. package/dist/lib/palette/index.js +28 -0
  165. package/dist/lib/palette/index.js.map +1 -0
  166. package/dist/lib/replace/ReplaceMenuProvider.js +84 -0
  167. package/dist/lib/replace/ReplaceMenuProvider.js.map +1 -0
  168. package/dist/lib/replace/index.js +9 -0
  169. package/dist/lib/replace/index.js.map +1 -0
  170. package/dist/lib/rules/CustomRuleProvider.js +107 -0
  171. package/dist/lib/rules/CustomRuleProvider.js.map +1 -0
  172. package/dist/lib/rules/index.js +8 -0
  173. package/dist/lib/rules/index.js.map +1 -0
  174. package/dist/lib/simulation/EventHelper.js +6 -0
  175. package/dist/lib/simulation/EventHelper.js.map +1 -0
  176. package/dist/lib/simulation/Utils.js +8 -0
  177. package/dist/lib/simulation/Utils.js.map +1 -0
  178. package/dist/lib/simulation/binding-utils/arcPlaceInfoLogic.js +157 -0
  179. package/dist/lib/simulation/binding-utils/arcPlaceInfoLogic.js.map +1 -0
  180. package/dist/lib/simulation/binding-utils/bindingUtils.js +64 -0
  181. package/dist/lib/simulation/binding-utils/bindingUtils.js.map +1 -0
  182. package/dist/lib/simulation/binding-utils/earlyReturnLogic.js +107 -0
  183. package/dist/lib/simulation/binding-utils/earlyReturnLogic.js.map +1 -0
  184. package/dist/lib/simulation/binding-utils/exactSynchro.js +102 -0
  185. package/dist/lib/simulation/binding-utils/exactSynchro.js.map +1 -0
  186. package/dist/lib/simulation/binding-utils/helpers.js +141 -0
  187. package/dist/lib/simulation/binding-utils/helpers.js.map +1 -0
  188. package/dist/lib/simulation/binding-utils/inhibitorLogic.js +166 -0
  189. package/dist/lib/simulation/binding-utils/inhibitorLogic.js.map +1 -0
  190. package/dist/lib/simulation/binding-utils/linkingLogic.js +384 -0
  191. package/dist/lib/simulation/binding-utils/linkingLogic.js.map +1 -0
  192. package/dist/lib/simulation/context-pads/ContextPads.js +141 -0
  193. package/dist/lib/simulation/context-pads/ContextPads.js.map +1 -0
  194. package/dist/lib/simulation/context-pads/FireTransitionHandler.js +481 -0
  195. package/dist/lib/simulation/context-pads/FireTransitionHandler.js.map +1 -0
  196. package/dist/lib/simulation/context-pads/FireTransitionUtils.js +169 -0
  197. package/dist/lib/simulation/context-pads/FireTransitionUtils.js.map +1 -0
  198. package/dist/lib/simulation/context-pads/FormJsAdapter.js +99 -0
  199. package/dist/lib/simulation/context-pads/FormJsAdapter.js.map +1 -0
  200. package/dist/lib/simulation/context-pads/index.js +8 -0
  201. package/dist/lib/simulation/context-pads/index.js.map +1 -0
  202. package/dist/lib/simulation/palette/Palette.js +36 -0
  203. package/dist/lib/simulation/palette/Palette.js.map +1 -0
  204. package/dist/lib/simulation/palette/index.js +6 -0
  205. package/dist/lib/simulation/palette/index.js.map +1 -0
  206. package/dist/lib/simulation/reset-simulation/ResetSimulation.js +36 -0
  207. package/dist/lib/simulation/reset-simulation/ResetSimulation.js.map +1 -0
  208. package/dist/lib/simulation/reset-simulation/index.js +6 -0
  209. package/dist/lib/simulation/reset-simulation/index.js.map +1 -0
  210. package/dist/lib/simulation/simulation-history/SimulationHistory.js +158 -0
  211. package/dist/lib/simulation/simulation-history/SimulationHistory.js.map +1 -0
  212. package/dist/lib/simulation/simulation-history/index.js +6 -0
  213. package/dist/lib/simulation/simulation-history/index.js.map +1 -0
  214. package/dist/lib/simulation/simulator/Simulator.js +131 -0
  215. package/dist/lib/simulation/simulator/Simulator.js.map +1 -0
  216. package/dist/lib/simulation/simulator/index.js +6 -0
  217. package/dist/lib/simulation/simulator/index.js.map +1 -0
  218. package/dist/lib/simulation/toggle-simulation-mode/DisableModeling.js +85 -0
  219. package/dist/lib/simulation/toggle-simulation-mode/DisableModeling.js.map +1 -0
  220. package/dist/lib/simulation/toggle-simulation-mode/ToggleSimulationMode.js +65 -0
  221. package/dist/lib/simulation/toggle-simulation-mode/ToggleSimulationMode.js.map +1 -0
  222. package/dist/lib/simulation/toggle-simulation-mode/index.js +8 -0
  223. package/dist/lib/simulation/toggle-simulation-mode/index.js.map +1 -0
  224. package/dist/lib/util/EventBusEvents.js +70 -0
  225. package/dist/lib/util/EventBusEvents.js.map +1 -0
  226. package/dist/lib/util/FileUtil.js +35 -0
  227. package/dist/lib/util/FileUtil.js.map +1 -0
  228. package/dist/lib/util/HtmlUtil.js +67 -0
  229. package/dist/lib/util/HtmlUtil.js.map +1 -0
  230. package/dist/lib/util/Util.js +60 -0
  231. package/dist/lib/util/Util.js.map +1 -0
  232. package/dist/lib/util/constants.js +6 -0
  233. package/dist/lib/util/constants.js.map +1 -0
  234. package/dist/lib/util/emptyDiagram.js +12 -0
  235. package/dist/lib/util/emptyDiagram.js.map +1 -0
  236. package/dist/lib/util/generated-icons.js +12 -0
  237. package/dist/lib/util/generated-icons.js.map +1 -0
  238. package/dist/scripts/build-icons.js +30 -0
  239. package/dist/scripts/build-icons.js.map +1 -0
  240. package/dist/tsconfig.tsbuildinfo +1 -0
  241. package/index.js +1 -0
  242. package/package.json +83 -0
@@ -0,0 +1,178 @@
1
+ import { forEach } from "min-dash";
2
+ import { Refs } from "object-refs";
3
+ import { elementToString } from "../util/Util";
4
+ import { MODELER_PREFIX } from "../util/constants";
5
+ const diRefs = new Refs({ name: "diagramElement", enumerable: true }, { name: "di", configurable: true });
6
+ /**
7
+ * Returns true if an element has the given meta-model type
8
+ *
9
+ * @param {ModdleElement} element
10
+ * @param {String} type
11
+ *
12
+ * @return {Boolean}
13
+ */
14
+ function is(element, type) {
15
+ return element.$instanceOf(type);
16
+ }
17
+ /**
18
+ * Find a suitable display candidate for definitions where the DI does not
19
+ * correctly specify one.
20
+ */
21
+ function findDisplayCandidate(definitions) {
22
+ return definitions.model;
23
+ }
24
+ export default function CustomTreeWalker(handler, translate) {
25
+ // list of containers already walked
26
+ const handledElements = {};
27
+ // list of elements to handle deferred to ensure
28
+ // prerequisites are drawn
29
+ const deferred = [];
30
+ // Helpers //////////////////////
31
+ function visitRoot(element, diagram) {
32
+ return handler.root(element, diagram);
33
+ }
34
+ function visit(element, ctx) {
35
+ const gfx = element.gfx;
36
+ // avoid multiple rendering of elements
37
+ if (gfx) {
38
+ throw new Error(translate("already rendered {element}", {
39
+ element: elementToString(element),
40
+ }));
41
+ }
42
+ // call handler
43
+ return handler.element(element, ctx);
44
+ }
45
+ function visitIfDi(element, ctx) {
46
+ try {
47
+ const gfx = element.di && visit(element, ctx);
48
+ handled(element);
49
+ return gfx;
50
+ }
51
+ catch (e) {
52
+ logError(e.message, { element: element, error: e });
53
+ console.error(translate("failed to import {element}", {
54
+ element: elementToString(element),
55
+ }));
56
+ console.error(e);
57
+ }
58
+ }
59
+ function logError(message, context) {
60
+ handler.error(message, context);
61
+ }
62
+ function handled(element) {
63
+ handledElements[element.id] = element;
64
+ }
65
+ // DI handling //////////////////////
66
+ function registerDi(di) {
67
+ const modelElement = di.modelElement;
68
+ if (modelElement) {
69
+ if (modelElement.di) {
70
+ logError(translate("multiple DI elements defined for {element}", {
71
+ element: elementToString(modelElement),
72
+ }), { element: modelElement });
73
+ }
74
+ else {
75
+ diRefs.bind(modelElement, "di");
76
+ modelElement.di = di;
77
+ }
78
+ }
79
+ else {
80
+ logError(translate("no modelElement referenced in {element}", {
81
+ element: elementToString(di),
82
+ }), { element: di });
83
+ }
84
+ }
85
+ function handleDiagram(diagram) {
86
+ handlePlane(diagram.plane);
87
+ }
88
+ function handlePlane(plane) {
89
+ registerDi(plane);
90
+ forEach(plane.planeElements, handlePlaneElement);
91
+ }
92
+ function handlePlaneElement(planeElement) {
93
+ registerDi(planeElement);
94
+ }
95
+ function handleSequenceFlow(sequenceFlow, context) {
96
+ visitIfDi(sequenceFlow, context);
97
+ }
98
+ // Semantic handling //////////////////////
99
+ /**
100
+ * Handle definitions and return the rendered diagram (if any)
101
+ *
102
+ * @param {ModdleElement} definitions to walk and import
103
+ * @param {ModdleElement} [rootDiagram] specific diagram to import and display
104
+ *
105
+ * @throws {Error} if no diagram to display could be found
106
+ */
107
+ function handleDefinitions(definitions, rootDiagram) {
108
+ // no root board -> nothing to import
109
+ if (!rootDiagram) {
110
+ throw new Error(translate("no diagram to display"));
111
+ }
112
+ // load DI from selected root board only
113
+ handleDiagram(rootDiagram);
114
+ const plane = rootDiagram.plane;
115
+ if (!plane) {
116
+ throw new Error(translate("no plane for {element}", {
117
+ element: elementToString(rootDiagram),
118
+ }));
119
+ }
120
+ // rootElement corresponds to the model to display
121
+ let rootElement = plane.modelElement;
122
+ // ensure we default to a suitable display candidate (model),
123
+ // even if none is specified in DI
124
+ if (!rootElement) {
125
+ rootElement = findDisplayCandidate(definitions);
126
+ if (!rootElement) {
127
+ throw new Error(translate("no model to display"));
128
+ }
129
+ else {
130
+ logError(translate("correcting missing modelElement on {plane} to {rootElement}", {
131
+ plane: elementToString(plane),
132
+ rootElement: elementToString(rootElement),
133
+ }));
134
+ // correct DI on the fly
135
+ plane.modelElement = rootElement;
136
+ registerDi(plane);
137
+ }
138
+ }
139
+ const ctx = visitRoot(rootElement, plane);
140
+ if (is(rootElement, `${MODELER_PREFIX}:Model`)) {
141
+ handleModel(rootElement, ctx);
142
+ }
143
+ // handle all deferred elements
144
+ handleDeferred(deferred);
145
+ }
146
+ function handleModelElements(modelElements, context) {
147
+ forEach(modelElements, function (element) {
148
+ if (is(element, `${MODELER_PREFIX}:Arc`)) {
149
+ deferred.push(function () {
150
+ handleSequenceFlow(element, context);
151
+ });
152
+ }
153
+ else {
154
+ visitIfDi(element, context);
155
+ }
156
+ });
157
+ }
158
+ function handleModel(model, context) {
159
+ handleModelElements(model.modelElements, context);
160
+ // log board handled
161
+ handled(model);
162
+ }
163
+ function handleDeferred() {
164
+ let fn;
165
+ // drain deferred until empty
166
+ while (deferred.length) {
167
+ fn = deferred.shift();
168
+ fn();
169
+ }
170
+ }
171
+ // API //////////////////////
172
+ return {
173
+ handleDeferred: handleDeferred,
174
+ handleDefinitions: handleDefinitions,
175
+ registerDi: registerDi,
176
+ };
177
+ }
178
+ //# sourceMappingURL=CustomTreeWalker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomTreeWalker.js","sourceRoot":"","sources":["../../../lib/import/CustomTreeWalker.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,GAAG,IAAI,IAAI,CACrB,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE,EAC5C,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CACnC,CAAC;AAEF;;;;;;;GAOG;AACH,SAAS,EAAE,CAAC,OAAO,EAAE,IAAI;IACvB,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,WAAW;IACvC,OAAO,WAAW,CAAC,KAAK,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,SAAS;IACzD,oCAAoC;IACpC,MAAM,eAAe,GAAG,EAAE,CAAC;IAE3B,gDAAgD;IAChD,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,iCAAiC;IAEjC,SAAS,SAAS,CAAC,OAAO,EAAE,OAAO;QACjC,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CA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AQ,CAAC,IAAI,CAAC;oBACZ,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,WAAW,CAAC,KAAK,EAAE,OAAO;QACjC,mBAAmB,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAElD,oBAAoB;QACpB,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,SAAS,cAAc;QACrB,IAAI,EAAE,CAAC;QAEP,6BAA6B;QAC7B,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC;YACvB,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;YAEtB,EAAE,EAAE,CAAC;QACP,CAAC;IACH,CAAC;IAED,6BAA6B;IAE7B,OAAO;QACL,cAAc,EAAE,cAAc;QAC9B,iBAAiB,EAAE,iBAAiB;QACpC,UAAU,EAAE,UAAU;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ import CustomTreeWalker from "./CustomTreeWalker";
2
+ export function importDiagram(modeler, definitions, rootDiagram) {
3
+ let importer;
4
+ let eventBus;
5
+ let translate;
6
+ let error;
7
+ const warnings = [];
8
+ /**
9
+ * Walk the diagram semantically, importing (=drawing)
10
+ * all elements you encounter.
11
+ */
12
+ function render(definitions, rootDiagram) {
13
+ const visitor = {
14
+ root: function (element) {
15
+ return importer.add(element);
16
+ },
17
+ element: function (element, parentShape) {
18
+ return importer.add(element, parentShape);
19
+ },
20
+ error: function (message, context) {
21
+ warnings.push({ message: message, context: context });
22
+ },
23
+ };
24
+ const walker = new CustomTreeWalker(visitor, translate);
25
+ // traverse xml document model,
26
+ // starting at definitions
27
+ walker.handleDefinitions(definitions, rootDiagram);
28
+ }
29
+ return new Promise(function (resolve, reject) {
30
+ try {
31
+ importer = modeler.get("customImporter");
32
+ eventBus = modeler.get("eventBus");
33
+ translate = modeler.get("translate");
34
+ eventBus.fire("import.render.start", { definitions: definitions });
35
+ render(definitions, rootDiagram);
36
+ eventBus.fire("import.render.complete", {
37
+ error: error,
38
+ warnings: warnings,
39
+ });
40
+ return resolve({ warnings: warnings });
41
+ }
42
+ catch (e) {
43
+ return reject(e);
44
+ }
45
+ });
46
+ }
47
+ //# sourceMappingURL=Importer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Importer.js","sourceRoot":"","sources":["../../../lib/import/Importer.js"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW;IAC7D,IAAI,QAAQ,CAAC;IACb,IAAI,QAAQ,CAAC;IACb,IAAI,SAAS,CAAC;IAEd,IAAI,KAAK,CAAC;IACV,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB;;;OAGG;IACH,SAAS,MAAM,CAAC,WAAW,EAAE,WAAW;QACtC,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,UAAU,OAAO;gBACrB,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,EAAE,UAAU,OAAO,EAAE,WAAW;gBACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC5C,CAAC;YACD,KAAK,EAAE,UAAU,OAAO,EAAE,OAAO;gBAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACxD,CAAC;SACF,CAAC;QAEF,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAExD,+BAA+B;QAC/B,0BAA0B;QAC1B,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,CAAC;YACH,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACzC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACnC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAErC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;YAEnE,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAEjC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,EAAE;gBACtC,KAAK,EAAE,KAAK;gBACZ,QAAQ,EAAE,QAAQ;aACnB,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import translate from "diagram-js/lib/i18n/translate";
2
+ import CustomImporter from "./CustomImporter";
3
+ export default {
4
+ __depends__: [translate],
5
+ customImporter: ["type", CustomImporter],
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/import/index.js"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,+BAA+B,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,eAAe;IACb,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;CACzC,CAAC"}
@@ -0,0 +1,86 @@
1
+ import Ids from "ids";
2
+ import { assign, isString } from "min-dash";
3
+ import { Moddle } from "moddle";
4
+ import { Reader, Writer } from "moddle-xml";
5
+ import { MODELER_PREFIX } from "../util/constants";
6
+ /**
7
+ * A sub class of {@link Moddle} with support for import and export of xml files.
8
+ *
9
+ * @class CustomModdle
10
+ *
11
+ * @extends Moddle
12
+ *
13
+ * @param {Object|Array} packages to use for instantiating the model
14
+ * @param {Object} [options] additional options to pass over
15
+ */
16
+ export default class CustomModdle extends Moddle {
17
+ constructor(packages, options) {
18
+ super(packages, options);
19
+ this.ids = new Ids();
20
+ }
21
+ /**
22
+ * The fromXML result.
23
+ *
24
+ * @typedef {Object} ParseResult
25
+ *
26
+ * @property {ModdleElement} rootElement
27
+ * @property {Array<Object>} references
28
+ * @property {Array<Error>} warnings
29
+ * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
30
+ */
31
+ /**
32
+ * The fromXML error.
33
+ *
34
+ * @typedef {Error} ParseError
35
+ *
36
+ * @property {Array<Error>} warnings
37
+ */
38
+ /**
39
+ * Instantiates a model tree from a given xml string.
40
+ *
41
+ * @param {String} xmlStr
42
+ * @param {String} [typeName='MODELER_PREFIX:Definitions'] name of the root element
43
+ * @param {Object} [options] options to pass to the underlying reader
44
+ *
45
+ * @returns {Promise<ParseResult, ParseError>}
46
+ */
47
+ fromXML(xmlStr, typeName, options) {
48
+ if (!isString(typeName)) {
49
+ options = typeName;
50
+ typeName = `${MODELER_PREFIX}:Definitions`;
51
+ }
52
+ const reader = new Reader(assign({ model: this, lax: false }, options));
53
+ const rootHandler = reader.handler(typeName);
54
+ return reader.fromXML(xmlStr, rootHandler);
55
+ }
56
+ /**
57
+ * The toXML result.
58
+ *
59
+ * @typedef {Object} SerializationResult
60
+ *
61
+ * @property {String} xml
62
+ */
63
+ /**
64
+ * Serializes a Petri net object tree to XML.
65
+ *
66
+ * @param {String} element the root element, typically an instance of `${MODELER_PREFIX}:Definitions`
67
+ * @param {Object} [options] to pass to the underlying writer
68
+ *
69
+ * @returns {Promise<SerializationResult, Error>}
70
+ */
71
+ toXML(element, options) {
72
+ const writer = new Writer(options);
73
+ return new Promise((resolve, reject) => {
74
+ try {
75
+ const result = writer.toXML(element);
76
+ return resolve({
77
+ xml: result,
78
+ });
79
+ }
80
+ catch (err) {
81
+ return reject(err);
82
+ }
83
+ });
84
+ }
85
+ }
86
+ //# sourceMappingURL=CustomModdle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomModdle.js","sourceRoot":"","sources":["../../../lib/moddle/CustomModdle.js"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,YAAY,QAAQ,EAAE,OAAO;QAC3B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;;;;OASG;IACH;;;;;;OAMG;IACH;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxB,OAAO,GAAG,QAAQ,CAAC;YACnB,QAAQ,GAAG,GAAG,cAAc,cAAc,CAAC;QAC7C,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;QACxE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE7C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,EAAE,OAAO;QACpB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAErC,OAAO,OAAO,CAAC;oBACb,GAAG,EAAE,MAAM;iBACZ,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { assign } from "min-dash";
2
+ import CustomModdle from "./CustomModdle";
3
+ import ModelDescriptors from "./resources/modelSchema";
4
+ import DiagramDescriptors from "./resources/diagramSchema";
5
+ import DcDescriptors from "./resources/dc.json";
6
+ const packages = {
7
+ modelSchema: ModelDescriptors,
8
+ diagramSchema: DiagramDescriptors,
9
+ dc: DcDescriptors,
10
+ };
11
+ export default function (additionalPackages, options) {
12
+ const pks = assign({}, packages, additionalPackages);
13
+ return new CustomModdle(pks, options);
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/moddle/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG;IACf,WAAW,EAAE,gBAAgB;IAC7B,aAAa,EAAE,kBAAkB;IACjC,EAAE,EAAE,aAAa;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,WAAW,kBAAkB,EAAE,OAAO;IAClD,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IAErD,OAAO,IAAI,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "dc",
3
+ "uri": "https://www.omg.org/spec/BPMN/20100501/DC.xsd",
4
+ "prefix": "dc",
5
+ "types": [
6
+ {
7
+ "name": "Boolean"
8
+ },
9
+ {
10
+ "name": "Integer"
11
+ },
12
+ {
13
+ "name": "Real"
14
+ },
15
+ {
16
+ "name": "String"
17
+ },
18
+ {
19
+ "name": "Font",
20
+ "properties": [
21
+ {
22
+ "name": "name",
23
+ "type": "String",
24
+ "isAttr": true
25
+ },
26
+ {
27
+ "name": "size",
28
+ "type": "Real",
29
+ "isAttr": true
30
+ },
31
+ {
32
+ "name": "isBold",
33
+ "type": "Boolean",
34
+ "isAttr": true
35
+ },
36
+ {
37
+ "name": "isItalic",
38
+ "type": "Boolean",
39
+ "isAttr": true
40
+ },
41
+ {
42
+ "name": "isUnderline",
43
+ "type": "Boolean",
44
+ "isAttr": true
45
+ },
46
+ {
47
+ "name": "isStrikeThrough",
48
+ "type": "Boolean",
49
+ "isAttr": true
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "name": "Point",
55
+ "properties": [
56
+ {
57
+ "name": "x",
58
+ "type": "Real",
59
+ "default": "0",
60
+ "isAttr": true
61
+ },
62
+ {
63
+ "name": "y",
64
+ "type": "Real",
65
+ "default": "0",
66
+ "isAttr": true
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "name": "Bounds",
72
+ "properties": [
73
+ {
74
+ "name": "x",
75
+ "type": "Real",
76
+ "default": "0",
77
+ "isAttr": true
78
+ },
79
+ {
80
+ "name": "y",
81
+ "type": "Real",
82
+ "default": "0",
83
+ "isAttr": true
84
+ },
85
+ {
86
+ "name": "width",
87
+ "type": "Real",
88
+ "isAttr": true
89
+ },
90
+ {
91
+ "name": "height",
92
+ "type": "Real",
93
+ "isAttr": true
94
+ }
95
+ ]
96
+ }
97
+ ],
98
+ "associations": []
99
+ }
@@ -0,0 +1,210 @@
1
+ import { MODELER_PREFIX, MODELER_DI_PREFIX, MODELER_DI_NAMESPACE, } from "../../util/constants";
2
+ const diagramSchema = {
3
+ name: "Petri net Diagrams",
4
+ uri: MODELER_DI_NAMESPACE,
5
+ prefix: MODELER_DI_PREFIX,
6
+ xml: {
7
+ tagAlias: "lowerCase",
8
+ },
9
+ types: [
10
+ {
11
+ name: "Diagram",
12
+ isAbstract: true,
13
+ properties: [
14
+ {
15
+ name: "id",
16
+ isAttr: true,
17
+ isId: true,
18
+ type: "String",
19
+ },
20
+ {
21
+ name: "name",
22
+ isAttr: true,
23
+ type: "String",
24
+ },
25
+ {
26
+ name: "plane",
27
+ type: "Plane",
28
+ },
29
+ ],
30
+ },
31
+ {
32
+ name: "DiagramElement",
33
+ isAbstract: true,
34
+ properties: [
35
+ {
36
+ name: "id",
37
+ isAttr: true,
38
+ isId: true,
39
+ type: "String",
40
+ },
41
+ {
42
+ name: "owningDiagram",
43
+ type: "Diagram",
44
+ isReadOnly: true,
45
+ isVirtual: true,
46
+ isReference: true,
47
+ },
48
+ {
49
+ name: "owningElement",
50
+ type: "DiagramElement",
51
+ isReadOnly: true,
52
+ isVirtual: true,
53
+ isReference: true,
54
+ },
55
+ ],
56
+ },
57
+ {
58
+ name: "Plane",
59
+ properties: [
60
+ {
61
+ name: "modelElement",
62
+ isAttr: true,
63
+ isReference: true,
64
+ type: `${MODELER_PREFIX}:Model`,
65
+ },
66
+ {
67
+ name: "planeElements",
68
+ type: "DiagramElement",
69
+ subsettedProperty: "DiagramElement-ownedElement",
70
+ isMany: true,
71
+ },
72
+ ],
73
+ superClass: ["DiagramElement"],
74
+ },
75
+ {
76
+ name: "Shape",
77
+ isAbstract: true,
78
+ properties: [
79
+ {
80
+ name: "bounds",
81
+ type: "dc:Bounds",
82
+ },
83
+ ],
84
+ superClass: ["DiagramElement"],
85
+ },
86
+ {
87
+ name: "LabeledShape",
88
+ isAbstract: true,
89
+ properties: [
90
+ {
91
+ name: "ownedLabel",
92
+ type: "Label",
93
+ isReadOnly: true,
94
+ subsettedProperty: "DiagramElement-ownedElement",
95
+ isMany: true,
96
+ isVirtual: true,
97
+ },
98
+ ],
99
+ superClass: ["Shape"],
100
+ },
101
+ {
102
+ name: "DiagramShape",
103
+ properties: [
104
+ {
105
+ name: "modelElement",
106
+ isAttr: true,
107
+ isReference: true,
108
+ type: `${MODELER_PREFIX}:Node`,
109
+ },
110
+ {
111
+ name: "label",
112
+ type: "DiagramLabel",
113
+ },
114
+ ],
115
+ superClass: ["LabeledShape"],
116
+ },
117
+ {
118
+ name: "Edge",
119
+ isAbstract: true,
120
+ properties: [
121
+ {
122
+ name: "source",
123
+ type: `${MODELER_PREFIX}:Node`,
124
+ isReadOnly: true,
125
+ isVirtual: true,
126
+ isReference: true,
127
+ },
128
+ {
129
+ name: "target",
130
+ type: `${MODELER_PREFIX}:Node`,
131
+ isReadOnly: true,
132
+ isVirtual: true,
133
+ isReference: true,
134
+ },
135
+ {
136
+ name: "waypoint",
137
+ type: "dc:Point",
138
+ isUnique: false,
139
+ isMany: true,
140
+ xml: {
141
+ serialize: "xsi:type",
142
+ },
143
+ },
144
+ ],
145
+ superClass: ["DiagramElement"],
146
+ },
147
+ {
148
+ name: "LabeledEdge",
149
+ isAbstract: true,
150
+ properties: [
151
+ {
152
+ name: "ownedLabel",
153
+ type: "Label",
154
+ isReadOnly: true,
155
+ subsettedProperty: "DiagramElement-ownedElement",
156
+ isMany: true,
157
+ isVirtual: true,
158
+ },
159
+ ],
160
+ superClass: ["Edge"],
161
+ },
162
+ {
163
+ name: "DiagramEdge",
164
+ properties: [
165
+ {
166
+ name: "modelElement",
167
+ isAttr: true,
168
+ isReference: true,
169
+ type: `${MODELER_PREFIX}:Connection`,
170
+ },
171
+ {
172
+ name: "label",
173
+ type: "DiagramLabel",
174
+ },
175
+ {
176
+ name: "sourceElement",
177
+ isAttr: true,
178
+ isReference: true,
179
+ type: `${MODELER_PREFIX}:Node`,
180
+ redefines: "Edge#source",
181
+ },
182
+ {
183
+ name: "targetElement",
184
+ isAttr: true,
185
+ isReference: true,
186
+ type: `${MODELER_PREFIX}:Node`,
187
+ redefines: "Edge#target",
188
+ },
189
+ ],
190
+ superClass: ["LabeledEdge"],
191
+ },
192
+ {
193
+ name: "Label",
194
+ isAbstract: true,
195
+ properties: [
196
+ {
197
+ name: "bounds",
198
+ type: "dc:Bounds",
199
+ },
200
+ ],
201
+ superClass: ["DiagramElement"],
202
+ },
203
+ {
204
+ name: "DiagramLabel",
205
+ superClass: ["Label"],
206
+ },
207
+ ],
208
+ };
209
+ export default diagramSchema;
210
+ //# sourceMappingURL=diagramSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagramSchema.js","sourceRoot":"","sources":["../../../../lib/moddle/resources/diagramSchema.js"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,oBAAoB;IACzB,MAAM,EAAE,iBAAiB;IACzB,GAAG,EAAE;QACH,QAAQ,EAAE,WAAW;KACtB;IACD,KAAK,EAAE;QACL;YACE,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,IAAI;oBACV,MAAM,EAAE,IAAI;oBACZ,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,IAAI,EAAE,MAAM;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