@webskill/sdk 0.20.0 → 0.22.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.
- package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
- package/dist/agent.d.ts +3 -3
- package/dist/agent.js +1171 -73
- package/dist/{approval-Bbh_Apwg.js → approval-DWQlDPbY.js} +527 -29
- package/dist/arc-8U_6NQWm.js +130 -0
- package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
- package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
- package/dist/array-DQfpQNY8.js +8 -0
- package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
- package/dist/browser.d.ts +1129 -48
- package/dist/browser.js +3562 -278
- package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
- package/dist/channel-CZxxLrG7.js +9 -0
- package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
- package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
- package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
- package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
- package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
- package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
- package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
- package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
- package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
- package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
- package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
- package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
- package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
- package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
- package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
- package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
- package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
- package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
- package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
- package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
- package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
- package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
- package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
- package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
- package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
- package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
- package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
- package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
- package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
- package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
- package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
- package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
- package/dist/defaultLocale-B_EoOkSF.js +249 -0
- package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
- package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
- package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
- package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
- package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
- package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
- package/dist/dist-UajCDt3n.js +92 -0
- package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
- package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
- package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
- package/dist/{eventTypes-CwciaqCU.js → eventTypes-DcTQXSV1.js} +7 -1
- package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
- package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
- package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
- package/dist/geometry-wx5ZTYzi.js +715 -0
- package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
- package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
- package/dist/governance.d.ts +9 -3
- package/dist/governance.js +1 -1
- package/dist/graphlib-tk9gQYuN.js +4194 -0
- package/dist/{index-ad11wflI.d.ts → index-BiO9_XRk.d.ts} +2 -2
- package/dist/{index-DQ3-6GFu.d.ts → index-CjwdZQOS.d.ts} +945 -8
- package/dist/{index-BDyXe-a5.d.ts → index-YPd8ZSEa.d.ts} +413 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +47 -41
- package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
- package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
- package/dist/init-CMOIWdg-.js +16 -0
- package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
- package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
- package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
- package/dist/katex-BcRRvyh_.js +26465 -0
- package/dist/kind-Dc8x0HWz.js +110 -0
- package/dist/line-LgV8iVMV.js +48 -0
- package/dist/linear-BWKR0Tqd.js +393 -0
- package/dist/linkedDocument-CIuh_Yp0.js +416 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
- package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
- package/dist/mermaid.core-DMtwGCHy.js +1756 -0
- package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
- package/dist/node.d.ts +8 -3
- package/dist/node.js +79 -4
- package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
- package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
- package/dist/ordinal-CxA6GHQS.js +84 -0
- package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
- package/dist/path-C27Z2Bjv.js +106 -0
- package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
- package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
- package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
- package/dist/processSandboxEntry.js +5 -0
- package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
- package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
- package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
- package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
- package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
- package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
- package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
- package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
- package/dist/rough.cjs-AmDd_NQk.js +1395 -0
- package/dist/sandboxWorkerEntry.js +5 -0
- package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
- package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
- package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
- package/dist/{skillVersionStore-B24Jjjry-v2CCU0Xo.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
- package/dist/src-NkhI3UMl.js +2653 -0
- package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
- package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
- package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
- package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
- package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
- package/dist/{types-Btpdd1y--BcxQ10Fa.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +111 -9
- package/dist/ui-react.d.ts +3 -3
- package/dist/ui-react.js +3718 -77
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/untrustedText-BIaRvPZK.js +16 -0
- package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
- package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
- package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
- package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
- package/dist/{webSkillApi-CsvA69qk.js → webSkillApi-Dy-Zjv0y.js} +1 -1
- package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
- package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
- package/package.json +6 -5
- package/dist/kind-DxgS8LM-.js +0 -77
- package/dist/linkedDocument-xNXF-z8n.js +0 -94
- package/dist/types-DOJI5YC3.js +0 -90
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import { T as isEmResetFrame } from "./chunk-FOHPRMQF-Dkbp819z.js";
|
|
2
|
+
import { n as parse } from "./mermaid-parser.core-pYR5siSx.js";
|
|
3
|
+
import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
|
|
4
|
+
import { m as log, p as select_default } from "./src-NkhI3UMl.js";
|
|
5
|
+
import { H as setAccDescription, U as setAccTitle, X as setupGraphViewbox2, a as clear, b as getConfig, f as defaultConfig_default, q as setDiagramTitle, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle, z as sanitizeText } from "./chunk-O7XYJQB3-B6K0KOSL.js";
|
|
6
|
+
import { _ as wrapLabel, i as cleanAndMerge, t as calculateTextDimensions } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
|
|
7
|
+
import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
|
|
8
|
+
|
|
9
|
+
//#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/diagram-ATOU4E4O.mjs
|
|
10
|
+
var PositionFrameKind = "position frame";
|
|
11
|
+
var FramePositionedKind = "frame positioned";
|
|
12
|
+
var PositionRelationKind = "position relation";
|
|
13
|
+
var RelationPositionedKind = "relation positioned";
|
|
14
|
+
var setOptions = /* @__PURE__ */ __name(function(_rawOptString) {
|
|
15
|
+
log.debug("options str", _rawOptString);
|
|
16
|
+
}, "setOptions");
|
|
17
|
+
var getOptions = /* @__PURE__ */ __name(function() {
|
|
18
|
+
return {};
|
|
19
|
+
}, "getOptions");
|
|
20
|
+
var clear2 = /* @__PURE__ */ __name(function() {
|
|
21
|
+
reset();
|
|
22
|
+
clear();
|
|
23
|
+
}, "clear");
|
|
24
|
+
function reset() {
|
|
25
|
+
store = {};
|
|
26
|
+
}
|
|
27
|
+
__name(reset, "reset");
|
|
28
|
+
var DEFAULT_EVENTMODELING_CONFIG = defaultConfig_default.eventmodeling;
|
|
29
|
+
var getConfig3 = /* @__PURE__ */ __name(() => {
|
|
30
|
+
return cleanAndMerge({
|
|
31
|
+
...DEFAULT_EVENTMODELING_CONFIG,
|
|
32
|
+
...getConfig().eventmodeling
|
|
33
|
+
});
|
|
34
|
+
}, "getConfig");
|
|
35
|
+
var store = {};
|
|
36
|
+
function getState() {
|
|
37
|
+
let state = initial;
|
|
38
|
+
const { ast } = store;
|
|
39
|
+
const diagramProps2 = getDiagramProps();
|
|
40
|
+
if (!ast) throw new Error("No data for EventModel");
|
|
41
|
+
ast.frames.forEach((frame, index) => {
|
|
42
|
+
const textProps = calculateTextProps(frame, ast.dataEntities, diagramProps2);
|
|
43
|
+
state = dispatch(state, {
|
|
44
|
+
$kind: PositionFrameKind,
|
|
45
|
+
index,
|
|
46
|
+
frame,
|
|
47
|
+
textProps
|
|
48
|
+
});
|
|
49
|
+
let sourceFrames = void 0;
|
|
50
|
+
if (hasSourceFrame(frame)) {
|
|
51
|
+
log.debug(`source frame`, frame.sourceFrames);
|
|
52
|
+
sourceFrames = ast.frames.filter((currentFrame) => {
|
|
53
|
+
return frame.sourceFrames.some((sf) => sf.$refText === currentFrame.name);
|
|
54
|
+
});
|
|
55
|
+
sourceFrames.forEach((sourceFrame) => {
|
|
56
|
+
state = dispatch(state, {
|
|
57
|
+
$kind: PositionRelationKind,
|
|
58
|
+
index,
|
|
59
|
+
frame,
|
|
60
|
+
sourceFrame
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
} else state = dispatch(state, {
|
|
64
|
+
$kind: PositionRelationKind,
|
|
65
|
+
index,
|
|
66
|
+
frame
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
state = {
|
|
70
|
+
...state,
|
|
71
|
+
sortedSwimlanesArray: sortedSwimlanesArray(state.swimlanes)
|
|
72
|
+
};
|
|
73
|
+
return state;
|
|
74
|
+
}
|
|
75
|
+
__name(getState, "getState");
|
|
76
|
+
function setAst(ast) {
|
|
77
|
+
store.ast = ast;
|
|
78
|
+
}
|
|
79
|
+
__name(setAst, "setAst");
|
|
80
|
+
var diagramProps = {
|
|
81
|
+
swimlaneMinHeight: 70,
|
|
82
|
+
swimlanePadding: 15,
|
|
83
|
+
swimlaneGap: 10,
|
|
84
|
+
boxPadding: 10,
|
|
85
|
+
boxOverlap: 90,
|
|
86
|
+
boxDefaultY: 0,
|
|
87
|
+
boxMinWidth: 80,
|
|
88
|
+
boxMaxWidth: 450,
|
|
89
|
+
boxMinHeight: 80,
|
|
90
|
+
boxMaxHeight: 750,
|
|
91
|
+
contentStartX: 250,
|
|
92
|
+
textMaxWidth: 430,
|
|
93
|
+
boxTextFontWeight: "bold",
|
|
94
|
+
boxTextPadding: 10,
|
|
95
|
+
swimlaneTextFontWeight: "bold",
|
|
96
|
+
labelUiAutomation: "UI/Automation",
|
|
97
|
+
labelUiAutomationPrefix: "UI/A: ",
|
|
98
|
+
labelCommandReadModel: "Command/Read Model",
|
|
99
|
+
labelCommandReadModelPrefix: "C/RM: ",
|
|
100
|
+
labelEvents: "Events",
|
|
101
|
+
labelEventsPrefix: "Stream: "
|
|
102
|
+
};
|
|
103
|
+
function getDiagramProps() {
|
|
104
|
+
return diagramProps;
|
|
105
|
+
}
|
|
106
|
+
__name(getDiagramProps, "getDiagramProps");
|
|
107
|
+
var initial = {
|
|
108
|
+
boxes: [],
|
|
109
|
+
swimlanes: {},
|
|
110
|
+
relations: [],
|
|
111
|
+
maxR: 0,
|
|
112
|
+
sortedSwimlanesArray: []
|
|
113
|
+
};
|
|
114
|
+
function extractNamespace(entityIdentifier) {
|
|
115
|
+
const spl = entityIdentifier.split(".");
|
|
116
|
+
if (spl.length === 2) return spl[0];
|
|
117
|
+
}
|
|
118
|
+
__name(extractNamespace, "extractNamespace");
|
|
119
|
+
function extractName(entityIdentifier) {
|
|
120
|
+
const spl = entityIdentifier.split(".");
|
|
121
|
+
if (spl.length === 2) return spl[1];
|
|
122
|
+
return entityIdentifier;
|
|
123
|
+
}
|
|
124
|
+
__name(extractName, "extractName");
|
|
125
|
+
function findSwimlaneByNamespace(swimlanes, namespace) {
|
|
126
|
+
if (!namespace || namespace.length === 0) return;
|
|
127
|
+
return Object.values(swimlanes).find((swimlane) => swimlane.namespace === namespace);
|
|
128
|
+
}
|
|
129
|
+
__name(findSwimlaneByNamespace, "findSwimlaneByNamespace");
|
|
130
|
+
function findNextAvailableIndex(swimlanes, boundaryMin, boundaryMax) {
|
|
131
|
+
return Math.max(boundaryMin, ...Object.keys(swimlanes).filter((key) => {
|
|
132
|
+
const index = Number.parseInt(key);
|
|
133
|
+
return index > boundaryMin && index < boundaryMax;
|
|
134
|
+
}).map((key) => Number.parseInt(key))) + 1;
|
|
135
|
+
}
|
|
136
|
+
__name(findNextAvailableIndex, "findNextAvailableIndex");
|
|
137
|
+
function calculateSwimlaneProps(frame, swimlanes) {
|
|
138
|
+
const namespace = extractNamespace(frame.entityIdentifier);
|
|
139
|
+
const sw = findSwimlaneByNamespace(swimlanes, namespace);
|
|
140
|
+
switch (frame.modelEntityType) {
|
|
141
|
+
case "ui":
|
|
142
|
+
case "pcr":
|
|
143
|
+
case "processor":
|
|
144
|
+
if (sw) return {
|
|
145
|
+
index: sw.index,
|
|
146
|
+
label: sw.namespace || diagramProps.labelUiAutomation
|
|
147
|
+
};
|
|
148
|
+
else if (namespace) return {
|
|
149
|
+
index: findNextAvailableIndex(swimlanes, 0, 100),
|
|
150
|
+
label: diagramProps.labelUiAutomationPrefix + namespace
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
index: 0,
|
|
154
|
+
label: diagramProps.labelUiAutomation
|
|
155
|
+
};
|
|
156
|
+
case "rmo":
|
|
157
|
+
case "readmodel":
|
|
158
|
+
case "cmd":
|
|
159
|
+
case "command":
|
|
160
|
+
if (sw) return {
|
|
161
|
+
index: sw.index,
|
|
162
|
+
label: sw.namespace || diagramProps.labelCommandReadModel
|
|
163
|
+
};
|
|
164
|
+
else if (namespace) return {
|
|
165
|
+
index: findNextAvailableIndex(swimlanes, 100, 200),
|
|
166
|
+
label: diagramProps.labelCommandReadModelPrefix + namespace
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
index: 100,
|
|
170
|
+
label: diagramProps.labelCommandReadModel
|
|
171
|
+
};
|
|
172
|
+
default:
|
|
173
|
+
if (sw) return {
|
|
174
|
+
index: sw.index,
|
|
175
|
+
label: sw.namespace || diagramProps.labelEvents
|
|
176
|
+
};
|
|
177
|
+
else if (namespace) return {
|
|
178
|
+
index: findNextAvailableIndex(swimlanes, 200, 300),
|
|
179
|
+
label: diagramProps.labelEventsPrefix + namespace
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
index: 200,
|
|
183
|
+
label: diagramProps.labelEvents
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
__name(calculateSwimlaneProps, "calculateSwimlaneProps");
|
|
188
|
+
function calculateEntityVisualProps(frame) {
|
|
189
|
+
const { themeVariables } = getConfig();
|
|
190
|
+
switch (frame.modelEntityType) {
|
|
191
|
+
case "ui": return {
|
|
192
|
+
fill: themeVariables.emUiFill ?? "white",
|
|
193
|
+
stroke: themeVariables.emUiStroke ?? "#dbdada"
|
|
194
|
+
};
|
|
195
|
+
case "pcr":
|
|
196
|
+
case "processor": return {
|
|
197
|
+
fill: themeVariables.emProcessorFill ?? "#edb3f6",
|
|
198
|
+
stroke: themeVariables.emProcessorStroke ?? "#b88cbf"
|
|
199
|
+
};
|
|
200
|
+
case "rmo":
|
|
201
|
+
case "readmodel": return {
|
|
202
|
+
fill: themeVariables.emReadModelFill ?? "#d3f1a2",
|
|
203
|
+
stroke: themeVariables.emReadModelStroke ?? "#a3b732"
|
|
204
|
+
};
|
|
205
|
+
case "cmd":
|
|
206
|
+
case "command": return {
|
|
207
|
+
fill: themeVariables.emCommandFill ?? "#bcd6fe",
|
|
208
|
+
stroke: themeVariables.emCommandStroke ?? "#679ac3"
|
|
209
|
+
};
|
|
210
|
+
case "evt":
|
|
211
|
+
case "event": return {
|
|
212
|
+
fill: themeVariables.emEventFill ?? "#ffb778",
|
|
213
|
+
stroke: themeVariables.emEventStroke ?? "#c19a0f"
|
|
214
|
+
};
|
|
215
|
+
default: return {
|
|
216
|
+
fill: "red",
|
|
217
|
+
stroke: "black"
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
__name(calculateEntityVisualProps, "calculateEntityVisualProps");
|
|
222
|
+
function calculateTextProps(frame, dataEntities, diagramProps2) {
|
|
223
|
+
const config = getConfig();
|
|
224
|
+
const name = sanitizeText(extractName(frame.entityIdentifier) ?? "", config);
|
|
225
|
+
let toHtml;
|
|
226
|
+
const wrapLabelConfig = {
|
|
227
|
+
fontSize: 16,
|
|
228
|
+
fontWeight: 700,
|
|
229
|
+
fontFamily: "\"trebuchet ms\", verdana, arial, sans-serif",
|
|
230
|
+
joinWith: "<br/>"
|
|
231
|
+
};
|
|
232
|
+
let content = `<b>${wrapLabel(name, diagramProps2.textMaxWidth, wrapLabelConfig)}</b>`;
|
|
233
|
+
if (frame.dataInlineValue) {
|
|
234
|
+
toHtml = frame.dataInlineValue;
|
|
235
|
+
toHtml = toHtml.substring(toHtml.indexOf("{") + 1);
|
|
236
|
+
toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1);
|
|
237
|
+
toHtml = sanitizeText(toHtml, config);
|
|
238
|
+
toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig);
|
|
239
|
+
toHtml = toHtml.replaceAll(" ", " ");
|
|
240
|
+
}
|
|
241
|
+
if (frame.dataReference) {
|
|
242
|
+
const dataEntity = dataEntities.find((dataEntity2) => dataEntity2.name === frame.dataReference?.$refText);
|
|
243
|
+
if (dataEntity) {
|
|
244
|
+
toHtml = dataEntity.dataBlockValue;
|
|
245
|
+
toHtml = toHtml.substring(toHtml.indexOf("{\n") + 2);
|
|
246
|
+
toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1);
|
|
247
|
+
toHtml = sanitizeText(toHtml, config);
|
|
248
|
+
toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig);
|
|
249
|
+
toHtml = toHtml.replaceAll(" ", " ");
|
|
250
|
+
toHtml += `<br/>`;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const hasRenderedData = toHtml !== void 0;
|
|
254
|
+
if (hasRenderedData) content += `<br/><br/><code style="text-align: left; display: block;max-width:${diagramProps2.textMaxWidth}px">${toHtml}</code>`;
|
|
255
|
+
const textDimensionConfig = {
|
|
256
|
+
fontSize: wrapLabelConfig.fontSize,
|
|
257
|
+
fontWeight: wrapLabelConfig.fontWeight,
|
|
258
|
+
fontFamily: wrapLabelConfig.fontFamily
|
|
259
|
+
};
|
|
260
|
+
const dimensions = calculateTextDimensions(content, textDimensionConfig);
|
|
261
|
+
const calculatedWidthFix = hasRenderedData ? dimensions.width / 3 : dimensions.width;
|
|
262
|
+
const props = {
|
|
263
|
+
content,
|
|
264
|
+
width: calculatedWidthFix,
|
|
265
|
+
height: dimensions.height
|
|
266
|
+
};
|
|
267
|
+
log.debug(`[${frame.name}] ${frame.entityIdentifier} text`, props);
|
|
268
|
+
return props;
|
|
269
|
+
}
|
|
270
|
+
__name(calculateTextProps, "calculateTextProps");
|
|
271
|
+
function decidePositionFrame(state, _command) {
|
|
272
|
+
const command = _command;
|
|
273
|
+
const visual = calculateEntityVisualProps(command.frame);
|
|
274
|
+
const dimension = {
|
|
275
|
+
width: command.textProps.width + 2 * diagramProps.boxTextPadding,
|
|
276
|
+
height: command.textProps.height + 2 * diagramProps.boxTextPadding
|
|
277
|
+
};
|
|
278
|
+
return [{
|
|
279
|
+
$kind: FramePositionedKind,
|
|
280
|
+
frame: command.frame,
|
|
281
|
+
index: command.index,
|
|
282
|
+
visual,
|
|
283
|
+
dimension,
|
|
284
|
+
textProps: command.textProps
|
|
285
|
+
}];
|
|
286
|
+
}
|
|
287
|
+
__name(decidePositionFrame, "decidePositionFrame");
|
|
288
|
+
function calculateX(swimlane, previousSwimlane, lastBox) {
|
|
289
|
+
if (previousSwimlane === void 0) return diagramProps.contentStartX;
|
|
290
|
+
if (previousSwimlane.index === swimlane.index && swimlane.r) return swimlane.r + diagramProps.boxPadding;
|
|
291
|
+
if (lastBox === void 0) return diagramProps.contentStartX;
|
|
292
|
+
return lastBox.r - diagramProps.boxOverlap + diagramProps.boxPadding;
|
|
293
|
+
}
|
|
294
|
+
__name(calculateX, "calculateX");
|
|
295
|
+
function calculateMaxRight(swimlanes, swimlaneR) {
|
|
296
|
+
const rs = [...swimlanes.map((s) => s.r), swimlaneR];
|
|
297
|
+
return Math.max(...rs);
|
|
298
|
+
}
|
|
299
|
+
__name(calculateMaxRight, "calculateMaxRight");
|
|
300
|
+
function sortedSwimlanesArray(swimlanes) {
|
|
301
|
+
return Object.values(swimlanes).sort((a, b) => a.index - b.index);
|
|
302
|
+
}
|
|
303
|
+
__name(sortedSwimlanesArray, "sortedSwimlanesArray");
|
|
304
|
+
function evolveFramePositioned(state, _event) {
|
|
305
|
+
const event = _event;
|
|
306
|
+
const swimlaneProps = calculateSwimlaneProps(event.frame, state.swimlanes);
|
|
307
|
+
let swimlane;
|
|
308
|
+
if (swimlaneProps.index in state.swimlanes) swimlane = state.swimlanes[swimlaneProps.index];
|
|
309
|
+
else swimlane = {
|
|
310
|
+
index: swimlaneProps.index,
|
|
311
|
+
label: swimlaneProps.label,
|
|
312
|
+
r: 0,
|
|
313
|
+
y: swimlaneProps.index * diagramProps.swimlaneMinHeight + diagramProps.swimlaneGap,
|
|
314
|
+
height: diagramProps.swimlaneMinHeight,
|
|
315
|
+
maxHeight: diagramProps.swimlaneMinHeight
|
|
316
|
+
};
|
|
317
|
+
const lastBox = state.boxes.length > 0 ? state.boxes[state.boxes.length - 1] : void 0;
|
|
318
|
+
const previousSwimlane = state.previousSwimlaneNumber !== void 0 ? state.swimlanes[state.previousSwimlaneNumber] : void 0;
|
|
319
|
+
const dimension = {
|
|
320
|
+
width: Math.max(diagramProps.boxMinWidth, Math.min(diagramProps.boxMaxWidth, event.dimension.width)) + 2 * diagramProps.boxPadding,
|
|
321
|
+
height: Math.max(diagramProps.boxMinHeight, Math.min(diagramProps.boxMaxHeight, event.dimension.height)) + 2 * diagramProps.boxPadding
|
|
322
|
+
};
|
|
323
|
+
const x = calculateX(swimlane, previousSwimlane, lastBox);
|
|
324
|
+
const r = x + dimension.width + diagramProps.boxPadding;
|
|
325
|
+
const maxR = calculateMaxRight(Object.values(state.swimlanes), r);
|
|
326
|
+
swimlane.r = x + dimension.width;
|
|
327
|
+
swimlane.maxHeight = Math.max(swimlane.maxHeight, dimension.height);
|
|
328
|
+
swimlane.height = Math.max(diagramProps.swimlaneMinHeight, swimlane.maxHeight) + 2 * diagramProps.swimlanePadding;
|
|
329
|
+
const box = {
|
|
330
|
+
x,
|
|
331
|
+
y: diagramProps.swimlanePadding + swimlane.y,
|
|
332
|
+
r,
|
|
333
|
+
dimension,
|
|
334
|
+
leftSibling: false,
|
|
335
|
+
swimlane,
|
|
336
|
+
visual: event.visual,
|
|
337
|
+
text: event.textProps.content,
|
|
338
|
+
frame: event.frame,
|
|
339
|
+
index: event.index
|
|
340
|
+
};
|
|
341
|
+
const newState = {
|
|
342
|
+
...state,
|
|
343
|
+
boxes: [...state.boxes, box],
|
|
344
|
+
swimlanes: {
|
|
345
|
+
...state.swimlanes,
|
|
346
|
+
[`${swimlane.index}`]: swimlane
|
|
347
|
+
},
|
|
348
|
+
previousSwimlaneNumber: swimlaneProps.index,
|
|
349
|
+
previousFrame: event.frame,
|
|
350
|
+
maxR
|
|
351
|
+
};
|
|
352
|
+
const swimlanes = sortedSwimlanesArray(newState.swimlanes);
|
|
353
|
+
if (swimlanes.length > 0) swimlanes[0].y = 0;
|
|
354
|
+
for (let i = 1; i < swimlanes.length; i++) {
|
|
355
|
+
const sw = swimlanes[i];
|
|
356
|
+
const prevSw = swimlanes[i - 1];
|
|
357
|
+
sw.y = prevSw.y + prevSw.height + diagramProps.swimlaneGap;
|
|
358
|
+
}
|
|
359
|
+
return newState;
|
|
360
|
+
}
|
|
361
|
+
__name(evolveFramePositioned, "evolveFramePositioned");
|
|
362
|
+
function isFirstFrame(index, frame) {
|
|
363
|
+
if (index === 0 && frame.sourceFrames.length === 0) return true;
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
__name(isFirstFrame, "isFirstFrame");
|
|
367
|
+
function hasSourceFrame(frame) {
|
|
368
|
+
return frame.sourceFrames !== void 0 && frame.sourceFrames !== null && frame.sourceFrames.length > 0;
|
|
369
|
+
}
|
|
370
|
+
__name(hasSourceFrame, "hasSourceFrame");
|
|
371
|
+
function findBoxByFrame(boxes, frame) {
|
|
372
|
+
if (frame === void 0 || frame === null) return;
|
|
373
|
+
return boxes.find((box) => box.frame.name === frame.name);
|
|
374
|
+
}
|
|
375
|
+
__name(findBoxByFrame, "findBoxByFrame");
|
|
376
|
+
function findBoxByLineIndex(boxes, targetSwimlane, lineIndex) {
|
|
377
|
+
if (lineIndex < 0) return;
|
|
378
|
+
for (let i = lineIndex; i >= 0; i--) {
|
|
379
|
+
const box = boxes[i];
|
|
380
|
+
if (box.swimlane.index !== targetSwimlane) return box;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
__name(findBoxByLineIndex, "findBoxByLineIndex");
|
|
384
|
+
function decidePositionRelation(state, _command) {
|
|
385
|
+
const command = _command;
|
|
386
|
+
if (isEmResetFrame(command.frame) || isFirstFrame(command.index, command.frame)) return [];
|
|
387
|
+
const targetBox = findBoxByFrame(state.boxes, command.frame);
|
|
388
|
+
if (targetBox === void 0) throw new Error(`Target box not found for frame ${command.frame.name}`);
|
|
389
|
+
let sourceBox;
|
|
390
|
+
if (command.sourceFrame) sourceBox = findBoxByFrame(state.boxes, command.sourceFrame);
|
|
391
|
+
else sourceBox = findBoxByLineIndex(state.boxes, targetBox.swimlane.index, command.index - 1);
|
|
392
|
+
if (sourceBox === void 0) return [];
|
|
393
|
+
return [{
|
|
394
|
+
$kind: RelationPositionedKind,
|
|
395
|
+
frame: command.frame,
|
|
396
|
+
index: command.index,
|
|
397
|
+
sourceBox,
|
|
398
|
+
targetBox
|
|
399
|
+
}];
|
|
400
|
+
}
|
|
401
|
+
__name(decidePositionRelation, "decidePositionRelation");
|
|
402
|
+
function evolveRelationPositioned(state, _event) {
|
|
403
|
+
const event = _event;
|
|
404
|
+
const relation = {
|
|
405
|
+
visual: {
|
|
406
|
+
fill: "none",
|
|
407
|
+
stroke: "#000"
|
|
408
|
+
},
|
|
409
|
+
source: {
|
|
410
|
+
x: event.sourceBox.x,
|
|
411
|
+
y: event.sourceBox.y
|
|
412
|
+
},
|
|
413
|
+
target: {
|
|
414
|
+
x: event.targetBox.x,
|
|
415
|
+
y: event.targetBox.y
|
|
416
|
+
},
|
|
417
|
+
sourceBox: event.sourceBox,
|
|
418
|
+
targetBox: event.targetBox
|
|
419
|
+
};
|
|
420
|
+
return {
|
|
421
|
+
...state,
|
|
422
|
+
relations: [...state.relations, relation]
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
__name(evolveRelationPositioned, "evolveRelationPositioned");
|
|
426
|
+
var deciders = {
|
|
427
|
+
[PositionFrameKind]: decidePositionFrame,
|
|
428
|
+
[PositionRelationKind]: decidePositionRelation
|
|
429
|
+
};
|
|
430
|
+
var evolvers = {
|
|
431
|
+
[FramePositionedKind]: evolveFramePositioned,
|
|
432
|
+
[RelationPositionedKind]: evolveRelationPositioned
|
|
433
|
+
};
|
|
434
|
+
function decide(state, command) {
|
|
435
|
+
const fn = deciders[command.$kind];
|
|
436
|
+
if (fn === void 0 || fn === null) return [];
|
|
437
|
+
const events = fn(state, command);
|
|
438
|
+
log.debug(`decided events`, events);
|
|
439
|
+
return events;
|
|
440
|
+
}
|
|
441
|
+
__name(decide, "decide");
|
|
442
|
+
function evolve(state, events) {
|
|
443
|
+
const newState = events.reduce((previousState, event) => {
|
|
444
|
+
const fn = evolvers[event.$kind];
|
|
445
|
+
if (fn === void 0 || fn === null) return previousState;
|
|
446
|
+
return fn(previousState, event);
|
|
447
|
+
}, state);
|
|
448
|
+
log.debug(`evolve events`, {
|
|
449
|
+
state,
|
|
450
|
+
newState,
|
|
451
|
+
events
|
|
452
|
+
});
|
|
453
|
+
return newState;
|
|
454
|
+
}
|
|
455
|
+
__name(evolve, "evolve");
|
|
456
|
+
function dispatch(state, command) {
|
|
457
|
+
return evolve(state, decide(state, command));
|
|
458
|
+
}
|
|
459
|
+
__name(dispatch, "dispatch");
|
|
460
|
+
var db = {
|
|
461
|
+
getConfig: getConfig3,
|
|
462
|
+
setOptions,
|
|
463
|
+
getOptions,
|
|
464
|
+
clear: clear2,
|
|
465
|
+
setAccTitle,
|
|
466
|
+
getAccTitle,
|
|
467
|
+
getAccDescription,
|
|
468
|
+
setAccDescription,
|
|
469
|
+
setDiagramTitle,
|
|
470
|
+
getDiagramTitle,
|
|
471
|
+
setAst,
|
|
472
|
+
getDiagramProps,
|
|
473
|
+
getState
|
|
474
|
+
};
|
|
475
|
+
var parser = { parse: /* @__PURE__ */ __name(async (input) => {
|
|
476
|
+
const ast = await parse("eventmodeling", input);
|
|
477
|
+
log.debug(ast);
|
|
478
|
+
db.setAst(ast);
|
|
479
|
+
populateCommonDb(ast, db);
|
|
480
|
+
}, "parse") };
|
|
481
|
+
var DEFAULT_EVENTMODELING_CONFIG2 = getConfig2()?.eventmodeling;
|
|
482
|
+
function renderD3Box(diagram2, diagramProps2) {
|
|
483
|
+
return (box) => {
|
|
484
|
+
const y = box.swimlane.y + diagramProps2.swimlanePadding;
|
|
485
|
+
const g = diagram2.append("g").attr("class", "em-box");
|
|
486
|
+
g.append("rect").attr("x", box.x).attr("y", y).attr("rx", "3").attr("width", box.dimension.width).attr("height", box.dimension.height).attr("stroke", box.visual.stroke).attr("fill", box.visual.fill);
|
|
487
|
+
g.append("foreignObject").attr("x", box.x + diagramProps2.boxPadding).attr("y", y + 10).attr("width", box.dimension.width - 2 * diagramProps2.boxPadding).attr("height", box.dimension.height - 2 * diagramProps2.boxPadding).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%").append("span").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").html(box.text);
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
__name(renderD3Box, "renderD3Box");
|
|
491
|
+
function dirUpwards(sourceY, targetY) {
|
|
492
|
+
return sourceY > targetY;
|
|
493
|
+
}
|
|
494
|
+
__name(dirUpwards, "dirUpwards");
|
|
495
|
+
function renderD3Relation(diagram2, diagramProps2, arrowheadId, themeVariables) {
|
|
496
|
+
return (relation) => {
|
|
497
|
+
const sourceBoxY = relation.sourceBox.swimlane.y + diagramProps2.swimlanePadding;
|
|
498
|
+
const targetBoxY = relation.targetBox.swimlane.y + diagramProps2.swimlanePadding;
|
|
499
|
+
const upwards = dirUpwards(sourceBoxY, targetBoxY);
|
|
500
|
+
const sourceX = relation.sourceBox.x + relation.sourceBox.dimension.width * 2 / 3;
|
|
501
|
+
const targetX = relation.targetBox.x + relation.targetBox.dimension.width / 3;
|
|
502
|
+
let sourceY;
|
|
503
|
+
let targetY;
|
|
504
|
+
log.debug(`rendering relation up=${upwards} for `, {
|
|
505
|
+
sourceBox: relation.sourceBox,
|
|
506
|
+
targetBox: relation.targetBox
|
|
507
|
+
});
|
|
508
|
+
if (upwards) {
|
|
509
|
+
sourceY = sourceBoxY;
|
|
510
|
+
targetY = targetBoxY + relation.targetBox.dimension.height;
|
|
511
|
+
} else {
|
|
512
|
+
sourceY = sourceBoxY + relation.sourceBox.dimension.height;
|
|
513
|
+
targetY = targetBoxY;
|
|
514
|
+
}
|
|
515
|
+
const relationStroke = themeVariables.emRelationStroke ?? relation.visual.stroke;
|
|
516
|
+
diagram2.append("path").attr("class", "em-relation").attr("fill", relation.visual.fill).attr("stroke", relationStroke).attr("stroke-width", "1").attr("marker-end", `url(#${arrowheadId})`).attr("d", `M${sourceX} ${sourceY} L${targetX} ${targetY}`);
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
__name(renderD3Relation, "renderD3Relation");
|
|
520
|
+
function renderD3Swimlane(diagram2, maxR, diagramProps2, themeVariables) {
|
|
521
|
+
return (swimlane) => {
|
|
522
|
+
const g = diagram2.append("g").attr("class", "em-swimlane");
|
|
523
|
+
const oddBackground = themeVariables.emSwimlaneBackgroundOdd ?? "rgb(250,250,250)";
|
|
524
|
+
const backgroundStroke = themeVariables.emSwimlaneBackgroundStroke ?? "rgb(240,240,240)";
|
|
525
|
+
g.append("rect").attr("x", 0).attr("y", swimlane.y).attr("rx", "3").attr("width", maxR + diagramProps2.swimlanePadding).attr("height", swimlane.height).attr("fill", oddBackground).attr("stroke", backgroundStroke);
|
|
526
|
+
g.append("text").attr("font-weight", diagramProps2.swimlaneTextFontWeight).attr("x", 30).attr("y", swimlane.y + 30).text(swimlane.label);
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
__name(renderD3Swimlane, "renderD3Swimlane");
|
|
530
|
+
var diagram = {
|
|
531
|
+
parser,
|
|
532
|
+
db,
|
|
533
|
+
renderer: { draw: /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
|
|
534
|
+
log.debug("in eventmodeling renderer", txt + "\n", "id:", id, ver);
|
|
535
|
+
if (!DEFAULT_EVENTMODELING_CONFIG2) throw new Error("EventModeling config not found");
|
|
536
|
+
const db2 = diagObj.db;
|
|
537
|
+
const { themeVariables, eventmodeling: config } = getConfig2();
|
|
538
|
+
const diagram2 = select_default(`[id="${id}"]`);
|
|
539
|
+
const diagramProps2 = db2.getDiagramProps();
|
|
540
|
+
const state = db2.getState();
|
|
541
|
+
const arrowheadId = `em-arrowhead-${id}`;
|
|
542
|
+
const arrowheadColor = themeVariables.emArrowhead ?? "#000000";
|
|
543
|
+
state.sortedSwimlanesArray.forEach(renderD3Swimlane(diagram2, state.maxR, diagramProps2, themeVariables));
|
|
544
|
+
state.boxes.forEach(renderD3Box(diagram2, diagramProps2));
|
|
545
|
+
state.relations.forEach(renderD3Relation(diagram2, diagramProps2, arrowheadId, themeVariables));
|
|
546
|
+
diagram2.append("defs").append("marker").attr("id", arrowheadId).attr("markerWidth", "10").attr("markerHeight", "7").attr("refX", "10").attr("refY", "3.5").attr("orient", "auto").append("polygon").attr("points", "0 0, 10 3.5, 0 7").attr("fill", arrowheadColor);
|
|
547
|
+
setupGraphViewbox2(void 0, diagram2, config?.padding ?? 30, config?.useMaxWidth);
|
|
548
|
+
}, "draw") },
|
|
549
|
+
styles: /* @__PURE__ */ __name((_options) => ``, "getStyles")
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
//#endregion
|
|
553
|
+
export { diagram };
|