@markdy/renderer-dom 1.0.21 → 1.0.22

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 (2) hide show
  1. package/dist/index.js +48 -39
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -2722,6 +2722,13 @@ function ensureSceneStyles(doc) {
2722
2722
  transform: translateY(8px);
2723
2723
  will-change: opacity, transform;
2724
2724
  }
2725
+ .markdy-diagram-root {
2726
+ position: relative;
2727
+ display: flex;
2728
+ flex-direction: column;
2729
+ box-sizing: border-box;
2730
+ width: 100%;
2731
+ }
2725
2732
  .markdy-footer {
2726
2733
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
2727
2734
  position: relative;
@@ -3191,37 +3198,13 @@ function ensureSceneStyles(doc) {
3191
3198
  color: #64748b !important;
3192
3199
  }
3193
3200
  /* Fullscreen & Fallback Pseudo-Fullscreen Views */
3201
+ .markdy-diagram-root:fullscreen,
3202
+ .markdy-diagram-root:-webkit-full-screen,
3203
+ .markdy-diagram-root:-moz-full-screen,
3204
+ .markdy-diagram-root:-ms-fullscreen,
3205
+ .markdy-viewport:fullscreen,
3206
+ .markdy-viewport:-webkit-full-screen,
3194
3207
  .markdy-fullscreen-host,
3195
- :fullscreen {
3196
- background-color: var(--md-canvas, #0b101b) !important;
3197
- width: 100vw !important;
3198
- height: 100vh !important;
3199
- max-width: 100vw !important;
3200
- max-height: 100vh !important;
3201
- box-sizing: border-box !important;
3202
- display: flex !important;
3203
- flex-direction: column !important;
3204
- justify-content: space-between !important;
3205
- align-items: center !important;
3206
- padding: 16px 20px 12px !important;
3207
- overflow: hidden !important;
3208
- }
3209
- .markdy-fullscreen-host .markdy-viewport,
3210
- :fullscreen .markdy-viewport {
3211
- flex: 1 1 auto !important;
3212
- width: 100% !important;
3213
- height: 100% !important;
3214
- max-width: 100% !important;
3215
- max-height: calc(100vh - 64px) !important;
3216
- }
3217
- .markdy-fullscreen-host .markdy-footer,
3218
- :fullscreen .markdy-footer {
3219
- flex-shrink: 0 !important;
3220
- width: 100% !important;
3221
- max-width: 1400px !important;
3222
- margin: 0 auto !important;
3223
- padding: 8px 12px 4px !important;
3224
- }
3225
3208
  .markdy--pseudo-fullscreen {
3226
3209
  position: fixed !important;
3227
3210
  inset: 0 !important;
@@ -3231,21 +3214,34 @@ function ensureSceneStyles(doc) {
3231
3214
  max-width: 100vw !important;
3232
3215
  max-height: 100vh !important;
3233
3216
  background-color: var(--md-canvas, #0b101b) !important;
3217
+ box-sizing: border-box !important;
3234
3218
  display: flex !important;
3235
3219
  flex-direction: column !important;
3236
3220
  justify-content: space-between !important;
3237
3221
  align-items: center !important;
3238
3222
  padding: 16px 20px 12px !important;
3239
- box-sizing: border-box !important;
3240
3223
  overflow: hidden !important;
3241
3224
  }
3225
+ .markdy-diagram-root:fullscreen .markdy-viewport,
3226
+ .markdy-diagram-root:-webkit-full-screen .markdy-viewport,
3227
+ .markdy-diagram-root:-moz-full-screen .markdy-viewport,
3228
+ .markdy-diagram-root:-ms-fullscreen .markdy-viewport,
3229
+ .markdy-fullscreen-host .markdy-viewport,
3242
3230
  .markdy--pseudo-fullscreen .markdy-viewport {
3243
3231
  flex: 1 1 auto !important;
3244
3232
  width: 100% !important;
3245
3233
  height: 100% !important;
3246
3234
  max-width: 100% !important;
3247
3235
  max-height: calc(100vh - 64px) !important;
3236
+ display: flex !important;
3237
+ align-items: center !important;
3238
+ justify-content: center !important;
3248
3239
  }
3240
+ .markdy-diagram-root:fullscreen .markdy-footer,
3241
+ .markdy-diagram-root:-webkit-full-screen .markdy-footer,
3242
+ .markdy-diagram-root:-moz-full-screen .markdy-footer,
3243
+ .markdy-diagram-root:-ms-fullscreen .markdy-footer,
3244
+ .markdy-fullscreen-host .markdy-footer,
3249
3245
  .markdy--pseudo-fullscreen .markdy-footer {
3250
3246
  flex-shrink: 0 !important;
3251
3247
  width: 100% !important;
@@ -3447,6 +3443,16 @@ function createDiagram(opts) {
3447
3443
  const DEFAULT_RAINBOW = "hsl(0,90%,60%), hsl(45,90%,55%), hsl(90,80%,50%), hsl(180,80%,50%), hsl(270,80%,55%), hsl(330,90%,60%)";
3448
3444
  const totalDurationMs = plan.duration * 1e3;
3449
3445
  const durationSeconds = plan.duration;
3446
+ container.classList.add("markdy-diagram-root");
3447
+ Object.assign(container.style, {
3448
+ position: "relative",
3449
+ display: "flex",
3450
+ flexDirection: "column",
3451
+ boxSizing: "border-box",
3452
+ width: "100%"
3453
+ });
3454
+ if (container.style.aspectRatio) container.style.aspectRatio = "unset";
3455
+ if (container.style.overflow === "hidden") container.style.overflow = "visible";
3450
3456
  const viewport = document.createElement("div");
3451
3457
  viewport.className = "markdy-viewport";
3452
3458
  Object.assign(viewport.style, {
@@ -3511,8 +3517,7 @@ function createDiagram(opts) {
3511
3517
  padding: "6px 8px 2px",
3512
3518
  background: "transparent"
3513
3519
  });
3514
- if (container.parentNode) container.parentNode.insertBefore(footer, container.nextSibling);
3515
- else container.appendChild(footer);
3520
+ container.appendChild(footer);
3516
3521
  return footer;
3517
3522
  }
3518
3523
  let badge = null;
@@ -4057,8 +4062,11 @@ function createDiagram(opts) {
4057
4062
  removeFullscreenListeners?.();
4058
4063
  closeCodePanel?.();
4059
4064
  closeCodePanel = null;
4065
+ container.classList.remove("markdy-diagram-root");
4066
+ container.classList.remove("markdy-fullscreen-host");
4067
+ container.classList.remove("markdy--pseudo-fullscreen");
4060
4068
  if (progressEl?.parentNode === viewport) viewport.removeChild(progressEl);
4061
- if (footer?.parentNode) footer.parentNode.removeChild(footer);
4069
+ if (footer?.parentNode === container) container.removeChild(footer);
4062
4070
  if (viewport.parentNode === container) container.removeChild(viewport);
4063
4071
  }
4064
4072
  };
@@ -4366,10 +4374,10 @@ function createDiagram(opts) {
4366
4374
  const button = makeControlButton("Full", "Toggle fullscreen view", ICONS2.fullscreen);
4367
4375
  button.className = "markdy-control-fullscreen";
4368
4376
  button.setAttribute("aria-pressed", "false");
4369
- const host = footer && footer.parentElement ? footer.parentElement : container.parentElement ?? container;
4377
+ const host = container;
4370
4378
  let isPseudoFull = false;
4371
4379
  function syncFullscreenState() {
4372
- const isFull = isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === container || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === container;
4380
+ const isFull = isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === viewport || document.mozFullScreenElement === host || document.msFullscreenElement === host;
4373
4381
  button.setAttribute("aria-pressed", isFull ? "true" : "false");
4374
4382
  button.title = isFull ? "Exit fullscreen" : "Toggle fullscreen view";
4375
4383
  button.innerHTML = isFull ? `${ICONS2.fullscreen}Exit` : `${ICONS2.fullscreen}Full`;
@@ -4380,15 +4388,16 @@ function createDiagram(opts) {
4380
4388
  host.classList.remove("markdy--pseudo-fullscreen");
4381
4389
  }
4382
4390
  requestAnimationFrame(() => {
4391
+ scaleScene();
4383
4392
  applyViewportTransform();
4384
4393
  syncControls();
4385
4394
  });
4386
4395
  }
4387
4396
  async function toggleFullscreen() {
4388
4397
  try {
4389
- const isCurrentlyFull = isPseudoFull || document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;
4398
+ const isCurrentlyFull = isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.mozFullScreenElement === host || document.msFullscreenElement === host;
4390
4399
  if (!isCurrentlyFull) {
4391
- const req = host.requestFullscreen?.bind(host) || host.webkitRequestFullscreen?.bind(host) || host.mozRequestFullScreen?.bind(host) || host.msRequestFullscreen?.bind(host) || container.requestFullscreen?.bind(container) || container.webkitRequestFullscreen?.bind(container);
4400
+ const req = host.requestFullscreen?.bind(host) || host.webkitRequestFullscreen?.bind(host) || host.mozRequestFullScreen?.bind(host) || host.msRequestFullscreen?.bind(host) || viewport.requestFullscreen?.bind(viewport) || viewport.webkitRequestFullscreen?.bind(viewport);
4392
4401
  if (req) {
4393
4402
  try {
4394
4403
  await req();
@@ -4414,7 +4423,7 @@ function createDiagram(opts) {
4414
4423
  }
4415
4424
  }
4416
4425
  }
4417
- } catch (err) {
4426
+ } catch {
4418
4427
  if (!isPseudoFull) {
4419
4428
  isPseudoFull = true;
4420
4429
  host.classList.add("markdy--pseudo-fullscreen");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
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",
@@ -45,14 +45,14 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "html2canvas": "^1.4.1",
48
- "@markdy/core": "1.0.21"
48
+ "@markdy/core": "1.0.22"
49
49
  },
50
50
  "devDependencies": {
51
51
  "jsdom": "^29.1.1",
52
52
  "tsup": "^8.5.1",
53
53
  "typescript": "^5.9.3",
54
54
  "vitest": "^4.1.7",
55
- "@markdy/stdlib-systems": "1.0.21"
55
+ "@markdy/stdlib-systems": "1.0.22"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup",