@markdy/renderer-dom 1.5.6 → 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 +370 -44
  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); }
@@ -3826,11 +4020,11 @@ function ensureSceneStyles(doc) {
3826
4020
  flex: 0 1 auto;
3827
4021
  width: auto;
3828
4022
  min-width: 0;
3829
- gap: 3px;
4023
+ gap: 2px;
3830
4024
  max-width: 100%;
3831
- padding: 3px 4px;
4025
+ padding: 2px;
3832
4026
  margin: 0;
3833
- border-radius: 6px;
4027
+ border-radius: 5px;
3834
4028
  background: rgba(255, 255, 255, 0.75);
3835
4029
  backdrop-filter: blur(8px);
3836
4030
  -webkit-backdrop-filter: blur(8px);
@@ -3842,7 +4036,7 @@ function ensureSceneStyles(doc) {
3842
4036
  .markdy-controls-group {
3843
4037
  display: inline-flex;
3844
4038
  align-items: center;
3845
- gap: 3px;
4039
+ gap: 2px;
3846
4040
  flex-shrink: 0;
3847
4041
  position: relative;
3848
4042
  z-index: 5;
@@ -3851,15 +4045,15 @@ function ensureSceneStyles(doc) {
3851
4045
  .markdy-controls-tools {
3852
4046
  display: inline-flex;
3853
4047
  align-items: center;
3854
- gap: 3px;
4048
+ gap: 2px;
3855
4049
  flex-shrink: 0;
3856
4050
  margin-left: 0;
3857
4051
  }
3858
4052
  .markdy-control-divider {
3859
4053
  width: 1px;
3860
- height: 14px;
4054
+ height: 10px;
3861
4055
  background: var(--md-divider, rgba(148, 163, 184, 0.2));
3862
- margin: 0 2px;
4056
+ margin: 0 1px;
3863
4057
  flex-shrink: 0;
3864
4058
  }
3865
4059
  .markdy-btn-label {
@@ -3871,14 +4065,14 @@ function ensureSceneStyles(doc) {
3871
4065
  touch-action: manipulation;
3872
4066
  user-select: none;
3873
4067
  -webkit-user-select: none;
3874
- width: 24px;
3875
- height: 24px;
3876
- min-width: 24px;
4068
+ width: 20px;
4069
+ height: 20px;
4070
+ min-width: 20px;
3877
4071
  padding: 0;
3878
4072
  display: inline-flex;
3879
4073
  align-items: center;
3880
4074
  justify-content: center;
3881
- border-radius: 4px;
4075
+ border-radius: 3px;
3882
4076
  background: transparent;
3883
4077
  border: none;
3884
4078
  box-shadow: none;
@@ -3891,8 +4085,8 @@ function ensureSceneStyles(doc) {
3891
4085
  }
3892
4086
  .markdy-controls button svg,
3893
4087
  .markdy-controls button .markdy-icon {
3894
- width: 13px;
3895
- height: 13px;
4088
+ width: 11px;
4089
+ height: 11px;
3896
4090
  }
3897
4091
  .markdy-controls button:hover:not([aria-pressed="true"]) {
3898
4092
  background: rgba(148, 163, 184, 0.15);
@@ -3956,17 +4150,18 @@ function ensureSceneStyles(doc) {
3956
4150
  color: #0f172a;
3957
4151
  background-color: rgba(148, 163, 184, 0.1);
3958
4152
  }
4153
+ .markdy-control-fullscreen,
3959
4154
  .markdy-studio-link {
3960
4155
  position: absolute;
3961
4156
  top: 8px;
3962
- right: 8px;
3963
4157
  z-index: 50;
3964
4158
  display: inline-flex;
3965
4159
  align-items: center;
3966
4160
  justify-content: center;
3967
- width: 28px;
3968
- height: 28px;
3969
- border-radius: 6px;
4161
+ width: 22px;
4162
+ height: 22px;
4163
+ min-width: 22px;
4164
+ border-radius: 5px;
3970
4165
  background: rgba(255, 255, 255, 0.75);
3971
4166
  backdrop-filter: blur(8px);
3972
4167
  -webkit-backdrop-filter: blur(8px);
@@ -3976,14 +4171,35 @@ function ensureSceneStyles(doc) {
3976
4171
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
3977
4172
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
3978
4173
  pointer-events: auto;
4174
+ cursor: pointer;
4175
+ padding: 0;
4176
+ }
4177
+ .markdy-control-fullscreen {
4178
+ left: 8px;
4179
+ }
4180
+ .markdy-studio-link {
4181
+ right: 8px;
4182
+ }
4183
+ .markdy-control-fullscreen svg,
4184
+ .markdy-studio-link svg {
4185
+ width: 11px;
4186
+ height: 11px;
4187
+ }
4188
+ .markdy-control-fullscreen[aria-pressed="true"] {
4189
+ background: #0f172a !important;
4190
+ color: #ffffff !important;
4191
+ opacity: 1 !important;
3979
4192
  }
3980
4193
  @media (hover: hover) {
4194
+ .markdy-control-fullscreen,
3981
4195
  .markdy-studio-link {
3982
4196
  opacity: 0;
3983
4197
  }
4198
+ .markdy-diagram-root:hover .markdy-control-fullscreen,
3984
4199
  .markdy-diagram-root:hover .markdy-studio-link {
3985
4200
  opacity: 0.75;
3986
4201
  }
4202
+ .markdy-control-fullscreen:hover,
3987
4203
  .markdy-studio-link:hover {
3988
4204
  opacity: 1 !important;
3989
4205
  color: #0f172a;
@@ -3991,11 +4207,14 @@ function ensureSceneStyles(doc) {
3991
4207
  }
3992
4208
  }
3993
4209
  @media (hover: none) {
4210
+ .markdy-control-fullscreen,
3994
4211
  .markdy-studio-link {
3995
4212
  opacity: 0.75;
3996
4213
  }
4214
+ .markdy-control-fullscreen:active,
3997
4215
  .markdy-studio-link:active {
3998
4216
  opacity: 1;
4217
+ transform: scale(0.96);
3999
4218
  }
4000
4219
  }
4001
4220
  .markdy-badge-prefix {
@@ -4014,19 +4233,20 @@ function ensureSceneStyles(doc) {
4014
4233
  }
4015
4234
  .markdy-controls button {
4016
4235
  padding: 0 !important;
4017
- width: 25px !important;
4018
- height: 25px !important;
4019
- min-width: 25px !important;
4236
+ width: 20px !important;
4237
+ height: 20px !important;
4238
+ min-width: 20px !important;
4020
4239
  justify-content: center !important;
4021
4240
  }
4022
4241
  .markdy-speed-group {
4023
4242
  display: none !important;
4024
4243
  }
4025
4244
  .markdy-controls {
4026
- gap: 4px !important;
4245
+ gap: 2px !important;
4246
+ padding: 2px !important;
4027
4247
  }
4028
4248
  .markdy-footer {
4029
- padding: 6px 10px 5px 8px !important;
4249
+ padding: 0 !important;
4030
4250
  }
4031
4251
  .markdy-badge {
4032
4252
  font-size: 9px !important;
@@ -4045,16 +4265,17 @@ function ensureSceneStyles(doc) {
4045
4265
  }
4046
4266
  .markdy-controls button {
4047
4267
  padding: 0 !important;
4048
- width: 25px !important;
4049
- height: 25px !important;
4050
- min-width: 25px !important;
4268
+ width: 20px !important;
4269
+ height: 20px !important;
4270
+ min-width: 20px !important;
4051
4271
  justify-content: center !important;
4052
4272
  }
4053
4273
  .markdy-speed-group {
4054
4274
  display: none !important;
4055
4275
  }
4056
4276
  .markdy-controls {
4057
- gap: 4px !important;
4277
+ gap: 2px !important;
4278
+ padding: 2px !important;
4058
4279
  }
4059
4280
  .markdy-badge {
4060
4281
  font-size: 9px !important;
@@ -4499,6 +4720,14 @@ function ensureSceneStyles(doc) {
4499
4720
  background-color: rgba(255, 255, 255, 0.08);
4500
4721
  opacity: 0.8 !important;
4501
4722
  }
4723
+ [data-markdy-theme="midnight"] .markdy-control-fullscreen,
4724
+ [data-markdy-theme="blueprint"] .markdy-control-fullscreen,
4725
+ [data-markdy-theme="terminal"] .markdy-control-fullscreen,
4726
+ [data-markdy-theme="graphite"] .markdy-control-fullscreen,
4727
+ [data-markdy-theme="nebula"] .markdy-control-fullscreen,
4728
+ :root[data-theme="dark"] .markdy-control-fullscreen,
4729
+ .theme-dark .markdy-control-fullscreen,
4730
+ .dark .markdy-control-fullscreen,
4502
4731
  [data-markdy-theme="midnight"] .markdy-studio-link,
4503
4732
  [data-markdy-theme="blueprint"] .markdy-studio-link,
4504
4733
  [data-markdy-theme="terminal"] .markdy-studio-link,
@@ -4513,6 +4742,14 @@ function ensureSceneStyles(doc) {
4513
4742
  color: #94a3b8;
4514
4743
  }
4515
4744
  @media (hover: hover) {
4745
+ [data-markdy-theme="midnight"] .markdy-control-fullscreen:hover,
4746
+ [data-markdy-theme="blueprint"] .markdy-control-fullscreen:hover,
4747
+ [data-markdy-theme="terminal"] .markdy-control-fullscreen:hover,
4748
+ [data-markdy-theme="graphite"] .markdy-control-fullscreen:hover,
4749
+ [data-markdy-theme="nebula"] .markdy-control-fullscreen:hover,
4750
+ :root[data-theme="dark"] .markdy-control-fullscreen:hover,
4751
+ .theme-dark .markdy-control-fullscreen:hover,
4752
+ .dark .markdy-control-fullscreen:hover,
4516
4753
  [data-markdy-theme="midnight"] .markdy-studio-link:hover,
4517
4754
  [data-markdy-theme="blueprint"] .markdy-studio-link:hover,
4518
4755
  [data-markdy-theme="terminal"] .markdy-studio-link:hover,
@@ -4952,6 +5189,15 @@ function wrapNodeLabel(label, maxWidthPx, fontSize = 13.5) {
4952
5189
  }
4953
5190
  return lines;
4954
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
+ }
4955
5201
  function renderPureVectorSvg(plan, options = {}) {
4956
5202
  const width = plan.meta.width;
4957
5203
  const height = plan.meta.height;
@@ -5043,14 +5289,84 @@ function renderPureVectorSvg(plan, options = {}) {
5043
5289
  <g class="markdy-groups-layer">
5044
5290
  `;
5045
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
+ }
5046
5363
  svg += ` <g id="group-${escapeXml(gb.id)}" transform="translate(${gb.x}, ${gb.y})">
5047
- <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}"` : ""}/>
5048
5365
  `;
5049
5366
  if (gb.label) {
5050
- const labelText = gb.label.toUpperCase();
5051
- const labelW = Math.max(54, labelText.length * 6.8 + 20);
5052
- svg += ` <rect x="14" y="10" width="${labelW}" height="20" rx="6" fill="${surfaceRaised}" fill-opacity="0.95" stroke="${border}" stroke-width="1"/>
5053
- <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>
5054
5370
  `;
5055
5371
  }
5056
5372
  svg += ` </g>
@@ -5265,12 +5581,12 @@ function renderPureVectorSvg(plan, options = {}) {
5265
5581
  <rect x="${labelX}" y="${labelY}" width="${textWidth + padX * 2}" height="${boxHeight}" rx="4" fill="${canvasBg}" stroke="${border}" stroke-width="1"/>
5266
5582
  `;
5267
5583
  if (lines.length === 1) {
5268
- 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>
5269
5585
  `;
5270
5586
  } else {
5271
5587
  lines.forEach((lineText, idx) => {
5272
5588
  const lineY = placement.y - (lines.length - 1) * lineHeight / 2 + idx * lineHeight;
5273
- 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>
5274
5590
  `;
5275
5591
  });
5276
5592
  }
@@ -5337,7 +5653,7 @@ function renderPureVectorSvg(plan, options = {}) {
5337
5653
  svg += ` <image href="${escapeXml(rawImage)}" x="${iconX}" y="${iconY}" width="${diamondIconSize}" height="${diamondIconSize}" preserveAspectRatio="xMidYMid meet"/>
5338
5654
  `;
5339
5655
  } else if (vectorSymbol) {
5340
- const symColor = vectorSymbol.brandColor || roleColor;
5656
+ const symColor = resolveContrastColor(vectorSymbol.brandColor, roleColor, isDark);
5341
5657
  svg += ` <g transform="translate(${iconX}, ${iconY}) scale(${diamondIconSize / 24})" fill="currentColor" color="${symColor}">
5342
5658
  ${vectorSymbol.svgPaths}
5343
5659
  </g>
@@ -5388,7 +5704,7 @@ function renderPureVectorSvg(plan, options = {}) {
5388
5704
  <image href="${escapeXml(rawImage)}" x="${iconX}" y="${iconY}" width="${circleIconSize}" height="${circleIconSize}" preserveAspectRatio="xMidYMid meet"/>
5389
5705
  `;
5390
5706
  } else if (circleVectorSymbol) {
5391
- const symColor = circleVectorSymbol.brandColor || roleColor;
5707
+ const symColor = resolveContrastColor(circleVectorSymbol.brandColor, roleColor, isDark);
5392
5708
  svg += ` <!-- Centered Vector Symbol: ${escapeXml(circleVectorSymbol.name)} -->
5393
5709
  <g transform="translate(${iconX}, ${iconY}) scale(${circleIconSize / 24})" fill="currentColor" color="${symColor}">
5394
5710
  ${circleVectorSymbol.svgPaths}
@@ -5430,7 +5746,7 @@ function renderPureVectorSvg(plan, options = {}) {
5430
5746
  <image href="${escapeXml(rawImage)}" x="${iconX}" y="${iconY}" width="${iconSize}" height="${iconSize}" preserveAspectRatio="xMidYMid meet"/>
5431
5747
  `;
5432
5748
  } else if (cardVectorSymbol) {
5433
- const symColor = cardVectorSymbol.brandColor || roleColor;
5749
+ const symColor = resolveContrastColor(cardVectorSymbol.brandColor, roleColor, isDark);
5434
5750
  svg += ` <!-- Native Vector Symbol: ${escapeXml(cardVectorSymbol.name)} -->
5435
5751
  <g transform="translate(${iconX}, ${iconY}) scale(${iconSize / 24})" fill="currentColor" color="${symColor}">
5436
5752
  ${cardVectorSymbol.svgPaths}
@@ -7971,6 +8287,8 @@ function createDiagram(opts) {
7971
8287
  if (progressEl?.parentNode === viewport) viewport.removeChild(progressEl);
7972
8288
  if (footer?.parentNode === container) container.removeChild(footer);
7973
8289
  if (studioLink?.parentNode === container) container.removeChild(studioLink);
8290
+ if (fullscreenControlEl?.parentNode === container) container.removeChild(fullscreenControlEl);
8291
+ fullscreenControlEl = null;
7974
8292
  if (viewport.parentNode === container) container.removeChild(viewport);
7975
8293
  }
7976
8294
  };
@@ -8514,7 +8832,8 @@ function createDiagram(opts) {
8514
8832
  }
8515
8833
  let removeFullscreenListeners = null;
8516
8834
  let syncFullscreenHandler = null;
8517
- function mountFullscreenControl(toolbar) {
8835
+ let fullscreenControlEl = null;
8836
+ function mountFullscreenControl(parent = container) {
8518
8837
  if (!fullscreenButton) return;
8519
8838
  const button = makeControlButton("Full", "Toggle fullscreen view", ICONS2.fullscreen);
8520
8839
  button.className = "markdy-control-fullscreen";
@@ -8682,8 +9001,13 @@ function createDiagram(opts) {
8682
9001
  host.classList.remove("markdy--pseudo-fullscreen");
8683
9002
  host.classList.remove("markdy-fullscreen-host");
8684
9003
  }
9004
+ if (fullscreenControlEl?.parentNode) {
9005
+ fullscreenControlEl.parentNode.removeChild(fullscreenControlEl);
9006
+ }
9007
+ fullscreenControlEl = null;
8685
9008
  };
8686
- toolbar.appendChild(button);
9009
+ fullscreenControlEl = button;
9010
+ parent.appendChild(button);
8687
9011
  }
8688
9012
  function handleKeyDown(event) {
8689
9013
  const target = event.target;
@@ -8754,14 +9078,16 @@ function createDiagram(opts) {
8754
9078
  mountSpeedControls(speedGroup);
8755
9079
  toolsGroup.appendChild(speedGroup);
8756
9080
  }
8757
- if (resetViewButton || fullscreenButton) {
9081
+ if (resetViewButton) {
8758
9082
  if (toolsGroup.children.length > 0) {
8759
9083
  const divider = document.createElement("div");
8760
9084
  divider.className = "markdy-control-divider";
8761
9085
  toolsGroup.appendChild(divider);
8762
9086
  }
8763
9087
  mountResetViewControl(toolsGroup);
8764
- mountFullscreenControl(toolsGroup);
9088
+ }
9089
+ if (fullscreenButton) {
9090
+ mountFullscreenControl(container);
8765
9091
  }
8766
9092
  if (svgButton || gifButton || shareButton || codeButton || themeButton) {
8767
9093
  if (toolsGroup.children.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.5.6",
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.6"
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.6"
56
+ "@markdy/stdlib-systems": "1.5.8"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",