@markdy/renderer-dom 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +17 -17
  2. package/dist/index.js +287 -14
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -16,19 +16,19 @@ Web Animations API renderer for [MarkdyScript](https://markdy.com/docs/) scenes.
16
16
 
17
17
  ## Features
18
18
 
19
- - **Browser-native** — Web Animations API + CSS transforms, no Canvas or GSAP (~24 KB minzipped)
20
- - **Blast Radius & Upstream Impact Lens** — compute and highlight transitive inward callers and outward impact chains dynamically
21
- - **Route Pathfinder** — discover and animate the shortest topological communication route between any two services
22
- - **Dynamic Port Multiplexing & Fillet Connectors** — renders balanced parallel connection lanes with smooth rounded corner paths
23
- - **17 Diagram Layout Topologies** — `architecture`, `flowchart`, `tree`, `sequence`, `state`, `layers`, `nested`, `swimlane`, `timeline`, `gantt`, `medallion`, `flywheel`, `constellation`, `quadrant`, `pyramid`, `radar`, `venn`
24
- - **Dynamic Theme Switching** — live runtime switching across 10 semantic themes (`paper`, `editorial`, `midnight`, `blueprint`, `graphite`, `nebula`, `terminal`, `sketchy`, `ink`, `doodle`)
25
- - **Flow edges** — `->` request, `<-` response, `~>` event, `--` dependency, each with its own stroke, plus animated traveling pulse
26
- - **Beat-driven cues** — `show`, `hide`, `glow`, `focus`, and `frame` camera zooms, sequenced by named beats
27
- - **Media Exporters** — zero-dep animated GIF89a exporter with LZW compression and Figma-ready vector SVG export
28
- - **Seek-safe** — manual `currentTime` control enables reliable `seek()` in any direction
29
- - **Playback-rate controls** — set normalized timeline speed to slow down or speed up diagrams without rebuilding animations
30
- - **Interactive viewport** — wheel zoom, drag pan, and double-click reset with responsive auto-fit
31
- - **Single dependency** — only `@markdy/core`
19
+ - **Browser-native**: Web Animations API + CSS transforms, no Canvas or GSAP (~24 KB minzipped)
20
+ - **Blast Radius & Upstream Impact Lens**: compute and highlight transitive inward callers and outward impact chains dynamically
21
+ - **Route Pathfinder**: discover and animate the shortest topological communication route between any two services
22
+ - **Dynamic Port Multiplexing & Fillet Connectors**: renders balanced parallel connection lanes with smooth rounded corner paths
23
+ - **17 Diagram Layout Topologies**: `architecture`, `flowchart`, `tree`, `sequence`, `state`, `layers`, `nested`, `swimlane`, `timeline`, `gantt`, `medallion`, `flywheel`, `constellation`, `quadrant`, `pyramid`, `radar`, `venn`
24
+ - **Dynamic Theme Switching**: live runtime switching across 10 semantic themes (`paper`, `editorial`, `midnight`, `blueprint`, `graphite`, `nebula`, `terminal`, `sketchy`, `ink`, `doodle`)
25
+ - **Flow edges**: `->` request, `<-` response, `~>` event, `--` dependency, each with its own stroke, plus animated traveling pulse
26
+ - **Beat-driven cues**: `show`, `hide`, `glow`, `focus`, and `frame` camera zooms, sequenced by named beats
27
+ - **Media Exporters**: zero-dep animated GIF89a exporter with LZW compression and Figma-ready vector SVG export
28
+ - **Seek-safe**: manual `currentTime` control enables reliable `seek()` in any direction
29
+ - **Playback-rate controls**: set normalized timeline speed to slow down or speed up diagrams without rebuilding animations
30
+ - **Interactive viewport**: wheel zoom, drag pan, and double-click reset with responsive auto-fit
31
+ - **Single dependency**: only `@markdy/core`
32
32
 
33
33
  ## Installation
34
34
 
@@ -164,10 +164,10 @@ The harness runs on **`http://127.0.0.1:4325`** (port 4325 is decoupled from Ast
164
164
 
165
165
  ## Ecosystem & Documentation
166
166
 
167
- - ⚡ **[Interactive Studio / Playground](https://markdy.com/playground/)** — edit MarkdyScript with instant live preview in your browser
168
- - 📖 **[Syntax Guide & Reference](https://markdy.com/docs/)** — complete language specification and keywords
169
- - 🌟 **[Canonical Blueprints](https://markdy.com/examples/)** — production-grade distributed system and cloud architectures
170
- - 📦 **[GitHub Repository](https://github.com/HoangYell/markdy-com)** — source code, benchmarks, and issue tracker
167
+ - ⚡ **[Interactive Studio / Playground](https://markdy.com/playground/)**: edit MarkdyScript with instant live preview in your browser
168
+ - 📖 **[Syntax Guide & Reference](https://markdy.com/docs/)**: complete language specification and keywords
169
+ - 🌟 **[Canonical Blueprints](https://markdy.com/examples/)**: production-grade distributed system and cloud architectures
170
+ - 📦 **[GitHub Repository](https://github.com/HoangYell/markdy-com)**: source code, benchmarks, and issue tracker
171
171
 
172
172
  ## 📐 Production Architecture Blueprints & Pro Support
173
173
 
package/dist/index.js CHANGED
@@ -1039,6 +1039,10 @@ function createEdgeRuntime(svg, from, to, kind, label, theme, sceneId, routeObst
1039
1039
  textEl.setAttribute("letter-spacing", "0.02em");
1040
1040
  textEl.setAttribute("font-family", "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace");
1041
1041
  textEl.setAttribute("fill", labelColor);
1042
+ textEl.setAttribute("paint-order", "stroke fill");
1043
+ textEl.setAttribute("stroke", theme.canvas ?? theme.surface ?? "#ffffff");
1044
+ textEl.setAttribute("stroke-width", "3.5px");
1045
+ textEl.setAttribute("stroke-linejoin", "round");
1042
1046
  if (lines.length === 1) {
1043
1047
  textEl.setAttribute("y", String(placement.y + 0.5));
1044
1048
  textEl.setAttribute("dominant-baseline", "middle");
@@ -2179,6 +2183,113 @@ function ensureGroupStyles(doc) {
2179
2183
  color: #1e3a8a;
2180
2184
  font-weight: 600;
2181
2185
  }
2186
+
2187
+ /* Cloud Vendor & Architecture Bounding Containers */
2188
+ .markdy-group-boundary[data-vendor="aws"],
2189
+ .markdy-group-boundary[data-vendor="aws-vpc"] {
2190
+ border: 1.5px solid #8c4fff !important;
2191
+ border-radius: 8px !important;
2192
+ background: rgba(140, 79, 255, 0.04) !important;
2193
+ }
2194
+ .markdy-group-boundary[data-vendor="aws"] .markdy-group-boundary__label,
2195
+ .markdy-group-boundary[data-vendor="aws-vpc"] .markdy-group-boundary__label {
2196
+ border-color: #8c4fff !important;
2197
+ color: #8c4fff !important;
2198
+ }
2199
+
2200
+ .markdy-group-boundary[data-vendor="aws-private"] {
2201
+ border: 1.5px dashed #00a4a6 !important;
2202
+ border-radius: 6px !important;
2203
+ background: rgba(0, 164, 166, 0.03) !important;
2204
+ }
2205
+ .markdy-group-boundary[data-vendor="aws-private"] .markdy-group-boundary__label {
2206
+ border-color: #00a4a6 !important;
2207
+ color: #00a4a6 !important;
2208
+ }
2209
+
2210
+ .markdy-group-boundary[data-vendor="aws-public"] {
2211
+ border: 1.5px dashed #7aa116 !important;
2212
+ border-radius: 6px !important;
2213
+ background: rgba(122, 161, 22, 0.03) !important;
2214
+ }
2215
+ .markdy-group-boundary[data-vendor="aws-public"] .markdy-group-boundary__label {
2216
+ border-color: #7aa116 !important;
2217
+ color: #7aa116 !important;
2218
+ }
2219
+
2220
+ .markdy-group-boundary[data-vendor="gcp"] {
2221
+ border: 1.5px solid #4285f4 !important;
2222
+ border-radius: 8px !important;
2223
+ background: rgba(66, 133, 244, 0.04) !important;
2224
+ }
2225
+ .markdy-group-boundary[data-vendor="gcp"] .markdy-group-boundary__label {
2226
+ border-color: #4285f4 !important;
2227
+ color: #4285f4 !important;
2228
+ }
2229
+
2230
+ .markdy-group-boundary[data-vendor="azure"] {
2231
+ border: 1.5px solid #0078d4 !important;
2232
+ border-radius: 8px !important;
2233
+ background: rgba(0, 120, 212, 0.04) !important;
2234
+ }
2235
+ .markdy-group-boundary[data-vendor="azure"] .markdy-group-boundary__label {
2236
+ border-color: #0078d4 !important;
2237
+ color: #0078d4 !important;
2238
+ }
2239
+
2240
+ .markdy-group-boundary[data-vendor="tooling"] {
2241
+ border: 1.5px solid #0284c7 !important;
2242
+ border-radius: 8px !important;
2243
+ background: rgba(2, 132, 199, 0.04) !important;
2244
+ }
2245
+ .markdy-group-boundary[data-vendor="tooling"] .markdy-group-boundary__label {
2246
+ border-color: #0284c7 !important;
2247
+ color: #0284c7 !important;
2248
+ }
2249
+
2250
+ /* CAD Engineered Paper Theme Group Style */
2251
+ .markdy-scene-root[data-markdy-theme="cad"] .markdy-group-boundary {
2252
+ border: 1.5px solid #cbd5e1;
2253
+ border-radius: 8px;
2254
+ background: rgba(241, 245, 249, 0.45);
2255
+ box-shadow: none;
2256
+ backdrop-filter: none;
2257
+ -webkit-backdrop-filter: none;
2258
+ }
2259
+ .markdy-scene-root[data-markdy-theme="cad"] .markdy-group-boundary__label {
2260
+ top: 8px;
2261
+ left: 10px;
2262
+ border: 1px solid #cbd5e1;
2263
+ background: #ffffff;
2264
+ color: #334155;
2265
+ font-weight: 600;
2266
+ font-size: 11px;
2267
+ border-radius: 4px;
2268
+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
2269
+ letter-spacing: 0.02em;
2270
+ text-transform: none;
2271
+ }
2272
+ .markdy-scene-root[data-markdy-theme="cad-dark"] .markdy-group-boundary {
2273
+ border: 1.5px solid #475569;
2274
+ border-radius: 8px;
2275
+ background: rgba(30, 41, 59, 0.45);
2276
+ box-shadow: none;
2277
+ backdrop-filter: none;
2278
+ -webkit-backdrop-filter: none;
2279
+ }
2280
+ .markdy-scene-root[data-markdy-theme="cad-dark"] .markdy-group-boundary__label {
2281
+ top: 8px;
2282
+ left: 10px;
2283
+ border: 1px solid #475569;
2284
+ background: #1e293b;
2285
+ color: #f1f5f9;
2286
+ font-weight: 600;
2287
+ font-size: 11px;
2288
+ border-radius: 4px;
2289
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
2290
+ letter-spacing: 0.02em;
2291
+ text-transform: none;
2292
+ }
2182
2293
  `;
2183
2294
  doc.head.appendChild(style);
2184
2295
  }
@@ -2191,6 +2302,28 @@ function createGroupBoundaryEl(boundary, theme, doc = document) {
2191
2302
  el.style.width = `${boundary.width}px`;
2192
2303
  el.style.height = `${boundary.height}px`;
2193
2304
  el.style.setProperty("--md-group-border", theme.border ?? theme.rule ?? "#cbd5e1");
2305
+ const rawId = boundary.id.toLowerCase();
2306
+ const rawLabel = (boundary.label || "").toLowerCase();
2307
+ const rawKind = String(boundary.props?.kind || boundary.props?.vendor || "").toLowerCase();
2308
+ let vendor = null;
2309
+ if (rawKind === "aws-vpc" || rawKind === "vpc" || rawId.startsWith("aws_vpc") || rawLabel.includes("aws") && rawLabel.includes("vpc")) {
2310
+ vendor = "aws-vpc";
2311
+ } else if (rawKind === "aws-private" || rawKind === "private-subnet" || rawId.startsWith("aws_private") || rawLabel.includes("aws") && rawLabel.includes("private") || rawId === "private_subnet") {
2312
+ vendor = "aws-private";
2313
+ } else if (rawKind === "aws-public" || rawKind === "public-subnet" || rawId.startsWith("aws_public") || rawLabel.includes("aws") && rawLabel.includes("public") || rawId === "public_subnet") {
2314
+ vendor = "aws-public";
2315
+ } else if (rawKind === "aws" || rawId.startsWith("aws_") || rawLabel.startsWith("aws ")) {
2316
+ vendor = "aws";
2317
+ } else if (rawKind === "gcp" || rawId.startsWith("gcp_") || rawLabel.includes("google cloud") || rawLabel.startsWith("gcp ")) {
2318
+ vendor = "gcp";
2319
+ } else if (rawKind === "azure" || rawId.startsWith("azure_") || rawLabel.startsWith("azure ")) {
2320
+ vendor = "azure";
2321
+ } else if (rawKind === "tooling" || rawKind === "monorepo" || rawId === "tooling" || rawId === "monorepo" || rawLabel.includes("monorepo")) {
2322
+ vendor = "tooling";
2323
+ }
2324
+ if (vendor) {
2325
+ el.dataset.vendor = vendor;
2326
+ }
2194
2327
  const displayLabel = boundary.label || boundary.id;
2195
2328
  if (displayLabel) {
2196
2329
  const label = doc.createElement("div");
@@ -2208,7 +2341,7 @@ function mountGroupBoundaries(layer, boundaries, theme) {
2208
2341
  }
2209
2342
 
2210
2343
  // src/nodes.ts
2211
- import { resolveVectorSymbol } from "@markdy/core";
2344
+ import { resolveVectorSymbol, resolveBrandLogoUrl } from "@markdy/core";
2212
2345
  var STYLE_ID3 = "markdy-diagram-node-styles";
2213
2346
  function ensureNodeStyles(doc) {
2214
2347
  if (doc.getElementById(STYLE_ID3)) return;
@@ -2309,6 +2442,12 @@ function ensureNodeStyles(doc) {
2309
2442
  .markdy-node__icon[data-fit="cover"] img {
2310
2443
  object-fit: cover;
2311
2444
  }
2445
+ .markdy-node__icon[data-tile="dark"] {
2446
+ background: #18181b !important;
2447
+ border-radius: 6px !important;
2448
+ padding: 3px !important;
2449
+ box-sizing: border-box !important;
2450
+ }
2312
2451
  .markdy-node__content {
2313
2452
  flex: 1 1 auto;
2314
2453
  min-width: 0;
@@ -2994,10 +3133,13 @@ function resolveImageSrc(node, assets) {
2994
3133
  if (typeof raw !== "string" || raw.length === 0) return void 0;
2995
3134
  return assets?.[raw] ?? raw;
2996
3135
  }
2997
- function createNodeMediaEl(doc, node, assets) {
3136
+ function createNodeMediaEl(doc, node, assets, theme) {
2998
3137
  const wrap = doc.createElement("div");
2999
3138
  wrap.className = "markdy-node__icon";
3000
3139
  wrap.setAttribute("aria-hidden", "true");
3140
+ if (node.props?.tile === "dark") {
3141
+ wrap.dataset.tile = "dark";
3142
+ }
3001
3143
  const imgSrc = resolveImageSrc(node, assets);
3002
3144
  if (imgSrc) {
3003
3145
  wrap.dataset.media = "image";
@@ -3027,12 +3169,38 @@ function createNodeMediaEl(doc, node, assets) {
3027
3169
  svg.setAttribute("width", "26");
3028
3170
  svg.setAttribute("height", "26");
3029
3171
  if (vectorSymbol.brandColor) {
3030
- svg.style.color = vectorSymbol.brandColor;
3172
+ const isDark = theme ? theme.name.includes("dark") || theme.name === "midnight" || theme.name === "graphite" || theme.name === "nebula" || theme.name === "terminal" : false;
3173
+ const hex = vectorSymbol.brandColor.toLowerCase();
3174
+ if (isDark && (hex === "#000000" || hex === "#0f172a" || hex === "#18181b")) {
3175
+ svg.style.color = "#ffffff";
3176
+ } else if (!isDark && (hex === "#ffffff" || hex === "#f8fafc" || hex === "#fbf0df")) {
3177
+ svg.style.color = "#000000";
3178
+ } else {
3179
+ svg.style.color = vectorSymbol.brandColor;
3180
+ }
3031
3181
  }
3032
3182
  svg.innerHTML = vectorSymbol.svgPaths;
3033
3183
  wrap.appendChild(svg);
3034
3184
  return wrap;
3035
3185
  }
3186
+ if (symbolKey && !vectorSymbol && !symbolKey.includes(" ")) {
3187
+ wrap.dataset.media = "image";
3188
+ wrap.dataset.fit = "contain";
3189
+ const img = doc.createElement("img");
3190
+ img.src = resolveBrandLogoUrl(symbolKey);
3191
+ img.alt = "";
3192
+ img.decoding = "async";
3193
+ img.loading = "lazy";
3194
+ img.referrerPolicy = "no-referrer";
3195
+ img.addEventListener("error", () => {
3196
+ wrap.removeAttribute("data-media");
3197
+ wrap.removeAttribute("data-fit");
3198
+ wrap.textContent = "";
3199
+ appendGlyph(doc, wrap, ICONS[iconKeyForNode(node)] ?? ICONS.service);
3200
+ });
3201
+ wrap.appendChild(img);
3202
+ return wrap;
3203
+ }
3036
3204
  appendGlyph(doc, wrap, ICONS[iconKeyForNode(node)] ?? ICONS.service);
3037
3205
  return wrap;
3038
3206
  }
@@ -3096,7 +3264,7 @@ function createNodeEl(node, theme, assets) {
3096
3264
  }
3097
3265
  const body = document.createElement("div");
3098
3266
  body.className = "markdy-node__body";
3099
- body.append(createNodeMediaEl(document, node, assets));
3267
+ body.append(createNodeMediaEl(document, node, assets, theme));
3100
3268
  const content = document.createElement("div");
3101
3269
  content.className = "markdy-node__content";
3102
3270
  const label = document.createElement("div");
@@ -3582,6 +3750,32 @@ function ensureSceneStyles(doc) {
3582
3750
  radial-gradient(ellipse at 15% 85%, rgba(37, 99, 235, 0.05), transparent 45%);
3583
3751
  opacity: 0.6;
3584
3752
  }
3753
+ .markdy-viewport[data-markdy-theme="cad"]::before,
3754
+ .markdy-scene-root[data-markdy-theme="cad"]::before {
3755
+ background:
3756
+ linear-gradient(var(--md-rule, rgba(148, 163, 184, 0.28)) 1px, transparent 1px) 0 0 / 24px 24px,
3757
+ linear-gradient(90deg, var(--md-rule, rgba(148, 163, 184, 0.28)) 1px, transparent 1px) 0 0 / 24px 24px;
3758
+ mask-image: none;
3759
+ opacity: 0.85;
3760
+ }
3761
+ .markdy-viewport[data-markdy-theme="cad"]::after,
3762
+ .markdy-scene-root[data-markdy-theme="cad"]::after {
3763
+ background: none;
3764
+ opacity: 0;
3765
+ }
3766
+ .markdy-viewport[data-markdy-theme="cad-dark"]::before,
3767
+ .markdy-scene-root[data-markdy-theme="cad-dark"]::before {
3768
+ background:
3769
+ linear-gradient(var(--md-rule, rgba(148, 163, 184, 0.16)) 1px, transparent 1px) 0 0 / 24px 24px,
3770
+ linear-gradient(90deg, var(--md-rule, rgba(148, 163, 184, 0.16)) 1px, transparent 1px) 0 0 / 24px 24px;
3771
+ mask-image: none;
3772
+ opacity: 0.75;
3773
+ }
3774
+ .markdy-viewport[data-markdy-theme="cad-dark"]::after,
3775
+ .markdy-scene-root[data-markdy-theme="cad-dark"]::after {
3776
+ background: none;
3777
+ opacity: 0;
3778
+ }
3585
3779
  @keyframes markdy-star-twinkle {
3586
3780
  from { opacity: 0.24; transform: scale(0.85); }
3587
3781
  to { opacity: 0.9; transform: scale(1.15); }
@@ -4995,6 +5189,15 @@ function wrapNodeLabel(label, maxWidthPx, fontSize = 13.5) {
4995
5189
  }
4996
5190
  return lines;
4997
5191
  }
5192
+ function resolveContrastColor(brandColor, defaultColor, isDark) {
5193
+ if (brandColor) {
5194
+ const hex = brandColor.toLowerCase();
5195
+ if (isDark && (hex === "#000000" || hex === "#0f172a" || hex === "#18181b")) return "#ffffff";
5196
+ if (!isDark && (hex === "#ffffff" || hex === "#f8fafc" || hex === "#fbf0df")) return "#000000";
5197
+ return brandColor;
5198
+ }
5199
+ return defaultColor;
5200
+ }
4998
5201
  function renderPureVectorSvg(plan, options = {}) {
4999
5202
  const width = plan.meta.width;
5000
5203
  const height = plan.meta.height;
@@ -5086,14 +5289,84 @@ function renderPureVectorSvg(plan, options = {}) {
5086
5289
  <g class="markdy-groups-layer">
5087
5290
  `;
5088
5291
  for (const gb of plan.groupBoundaries) {
5292
+ const rawId = gb.id.toLowerCase();
5293
+ const rawLabel = (gb.label || "").toLowerCase();
5294
+ const rawKind = String(gb.props?.kind || gb.props?.vendor || "").toLowerCase();
5295
+ let groupStroke = border;
5296
+ let groupFill = surfaceRaised;
5297
+ let groupFillOpacity = isDark ? "0.28" : "0.45";
5298
+ let groupDash = "5 5";
5299
+ let groupRadius = 16;
5300
+ let labelBorder = border;
5301
+ let labelColor = textColor;
5302
+ let labelCase = gb.label ? gb.label.toUpperCase() : "";
5303
+ if (rawKind === "aws-vpc" || rawKind === "vpc" || rawId.startsWith("aws_vpc") || rawLabel.includes("aws") && rawLabel.includes("vpc")) {
5304
+ groupStroke = "#8C4FFF";
5305
+ groupDash = "none";
5306
+ groupRadius = 8;
5307
+ groupFill = "#8C4FFF";
5308
+ groupFillOpacity = "0.04";
5309
+ labelBorder = "#8C4FFF";
5310
+ labelColor = "#8C4FFF";
5311
+ labelCase = gb.label || "";
5312
+ } else if (rawKind === "aws-private" || rawKind === "private-subnet" || rawId.startsWith("aws_private") || rawLabel.includes("aws") && rawLabel.includes("private") || rawId === "private_subnet") {
5313
+ groupStroke = "#00A4A6";
5314
+ groupDash = "5 5";
5315
+ groupRadius = 6;
5316
+ groupFill = "#00A4A6";
5317
+ groupFillOpacity = "0.03";
5318
+ labelBorder = "#00A4A6";
5319
+ labelColor = "#00A4A6";
5320
+ labelCase = gb.label || "";
5321
+ } else if (rawKind === "aws-public" || rawKind === "public-subnet" || rawId.startsWith("aws_public") || rawLabel.includes("aws") && rawLabel.includes("public") || rawId === "public_subnet") {
5322
+ groupStroke = "#7AA116";
5323
+ groupDash = "5 5";
5324
+ groupRadius = 6;
5325
+ groupFill = "#7AA116";
5326
+ groupFillOpacity = "0.03";
5327
+ labelBorder = "#7AA116";
5328
+ labelColor = "#7AA116";
5329
+ labelCase = gb.label || "";
5330
+ } else if (rawKind === "gcp" || rawId.startsWith("gcp_") || rawLabel.includes("google cloud") || rawLabel.startsWith("gcp ")) {
5331
+ groupStroke = "#4285F4";
5332
+ groupDash = "none";
5333
+ groupRadius = 8;
5334
+ groupFill = "#4285F4";
5335
+ groupFillOpacity = "0.04";
5336
+ labelBorder = "#4285F4";
5337
+ labelColor = "#4285F4";
5338
+ labelCase = gb.label || "";
5339
+ } else if (rawKind === "azure" || rawId.startsWith("azure_") || rawLabel.startsWith("azure ")) {
5340
+ groupStroke = "#0078D4";
5341
+ groupDash = "none";
5342
+ groupRadius = 8;
5343
+ groupFill = "#0078D4";
5344
+ groupFillOpacity = "0.04";
5345
+ labelBorder = "#0078D4";
5346
+ labelColor = "#0078D4";
5347
+ labelCase = gb.label || "";
5348
+ } else if (rawKind === "tooling" || rawKind === "monorepo" || rawId === "tooling" || rawId === "monorepo" || rawLabel.includes("monorepo")) {
5349
+ groupStroke = "#0284C7";
5350
+ groupDash = "none";
5351
+ groupRadius = 8;
5352
+ groupFill = "#0284C7";
5353
+ groupFillOpacity = "0.04";
5354
+ labelBorder = "#0284C7";
5355
+ labelColor = "#0284C7";
5356
+ labelCase = gb.label || "";
5357
+ } else if (theme.name === "cad" || theme.name === "cad-dark") {
5358
+ groupStroke = isDark ? "#475569" : "#cbd5e1";
5359
+ groupDash = "none";
5360
+ groupRadius = 8;
5361
+ labelCase = gb.label || "";
5362
+ }
5089
5363
  svg += ` <g id="group-${escapeXml(gb.id)}" transform="translate(${gb.x}, ${gb.y})">
5090
- <rect width="${gb.width}" height="${gb.height}" rx="16" fill="${surfaceRaised}" fill-opacity="${isDark ? "0.28" : "0.45"}" stroke="${border}" stroke-width="1.2" stroke-dasharray="5 5"/>
5364
+ <rect width="${gb.width}" height="${gb.height}" rx="${groupRadius}" fill="${groupFill}" fill-opacity="${groupFillOpacity}" stroke="${groupStroke}" stroke-width="1.5"${groupDash !== "none" ? ` stroke-dasharray="${groupDash}"` : ""}/>
5091
5365
  `;
5092
5366
  if (gb.label) {
5093
- const labelText = gb.label.toUpperCase();
5094
- const labelW = Math.max(54, labelText.length * 6.8 + 20);
5095
- svg += ` <rect x="14" y="10" width="${labelW}" height="20" rx="6" fill="${surfaceRaised}" fill-opacity="0.95" stroke="${border}" stroke-width="1"/>
5096
- <text x="${14 + labelW / 2}" y="20" class="markdy-svg-mono" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, monospace" font-size="10" font-weight="700" letter-spacing="0.1em" fill="${textColor}" text-anchor="middle" dominant-baseline="central">${escapeXml(labelText)}</text>
5367
+ const labelW = Math.max(54, labelCase.length * 6.8 + 20);
5368
+ svg += ` <rect x="14" y="10" width="${labelW}" height="20" rx="4" fill="${surfaceRaised}" fill-opacity="0.95" stroke="${labelBorder}" stroke-width="1"/>
5369
+ <text x="${14 + labelW / 2}" y="20" class="markdy-svg-mono" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, monospace" font-size="10" font-weight="600" fill="${labelColor}" text-anchor="middle" dominant-baseline="central">${escapeXml(labelCase)}</text>
5097
5370
  `;
5098
5371
  }
5099
5372
  svg += ` </g>
@@ -5308,12 +5581,12 @@ function renderPureVectorSvg(plan, options = {}) {
5308
5581
  <rect x="${labelX}" y="${labelY}" width="${textWidth + padX * 2}" height="${boxHeight}" rx="4" fill="${canvasBg}" stroke="${border}" stroke-width="1"/>
5309
5582
  `;
5310
5583
  if (lines.length === 1) {
5311
- svg += ` <text x="${placement.x}" y="${placement.y}" class="markdy-svg-mono" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="10.5" font-weight="500" fill="${labelColor}" text-anchor="middle" dominant-baseline="central">${escapeXml(lines[0])}</text>
5584
+ svg += ` <text x="${placement.x}" y="${placement.y}" class="markdy-svg-mono" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="10.5" font-weight="500" fill="${labelColor}" stroke="${canvasBg}" stroke-width="3.5" stroke-linejoin="round" paint-order="stroke fill" text-anchor="middle" dominant-baseline="central">${escapeXml(lines[0])}</text>
5312
5585
  `;
5313
5586
  } else {
5314
5587
  lines.forEach((lineText, idx) => {
5315
5588
  const lineY = placement.y - (lines.length - 1) * lineHeight / 2 + idx * lineHeight;
5316
- svg += ` <text x="${placement.x}" y="${lineY}" class="markdy-svg-mono" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="10.5" font-weight="500" fill="${labelColor}" text-anchor="middle" dominant-baseline="central">${escapeXml(lineText)}</text>
5589
+ svg += ` <text x="${placement.x}" y="${lineY}" class="markdy-svg-mono" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="10.5" font-weight="500" fill="${labelColor}" stroke="${canvasBg}" stroke-width="3.5" stroke-linejoin="round" paint-order="stroke fill" text-anchor="middle" dominant-baseline="central">${escapeXml(lineText)}</text>
5317
5590
  `;
5318
5591
  });
5319
5592
  }
@@ -5380,7 +5653,7 @@ function renderPureVectorSvg(plan, options = {}) {
5380
5653
  svg += ` <image href="${escapeXml(rawImage)}" x="${iconX}" y="${iconY}" width="${diamondIconSize}" height="${diamondIconSize}" preserveAspectRatio="xMidYMid meet"/>
5381
5654
  `;
5382
5655
  } else if (vectorSymbol) {
5383
- const symColor = vectorSymbol.brandColor || roleColor;
5656
+ const symColor = resolveContrastColor(vectorSymbol.brandColor, roleColor, isDark);
5384
5657
  svg += ` <g transform="translate(${iconX}, ${iconY}) scale(${diamondIconSize / 24})" fill="currentColor" color="${symColor}">
5385
5658
  ${vectorSymbol.svgPaths}
5386
5659
  </g>
@@ -5431,7 +5704,7 @@ function renderPureVectorSvg(plan, options = {}) {
5431
5704
  <image href="${escapeXml(rawImage)}" x="${iconX}" y="${iconY}" width="${circleIconSize}" height="${circleIconSize}" preserveAspectRatio="xMidYMid meet"/>
5432
5705
  `;
5433
5706
  } else if (circleVectorSymbol) {
5434
- const symColor = circleVectorSymbol.brandColor || roleColor;
5707
+ const symColor = resolveContrastColor(circleVectorSymbol.brandColor, roleColor, isDark);
5435
5708
  svg += ` <!-- Centered Vector Symbol: ${escapeXml(circleVectorSymbol.name)} -->
5436
5709
  <g transform="translate(${iconX}, ${iconY}) scale(${circleIconSize / 24})" fill="currentColor" color="${symColor}">
5437
5710
  ${circleVectorSymbol.svgPaths}
@@ -5473,7 +5746,7 @@ function renderPureVectorSvg(plan, options = {}) {
5473
5746
  <image href="${escapeXml(rawImage)}" x="${iconX}" y="${iconY}" width="${iconSize}" height="${iconSize}" preserveAspectRatio="xMidYMid meet"/>
5474
5747
  `;
5475
5748
  } else if (cardVectorSymbol) {
5476
- const symColor = cardVectorSymbol.brandColor || roleColor;
5749
+ const symColor = resolveContrastColor(cardVectorSymbol.brandColor, roleColor, isDark);
5477
5750
  svg += ` <!-- Native Vector Symbol: ${escapeXml(cardVectorSymbol.name)} -->
5478
5751
  <g transform="translate(${iconX}, ${iconY}) scale(${iconSize / 24})" fill="currentColor" color="${symColor}">
5479
5752
  ${cardVectorSymbol.svgPaths}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Browser renderer for diagram-native animated MarkdyScript architecture diagrams, built on the Web Animations API.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,14 +46,14 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "html2canvas": "^1.4.1",
49
- "@markdy/core": "1.5.7"
49
+ "@markdy/core": "1.5.8"
50
50
  },
51
51
  "devDependencies": {
52
52
  "jsdom": "^29.1.1",
53
53
  "tsup": "^8.5.1",
54
54
  "typescript": "^5.9.3",
55
55
  "vitest": "^4.1.7",
56
- "@markdy/stdlib-systems": "1.5.7"
56
+ "@markdy/stdlib-systems": "1.5.8"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",