@diagrammo/dgmo 0.16.0 → 0.17.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/advanced.cjs +133 -280
- package/dist/advanced.d.cts +9 -2
- package/dist/advanced.d.ts +9 -2
- package/dist/advanced.js +133 -280
- package/dist/auto.cjs +135 -269
- package/dist/auto.js +96 -96
- package/dist/auto.mjs +135 -269
- package/dist/cli.cjs +125 -125
- package/dist/index.cjs +132 -266
- package/dist/index.js +132 -266
- package/dist/internal.cjs +133 -280
- package/dist/internal.d.cts +9 -2
- package/dist/internal.d.ts +9 -2
- package/dist/internal.js +133 -280
- package/docs/language-reference.md +14 -18
- package/docs/migration-sequence-color-to-tags.md +1 -1
- package/gallery/fixtures/sequence-tags-protocols.dgmo +3 -3
- package/gallery/fixtures/sequence-tags.dgmo +3 -3
- package/gallery/fixtures/sequence.dgmo +4 -4
- package/package.json +7 -3
- package/src/auto/index.ts +2 -2
- package/src/boxes-and-lines/layout.ts +1 -2
- package/src/c4/parser.ts +1 -1
- package/src/class/parser.ts +1 -1
- package/src/cli.ts +2 -2
- package/src/completion.ts +1 -14
- package/src/cycle/parser.ts +1 -1
- package/src/d3.ts +2 -3
- package/src/diagnostics.ts +20 -0
- package/src/echarts.ts +2 -2
- package/src/editor/dgmo.grammar.d.ts +1 -1
- package/src/er/parser.ts +1 -1
- package/src/graph/flowchart-renderer.ts +3 -0
- package/src/infra/renderer.ts +1 -2
- package/src/journey-map/parser.ts +1 -1
- package/src/kanban/parser.ts +1 -1
- package/src/mindmap/parser.ts +2 -3
- package/src/org/parser.ts +1 -1
- package/src/pert/analyzer.ts +10 -10
- package/src/pert/layout.ts +1 -1
- package/src/pert/parser.ts +1 -1
- package/src/pyramid/parser.ts +1 -1
- package/src/raci/parser.ts +2 -2
- package/src/ring/parser.ts +1 -1
- package/src/sequence/parser.ts +66 -14
- package/src/sequence/participant-inference.ts +18 -181
- package/src/sequence/renderer.ts +47 -136
- package/src/sitemap/parser.ts +1 -1
- package/src/tech-radar/parser.ts +2 -2
- package/src/utils/extract-alias.ts +1 -1
- package/src/utils/inline-markdown.ts +1 -1
- package/src/utils/time-ticks.ts +1 -1
- package/src/wireframe/parser.ts +1 -1
package/dist/internal.js
CHANGED
|
@@ -74,6 +74,9 @@ function nameMergedMessage(args) {
|
|
|
74
74
|
function akaRemovedMessage() {
|
|
75
75
|
return `'aka' is no longer supported \u2014 use the participant name directly`;
|
|
76
76
|
}
|
|
77
|
+
function participantTypeRemovedMessage(type) {
|
|
78
|
+
return `'${type}' is no longer supported \u2014 drop 'is a ${type}'; the participant renders as the default rectangle`;
|
|
79
|
+
}
|
|
77
80
|
function tagShorthandRemovedMessage(args) {
|
|
78
81
|
return `Bare tag shorthand 'tag ${args.name} ${args.alias}' was removed. Use 'tag ${args.name} as ${args.alias}' instead.`;
|
|
79
82
|
}
|
|
@@ -107,7 +110,15 @@ var init_diagnostics = __esm({
|
|
|
107
110
|
* participant declaration. Forgiving normalization makes aliasing
|
|
108
111
|
* unnecessary; the diagnostic directs users to the new syntax.
|
|
109
112
|
*/
|
|
110
|
-
AKA_REMOVED: "E_AKA_REMOVED"
|
|
113
|
+
AKA_REMOVED: "E_AKA_REMOVED",
|
|
114
|
+
/**
|
|
115
|
+
* Error: a removed sequence participant-type keyword was used in
|
|
116
|
+
* an `is a X` declaration. The 0.16.0 trim retained only
|
|
117
|
+
* `actor`/`database`/`cache`/`queue`; `service`/`frontend`/
|
|
118
|
+
* `networking`/`gateway`/`external` no longer carry semantic
|
|
119
|
+
* weight and emit this error so users drop the override.
|
|
120
|
+
*/
|
|
121
|
+
PARTICIPANT_TYPE_REMOVED: "E_PARTICIPANT_TYPE_REMOVED"
|
|
111
122
|
};
|
|
112
123
|
ALIAS_DIAGNOSTIC_CODES = {
|
|
113
124
|
/** Alias token used before its declaration (strict-ordering rule). */
|
|
@@ -3213,81 +3224,7 @@ var init_participant_inference = __esm({
|
|
|
3213
3224
|
// Names that would incorrectly match general patterns in later groups
|
|
3214
3225
|
{ pattern: /^KeyDB$/i, type: "cache" },
|
|
3215
3226
|
// not database (DB$ suffix)
|
|
3216
|
-
|
|
3217
|
-
// not frontend (Web contains)
|
|
3218
|
-
{ pattern: /^Upstream$/i, type: "external" },
|
|
3219
|
-
// not queue (Stream$ suffix)
|
|
3220
|
-
{ pattern: /^Downstream$/i, type: "external" },
|
|
3221
|
-
// not queue (Stream$ suffix)
|
|
3222
|
-
// ── 1. Infrastructure overrides ─────────────────────────
|
|
3223
|
-
// These names end in -er/-or but are NOT actors
|
|
3224
|
-
{ pattern: /^.*Router$/i, type: "networking" },
|
|
3225
|
-
{ pattern: /^.*Scheduler$/i, type: "service" },
|
|
3226
|
-
{ pattern: /^.*Dispatcher$/i, type: "service" },
|
|
3227
|
-
{ pattern: /^.*Balancer$/i, type: "networking" },
|
|
3228
|
-
{ pattern: /^.*Controller$/i, type: "service" },
|
|
3229
|
-
{ pattern: /^.*Handler$/i, type: "service" },
|
|
3230
|
-
{ pattern: /^.*Processor$/i, type: "service" },
|
|
3231
|
-
{ pattern: /^.*Connector$/i, type: "service" },
|
|
3232
|
-
{ pattern: /^.*Adapter$/i, type: "service" },
|
|
3233
|
-
{ pattern: /^.*Provider$/i, type: "service" },
|
|
3234
|
-
{ pattern: /^.*Manager$/i, type: "service" },
|
|
3235
|
-
{ pattern: /^.*Orchestrator$/i, type: "service" },
|
|
3236
|
-
{ pattern: /^.*Monitor$/i, type: "service" },
|
|
3237
|
-
{ pattern: /^.*Resolver$/i, type: "service" },
|
|
3238
|
-
{ pattern: /^.*Logger$/i, type: "service" },
|
|
3239
|
-
{ pattern: /^.*Server$/i, type: "service" },
|
|
3240
|
-
{ pattern: /^.*Broker$/i, type: "queue" },
|
|
3241
|
-
{ pattern: /^.*Worker$/i, type: "service" },
|
|
3242
|
-
{ pattern: /^.*Consumer$/i, type: "service" },
|
|
3243
|
-
{ pattern: /^.*Producer$/i, type: "service" },
|
|
3244
|
-
{ pattern: /^.*Publisher$/i, type: "service" },
|
|
3245
|
-
{ pattern: /^.*Subscriber$/i, type: "service" },
|
|
3246
|
-
{ pattern: /^.*Listener$/i, type: "service" },
|
|
3247
|
-
// New -er/-or suffixes that are services, not actors
|
|
3248
|
-
{ pattern: /^.*Watcher$/i, type: "service" },
|
|
3249
|
-
{ pattern: /^.*Executor$/i, type: "service" },
|
|
3250
|
-
{ pattern: /^.*Aggregator$/i, type: "service" },
|
|
3251
|
-
{ pattern: /^.*Collector$/i, type: "service" },
|
|
3252
|
-
{ pattern: /^.*Transformer$/i, type: "service" },
|
|
3253
|
-
{ pattern: /^.*Validator$/i, type: "service" },
|
|
3254
|
-
{ pattern: /^.*Generator$/i, type: "service" },
|
|
3255
|
-
{ pattern: /^.*Indexer$/i, type: "service" },
|
|
3256
|
-
{ pattern: /^.*Crawler$/i, type: "service" },
|
|
3257
|
-
{ pattern: /^.*Scanner$/i, type: "service" },
|
|
3258
|
-
{ pattern: /^.*Parser$/i, type: "service" },
|
|
3259
|
-
{ pattern: /^.*Emitter$/i, type: "service" },
|
|
3260
|
-
{ pattern: /^.*Exporter$/i, type: "service" },
|
|
3261
|
-
{ pattern: /^.*Importer$/i, type: "service" },
|
|
3262
|
-
{ pattern: /^.*Loader$/i, type: "service" },
|
|
3263
|
-
{ pattern: /^.*Renderer$/i, type: "service" },
|
|
3264
|
-
{ pattern: /^.*Checker$/i, type: "service" },
|
|
3265
|
-
{ pattern: /^.*Inspector$/i, type: "service" },
|
|
3266
|
-
{ pattern: /^.*Encoder$/i, type: "service" },
|
|
3267
|
-
{ pattern: /^.*Decoder$/i, type: "service" },
|
|
3268
|
-
{ pattern: /^.*Notifier$/i, type: "service" },
|
|
3269
|
-
// ── 2. Networking patterns ──────────────────────────────
|
|
3270
|
-
{ pattern: /Gateway/i, type: "networking" },
|
|
3271
|
-
{ pattern: /GW$/i, type: "networking" },
|
|
3272
|
-
{ pattern: /Proxy/i, type: "networking" },
|
|
3273
|
-
{ pattern: /LB$/i, type: "networking" },
|
|
3274
|
-
{ pattern: /LoadBalancer/i, type: "networking" },
|
|
3275
|
-
{ pattern: /CDN/i, type: "networking" },
|
|
3276
|
-
{ pattern: /Firewall/i, type: "networking" },
|
|
3277
|
-
{ pattern: /WAF$/i, type: "networking" },
|
|
3278
|
-
{ pattern: /DNS/i, type: "networking" },
|
|
3279
|
-
{ pattern: /Ingress/i, type: "networking" },
|
|
3280
|
-
// Named products & patterns
|
|
3281
|
-
{ pattern: /Nginx/i, type: "networking" },
|
|
3282
|
-
{ pattern: /Traefik/i, type: "networking" },
|
|
3283
|
-
{ pattern: /Envoy/i, type: "networking" },
|
|
3284
|
-
{ pattern: /Istio/i, type: "networking" },
|
|
3285
|
-
{ pattern: /Kong/i, type: "networking" },
|
|
3286
|
-
{ pattern: /Akamai/i, type: "networking" },
|
|
3287
|
-
{ pattern: /Cloudflare/i, type: "networking" },
|
|
3288
|
-
{ pattern: /Mesh$/i, type: "networking" },
|
|
3289
|
-
{ pattern: /ServiceMesh/i, type: "networking" },
|
|
3290
|
-
// ── 3. Database patterns ────────────────────────────────
|
|
3227
|
+
// ── 1. Database patterns ────────────────────────────────
|
|
3291
3228
|
{ pattern: /DB$/i, type: "database" },
|
|
3292
3229
|
{ pattern: /Database/i, type: "database" },
|
|
3293
3230
|
{ pattern: /Datastore/i, type: "database" },
|
|
@@ -3321,16 +3258,15 @@ var init_participant_inference = __esm({
|
|
|
3321
3258
|
{ pattern: /Milvus/i, type: "database" },
|
|
3322
3259
|
{ pattern: /Presto/i, type: "database" },
|
|
3323
3260
|
{ pattern: /Table$/i, type: "database" },
|
|
3324
|
-
// ──
|
|
3261
|
+
// ── 2. Cache patterns ──────────────────────────────────
|
|
3325
3262
|
{ pattern: /Cache/i, type: "cache" },
|
|
3326
3263
|
{ pattern: /Redis/i, type: "cache" },
|
|
3327
3264
|
{ pattern: /Memcache/i, type: "cache" },
|
|
3328
|
-
// CDN already matched by networking above
|
|
3329
3265
|
// Named products
|
|
3330
3266
|
{ pattern: /Dragonfly/i, type: "cache" },
|
|
3331
3267
|
{ pattern: /Hazelcast/i, type: "cache" },
|
|
3332
3268
|
{ pattern: /Valkey/i, type: "cache" },
|
|
3333
|
-
// ──
|
|
3269
|
+
// ── 3. Queue/Messaging patterns ─────────────────────────
|
|
3334
3270
|
{ pattern: /Queue/i, type: "queue" },
|
|
3335
3271
|
{ pattern: /MQ$/i, type: "queue" },
|
|
3336
3272
|
{ pattern: /SQS/i, type: "queue" },
|
|
@@ -3343,6 +3279,7 @@ var init_participant_inference = __esm({
|
|
|
3343
3279
|
{ pattern: /Stream$/i, type: "queue" },
|
|
3344
3280
|
{ pattern: /SNS/i, type: "queue" },
|
|
3345
3281
|
{ pattern: /PubSub/i, type: "queue" },
|
|
3282
|
+
{ pattern: /Broker$/i, type: "queue" },
|
|
3346
3283
|
// Named products & patterns
|
|
3347
3284
|
{ pattern: /NATS/i, type: "queue" },
|
|
3348
3285
|
{ pattern: /Pulsar/i, type: "queue" },
|
|
@@ -3353,7 +3290,7 @@ var init_participant_inference = __esm({
|
|
|
3353
3290
|
{ pattern: /Sidekiq/i, type: "queue" },
|
|
3354
3291
|
{ pattern: /EventHub/i, type: "queue" },
|
|
3355
3292
|
{ pattern: /Channel$/i, type: "queue" },
|
|
3356
|
-
// ──
|
|
3293
|
+
// ── 4. Actor patterns ──────────────────────────────────
|
|
3357
3294
|
// Exact matches first
|
|
3358
3295
|
{ pattern: /^Admin$/i, type: "actor" },
|
|
3359
3296
|
{ pattern: /^User$/i, type: "actor" },
|
|
@@ -3372,98 +3309,11 @@ var init_participant_inference = __esm({
|
|
|
3372
3309
|
{ pattern: /^Fan$/i, type: "actor" },
|
|
3373
3310
|
{ pattern: /^Purchaser$/i, type: "actor" },
|
|
3374
3311
|
{ pattern: /^Reviewer$/i, type: "actor" },
|
|
3375
|
-
// Suffix rules
|
|
3312
|
+
// Suffix rules
|
|
3376
3313
|
{ pattern: /User$/i, type: "actor" },
|
|
3377
3314
|
{ pattern: /Actor$/i, type: "actor" },
|
|
3378
3315
|
{ pattern: /Analyst$/i, type: "actor" },
|
|
3379
|
-
{ pattern: /Staff$/i, type: "actor" }
|
|
3380
|
-
// ── 7. Frontend patterns ────────────────────────────────
|
|
3381
|
-
{ pattern: /App$/i, type: "frontend" },
|
|
3382
|
-
{ pattern: /Application/i, type: "frontend" },
|
|
3383
|
-
{ pattern: /Mobile/i, type: "frontend" },
|
|
3384
|
-
{ pattern: /iOS/i, type: "frontend" },
|
|
3385
|
-
{ pattern: /Android/i, type: "frontend" },
|
|
3386
|
-
{ pattern: /Web/i, type: "frontend" },
|
|
3387
|
-
{ pattern: /Browser/i, type: "frontend" },
|
|
3388
|
-
{ pattern: /Frontend/i, type: "frontend" },
|
|
3389
|
-
{ pattern: /UI$/i, type: "frontend" },
|
|
3390
|
-
{ pattern: /Dashboard/i, type: "frontend" },
|
|
3391
|
-
{ pattern: /CLI$/i, type: "frontend" },
|
|
3392
|
-
{ pattern: /Terminal/i, type: "frontend" },
|
|
3393
|
-
// Frameworks & patterns
|
|
3394
|
-
{ pattern: /React/i, type: "frontend" },
|
|
3395
|
-
{ pattern: /^Vue$/i, type: "frontend" },
|
|
3396
|
-
{ pattern: /Angular/i, type: "frontend" },
|
|
3397
|
-
{ pattern: /Svelte/i, type: "frontend" },
|
|
3398
|
-
{ pattern: /NextJS/i, type: "frontend" },
|
|
3399
|
-
{ pattern: /Nuxt/i, type: "frontend" },
|
|
3400
|
-
{ pattern: /Remix/i, type: "frontend" },
|
|
3401
|
-
{ pattern: /Electron/i, type: "frontend" },
|
|
3402
|
-
{ pattern: /Tauri/i, type: "frontend" },
|
|
3403
|
-
{ pattern: /Widget$/i, type: "frontend" },
|
|
3404
|
-
{ pattern: /Portal/i, type: "frontend" },
|
|
3405
|
-
{ pattern: /Console$/i, type: "frontend" },
|
|
3406
|
-
{ pattern: /^SPA$/i, type: "frontend" },
|
|
3407
|
-
{ pattern: /^PWA$/i, type: "frontend" },
|
|
3408
|
-
// ── 8. Service patterns ─────────────────────────────────
|
|
3409
|
-
{ pattern: /Service/i, type: "service" },
|
|
3410
|
-
{ pattern: /Svc$/i, type: "service" },
|
|
3411
|
-
{ pattern: /API$/i, type: "service" },
|
|
3412
|
-
{ pattern: /Lambda/i, type: "service" },
|
|
3413
|
-
{ pattern: /Function$/i, type: "service" },
|
|
3414
|
-
{ pattern: /Fn$/i, type: "service" },
|
|
3415
|
-
{ pattern: /Job$/i, type: "service" },
|
|
3416
|
-
{ pattern: /Cron/i, type: "service" },
|
|
3417
|
-
{ pattern: /Microservice/i, type: "service" },
|
|
3418
|
-
// Auth
|
|
3419
|
-
{ pattern: /^Auth$/i, type: "service" },
|
|
3420
|
-
{ pattern: /^AuthN$/i, type: "service" },
|
|
3421
|
-
{ pattern: /^AuthZ$/i, type: "service" },
|
|
3422
|
-
{ pattern: /^SSO$/i, type: "service" },
|
|
3423
|
-
{ pattern: /OAuth/i, type: "service" },
|
|
3424
|
-
{ pattern: /^OIDC$/i, type: "service" },
|
|
3425
|
-
// SaaS
|
|
3426
|
-
{ pattern: /Stripe/i, type: "service" },
|
|
3427
|
-
{ pattern: /Twilio/i, type: "service" },
|
|
3428
|
-
{ pattern: /SendGrid/i, type: "service" },
|
|
3429
|
-
{ pattern: /Mailgun/i, type: "service" },
|
|
3430
|
-
// Cloud/infra
|
|
3431
|
-
{ pattern: /^S3$/i, type: "service" },
|
|
3432
|
-
{ pattern: /^Blob$/i, type: "service" },
|
|
3433
|
-
{ pattern: /Vercel/i, type: "service" },
|
|
3434
|
-
{ pattern: /Netlify/i, type: "service" },
|
|
3435
|
-
{ pattern: /Heroku/i, type: "service" },
|
|
3436
|
-
{ pattern: /Docker/i, type: "service" },
|
|
3437
|
-
{ pattern: /Kubernetes/i, type: "service" },
|
|
3438
|
-
{ pattern: /K8s/i, type: "service" },
|
|
3439
|
-
{ pattern: /Terraform/i, type: "service" },
|
|
3440
|
-
// Security
|
|
3441
|
-
{ pattern: /Vault/i, type: "service" },
|
|
3442
|
-
{ pattern: /^HSM$/i, type: "service" },
|
|
3443
|
-
{ pattern: /KMS/i, type: "service" },
|
|
3444
|
-
{ pattern: /^IAM$/i, type: "service" },
|
|
3445
|
-
// AI/ML
|
|
3446
|
-
{ pattern: /^LLM$/i, type: "service" },
|
|
3447
|
-
{ pattern: /GPT/i, type: "service" },
|
|
3448
|
-
{ pattern: /^Claude$/i, type: "service" },
|
|
3449
|
-
{ pattern: /Embedding/i, type: "service" },
|
|
3450
|
-
{ pattern: /Inference/i, type: "service" },
|
|
3451
|
-
// Suffixes & patterns
|
|
3452
|
-
{ pattern: /Pipeline$/i, type: "service" },
|
|
3453
|
-
{ pattern: /Registry/i, type: "service" },
|
|
3454
|
-
{ pattern: /Engine$/i, type: "service" },
|
|
3455
|
-
{ pattern: /Daemon/i, type: "service" },
|
|
3456
|
-
// ── 9. External patterns ────────────────────────────────
|
|
3457
|
-
{ pattern: /External/i, type: "external" },
|
|
3458
|
-
{ pattern: /Ext$/i, type: "external" },
|
|
3459
|
-
{ pattern: /ThirdParty/i, type: "external" },
|
|
3460
|
-
{ pattern: /3P$/i, type: "external" },
|
|
3461
|
-
{ pattern: /Vendor/i, type: "external" },
|
|
3462
|
-
// Named products & patterns
|
|
3463
|
-
{ pattern: /Callback/i, type: "external" },
|
|
3464
|
-
{ pattern: /^AWS$/i, type: "external" },
|
|
3465
|
-
{ pattern: /^GCP$/i, type: "external" },
|
|
3466
|
-
{ pattern: /Azure/i, type: "external" }
|
|
3316
|
+
{ pattern: /Staff$/i, type: "actor" }
|
|
3467
3317
|
];
|
|
3468
3318
|
RULE_COUNT = PARTICIPANT_RULES.length;
|
|
3469
3319
|
}
|
|
@@ -3691,7 +3541,7 @@ function parseSequenceDgmo(content) {
|
|
|
3691
3541
|
const pushWarning = (line12, message) => {
|
|
3692
3542
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
3693
3543
|
};
|
|
3694
|
-
if (!content
|
|
3544
|
+
if (!content?.trim()) {
|
|
3695
3545
|
return fail(0, "Empty content");
|
|
3696
3546
|
}
|
|
3697
3547
|
const lines = content.split("\n");
|
|
@@ -3702,7 +3552,7 @@ function parseSequenceDgmo(content) {
|
|
|
3702
3552
|
const fl = lines[fi].trim();
|
|
3703
3553
|
if (!fl || fl.startsWith("//")) continue;
|
|
3704
3554
|
const parsed = parseFirstLine(fl);
|
|
3705
|
-
if (parsed
|
|
3555
|
+
if (parsed?.chartType === "sequence") {
|
|
3706
3556
|
hasExplicitChart = true;
|
|
3707
3557
|
firstLineIndex = fi;
|
|
3708
3558
|
if (parsed.title) {
|
|
@@ -4017,6 +3867,17 @@ function parseSequenceDgmo(content) {
|
|
|
4017
3867
|
const id = isAMatch[1];
|
|
4018
3868
|
const typeStr = isAMatch[2].toLowerCase();
|
|
4019
3869
|
let remainder = isAMatch[3]?.trim() || "";
|
|
3870
|
+
if (REMOVED_PARTICIPANT_TYPES.has(typeStr)) {
|
|
3871
|
+
result.diagnostics.push(
|
|
3872
|
+
makeDgmoError(
|
|
3873
|
+
lineNumber,
|
|
3874
|
+
participantTypeRemovedMessage(typeStr),
|
|
3875
|
+
"error",
|
|
3876
|
+
NAME_DIAGNOSTIC_CODES.PARTICIPANT_TYPE_REMOVED
|
|
3877
|
+
)
|
|
3878
|
+
);
|
|
3879
|
+
continue;
|
|
3880
|
+
}
|
|
4020
3881
|
const participantType = VALID_PARTICIPANT_TYPES.has(
|
|
4021
3882
|
typeStr
|
|
4022
3883
|
) ? typeStr : "default";
|
|
@@ -4317,6 +4178,25 @@ function parseSequenceDgmo(content) {
|
|
|
4317
4178
|
}
|
|
4318
4179
|
continue;
|
|
4319
4180
|
}
|
|
4181
|
+
const elifMatch = trimmed.match(/^elif\b\s*(.*)$/i);
|
|
4182
|
+
if (elifMatch) {
|
|
4183
|
+
const tailRaw = elifMatch[1].trim();
|
|
4184
|
+
const tail = tailRaw ? " " + tailRaw : "";
|
|
4185
|
+
pushError(
|
|
4186
|
+
lineNumber,
|
|
4187
|
+
`'elif' is not a keyword. Did you mean 'else if${tail}'?`
|
|
4188
|
+
);
|
|
4189
|
+
continue;
|
|
4190
|
+
}
|
|
4191
|
+
const elseLabelMatch = trimmed.match(/^else\s+(.+)$/i);
|
|
4192
|
+
if (elseLabelMatch) {
|
|
4193
|
+
const tail = elseLabelMatch[1].trim();
|
|
4194
|
+
pushError(
|
|
4195
|
+
lineNumber,
|
|
4196
|
+
`'else' does not take a label. Did you mean 'else if ${tail}'?`
|
|
4197
|
+
);
|
|
4198
|
+
continue;
|
|
4199
|
+
}
|
|
4320
4200
|
{
|
|
4321
4201
|
const noteParsed = parseNoteLine(
|
|
4322
4202
|
trimmed,
|
|
@@ -4440,7 +4320,7 @@ function looksLikeSequence(content) {
|
|
|
4440
4320
|
return ARROW_PATTERN.test(trimmed);
|
|
4441
4321
|
});
|
|
4442
4322
|
}
|
|
4443
|
-
var KNOWN_SEQ_OPTIONS, KNOWN_SEQ_BOOLEANS, VALID_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, COLORED_PARTICIPANT_PATTERN, GROUP_HEADING_PATTERN, GROUP_HEADING_FALLBACK, LEGACY_GROUP_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_BARE, NOTE_MULTI;
|
|
4323
|
+
var KNOWN_SEQ_OPTIONS, KNOWN_SEQ_BOOLEANS, VALID_PARTICIPANT_TYPES, REMOVED_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, COLORED_PARTICIPANT_PATTERN, GROUP_HEADING_PATTERN, GROUP_HEADING_FALLBACK, LEGACY_GROUP_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_BARE, NOTE_MULTI;
|
|
4444
4324
|
var init_parser = __esm({
|
|
4445
4325
|
"src/sequence/parser.ts"() {
|
|
4446
4326
|
"use strict";
|
|
@@ -4453,15 +4333,17 @@ var init_parser = __esm({
|
|
|
4453
4333
|
KNOWN_SEQ_OPTIONS = /* @__PURE__ */ new Set(["active-tag"]);
|
|
4454
4334
|
KNOWN_SEQ_BOOLEANS = /* @__PURE__ */ new Set(["activations", "solid-fill", "no-title"]);
|
|
4455
4335
|
VALID_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
|
|
4456
|
-
"service",
|
|
4457
4336
|
"database",
|
|
4458
4337
|
"actor",
|
|
4459
4338
|
"queue",
|
|
4460
|
-
"cache"
|
|
4461
|
-
|
|
4462
|
-
|
|
4339
|
+
"cache"
|
|
4340
|
+
]);
|
|
4341
|
+
REMOVED_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
|
|
4342
|
+
"service",
|
|
4343
|
+
"frontend",
|
|
4463
4344
|
"networking",
|
|
4464
|
-
"
|
|
4345
|
+
"gateway",
|
|
4346
|
+
"external"
|
|
4465
4347
|
]);
|
|
4466
4348
|
IS_A_PATTERN = /^([^:]+?)\s+is\s+an?\s+(\w+)(?:\s+(.+))?$/i;
|
|
4467
4349
|
POSITION_ONLY_PATTERN = /^([^:]+?)\s+position\s+(-?\d+)$/i;
|
|
@@ -5355,7 +5237,7 @@ function parseClassDiagram(content, palette) {
|
|
|
5355
5237
|
if (trimmed.startsWith("//")) continue;
|
|
5356
5238
|
if (!contentStarted && indent === 0 && i === 0) {
|
|
5357
5239
|
const firstLine = parseFirstLine(trimmed);
|
|
5358
|
-
if (firstLine
|
|
5240
|
+
if (firstLine?.chartType === "class") {
|
|
5359
5241
|
if (firstLine.title) {
|
|
5360
5242
|
result.title = firstLine.title;
|
|
5361
5243
|
result.titleLineNumber = lineNumber;
|
|
@@ -5756,7 +5638,7 @@ function parseERDiagram(content, palette) {
|
|
|
5756
5638
|
if (trimmed.startsWith("//")) continue;
|
|
5757
5639
|
if (!firstLineParsed && indent === 0) {
|
|
5758
5640
|
const firstLineResult = parseFirstLine(trimmed);
|
|
5759
|
-
if (firstLineResult
|
|
5641
|
+
if (firstLineResult?.chartType === "er") {
|
|
5760
5642
|
firstLineParsed = true;
|
|
5761
5643
|
if (firstLineResult.title) {
|
|
5762
5644
|
result.title = firstLineResult.title;
|
|
@@ -6723,7 +6605,7 @@ function parseExtendedChart(content, palette) {
|
|
|
6723
6605
|
""
|
|
6724
6606
|
) : trimmed;
|
|
6725
6607
|
const dataRow2 = parseDataRowValues(strippedLine);
|
|
6726
|
-
if (dataRow2
|
|
6608
|
+
if (dataRow2?.values.length === 1) {
|
|
6727
6609
|
const source = sankeyStack.at(-1).name;
|
|
6728
6610
|
const linkColor = valColorMatch?.[2] ? resolveColorWithDiagnostic(
|
|
6729
6611
|
valColorMatch[2].trim(),
|
|
@@ -6955,7 +6837,7 @@ function parseExtendedChart(content, palette) {
|
|
|
6955
6837
|
}
|
|
6956
6838
|
}
|
|
6957
6839
|
const dataRow = parseDataRowValues(trimmed);
|
|
6958
|
-
if (dataRow
|
|
6840
|
+
if (dataRow?.values.length === 1) {
|
|
6959
6841
|
const { label: rawLabel, color: pointColor } = extractColor(
|
|
6960
6842
|
dataRow.label,
|
|
6961
6843
|
palette
|
|
@@ -8999,7 +8881,7 @@ function parseOrg(content, palette) {
|
|
|
8999
8881
|
const pushWarning = (line12, message) => {
|
|
9000
8882
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
9001
8883
|
};
|
|
9002
|
-
if (!content
|
|
8884
|
+
if (!content?.trim()) {
|
|
9003
8885
|
return fail(0, "No content provided");
|
|
9004
8886
|
}
|
|
9005
8887
|
const lines = content.split("\n");
|
|
@@ -9296,7 +9178,7 @@ function parseKanban(content, palette) {
|
|
|
9296
9178
|
const warn = (line12, message) => {
|
|
9297
9179
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
9298
9180
|
};
|
|
9299
|
-
if (!content
|
|
9181
|
+
if (!content?.trim()) {
|
|
9300
9182
|
return fail(0, "No content provided");
|
|
9301
9183
|
}
|
|
9302
9184
|
const lines = content.split("\n");
|
|
@@ -9685,7 +9567,7 @@ function parseC4(content, palette) {
|
|
|
9685
9567
|
result.error = formatDgmoError(diag);
|
|
9686
9568
|
return result;
|
|
9687
9569
|
};
|
|
9688
|
-
if (!content
|
|
9570
|
+
if (!content?.trim()) {
|
|
9689
9571
|
return fail(0, "No content provided");
|
|
9690
9572
|
}
|
|
9691
9573
|
const lines = content.split("\n");
|
|
@@ -10436,7 +10318,7 @@ function parseSitemap(content, palette) {
|
|
|
10436
10318
|
const pushWarning = (line12, message) => {
|
|
10437
10319
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
10438
10320
|
};
|
|
10439
|
-
if (!content
|
|
10321
|
+
if (!content?.trim()) {
|
|
10440
10322
|
return fail(0, "No content provided");
|
|
10441
10323
|
}
|
|
10442
10324
|
const lines = content.split("\n");
|
|
@@ -13120,7 +13002,7 @@ function parsePert(content, parseOpts = {}) {
|
|
|
13120
13002
|
const head = trimmed.slice(0, firstSpace).toLowerCase();
|
|
13121
13003
|
const value = trimmed.slice(firstSpace + 1).trim();
|
|
13122
13004
|
const hint = NEAR_DIRECTIVE_HINTS.find((h) => h.stem === head);
|
|
13123
|
-
if (hint
|
|
13005
|
+
if (hint?.matches.test(value)) {
|
|
13124
13006
|
error(
|
|
13125
13007
|
lineNumber,
|
|
13126
13008
|
`Unknown directive '${head}'. Did you mean '${hint.canonical}'?`,
|
|
@@ -14427,7 +14309,7 @@ function parseMindmap(content, palette) {
|
|
|
14427
14309
|
const pushWarning = (line12, message) => {
|
|
14428
14310
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
14429
14311
|
};
|
|
14430
|
-
if (!content
|
|
14312
|
+
if (!content?.trim()) {
|
|
14431
14313
|
return fail(0, "No content provided");
|
|
14432
14314
|
}
|
|
14433
14315
|
const lines = content.split("\n");
|
|
@@ -14598,7 +14480,7 @@ function parseMindmap(content, palette) {
|
|
|
14598
14480
|
const diag = makeDgmoError(1, "No nodes found in mindmap");
|
|
14599
14481
|
result.diagnostics.push(diag);
|
|
14600
14482
|
result.error = formatDgmoError(diag);
|
|
14601
|
-
} else if (titleRoot
|
|
14483
|
+
} else if (titleRoot?.children.length === 0 && result.roots.length === 1 && !result.error) {
|
|
14602
14484
|
}
|
|
14603
14485
|
return result;
|
|
14604
14486
|
}
|
|
@@ -15057,7 +14939,7 @@ function parseWireframe(content) {
|
|
|
15057
14939
|
const indent = measureIndent(line12);
|
|
15058
14940
|
if (phase === "header") {
|
|
15059
14941
|
const firstLineResult = parseFirstLine(trimmed);
|
|
15060
|
-
if (firstLineResult
|
|
14942
|
+
if (firstLineResult?.chartType === "wireframe") {
|
|
15061
14943
|
title = firstLineResult.title || null;
|
|
15062
14944
|
titleLineNumber = lineNumber;
|
|
15063
14945
|
continue;
|
|
@@ -15352,7 +15234,7 @@ function parseTechRadar(content) {
|
|
|
15352
15234
|
const warn = (line12, message) => {
|
|
15353
15235
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
15354
15236
|
};
|
|
15355
|
-
if (!content
|
|
15237
|
+
if (!content?.trim()) {
|
|
15356
15238
|
return fail(0, "No content provided");
|
|
15357
15239
|
}
|
|
15358
15240
|
function isRingName(name) {
|
|
@@ -15389,7 +15271,7 @@ function parseTechRadar(content) {
|
|
|
15389
15271
|
if (trimmed.startsWith("//")) continue;
|
|
15390
15272
|
if (!headerParsed) {
|
|
15391
15273
|
const firstLine = parseFirstLine(trimmed);
|
|
15392
|
-
if (firstLine
|
|
15274
|
+
if (firstLine?.chartType === "tech-radar") {
|
|
15393
15275
|
result.title = firstLine.title ?? "";
|
|
15394
15276
|
result.titleLineNumber = lineNumber;
|
|
15395
15277
|
headerParsed = true;
|
|
@@ -15681,7 +15563,7 @@ function parseCycle(content) {
|
|
|
15681
15563
|
const indent = measureIndent(raw);
|
|
15682
15564
|
if (!headerParsed) {
|
|
15683
15565
|
const firstLineResult = parseFirstLine(trimmed);
|
|
15684
|
-
if (firstLineResult
|
|
15566
|
+
if (firstLineResult?.chartType === "cycle") {
|
|
15685
15567
|
result.title = firstLineResult.title ?? "";
|
|
15686
15568
|
result.titleLineNumber = lineNum;
|
|
15687
15569
|
headerParsed = true;
|
|
@@ -15905,7 +15787,7 @@ function parseJourneyMap(content, palette) {
|
|
|
15905
15787
|
const warn = (line12, message) => {
|
|
15906
15788
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
15907
15789
|
};
|
|
15908
|
-
if (!content
|
|
15790
|
+
if (!content?.trim()) {
|
|
15909
15791
|
return fail(0, "No content provided");
|
|
15910
15792
|
}
|
|
15911
15793
|
const lines = content.split("\n");
|
|
@@ -16325,7 +16207,7 @@ function parsePyramid(content) {
|
|
|
16325
16207
|
const indent = measureIndent(raw);
|
|
16326
16208
|
if (!headerParsed) {
|
|
16327
16209
|
const firstLineResult = parseFirstLine(trimmed);
|
|
16328
|
-
if (firstLineResult
|
|
16210
|
+
if (firstLineResult?.chartType === "pyramid") {
|
|
16329
16211
|
result.title = firstLineResult.title ?? "";
|
|
16330
16212
|
result.titleLineNumber = lineNum;
|
|
16331
16213
|
headerParsed = true;
|
|
@@ -16459,7 +16341,7 @@ function parseRing(content) {
|
|
|
16459
16341
|
const indent = measureIndent(raw);
|
|
16460
16342
|
if (!headerParsed) {
|
|
16461
16343
|
const firstLineResult = parseFirstLine(trimmed);
|
|
16462
|
-
if (firstLineResult
|
|
16344
|
+
if (firstLineResult?.chartType === "ring") {
|
|
16463
16345
|
result.title = firstLineResult.title ?? "";
|
|
16464
16346
|
result.titleLineNumber = lineNum;
|
|
16465
16347
|
headerParsed = true;
|
|
@@ -16906,7 +16788,7 @@ function parseRaci(content, palette) {
|
|
|
16906
16788
|
const errorAt = (line12, message, code) => {
|
|
16907
16789
|
result.diagnostics.push(makeDgmoError(line12, message, "error", code));
|
|
16908
16790
|
};
|
|
16909
|
-
if (!content
|
|
16791
|
+
if (!content?.trim()) {
|
|
16910
16792
|
return fail(0, "No content provided");
|
|
16911
16793
|
}
|
|
16912
16794
|
const lines = content.split("\n");
|
|
@@ -17227,7 +17109,7 @@ function parseRaci(content, palette) {
|
|
|
17227
17109
|
if (roleId === null) continue;
|
|
17228
17110
|
if (rolesExplicit) {
|
|
17229
17111
|
const entry = roleStore.get(roleId);
|
|
17230
|
-
if (entry
|
|
17112
|
+
if (entry?.declaredLine === lineNumber) {
|
|
17231
17113
|
const candidates = result.roleDisplayNames.filter(
|
|
17232
17114
|
(n) => n !== entry.displayName
|
|
17233
17115
|
);
|
|
@@ -23609,8 +23491,7 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
|
|
|
23609
23491
|
const edge = parsed.edges[i];
|
|
23610
23492
|
if (edgeParallelCounts[i] === 0) continue;
|
|
23611
23493
|
const elkEdge = edgeById.get(`e${i}`);
|
|
23612
|
-
if (!elkEdge
|
|
23613
|
-
continue;
|
|
23494
|
+
if (!elkEdge?.sections || elkEdge.sections.length === 0) continue;
|
|
23614
23495
|
const container = elkEdge.container ?? "root";
|
|
23615
23496
|
const off = containerAbs.get(container) ?? { x: 0, y: 0 };
|
|
23616
23497
|
const s = elkEdge.sections[0];
|
|
@@ -28537,6 +28418,8 @@ function renderNodeShape(g, node, palette, isDark, endTerminalIds, colorOff, sol
|
|
|
28537
28418
|
case "document":
|
|
28538
28419
|
renderDocument(g, node, palette, isDark, colorOff, solid);
|
|
28539
28420
|
break;
|
|
28421
|
+
default:
|
|
28422
|
+
break;
|
|
28540
28423
|
}
|
|
28541
28424
|
}
|
|
28542
28425
|
function renderFlowchart(container, graph, layout, palette, isDark, onClickItem, exportDims) {
|
|
@@ -31107,7 +30990,7 @@ function renderNodes(svg, nodes, palette, isDark, animate, expandedNodeIds, acti
|
|
|
31107
30990
|
const badgeText = `${node.computedInstances}x`;
|
|
31108
30991
|
g.append("text").attr("x", x + node.width - 6).attr("y", y + NODE_HEADER_HEIGHT2 / 2 + META_FONT_SIZE4 * 0.35).attr("text-anchor", "end").attr("font-family", FONT_FAMILY).attr("font-size", META_FONT_SIZE4).attr("fill", textFill).attr("data-instance-node", node.id).style("cursor", "pointer").text(badgeText);
|
|
31109
30992
|
}
|
|
31110
|
-
const showDots = activeGroup
|
|
30993
|
+
const showDots = activeGroup?.toLowerCase() === "capabilities";
|
|
31111
30994
|
const roles = showDots && !node.isEdge ? inferRoles(node.properties) : [];
|
|
31112
30995
|
if (roles.length > 0) {
|
|
31113
30996
|
const dotY = isCollapsedGroup ? y + node.height - COLLAPSE_BAR_HEIGHT6 - NODE_PAD_BOTTOM2 / 2 : y + node.height - NODE_PAD_BOTTOM2 / 2;
|
|
@@ -31907,7 +31790,7 @@ function analyzePert(parsed) {
|
|
|
31907
31790
|
for (const e of edges) {
|
|
31908
31791
|
if (!e.lag || e.lag.amount >= 0) continue;
|
|
31909
31792
|
const src = activities.find((a) => a.id === e.source);
|
|
31910
|
-
if (!src
|
|
31793
|
+
if (!src?.duration) continue;
|
|
31911
31794
|
const leadDays = -toDays(e.lag, sprintDays);
|
|
31912
31795
|
const srcDurDays = toDays(src.duration.m, sprintDays);
|
|
31913
31796
|
if (e.type === "FS" && leadDays > srcDurDays) {
|
|
@@ -32413,7 +32296,7 @@ function buildSummary(input) {
|
|
|
32413
32296
|
const anchor = input.anchor ?? null;
|
|
32414
32297
|
if (parsedActivities.length === 0) return null;
|
|
32415
32298
|
if (projectMu === null) {
|
|
32416
|
-
if (anchor
|
|
32299
|
+
if (anchor?.kind === "backward") {
|
|
32417
32300
|
return [
|
|
32418
32301
|
{ text: "Expected duration: ?", level: 0 },
|
|
32419
32302
|
{ text: "P50 latest-safe start: ?", level: 0 },
|
|
@@ -32436,13 +32319,13 @@ function buildSummary(input) {
|
|
|
32436
32319
|
const sigmaPositive = projectSigma !== null && projectSigma > 0;
|
|
32437
32320
|
const showMcDetail = mc && sigmaPositive;
|
|
32438
32321
|
const sigmaParen = showMcDetail ? ` (\xB1 ${roundForCaption(projectSigma)} ${pluralizeUnit(projectSigma, unit)})` : "";
|
|
32439
|
-
if (anchor
|
|
32322
|
+
if (anchor?.kind === "forward") {
|
|
32440
32323
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32441
32324
|
rows.push({
|
|
32442
32325
|
text: `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)}${sigmaParen}.`,
|
|
32443
32326
|
level: 0
|
|
32444
32327
|
});
|
|
32445
|
-
} else if (anchor
|
|
32328
|
+
} else if (anchor?.kind === "backward") {
|
|
32446
32329
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32447
32330
|
rows.push({
|
|
32448
32331
|
text: `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)}${sigmaParen}.`,
|
|
@@ -32461,13 +32344,13 @@ function buildSummary(input) {
|
|
|
32461
32344
|
{ pct: 80, days: monteCarloResult.p80 },
|
|
32462
32345
|
{ pct: 95, days: monteCarloResult.p95 }
|
|
32463
32346
|
];
|
|
32464
|
-
if (anchor
|
|
32347
|
+
if (anchor?.kind === "forward") {
|
|
32465
32348
|
for (const { pct, days } of percentiles) {
|
|
32466
32349
|
const offsetDays = roundConservative(days, "forward");
|
|
32467
32350
|
const date = addCalendarDays(anchor.date, offsetDays);
|
|
32468
32351
|
rows.push({ text: `P${pct} finish: ${date}.`, level: 1 });
|
|
32469
32352
|
}
|
|
32470
|
-
} else if (anchor
|
|
32353
|
+
} else if (anchor?.kind === "backward") {
|
|
32471
32354
|
for (const { pct, days } of percentiles) {
|
|
32472
32355
|
const offsetDays = roundConservative(days, "backward");
|
|
32473
32356
|
const date = addCalendarDays(anchor.date, -offsetDays);
|
|
@@ -32511,20 +32394,20 @@ function buildProjectSubtitle(input) {
|
|
|
32511
32394
|
const sigmaPositive = projectSigma !== null && projectSigma > 0;
|
|
32512
32395
|
const sigmaParen = sigmaPositive ? ` (\xB1 ${roundForCaption(projectSigma)})` : "";
|
|
32513
32396
|
if (projectMu === null) {
|
|
32514
|
-
if (anchor
|
|
32397
|
+
if (anchor?.kind === "forward") {
|
|
32515
32398
|
return `Expected finish: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} of work`;
|
|
32516
32399
|
}
|
|
32517
|
-
if (anchor
|
|
32400
|
+
if (anchor?.kind === "backward") {
|
|
32518
32401
|
return `Expected start: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} lead time`;
|
|
32519
32402
|
}
|
|
32520
32403
|
return `\u2248 ? ${pluralizeUnit(2, unit)}`;
|
|
32521
32404
|
}
|
|
32522
32405
|
const muStr = `${roundForCaption(projectMu)} ${pluralizeUnit(projectMu, unit)}`;
|
|
32523
|
-
if (anchor
|
|
32406
|
+
if (anchor?.kind === "forward") {
|
|
32524
32407
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32525
32408
|
return `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)} \xB7 \u2248 ${muStr} of work${sigmaParen}`;
|
|
32526
32409
|
}
|
|
32527
|
-
if (anchor
|
|
32410
|
+
if (anchor?.kind === "backward") {
|
|
32528
32411
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32529
32412
|
return `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)} \xB7 \u2248 ${muStr} lead time${sigmaParen}`;
|
|
32530
32413
|
}
|
|
@@ -32715,7 +32598,7 @@ function computeNodeSizing(resolved) {
|
|
|
32715
32598
|
return { activityWidth, milestoneWidth, outerColW, midColW };
|
|
32716
32599
|
}
|
|
32717
32600
|
function nodeDimensions(resolved, id, sizing, overrides) {
|
|
32718
|
-
if (overrides
|
|
32601
|
+
if (overrides?.[id]) {
|
|
32719
32602
|
return { width: overrides[id].width, height: overrides[id].height };
|
|
32720
32603
|
}
|
|
32721
32604
|
const r = resolved.activities.find((a) => a.activity.id === id);
|
|
@@ -43321,9 +43204,6 @@ function wrapLabelWords(words) {
|
|
|
43321
43204
|
function renderRectParticipant(g, palette, isDark, color, solid) {
|
|
43322
43205
|
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
|
|
43323
43206
|
}
|
|
43324
|
-
function renderServiceParticipant(g, palette, isDark, color, solid) {
|
|
43325
|
-
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", SERVICE_BORDER_RADIUS).attr("ry", SERVICE_BORDER_RADIUS).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
|
|
43326
|
-
}
|
|
43327
43207
|
function renderActorParticipant(g, palette, color) {
|
|
43328
43208
|
const headR = 8;
|
|
43329
43209
|
const cx = 0;
|
|
@@ -43378,31 +43258,6 @@ function renderCacheParticipant(g, palette, isDark, color, solid) {
|
|
|
43378
43258
|
g.append("line").attr("x1", W / 2).attr("y1", topY).attr("x2", W / 2).attr("y2", topY + bodyH).attr("stroke", s).attr("stroke-width", SW).attr("stroke-dasharray", dash);
|
|
43379
43259
|
g.append("ellipse").attr("cx", 0).attr("cy", topY).attr("rx", W / 2).attr("ry", ry).attr("fill", f).attr("stroke", s).attr("stroke-width", SW).attr("stroke-dasharray", dash);
|
|
43380
43260
|
}
|
|
43381
|
-
function renderNetworkingParticipant(g, palette, isDark, color, solid) {
|
|
43382
|
-
const inset = 16;
|
|
43383
|
-
const points = [
|
|
43384
|
-
`${-W / 2 + inset},0`,
|
|
43385
|
-
`${W / 2 - inset},0`,
|
|
43386
|
-
`${W / 2},${H / 2}`,
|
|
43387
|
-
`${W / 2 - inset},${H}`,
|
|
43388
|
-
`${-W / 2 + inset},${H}`,
|
|
43389
|
-
`${-W / 2},${H / 2}`
|
|
43390
|
-
].join(" ");
|
|
43391
|
-
g.append("polygon").attr("points", points).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
|
|
43392
|
-
}
|
|
43393
|
-
function renderFrontendParticipant(g, palette, isDark, color, solid) {
|
|
43394
|
-
const screenH = H - 10;
|
|
43395
|
-
const s = stroke(palette, color);
|
|
43396
|
-
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", screenH).attr("rx", 3).attr("ry", 3).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", s).attr("stroke-width", SW);
|
|
43397
|
-
g.append("line").attr("x1", 0).attr("y1", screenH).attr("x2", 0).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
|
|
43398
|
-
g.append("line").attr("x1", -14).attr("y1", H - 2).attr("x2", 14).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
|
|
43399
|
-
}
|
|
43400
|
-
function renderExternalParticipant(g, palette, isDark, color, solid) {
|
|
43401
|
-
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW).attr("stroke-dasharray", "6 3");
|
|
43402
|
-
}
|
|
43403
|
-
function renderGatewayParticipant(g, palette, isDark, color, _solid) {
|
|
43404
|
-
renderRectParticipant(g, palette, isDark, color);
|
|
43405
|
-
}
|
|
43406
43261
|
function groupMessagesBySection(elements, messages) {
|
|
43407
43262
|
const groups = [];
|
|
43408
43263
|
let currentGroup = null;
|
|
@@ -44041,7 +43896,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44041
43896
|
}
|
|
44042
43897
|
}
|
|
44043
43898
|
const lastStep = renderSteps[renderSteps.length - 1];
|
|
44044
|
-
const lastIsSelfCall = lastStep
|
|
43899
|
+
const lastIsSelfCall = lastStep?.type === "call" && lastStep.from === lastStep.to;
|
|
44045
43900
|
const lastStepTrailing = lastIsSelfCall ? SELF_CALL_HEIGHT + 25 : stepSpacing;
|
|
44046
43901
|
let contentBottomY = renderSteps.length > 0 ? Math.max(
|
|
44047
43902
|
stepYPositions[stepYPositions.length - 1] + lastStepTrailing,
|
|
@@ -44215,6 +44070,9 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44215
44070
|
const FRAME_PADDING_X = 30;
|
|
44216
44071
|
const FRAME_PADDING_BOTTOM = 15;
|
|
44217
44072
|
const FRAME_LABEL_HEIGHT = 18;
|
|
44073
|
+
const SELF_ARROW_PROJECTION = ACTIVATION_WIDTH / 2 + SELF_CALL_WIDTH;
|
|
44074
|
+
const SELF_ARROW_FRAME_PAD = 10;
|
|
44075
|
+
const frameRightmostX = Math.max(...Array.from(participantX.values()));
|
|
44218
44076
|
const collectMsgIndices = (els) => {
|
|
44219
44077
|
const indices = [];
|
|
44220
44078
|
for (const el of els) {
|
|
@@ -44281,16 +44139,40 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44281
44139
|
maxPX = Math.max(maxPX, px);
|
|
44282
44140
|
}
|
|
44283
44141
|
}
|
|
44284
|
-
|
|
44142
|
+
let extraLeft = 0;
|
|
44143
|
+
let extraRight = 0;
|
|
44144
|
+
let maxStepIsSelfCall = false;
|
|
44145
|
+
for (const mi of allIndices) {
|
|
44146
|
+
const m = messages[mi];
|
|
44147
|
+
if (m.from === m.to) {
|
|
44148
|
+
const px = participantX.get(m.from);
|
|
44149
|
+
if (px !== void 0) {
|
|
44150
|
+
const flipLeft = px === frameRightmostX;
|
|
44151
|
+
if (flipLeft) {
|
|
44152
|
+
const loopMin = px - SELF_ARROW_PROJECTION;
|
|
44153
|
+
const need = minPX - FRAME_PADDING_X - loopMin + SELF_ARROW_FRAME_PAD;
|
|
44154
|
+
if (need > 0) extraLeft = Math.max(extraLeft, need);
|
|
44155
|
+
} else {
|
|
44156
|
+
const loopMax = px + SELF_ARROW_PROJECTION;
|
|
44157
|
+
const need = loopMax - (maxPX + FRAME_PADDING_X) + SELF_ARROW_FRAME_PAD;
|
|
44158
|
+
if (need > 0) extraRight = Math.max(extraRight, need);
|
|
44159
|
+
}
|
|
44160
|
+
}
|
|
44161
|
+
if (msgToLastStep.get(mi) === maxStep) {
|
|
44162
|
+
maxStepIsSelfCall = true;
|
|
44163
|
+
}
|
|
44164
|
+
}
|
|
44165
|
+
}
|
|
44166
|
+
const frameX = minPX - FRAME_PADDING_X - extraLeft;
|
|
44285
44167
|
const frameY = stepY(minStep) - FRAME_PADDING_TOP;
|
|
44286
|
-
const frameW = maxPX - minPX + FRAME_PADDING_X * 2;
|
|
44287
|
-
const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM;
|
|
44168
|
+
const frameW = maxPX - minPX + FRAME_PADDING_X * 2 + extraLeft + extraRight;
|
|
44169
|
+
const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM + (maxStepIsSelfCall ? SELF_CALL_HEIGHT : 0);
|
|
44288
44170
|
svg.append("rect").attr("x", frameX).attr("y", frameY).attr("width", frameW).attr("height", frameH).attr("fill", "none").attr("stroke", palette.textMuted).attr("stroke-width", 1).attr("stroke-dasharray", "2 3").attr("rx", 3).attr("ry", 3).attr("class", "block-frame").attr("data-block-line", String(el.lineNumber));
|
|
44289
44171
|
deferredLabels.push({
|
|
44290
44172
|
x: frameX + 6,
|
|
44291
44173
|
y: frameY + FRAME_LABEL_HEIGHT - 4,
|
|
44292
44174
|
text: `${el.type} ${el.label}`,
|
|
44293
|
-
bold:
|
|
44175
|
+
bold: false,
|
|
44294
44176
|
italic: false,
|
|
44295
44177
|
blockLine: el.lineNumber
|
|
44296
44178
|
});
|
|
@@ -44316,7 +44198,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44316
44198
|
y: dividerY + 14,
|
|
44317
44199
|
text: `else if ${branchData.label}`,
|
|
44318
44200
|
bold: false,
|
|
44319
|
-
italic:
|
|
44201
|
+
italic: false,
|
|
44320
44202
|
blockLine: branchData.lineNumber
|
|
44321
44203
|
});
|
|
44322
44204
|
}
|
|
@@ -44343,7 +44225,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44343
44225
|
y: dividerY + 14,
|
|
44344
44226
|
text: "else",
|
|
44345
44227
|
bold: false,
|
|
44346
|
-
italic:
|
|
44228
|
+
italic: false,
|
|
44347
44229
|
blockLine: el.elseLineNumber
|
|
44348
44230
|
});
|
|
44349
44231
|
}
|
|
@@ -44413,7 +44295,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44413
44295
|
return side === "right" ? px + ACTIVATION_WIDTH / 2 + offset : px - ACTIVATION_WIDTH / 2 + offset;
|
|
44414
44296
|
};
|
|
44415
44297
|
const leftmostX = Math.min(...Array.from(participantX.values()));
|
|
44416
|
-
const rightmostX =
|
|
44298
|
+
const rightmostX = frameRightmostX;
|
|
44417
44299
|
const sectionLineX1 = leftmostX - PARTICIPANT_BOX_WIDTH / 2 - 10;
|
|
44418
44300
|
const sectionLineX2 = rightmostX + PARTICIPANT_BOX_WIDTH / 2 + 10;
|
|
44419
44301
|
for (const region of sectionRegions) {
|
|
@@ -44672,27 +44554,12 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
|
|
|
44672
44554
|
case "database":
|
|
44673
44555
|
renderDatabaseParticipant(g, palette, isDark, color, solid);
|
|
44674
44556
|
break;
|
|
44675
|
-
case "service":
|
|
44676
|
-
renderServiceParticipant(g, palette, isDark, color, solid);
|
|
44677
|
-
break;
|
|
44678
44557
|
case "queue":
|
|
44679
44558
|
renderQueueParticipant(g, palette, isDark, color, solid);
|
|
44680
44559
|
break;
|
|
44681
44560
|
case "cache":
|
|
44682
44561
|
renderCacheParticipant(g, palette, isDark, color, solid);
|
|
44683
44562
|
break;
|
|
44684
|
-
case "networking":
|
|
44685
|
-
renderNetworkingParticipant(g, palette, isDark, color, solid);
|
|
44686
|
-
break;
|
|
44687
|
-
case "frontend":
|
|
44688
|
-
renderFrontendParticipant(g, palette, isDark, color, solid);
|
|
44689
|
-
break;
|
|
44690
|
-
case "external":
|
|
44691
|
-
renderExternalParticipant(g, palette, isDark, color, solid);
|
|
44692
|
-
break;
|
|
44693
|
-
case "gateway":
|
|
44694
|
-
renderGatewayParticipant(g, palette, isDark, color, solid);
|
|
44695
|
-
break;
|
|
44696
44563
|
default:
|
|
44697
44564
|
renderRectParticipant(g, palette, isDark, color, solid);
|
|
44698
44565
|
break;
|
|
@@ -44720,7 +44587,7 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
|
|
|
44720
44587
|
});
|
|
44721
44588
|
}
|
|
44722
44589
|
}
|
|
44723
|
-
var PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET,
|
|
44590
|
+
var PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE, ACTIVATION_WIDTH, SELF_CALL_HEIGHT, SELF_CALL_WIDTH, NOTE_LANE_MAX, LABEL_CHAR_WIDTH, LABEL_MAX_CHARS, fill, stroke, SW, W, H;
|
|
44724
44591
|
var init_renderer19 = __esm({
|
|
44725
44592
|
"src/sequence/renderer.ts"() {
|
|
44726
44593
|
"use strict";
|
|
@@ -44741,7 +44608,6 @@ var init_renderer19 = __esm({
|
|
|
44741
44608
|
TOP_MARGIN = 20;
|
|
44742
44609
|
TITLE_HEIGHT8 = 30;
|
|
44743
44610
|
PARTICIPANT_Y_OFFSET = 10;
|
|
44744
|
-
SERVICE_BORDER_RADIUS = 10;
|
|
44745
44611
|
MESSAGE_START_OFFSET = 30;
|
|
44746
44612
|
LIFELINE_TAIL = 30;
|
|
44747
44613
|
ARROWHEAD_SIZE = 8;
|
|
@@ -44938,7 +44804,7 @@ function parseVisualization(content, palette) {
|
|
|
44938
44804
|
const warn = (line12, message) => {
|
|
44939
44805
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
44940
44806
|
};
|
|
44941
|
-
if (!content
|
|
44807
|
+
if (!content?.trim()) {
|
|
44942
44808
|
return fail(0, "Empty content");
|
|
44943
44809
|
}
|
|
44944
44810
|
const lines = content.split("\n");
|
|
@@ -46978,7 +46844,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
|
|
|
46978
46844
|
const groupKey = groupName.toLowerCase();
|
|
46979
46845
|
groupEl.attr("data-tag-group", groupKey);
|
|
46980
46846
|
if (isActive && !viewMode) {
|
|
46981
|
-
const isSwimActive = currentSwimlaneGroup
|
|
46847
|
+
const isSwimActive = currentSwimlaneGroup?.toLowerCase() === groupKey;
|
|
46982
46848
|
const pillWidth3 = measureLegendText(groupName, LG_PILL_FONT_SIZE) + LG_PILL_PAD;
|
|
46983
46849
|
const pillXOff = LG_CAPSULE_PAD;
|
|
46984
46850
|
const iconX = pillXOff + pillWidth3 + 5;
|
|
@@ -51872,20 +51738,7 @@ var CHART_TYPES = [...ALL_CHART_TYPES].filter((t) => t !== "multi-line").map((na
|
|
|
51872
51738
|
description: CHART_TYPE_DESCRIPTIONS2[name] ?? name
|
|
51873
51739
|
}));
|
|
51874
51740
|
var ENTITY_TYPES = /* @__PURE__ */ new Map([
|
|
51875
|
-
[
|
|
51876
|
-
"sequence",
|
|
51877
|
-
[
|
|
51878
|
-
"service",
|
|
51879
|
-
"database",
|
|
51880
|
-
"actor",
|
|
51881
|
-
"queue",
|
|
51882
|
-
"cache",
|
|
51883
|
-
"gateway",
|
|
51884
|
-
"external",
|
|
51885
|
-
"networking",
|
|
51886
|
-
"frontend"
|
|
51887
|
-
]
|
|
51888
|
-
],
|
|
51741
|
+
["sequence", ["actor", "database", "queue", "cache"]],
|
|
51889
51742
|
[
|
|
51890
51743
|
"c4",
|
|
51891
51744
|
["person", "system", "container", "component", "external", "database"]
|