@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.cjs
CHANGED
|
@@ -76,6 +76,9 @@ function nameMergedMessage(args) {
|
|
|
76
76
|
function akaRemovedMessage() {
|
|
77
77
|
return `'aka' is no longer supported \u2014 use the participant name directly`;
|
|
78
78
|
}
|
|
79
|
+
function participantTypeRemovedMessage(type) {
|
|
80
|
+
return `'${type}' is no longer supported \u2014 drop 'is a ${type}'; the participant renders as the default rectangle`;
|
|
81
|
+
}
|
|
79
82
|
function tagShorthandRemovedMessage(args) {
|
|
80
83
|
return `Bare tag shorthand 'tag ${args.name} ${args.alias}' was removed. Use 'tag ${args.name} as ${args.alias}' instead.`;
|
|
81
84
|
}
|
|
@@ -109,7 +112,15 @@ var init_diagnostics = __esm({
|
|
|
109
112
|
* participant declaration. Forgiving normalization makes aliasing
|
|
110
113
|
* unnecessary; the diagnostic directs users to the new syntax.
|
|
111
114
|
*/
|
|
112
|
-
AKA_REMOVED: "E_AKA_REMOVED"
|
|
115
|
+
AKA_REMOVED: "E_AKA_REMOVED",
|
|
116
|
+
/**
|
|
117
|
+
* Error: a removed sequence participant-type keyword was used in
|
|
118
|
+
* an `is a X` declaration. The 0.16.0 trim retained only
|
|
119
|
+
* `actor`/`database`/`cache`/`queue`; `service`/`frontend`/
|
|
120
|
+
* `networking`/`gateway`/`external` no longer carry semantic
|
|
121
|
+
* weight and emit this error so users drop the override.
|
|
122
|
+
*/
|
|
123
|
+
PARTICIPANT_TYPE_REMOVED: "E_PARTICIPANT_TYPE_REMOVED"
|
|
113
124
|
};
|
|
114
125
|
ALIAS_DIAGNOSTIC_CODES = {
|
|
115
126
|
/** Alias token used before its declaration (strict-ordering rule). */
|
|
@@ -3215,81 +3226,7 @@ var init_participant_inference = __esm({
|
|
|
3215
3226
|
// Names that would incorrectly match general patterns in later groups
|
|
3216
3227
|
{ pattern: /^KeyDB$/i, type: "cache" },
|
|
3217
3228
|
// not database (DB$ suffix)
|
|
3218
|
-
|
|
3219
|
-
// not frontend (Web contains)
|
|
3220
|
-
{ pattern: /^Upstream$/i, type: "external" },
|
|
3221
|
-
// not queue (Stream$ suffix)
|
|
3222
|
-
{ pattern: /^Downstream$/i, type: "external" },
|
|
3223
|
-
// not queue (Stream$ suffix)
|
|
3224
|
-
// ── 1. Infrastructure overrides ─────────────────────────
|
|
3225
|
-
// These names end in -er/-or but are NOT actors
|
|
3226
|
-
{ pattern: /^.*Router$/i, type: "networking" },
|
|
3227
|
-
{ pattern: /^.*Scheduler$/i, type: "service" },
|
|
3228
|
-
{ pattern: /^.*Dispatcher$/i, type: "service" },
|
|
3229
|
-
{ pattern: /^.*Balancer$/i, type: "networking" },
|
|
3230
|
-
{ pattern: /^.*Controller$/i, type: "service" },
|
|
3231
|
-
{ pattern: /^.*Handler$/i, type: "service" },
|
|
3232
|
-
{ pattern: /^.*Processor$/i, type: "service" },
|
|
3233
|
-
{ pattern: /^.*Connector$/i, type: "service" },
|
|
3234
|
-
{ pattern: /^.*Adapter$/i, type: "service" },
|
|
3235
|
-
{ pattern: /^.*Provider$/i, type: "service" },
|
|
3236
|
-
{ pattern: /^.*Manager$/i, type: "service" },
|
|
3237
|
-
{ pattern: /^.*Orchestrator$/i, type: "service" },
|
|
3238
|
-
{ pattern: /^.*Monitor$/i, type: "service" },
|
|
3239
|
-
{ pattern: /^.*Resolver$/i, type: "service" },
|
|
3240
|
-
{ pattern: /^.*Logger$/i, type: "service" },
|
|
3241
|
-
{ pattern: /^.*Server$/i, type: "service" },
|
|
3242
|
-
{ pattern: /^.*Broker$/i, type: "queue" },
|
|
3243
|
-
{ pattern: /^.*Worker$/i, type: "service" },
|
|
3244
|
-
{ pattern: /^.*Consumer$/i, type: "service" },
|
|
3245
|
-
{ pattern: /^.*Producer$/i, type: "service" },
|
|
3246
|
-
{ pattern: /^.*Publisher$/i, type: "service" },
|
|
3247
|
-
{ pattern: /^.*Subscriber$/i, type: "service" },
|
|
3248
|
-
{ pattern: /^.*Listener$/i, type: "service" },
|
|
3249
|
-
// New -er/-or suffixes that are services, not actors
|
|
3250
|
-
{ pattern: /^.*Watcher$/i, type: "service" },
|
|
3251
|
-
{ pattern: /^.*Executor$/i, type: "service" },
|
|
3252
|
-
{ pattern: /^.*Aggregator$/i, type: "service" },
|
|
3253
|
-
{ pattern: /^.*Collector$/i, type: "service" },
|
|
3254
|
-
{ pattern: /^.*Transformer$/i, type: "service" },
|
|
3255
|
-
{ pattern: /^.*Validator$/i, type: "service" },
|
|
3256
|
-
{ pattern: /^.*Generator$/i, type: "service" },
|
|
3257
|
-
{ pattern: /^.*Indexer$/i, type: "service" },
|
|
3258
|
-
{ pattern: /^.*Crawler$/i, type: "service" },
|
|
3259
|
-
{ pattern: /^.*Scanner$/i, type: "service" },
|
|
3260
|
-
{ pattern: /^.*Parser$/i, type: "service" },
|
|
3261
|
-
{ pattern: /^.*Emitter$/i, type: "service" },
|
|
3262
|
-
{ pattern: /^.*Exporter$/i, type: "service" },
|
|
3263
|
-
{ pattern: /^.*Importer$/i, type: "service" },
|
|
3264
|
-
{ pattern: /^.*Loader$/i, type: "service" },
|
|
3265
|
-
{ pattern: /^.*Renderer$/i, type: "service" },
|
|
3266
|
-
{ pattern: /^.*Checker$/i, type: "service" },
|
|
3267
|
-
{ pattern: /^.*Inspector$/i, type: "service" },
|
|
3268
|
-
{ pattern: /^.*Encoder$/i, type: "service" },
|
|
3269
|
-
{ pattern: /^.*Decoder$/i, type: "service" },
|
|
3270
|
-
{ pattern: /^.*Notifier$/i, type: "service" },
|
|
3271
|
-
// ── 2. Networking patterns ──────────────────────────────
|
|
3272
|
-
{ pattern: /Gateway/i, type: "networking" },
|
|
3273
|
-
{ pattern: /GW$/i, type: "networking" },
|
|
3274
|
-
{ pattern: /Proxy/i, type: "networking" },
|
|
3275
|
-
{ pattern: /LB$/i, type: "networking" },
|
|
3276
|
-
{ pattern: /LoadBalancer/i, type: "networking" },
|
|
3277
|
-
{ pattern: /CDN/i, type: "networking" },
|
|
3278
|
-
{ pattern: /Firewall/i, type: "networking" },
|
|
3279
|
-
{ pattern: /WAF$/i, type: "networking" },
|
|
3280
|
-
{ pattern: /DNS/i, type: "networking" },
|
|
3281
|
-
{ pattern: /Ingress/i, type: "networking" },
|
|
3282
|
-
// Named products & patterns
|
|
3283
|
-
{ pattern: /Nginx/i, type: "networking" },
|
|
3284
|
-
{ pattern: /Traefik/i, type: "networking" },
|
|
3285
|
-
{ pattern: /Envoy/i, type: "networking" },
|
|
3286
|
-
{ pattern: /Istio/i, type: "networking" },
|
|
3287
|
-
{ pattern: /Kong/i, type: "networking" },
|
|
3288
|
-
{ pattern: /Akamai/i, type: "networking" },
|
|
3289
|
-
{ pattern: /Cloudflare/i, type: "networking" },
|
|
3290
|
-
{ pattern: /Mesh$/i, type: "networking" },
|
|
3291
|
-
{ pattern: /ServiceMesh/i, type: "networking" },
|
|
3292
|
-
// ── 3. Database patterns ────────────────────────────────
|
|
3229
|
+
// ── 1. Database patterns ────────────────────────────────
|
|
3293
3230
|
{ pattern: /DB$/i, type: "database" },
|
|
3294
3231
|
{ pattern: /Database/i, type: "database" },
|
|
3295
3232
|
{ pattern: /Datastore/i, type: "database" },
|
|
@@ -3323,16 +3260,15 @@ var init_participant_inference = __esm({
|
|
|
3323
3260
|
{ pattern: /Milvus/i, type: "database" },
|
|
3324
3261
|
{ pattern: /Presto/i, type: "database" },
|
|
3325
3262
|
{ pattern: /Table$/i, type: "database" },
|
|
3326
|
-
// ──
|
|
3263
|
+
// ── 2. Cache patterns ──────────────────────────────────
|
|
3327
3264
|
{ pattern: /Cache/i, type: "cache" },
|
|
3328
3265
|
{ pattern: /Redis/i, type: "cache" },
|
|
3329
3266
|
{ pattern: /Memcache/i, type: "cache" },
|
|
3330
|
-
// CDN already matched by networking above
|
|
3331
3267
|
// Named products
|
|
3332
3268
|
{ pattern: /Dragonfly/i, type: "cache" },
|
|
3333
3269
|
{ pattern: /Hazelcast/i, type: "cache" },
|
|
3334
3270
|
{ pattern: /Valkey/i, type: "cache" },
|
|
3335
|
-
// ──
|
|
3271
|
+
// ── 3. Queue/Messaging patterns ─────────────────────────
|
|
3336
3272
|
{ pattern: /Queue/i, type: "queue" },
|
|
3337
3273
|
{ pattern: /MQ$/i, type: "queue" },
|
|
3338
3274
|
{ pattern: /SQS/i, type: "queue" },
|
|
@@ -3345,6 +3281,7 @@ var init_participant_inference = __esm({
|
|
|
3345
3281
|
{ pattern: /Stream$/i, type: "queue" },
|
|
3346
3282
|
{ pattern: /SNS/i, type: "queue" },
|
|
3347
3283
|
{ pattern: /PubSub/i, type: "queue" },
|
|
3284
|
+
{ pattern: /Broker$/i, type: "queue" },
|
|
3348
3285
|
// Named products & patterns
|
|
3349
3286
|
{ pattern: /NATS/i, type: "queue" },
|
|
3350
3287
|
{ pattern: /Pulsar/i, type: "queue" },
|
|
@@ -3355,7 +3292,7 @@ var init_participant_inference = __esm({
|
|
|
3355
3292
|
{ pattern: /Sidekiq/i, type: "queue" },
|
|
3356
3293
|
{ pattern: /EventHub/i, type: "queue" },
|
|
3357
3294
|
{ pattern: /Channel$/i, type: "queue" },
|
|
3358
|
-
// ──
|
|
3295
|
+
// ── 4. Actor patterns ──────────────────────────────────
|
|
3359
3296
|
// Exact matches first
|
|
3360
3297
|
{ pattern: /^Admin$/i, type: "actor" },
|
|
3361
3298
|
{ pattern: /^User$/i, type: "actor" },
|
|
@@ -3374,98 +3311,11 @@ var init_participant_inference = __esm({
|
|
|
3374
3311
|
{ pattern: /^Fan$/i, type: "actor" },
|
|
3375
3312
|
{ pattern: /^Purchaser$/i, type: "actor" },
|
|
3376
3313
|
{ pattern: /^Reviewer$/i, type: "actor" },
|
|
3377
|
-
// Suffix rules
|
|
3314
|
+
// Suffix rules
|
|
3378
3315
|
{ pattern: /User$/i, type: "actor" },
|
|
3379
3316
|
{ pattern: /Actor$/i, type: "actor" },
|
|
3380
3317
|
{ pattern: /Analyst$/i, type: "actor" },
|
|
3381
|
-
{ pattern: /Staff$/i, type: "actor" }
|
|
3382
|
-
// ── 7. Frontend patterns ────────────────────────────────
|
|
3383
|
-
{ pattern: /App$/i, type: "frontend" },
|
|
3384
|
-
{ pattern: /Application/i, type: "frontend" },
|
|
3385
|
-
{ pattern: /Mobile/i, type: "frontend" },
|
|
3386
|
-
{ pattern: /iOS/i, type: "frontend" },
|
|
3387
|
-
{ pattern: /Android/i, type: "frontend" },
|
|
3388
|
-
{ pattern: /Web/i, type: "frontend" },
|
|
3389
|
-
{ pattern: /Browser/i, type: "frontend" },
|
|
3390
|
-
{ pattern: /Frontend/i, type: "frontend" },
|
|
3391
|
-
{ pattern: /UI$/i, type: "frontend" },
|
|
3392
|
-
{ pattern: /Dashboard/i, type: "frontend" },
|
|
3393
|
-
{ pattern: /CLI$/i, type: "frontend" },
|
|
3394
|
-
{ pattern: /Terminal/i, type: "frontend" },
|
|
3395
|
-
// Frameworks & patterns
|
|
3396
|
-
{ pattern: /React/i, type: "frontend" },
|
|
3397
|
-
{ pattern: /^Vue$/i, type: "frontend" },
|
|
3398
|
-
{ pattern: /Angular/i, type: "frontend" },
|
|
3399
|
-
{ pattern: /Svelte/i, type: "frontend" },
|
|
3400
|
-
{ pattern: /NextJS/i, type: "frontend" },
|
|
3401
|
-
{ pattern: /Nuxt/i, type: "frontend" },
|
|
3402
|
-
{ pattern: /Remix/i, type: "frontend" },
|
|
3403
|
-
{ pattern: /Electron/i, type: "frontend" },
|
|
3404
|
-
{ pattern: /Tauri/i, type: "frontend" },
|
|
3405
|
-
{ pattern: /Widget$/i, type: "frontend" },
|
|
3406
|
-
{ pattern: /Portal/i, type: "frontend" },
|
|
3407
|
-
{ pattern: /Console$/i, type: "frontend" },
|
|
3408
|
-
{ pattern: /^SPA$/i, type: "frontend" },
|
|
3409
|
-
{ pattern: /^PWA$/i, type: "frontend" },
|
|
3410
|
-
// ── 8. Service patterns ─────────────────────────────────
|
|
3411
|
-
{ pattern: /Service/i, type: "service" },
|
|
3412
|
-
{ pattern: /Svc$/i, type: "service" },
|
|
3413
|
-
{ pattern: /API$/i, type: "service" },
|
|
3414
|
-
{ pattern: /Lambda/i, type: "service" },
|
|
3415
|
-
{ pattern: /Function$/i, type: "service" },
|
|
3416
|
-
{ pattern: /Fn$/i, type: "service" },
|
|
3417
|
-
{ pattern: /Job$/i, type: "service" },
|
|
3418
|
-
{ pattern: /Cron/i, type: "service" },
|
|
3419
|
-
{ pattern: /Microservice/i, type: "service" },
|
|
3420
|
-
// Auth
|
|
3421
|
-
{ pattern: /^Auth$/i, type: "service" },
|
|
3422
|
-
{ pattern: /^AuthN$/i, type: "service" },
|
|
3423
|
-
{ pattern: /^AuthZ$/i, type: "service" },
|
|
3424
|
-
{ pattern: /^SSO$/i, type: "service" },
|
|
3425
|
-
{ pattern: /OAuth/i, type: "service" },
|
|
3426
|
-
{ pattern: /^OIDC$/i, type: "service" },
|
|
3427
|
-
// SaaS
|
|
3428
|
-
{ pattern: /Stripe/i, type: "service" },
|
|
3429
|
-
{ pattern: /Twilio/i, type: "service" },
|
|
3430
|
-
{ pattern: /SendGrid/i, type: "service" },
|
|
3431
|
-
{ pattern: /Mailgun/i, type: "service" },
|
|
3432
|
-
// Cloud/infra
|
|
3433
|
-
{ pattern: /^S3$/i, type: "service" },
|
|
3434
|
-
{ pattern: /^Blob$/i, type: "service" },
|
|
3435
|
-
{ pattern: /Vercel/i, type: "service" },
|
|
3436
|
-
{ pattern: /Netlify/i, type: "service" },
|
|
3437
|
-
{ pattern: /Heroku/i, type: "service" },
|
|
3438
|
-
{ pattern: /Docker/i, type: "service" },
|
|
3439
|
-
{ pattern: /Kubernetes/i, type: "service" },
|
|
3440
|
-
{ pattern: /K8s/i, type: "service" },
|
|
3441
|
-
{ pattern: /Terraform/i, type: "service" },
|
|
3442
|
-
// Security
|
|
3443
|
-
{ pattern: /Vault/i, type: "service" },
|
|
3444
|
-
{ pattern: /^HSM$/i, type: "service" },
|
|
3445
|
-
{ pattern: /KMS/i, type: "service" },
|
|
3446
|
-
{ pattern: /^IAM$/i, type: "service" },
|
|
3447
|
-
// AI/ML
|
|
3448
|
-
{ pattern: /^LLM$/i, type: "service" },
|
|
3449
|
-
{ pattern: /GPT/i, type: "service" },
|
|
3450
|
-
{ pattern: /^Claude$/i, type: "service" },
|
|
3451
|
-
{ pattern: /Embedding/i, type: "service" },
|
|
3452
|
-
{ pattern: /Inference/i, type: "service" },
|
|
3453
|
-
// Suffixes & patterns
|
|
3454
|
-
{ pattern: /Pipeline$/i, type: "service" },
|
|
3455
|
-
{ pattern: /Registry/i, type: "service" },
|
|
3456
|
-
{ pattern: /Engine$/i, type: "service" },
|
|
3457
|
-
{ pattern: /Daemon/i, type: "service" },
|
|
3458
|
-
// ── 9. External patterns ────────────────────────────────
|
|
3459
|
-
{ pattern: /External/i, type: "external" },
|
|
3460
|
-
{ pattern: /Ext$/i, type: "external" },
|
|
3461
|
-
{ pattern: /ThirdParty/i, type: "external" },
|
|
3462
|
-
{ pattern: /3P$/i, type: "external" },
|
|
3463
|
-
{ pattern: /Vendor/i, type: "external" },
|
|
3464
|
-
// Named products & patterns
|
|
3465
|
-
{ pattern: /Callback/i, type: "external" },
|
|
3466
|
-
{ pattern: /^AWS$/i, type: "external" },
|
|
3467
|
-
{ pattern: /^GCP$/i, type: "external" },
|
|
3468
|
-
{ pattern: /Azure/i, type: "external" }
|
|
3318
|
+
{ pattern: /Staff$/i, type: "actor" }
|
|
3469
3319
|
];
|
|
3470
3320
|
RULE_COUNT = PARTICIPANT_RULES.length;
|
|
3471
3321
|
}
|
|
@@ -3693,7 +3543,7 @@ function parseSequenceDgmo(content) {
|
|
|
3693
3543
|
const pushWarning = (line12, message) => {
|
|
3694
3544
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
3695
3545
|
};
|
|
3696
|
-
if (!content
|
|
3546
|
+
if (!content?.trim()) {
|
|
3697
3547
|
return fail(0, "Empty content");
|
|
3698
3548
|
}
|
|
3699
3549
|
const lines = content.split("\n");
|
|
@@ -3704,7 +3554,7 @@ function parseSequenceDgmo(content) {
|
|
|
3704
3554
|
const fl = lines[fi].trim();
|
|
3705
3555
|
if (!fl || fl.startsWith("//")) continue;
|
|
3706
3556
|
const parsed = parseFirstLine(fl);
|
|
3707
|
-
if (parsed
|
|
3557
|
+
if (parsed?.chartType === "sequence") {
|
|
3708
3558
|
hasExplicitChart = true;
|
|
3709
3559
|
firstLineIndex = fi;
|
|
3710
3560
|
if (parsed.title) {
|
|
@@ -4019,6 +3869,17 @@ function parseSequenceDgmo(content) {
|
|
|
4019
3869
|
const id = isAMatch[1];
|
|
4020
3870
|
const typeStr = isAMatch[2].toLowerCase();
|
|
4021
3871
|
let remainder = isAMatch[3]?.trim() || "";
|
|
3872
|
+
if (REMOVED_PARTICIPANT_TYPES.has(typeStr)) {
|
|
3873
|
+
result.diagnostics.push(
|
|
3874
|
+
makeDgmoError(
|
|
3875
|
+
lineNumber,
|
|
3876
|
+
participantTypeRemovedMessage(typeStr),
|
|
3877
|
+
"error",
|
|
3878
|
+
NAME_DIAGNOSTIC_CODES.PARTICIPANT_TYPE_REMOVED
|
|
3879
|
+
)
|
|
3880
|
+
);
|
|
3881
|
+
continue;
|
|
3882
|
+
}
|
|
4022
3883
|
const participantType = VALID_PARTICIPANT_TYPES.has(
|
|
4023
3884
|
typeStr
|
|
4024
3885
|
) ? typeStr : "default";
|
|
@@ -4319,6 +4180,25 @@ function parseSequenceDgmo(content) {
|
|
|
4319
4180
|
}
|
|
4320
4181
|
continue;
|
|
4321
4182
|
}
|
|
4183
|
+
const elifMatch = trimmed.match(/^elif\b\s*(.*)$/i);
|
|
4184
|
+
if (elifMatch) {
|
|
4185
|
+
const tailRaw = elifMatch[1].trim();
|
|
4186
|
+
const tail = tailRaw ? " " + tailRaw : "";
|
|
4187
|
+
pushError(
|
|
4188
|
+
lineNumber,
|
|
4189
|
+
`'elif' is not a keyword. Did you mean 'else if${tail}'?`
|
|
4190
|
+
);
|
|
4191
|
+
continue;
|
|
4192
|
+
}
|
|
4193
|
+
const elseLabelMatch = trimmed.match(/^else\s+(.+)$/i);
|
|
4194
|
+
if (elseLabelMatch) {
|
|
4195
|
+
const tail = elseLabelMatch[1].trim();
|
|
4196
|
+
pushError(
|
|
4197
|
+
lineNumber,
|
|
4198
|
+
`'else' does not take a label. Did you mean 'else if ${tail}'?`
|
|
4199
|
+
);
|
|
4200
|
+
continue;
|
|
4201
|
+
}
|
|
4322
4202
|
{
|
|
4323
4203
|
const noteParsed = parseNoteLine(
|
|
4324
4204
|
trimmed,
|
|
@@ -4442,7 +4322,7 @@ function looksLikeSequence(content) {
|
|
|
4442
4322
|
return ARROW_PATTERN.test(trimmed);
|
|
4443
4323
|
});
|
|
4444
4324
|
}
|
|
4445
|
-
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;
|
|
4325
|
+
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;
|
|
4446
4326
|
var init_parser = __esm({
|
|
4447
4327
|
"src/sequence/parser.ts"() {
|
|
4448
4328
|
"use strict";
|
|
@@ -4455,15 +4335,17 @@ var init_parser = __esm({
|
|
|
4455
4335
|
KNOWN_SEQ_OPTIONS = /* @__PURE__ */ new Set(["active-tag"]);
|
|
4456
4336
|
KNOWN_SEQ_BOOLEANS = /* @__PURE__ */ new Set(["activations", "solid-fill", "no-title"]);
|
|
4457
4337
|
VALID_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
|
|
4458
|
-
"service",
|
|
4459
4338
|
"database",
|
|
4460
4339
|
"actor",
|
|
4461
4340
|
"queue",
|
|
4462
|
-
"cache"
|
|
4463
|
-
|
|
4464
|
-
|
|
4341
|
+
"cache"
|
|
4342
|
+
]);
|
|
4343
|
+
REMOVED_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
|
|
4344
|
+
"service",
|
|
4345
|
+
"frontend",
|
|
4465
4346
|
"networking",
|
|
4466
|
-
"
|
|
4347
|
+
"gateway",
|
|
4348
|
+
"external"
|
|
4467
4349
|
]);
|
|
4468
4350
|
IS_A_PATTERN = /^([^:]+?)\s+is\s+an?\s+(\w+)(?:\s+(.+))?$/i;
|
|
4469
4351
|
POSITION_ONLY_PATTERN = /^([^:]+?)\s+position\s+(-?\d+)$/i;
|
|
@@ -5357,7 +5239,7 @@ function parseClassDiagram(content, palette) {
|
|
|
5357
5239
|
if (trimmed.startsWith("//")) continue;
|
|
5358
5240
|
if (!contentStarted && indent === 0 && i === 0) {
|
|
5359
5241
|
const firstLine = parseFirstLine(trimmed);
|
|
5360
|
-
if (firstLine
|
|
5242
|
+
if (firstLine?.chartType === "class") {
|
|
5361
5243
|
if (firstLine.title) {
|
|
5362
5244
|
result.title = firstLine.title;
|
|
5363
5245
|
result.titleLineNumber = lineNumber;
|
|
@@ -5758,7 +5640,7 @@ function parseERDiagram(content, palette) {
|
|
|
5758
5640
|
if (trimmed.startsWith("//")) continue;
|
|
5759
5641
|
if (!firstLineParsed && indent === 0) {
|
|
5760
5642
|
const firstLineResult = parseFirstLine(trimmed);
|
|
5761
|
-
if (firstLineResult
|
|
5643
|
+
if (firstLineResult?.chartType === "er") {
|
|
5762
5644
|
firstLineParsed = true;
|
|
5763
5645
|
if (firstLineResult.title) {
|
|
5764
5646
|
result.title = firstLineResult.title;
|
|
@@ -6703,7 +6585,7 @@ function parseExtendedChart(content, palette) {
|
|
|
6703
6585
|
""
|
|
6704
6586
|
) : trimmed;
|
|
6705
6587
|
const dataRow2 = parseDataRowValues(strippedLine);
|
|
6706
|
-
if (dataRow2
|
|
6588
|
+
if (dataRow2?.values.length === 1) {
|
|
6707
6589
|
const source = sankeyStack.at(-1).name;
|
|
6708
6590
|
const linkColor = valColorMatch?.[2] ? resolveColorWithDiagnostic(
|
|
6709
6591
|
valColorMatch[2].trim(),
|
|
@@ -6935,7 +6817,7 @@ function parseExtendedChart(content, palette) {
|
|
|
6935
6817
|
}
|
|
6936
6818
|
}
|
|
6937
6819
|
const dataRow = parseDataRowValues(trimmed);
|
|
6938
|
-
if (dataRow
|
|
6820
|
+
if (dataRow?.values.length === 1) {
|
|
6939
6821
|
const { label: rawLabel, color: pointColor } = extractColor(
|
|
6940
6822
|
dataRow.label,
|
|
6941
6823
|
palette
|
|
@@ -8983,7 +8865,7 @@ function parseOrg(content, palette) {
|
|
|
8983
8865
|
const pushWarning = (line12, message) => {
|
|
8984
8866
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
8985
8867
|
};
|
|
8986
|
-
if (!content
|
|
8868
|
+
if (!content?.trim()) {
|
|
8987
8869
|
return fail(0, "No content provided");
|
|
8988
8870
|
}
|
|
8989
8871
|
const lines = content.split("\n");
|
|
@@ -9280,7 +9162,7 @@ function parseKanban(content, palette) {
|
|
|
9280
9162
|
const warn = (line12, message) => {
|
|
9281
9163
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
9282
9164
|
};
|
|
9283
|
-
if (!content
|
|
9165
|
+
if (!content?.trim()) {
|
|
9284
9166
|
return fail(0, "No content provided");
|
|
9285
9167
|
}
|
|
9286
9168
|
const lines = content.split("\n");
|
|
@@ -9669,7 +9551,7 @@ function parseC4(content, palette) {
|
|
|
9669
9551
|
result.error = formatDgmoError(diag);
|
|
9670
9552
|
return result;
|
|
9671
9553
|
};
|
|
9672
|
-
if (!content
|
|
9554
|
+
if (!content?.trim()) {
|
|
9673
9555
|
return fail(0, "No content provided");
|
|
9674
9556
|
}
|
|
9675
9557
|
const lines = content.split("\n");
|
|
@@ -10420,7 +10302,7 @@ function parseSitemap(content, palette) {
|
|
|
10420
10302
|
const pushWarning = (line12, message) => {
|
|
10421
10303
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
10422
10304
|
};
|
|
10423
|
-
if (!content
|
|
10305
|
+
if (!content?.trim()) {
|
|
10424
10306
|
return fail(0, "No content provided");
|
|
10425
10307
|
}
|
|
10426
10308
|
const lines = content.split("\n");
|
|
@@ -13104,7 +12986,7 @@ function parsePert(content, parseOpts = {}) {
|
|
|
13104
12986
|
const head = trimmed.slice(0, firstSpace).toLowerCase();
|
|
13105
12987
|
const value = trimmed.slice(firstSpace + 1).trim();
|
|
13106
12988
|
const hint = NEAR_DIRECTIVE_HINTS.find((h) => h.stem === head);
|
|
13107
|
-
if (hint
|
|
12989
|
+
if (hint?.matches.test(value)) {
|
|
13108
12990
|
error(
|
|
13109
12991
|
lineNumber,
|
|
13110
12992
|
`Unknown directive '${head}'. Did you mean '${hint.canonical}'?`,
|
|
@@ -14411,7 +14293,7 @@ function parseMindmap(content, palette) {
|
|
|
14411
14293
|
const pushWarning = (line12, message) => {
|
|
14412
14294
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
14413
14295
|
};
|
|
14414
|
-
if (!content
|
|
14296
|
+
if (!content?.trim()) {
|
|
14415
14297
|
return fail(0, "No content provided");
|
|
14416
14298
|
}
|
|
14417
14299
|
const lines = content.split("\n");
|
|
@@ -14582,7 +14464,7 @@ function parseMindmap(content, palette) {
|
|
|
14582
14464
|
const diag = makeDgmoError(1, "No nodes found in mindmap");
|
|
14583
14465
|
result.diagnostics.push(diag);
|
|
14584
14466
|
result.error = formatDgmoError(diag);
|
|
14585
|
-
} else if (titleRoot
|
|
14467
|
+
} else if (titleRoot?.children.length === 0 && result.roots.length === 1 && !result.error) {
|
|
14586
14468
|
}
|
|
14587
14469
|
return result;
|
|
14588
14470
|
}
|
|
@@ -15041,7 +14923,7 @@ function parseWireframe(content) {
|
|
|
15041
14923
|
const indent = measureIndent(line12);
|
|
15042
14924
|
if (phase === "header") {
|
|
15043
14925
|
const firstLineResult = parseFirstLine(trimmed);
|
|
15044
|
-
if (firstLineResult
|
|
14926
|
+
if (firstLineResult?.chartType === "wireframe") {
|
|
15045
14927
|
title = firstLineResult.title || null;
|
|
15046
14928
|
titleLineNumber = lineNumber;
|
|
15047
14929
|
continue;
|
|
@@ -15336,7 +15218,7 @@ function parseTechRadar(content) {
|
|
|
15336
15218
|
const warn = (line12, message) => {
|
|
15337
15219
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
15338
15220
|
};
|
|
15339
|
-
if (!content
|
|
15221
|
+
if (!content?.trim()) {
|
|
15340
15222
|
return fail(0, "No content provided");
|
|
15341
15223
|
}
|
|
15342
15224
|
function isRingName(name) {
|
|
@@ -15373,7 +15255,7 @@ function parseTechRadar(content) {
|
|
|
15373
15255
|
if (trimmed.startsWith("//")) continue;
|
|
15374
15256
|
if (!headerParsed) {
|
|
15375
15257
|
const firstLine = parseFirstLine(trimmed);
|
|
15376
|
-
if (firstLine
|
|
15258
|
+
if (firstLine?.chartType === "tech-radar") {
|
|
15377
15259
|
result.title = firstLine.title ?? "";
|
|
15378
15260
|
result.titleLineNumber = lineNumber;
|
|
15379
15261
|
headerParsed = true;
|
|
@@ -15665,7 +15547,7 @@ function parseCycle(content) {
|
|
|
15665
15547
|
const indent = measureIndent(raw);
|
|
15666
15548
|
if (!headerParsed) {
|
|
15667
15549
|
const firstLineResult = parseFirstLine(trimmed);
|
|
15668
|
-
if (firstLineResult
|
|
15550
|
+
if (firstLineResult?.chartType === "cycle") {
|
|
15669
15551
|
result.title = firstLineResult.title ?? "";
|
|
15670
15552
|
result.titleLineNumber = lineNum;
|
|
15671
15553
|
headerParsed = true;
|
|
@@ -15889,7 +15771,7 @@ function parseJourneyMap(content, palette) {
|
|
|
15889
15771
|
const warn = (line12, message) => {
|
|
15890
15772
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
15891
15773
|
};
|
|
15892
|
-
if (!content
|
|
15774
|
+
if (!content?.trim()) {
|
|
15893
15775
|
return fail(0, "No content provided");
|
|
15894
15776
|
}
|
|
15895
15777
|
const lines = content.split("\n");
|
|
@@ -16309,7 +16191,7 @@ function parsePyramid(content) {
|
|
|
16309
16191
|
const indent = measureIndent(raw);
|
|
16310
16192
|
if (!headerParsed) {
|
|
16311
16193
|
const firstLineResult = parseFirstLine(trimmed);
|
|
16312
|
-
if (firstLineResult
|
|
16194
|
+
if (firstLineResult?.chartType === "pyramid") {
|
|
16313
16195
|
result.title = firstLineResult.title ?? "";
|
|
16314
16196
|
result.titleLineNumber = lineNum;
|
|
16315
16197
|
headerParsed = true;
|
|
@@ -16443,7 +16325,7 @@ function parseRing(content) {
|
|
|
16443
16325
|
const indent = measureIndent(raw);
|
|
16444
16326
|
if (!headerParsed) {
|
|
16445
16327
|
const firstLineResult = parseFirstLine(trimmed);
|
|
16446
|
-
if (firstLineResult
|
|
16328
|
+
if (firstLineResult?.chartType === "ring") {
|
|
16447
16329
|
result.title = firstLineResult.title ?? "";
|
|
16448
16330
|
result.titleLineNumber = lineNum;
|
|
16449
16331
|
headerParsed = true;
|
|
@@ -16890,7 +16772,7 @@ function parseRaci(content, palette) {
|
|
|
16890
16772
|
const errorAt = (line12, message, code) => {
|
|
16891
16773
|
result.diagnostics.push(makeDgmoError(line12, message, "error", code));
|
|
16892
16774
|
};
|
|
16893
|
-
if (!content
|
|
16775
|
+
if (!content?.trim()) {
|
|
16894
16776
|
return fail(0, "No content provided");
|
|
16895
16777
|
}
|
|
16896
16778
|
const lines = content.split("\n");
|
|
@@ -17211,7 +17093,7 @@ function parseRaci(content, palette) {
|
|
|
17211
17093
|
if (roleId === null) continue;
|
|
17212
17094
|
if (rolesExplicit) {
|
|
17213
17095
|
const entry = roleStore.get(roleId);
|
|
17214
|
-
if (entry
|
|
17096
|
+
if (entry?.declaredLine === lineNumber) {
|
|
17215
17097
|
const candidates = result.roleDisplayNames.filter(
|
|
17216
17098
|
(n) => n !== entry.displayName
|
|
17217
17099
|
);
|
|
@@ -23592,8 +23474,7 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
|
|
|
23592
23474
|
const edge = parsed.edges[i];
|
|
23593
23475
|
if (edgeParallelCounts[i] === 0) continue;
|
|
23594
23476
|
const elkEdge = edgeById.get(`e${i}`);
|
|
23595
|
-
if (!elkEdge
|
|
23596
|
-
continue;
|
|
23477
|
+
if (!elkEdge?.sections || elkEdge.sections.length === 0) continue;
|
|
23597
23478
|
const container = elkEdge.container ?? "root";
|
|
23598
23479
|
const off = containerAbs.get(container) ?? { x: 0, y: 0 };
|
|
23599
23480
|
const s = elkEdge.sections[0];
|
|
@@ -28519,6 +28400,8 @@ function renderNodeShape(g, node, palette, isDark, endTerminalIds, colorOff, sol
|
|
|
28519
28400
|
case "document":
|
|
28520
28401
|
renderDocument(g, node, palette, isDark, colorOff, solid);
|
|
28521
28402
|
break;
|
|
28403
|
+
default:
|
|
28404
|
+
break;
|
|
28522
28405
|
}
|
|
28523
28406
|
}
|
|
28524
28407
|
function renderFlowchart(container, graph, layout, palette, isDark, onClickItem, exportDims) {
|
|
@@ -31089,7 +30972,7 @@ function renderNodes(svg, nodes, palette, isDark, animate, expandedNodeIds, acti
|
|
|
31089
30972
|
const badgeText = `${node.computedInstances}x`;
|
|
31090
30973
|
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);
|
|
31091
30974
|
}
|
|
31092
|
-
const showDots = activeGroup
|
|
30975
|
+
const showDots = activeGroup?.toLowerCase() === "capabilities";
|
|
31093
30976
|
const roles = showDots && !node.isEdge ? inferRoles(node.properties) : [];
|
|
31094
30977
|
if (roles.length > 0) {
|
|
31095
30978
|
const dotY = isCollapsedGroup ? y + node.height - COLLAPSE_BAR_HEIGHT6 - NODE_PAD_BOTTOM2 / 2 : y + node.height - NODE_PAD_BOTTOM2 / 2;
|
|
@@ -31891,7 +31774,7 @@ function analyzePert(parsed) {
|
|
|
31891
31774
|
for (const e of edges) {
|
|
31892
31775
|
if (!e.lag || e.lag.amount >= 0) continue;
|
|
31893
31776
|
const src = activities.find((a) => a.id === e.source);
|
|
31894
|
-
if (!src
|
|
31777
|
+
if (!src?.duration) continue;
|
|
31895
31778
|
const leadDays = -toDays(e.lag, sprintDays);
|
|
31896
31779
|
const srcDurDays = toDays(src.duration.m, sprintDays);
|
|
31897
31780
|
if (e.type === "FS" && leadDays > srcDurDays) {
|
|
@@ -32397,7 +32280,7 @@ function buildSummary(input) {
|
|
|
32397
32280
|
const anchor = input.anchor ?? null;
|
|
32398
32281
|
if (parsedActivities.length === 0) return null;
|
|
32399
32282
|
if (projectMu === null) {
|
|
32400
|
-
if (anchor
|
|
32283
|
+
if (anchor?.kind === "backward") {
|
|
32401
32284
|
return [
|
|
32402
32285
|
{ text: "Expected duration: ?", level: 0 },
|
|
32403
32286
|
{ text: "P50 latest-safe start: ?", level: 0 },
|
|
@@ -32420,13 +32303,13 @@ function buildSummary(input) {
|
|
|
32420
32303
|
const sigmaPositive = projectSigma !== null && projectSigma > 0;
|
|
32421
32304
|
const showMcDetail = mc && sigmaPositive;
|
|
32422
32305
|
const sigmaParen = showMcDetail ? ` (\xB1 ${roundForCaption(projectSigma)} ${pluralizeUnit(projectSigma, unit)})` : "";
|
|
32423
|
-
if (anchor
|
|
32306
|
+
if (anchor?.kind === "forward") {
|
|
32424
32307
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32425
32308
|
rows.push({
|
|
32426
32309
|
text: `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)}${sigmaParen}.`,
|
|
32427
32310
|
level: 0
|
|
32428
32311
|
});
|
|
32429
|
-
} else if (anchor
|
|
32312
|
+
} else if (anchor?.kind === "backward") {
|
|
32430
32313
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32431
32314
|
rows.push({
|
|
32432
32315
|
text: `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)}${sigmaParen}.`,
|
|
@@ -32445,13 +32328,13 @@ function buildSummary(input) {
|
|
|
32445
32328
|
{ pct: 80, days: monteCarloResult.p80 },
|
|
32446
32329
|
{ pct: 95, days: monteCarloResult.p95 }
|
|
32447
32330
|
];
|
|
32448
|
-
if (anchor
|
|
32331
|
+
if (anchor?.kind === "forward") {
|
|
32449
32332
|
for (const { pct, days } of percentiles) {
|
|
32450
32333
|
const offsetDays = roundConservative(days, "forward");
|
|
32451
32334
|
const date = addCalendarDays(anchor.date, offsetDays);
|
|
32452
32335
|
rows.push({ text: `P${pct} finish: ${date}.`, level: 1 });
|
|
32453
32336
|
}
|
|
32454
|
-
} else if (anchor
|
|
32337
|
+
} else if (anchor?.kind === "backward") {
|
|
32455
32338
|
for (const { pct, days } of percentiles) {
|
|
32456
32339
|
const offsetDays = roundConservative(days, "backward");
|
|
32457
32340
|
const date = addCalendarDays(anchor.date, -offsetDays);
|
|
@@ -32495,20 +32378,20 @@ function buildProjectSubtitle(input) {
|
|
|
32495
32378
|
const sigmaPositive = projectSigma !== null && projectSigma > 0;
|
|
32496
32379
|
const sigmaParen = sigmaPositive ? ` (\xB1 ${roundForCaption(projectSigma)})` : "";
|
|
32497
32380
|
if (projectMu === null) {
|
|
32498
|
-
if (anchor
|
|
32381
|
+
if (anchor?.kind === "forward") {
|
|
32499
32382
|
return `Expected finish: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} of work`;
|
|
32500
32383
|
}
|
|
32501
|
-
if (anchor
|
|
32384
|
+
if (anchor?.kind === "backward") {
|
|
32502
32385
|
return `Expected start: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} lead time`;
|
|
32503
32386
|
}
|
|
32504
32387
|
return `\u2248 ? ${pluralizeUnit(2, unit)}`;
|
|
32505
32388
|
}
|
|
32506
32389
|
const muStr = `${roundForCaption(projectMu)} ${pluralizeUnit(projectMu, unit)}`;
|
|
32507
|
-
if (anchor
|
|
32390
|
+
if (anchor?.kind === "forward") {
|
|
32508
32391
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32509
32392
|
return `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)} \xB7 \u2248 ${muStr} of work${sigmaParen}`;
|
|
32510
32393
|
}
|
|
32511
|
-
if (anchor
|
|
32394
|
+
if (anchor?.kind === "backward") {
|
|
32512
32395
|
const projectMuDays = projectMu * unitToDays(unit);
|
|
32513
32396
|
return `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)} \xB7 \u2248 ${muStr} lead time${sigmaParen}`;
|
|
32514
32397
|
}
|
|
@@ -32698,7 +32581,7 @@ function computeNodeSizing(resolved) {
|
|
|
32698
32581
|
return { activityWidth, milestoneWidth, outerColW, midColW };
|
|
32699
32582
|
}
|
|
32700
32583
|
function nodeDimensions(resolved, id, sizing, overrides) {
|
|
32701
|
-
if (overrides
|
|
32584
|
+
if (overrides?.[id]) {
|
|
32702
32585
|
return { width: overrides[id].width, height: overrides[id].height };
|
|
32703
32586
|
}
|
|
32704
32587
|
const r = resolved.activities.find((a) => a.activity.id === id);
|
|
@@ -43304,9 +43187,6 @@ function wrapLabelWords(words) {
|
|
|
43304
43187
|
function renderRectParticipant(g, palette, isDark, color, solid) {
|
|
43305
43188
|
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);
|
|
43306
43189
|
}
|
|
43307
|
-
function renderServiceParticipant(g, palette, isDark, color, solid) {
|
|
43308
|
-
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);
|
|
43309
|
-
}
|
|
43310
43190
|
function renderActorParticipant(g, palette, color) {
|
|
43311
43191
|
const headR = 8;
|
|
43312
43192
|
const cx = 0;
|
|
@@ -43361,31 +43241,6 @@ function renderCacheParticipant(g, palette, isDark, color, solid) {
|
|
|
43361
43241
|
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);
|
|
43362
43242
|
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);
|
|
43363
43243
|
}
|
|
43364
|
-
function renderNetworkingParticipant(g, palette, isDark, color, solid) {
|
|
43365
|
-
const inset = 16;
|
|
43366
|
-
const points = [
|
|
43367
|
-
`${-W / 2 + inset},0`,
|
|
43368
|
-
`${W / 2 - inset},0`,
|
|
43369
|
-
`${W / 2},${H / 2}`,
|
|
43370
|
-
`${W / 2 - inset},${H}`,
|
|
43371
|
-
`${-W / 2 + inset},${H}`,
|
|
43372
|
-
`${-W / 2},${H / 2}`
|
|
43373
|
-
].join(" ");
|
|
43374
|
-
g.append("polygon").attr("points", points).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
|
|
43375
|
-
}
|
|
43376
|
-
function renderFrontendParticipant(g, palette, isDark, color, solid) {
|
|
43377
|
-
const screenH = H - 10;
|
|
43378
|
-
const s = stroke(palette, color);
|
|
43379
|
-
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);
|
|
43380
|
-
g.append("line").attr("x1", 0).attr("y1", screenH).attr("x2", 0).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
|
|
43381
|
-
g.append("line").attr("x1", -14).attr("y1", H - 2).attr("x2", 14).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
|
|
43382
|
-
}
|
|
43383
|
-
function renderExternalParticipant(g, palette, isDark, color, solid) {
|
|
43384
|
-
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");
|
|
43385
|
-
}
|
|
43386
|
-
function renderGatewayParticipant(g, palette, isDark, color, _solid) {
|
|
43387
|
-
renderRectParticipant(g, palette, isDark, color);
|
|
43388
|
-
}
|
|
43389
43244
|
function groupMessagesBySection(elements, messages) {
|
|
43390
43245
|
const groups = [];
|
|
43391
43246
|
let currentGroup = null;
|
|
@@ -44024,7 +43879,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44024
43879
|
}
|
|
44025
43880
|
}
|
|
44026
43881
|
const lastStep = renderSteps[renderSteps.length - 1];
|
|
44027
|
-
const lastIsSelfCall = lastStep
|
|
43882
|
+
const lastIsSelfCall = lastStep?.type === "call" && lastStep.from === lastStep.to;
|
|
44028
43883
|
const lastStepTrailing = lastIsSelfCall ? SELF_CALL_HEIGHT + 25 : stepSpacing;
|
|
44029
43884
|
let contentBottomY = renderSteps.length > 0 ? Math.max(
|
|
44030
43885
|
stepYPositions[stepYPositions.length - 1] + lastStepTrailing,
|
|
@@ -44198,6 +44053,9 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44198
44053
|
const FRAME_PADDING_X = 30;
|
|
44199
44054
|
const FRAME_PADDING_BOTTOM = 15;
|
|
44200
44055
|
const FRAME_LABEL_HEIGHT = 18;
|
|
44056
|
+
const SELF_ARROW_PROJECTION = ACTIVATION_WIDTH / 2 + SELF_CALL_WIDTH;
|
|
44057
|
+
const SELF_ARROW_FRAME_PAD = 10;
|
|
44058
|
+
const frameRightmostX = Math.max(...Array.from(participantX.values()));
|
|
44201
44059
|
const collectMsgIndices = (els) => {
|
|
44202
44060
|
const indices = [];
|
|
44203
44061
|
for (const el of els) {
|
|
@@ -44264,16 +44122,40 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44264
44122
|
maxPX = Math.max(maxPX, px);
|
|
44265
44123
|
}
|
|
44266
44124
|
}
|
|
44267
|
-
|
|
44125
|
+
let extraLeft = 0;
|
|
44126
|
+
let extraRight = 0;
|
|
44127
|
+
let maxStepIsSelfCall = false;
|
|
44128
|
+
for (const mi of allIndices) {
|
|
44129
|
+
const m = messages[mi];
|
|
44130
|
+
if (m.from === m.to) {
|
|
44131
|
+
const px = participantX.get(m.from);
|
|
44132
|
+
if (px !== void 0) {
|
|
44133
|
+
const flipLeft = px === frameRightmostX;
|
|
44134
|
+
if (flipLeft) {
|
|
44135
|
+
const loopMin = px - SELF_ARROW_PROJECTION;
|
|
44136
|
+
const need = minPX - FRAME_PADDING_X - loopMin + SELF_ARROW_FRAME_PAD;
|
|
44137
|
+
if (need > 0) extraLeft = Math.max(extraLeft, need);
|
|
44138
|
+
} else {
|
|
44139
|
+
const loopMax = px + SELF_ARROW_PROJECTION;
|
|
44140
|
+
const need = loopMax - (maxPX + FRAME_PADDING_X) + SELF_ARROW_FRAME_PAD;
|
|
44141
|
+
if (need > 0) extraRight = Math.max(extraRight, need);
|
|
44142
|
+
}
|
|
44143
|
+
}
|
|
44144
|
+
if (msgToLastStep.get(mi) === maxStep) {
|
|
44145
|
+
maxStepIsSelfCall = true;
|
|
44146
|
+
}
|
|
44147
|
+
}
|
|
44148
|
+
}
|
|
44149
|
+
const frameX = minPX - FRAME_PADDING_X - extraLeft;
|
|
44268
44150
|
const frameY = stepY(minStep) - FRAME_PADDING_TOP;
|
|
44269
|
-
const frameW = maxPX - minPX + FRAME_PADDING_X * 2;
|
|
44270
|
-
const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM;
|
|
44151
|
+
const frameW = maxPX - minPX + FRAME_PADDING_X * 2 + extraLeft + extraRight;
|
|
44152
|
+
const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM + (maxStepIsSelfCall ? SELF_CALL_HEIGHT : 0);
|
|
44271
44153
|
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));
|
|
44272
44154
|
deferredLabels.push({
|
|
44273
44155
|
x: frameX + 6,
|
|
44274
44156
|
y: frameY + FRAME_LABEL_HEIGHT - 4,
|
|
44275
44157
|
text: `${el.type} ${el.label}`,
|
|
44276
|
-
bold:
|
|
44158
|
+
bold: false,
|
|
44277
44159
|
italic: false,
|
|
44278
44160
|
blockLine: el.lineNumber
|
|
44279
44161
|
});
|
|
@@ -44299,7 +44181,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44299
44181
|
y: dividerY + 14,
|
|
44300
44182
|
text: `else if ${branchData.label}`,
|
|
44301
44183
|
bold: false,
|
|
44302
|
-
italic:
|
|
44184
|
+
italic: false,
|
|
44303
44185
|
blockLine: branchData.lineNumber
|
|
44304
44186
|
});
|
|
44305
44187
|
}
|
|
@@ -44326,7 +44208,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44326
44208
|
y: dividerY + 14,
|
|
44327
44209
|
text: "else",
|
|
44328
44210
|
bold: false,
|
|
44329
|
-
italic:
|
|
44211
|
+
italic: false,
|
|
44330
44212
|
blockLine: el.elseLineNumber
|
|
44331
44213
|
});
|
|
44332
44214
|
}
|
|
@@ -44396,7 +44278,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
44396
44278
|
return side === "right" ? px + ACTIVATION_WIDTH / 2 + offset : px - ACTIVATION_WIDTH / 2 + offset;
|
|
44397
44279
|
};
|
|
44398
44280
|
const leftmostX = Math.min(...Array.from(participantX.values()));
|
|
44399
|
-
const rightmostX =
|
|
44281
|
+
const rightmostX = frameRightmostX;
|
|
44400
44282
|
const sectionLineX1 = leftmostX - PARTICIPANT_BOX_WIDTH / 2 - 10;
|
|
44401
44283
|
const sectionLineX2 = rightmostX + PARTICIPANT_BOX_WIDTH / 2 + 10;
|
|
44402
44284
|
for (const region of sectionRegions) {
|
|
@@ -44655,27 +44537,12 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
|
|
|
44655
44537
|
case "database":
|
|
44656
44538
|
renderDatabaseParticipant(g, palette, isDark, color, solid);
|
|
44657
44539
|
break;
|
|
44658
|
-
case "service":
|
|
44659
|
-
renderServiceParticipant(g, palette, isDark, color, solid);
|
|
44660
|
-
break;
|
|
44661
44540
|
case "queue":
|
|
44662
44541
|
renderQueueParticipant(g, palette, isDark, color, solid);
|
|
44663
44542
|
break;
|
|
44664
44543
|
case "cache":
|
|
44665
44544
|
renderCacheParticipant(g, palette, isDark, color, solid);
|
|
44666
44545
|
break;
|
|
44667
|
-
case "networking":
|
|
44668
|
-
renderNetworkingParticipant(g, palette, isDark, color, solid);
|
|
44669
|
-
break;
|
|
44670
|
-
case "frontend":
|
|
44671
|
-
renderFrontendParticipant(g, palette, isDark, color, solid);
|
|
44672
|
-
break;
|
|
44673
|
-
case "external":
|
|
44674
|
-
renderExternalParticipant(g, palette, isDark, color, solid);
|
|
44675
|
-
break;
|
|
44676
|
-
case "gateway":
|
|
44677
|
-
renderGatewayParticipant(g, palette, isDark, color, solid);
|
|
44678
|
-
break;
|
|
44679
44546
|
default:
|
|
44680
44547
|
renderRectParticipant(g, palette, isDark, color, solid);
|
|
44681
44548
|
break;
|
|
@@ -44703,7 +44570,7 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
|
|
|
44703
44570
|
});
|
|
44704
44571
|
}
|
|
44705
44572
|
}
|
|
44706
|
-
var d3Selection21, PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET,
|
|
44573
|
+
var d3Selection21, 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;
|
|
44707
44574
|
var init_renderer19 = __esm({
|
|
44708
44575
|
"src/sequence/renderer.ts"() {
|
|
44709
44576
|
"use strict";
|
|
@@ -44725,7 +44592,6 @@ var init_renderer19 = __esm({
|
|
|
44725
44592
|
TOP_MARGIN = 20;
|
|
44726
44593
|
TITLE_HEIGHT8 = 30;
|
|
44727
44594
|
PARTICIPANT_Y_OFFSET = 10;
|
|
44728
|
-
SERVICE_BORDER_RADIUS = 10;
|
|
44729
44595
|
MESSAGE_START_OFFSET = 30;
|
|
44730
44596
|
LIFELINE_TAIL = 30;
|
|
44731
44597
|
ARROWHEAD_SIZE = 8;
|
|
@@ -44917,7 +44783,7 @@ function parseVisualization(content, palette) {
|
|
|
44917
44783
|
const warn = (line12, message) => {
|
|
44918
44784
|
result.diagnostics.push(makeDgmoError(line12, message, "warning"));
|
|
44919
44785
|
};
|
|
44920
|
-
if (!content
|
|
44786
|
+
if (!content?.trim()) {
|
|
44921
44787
|
return fail(0, "Empty content");
|
|
44922
44788
|
}
|
|
44923
44789
|
const lines = content.split("\n");
|
|
@@ -46957,7 +46823,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
|
|
|
46957
46823
|
const groupKey = groupName.toLowerCase();
|
|
46958
46824
|
groupEl.attr("data-tag-group", groupKey);
|
|
46959
46825
|
if (isActive && !viewMode) {
|
|
46960
|
-
const isSwimActive = currentSwimlaneGroup
|
|
46826
|
+
const isSwimActive = currentSwimlaneGroup?.toLowerCase() === groupKey;
|
|
46961
46827
|
const pillWidth3 = measureLegendText(groupName, LG_PILL_FONT_SIZE) + LG_PILL_PAD;
|
|
46962
46828
|
const pillXOff = LG_CAPSULE_PAD;
|
|
46963
46829
|
const iconX = pillXOff + pillWidth3 + 5;
|
|
@@ -52118,20 +51984,7 @@ var CHART_TYPES = [...ALL_CHART_TYPES].filter((t) => t !== "multi-line").map((na
|
|
|
52118
51984
|
description: CHART_TYPE_DESCRIPTIONS2[name] ?? name
|
|
52119
51985
|
}));
|
|
52120
51986
|
var ENTITY_TYPES = /* @__PURE__ */ new Map([
|
|
52121
|
-
[
|
|
52122
|
-
"sequence",
|
|
52123
|
-
[
|
|
52124
|
-
"service",
|
|
52125
|
-
"database",
|
|
52126
|
-
"actor",
|
|
52127
|
-
"queue",
|
|
52128
|
-
"cache",
|
|
52129
|
-
"gateway",
|
|
52130
|
-
"external",
|
|
52131
|
-
"networking",
|
|
52132
|
-
"frontend"
|
|
52133
|
-
]
|
|
52134
|
-
],
|
|
51987
|
+
["sequence", ["actor", "database", "queue", "cache"]],
|
|
52135
51988
|
[
|
|
52136
51989
|
"c4",
|
|
52137
51990
|
["person", "system", "container", "component", "external", "database"]
|