@markdy/renderer-dom 1.0.20 → 1.0.21

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 +43 -24
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -189,11 +189,24 @@ function toPathD(points, cornerRadius = 14, existingPaths = []) {
189
189
  }
190
190
  return parts.join(" ");
191
191
  }
192
- function selfLoopPath(rect) {
192
+ function selfLoopPath(rect, bounds) {
193
193
  const top = rect.y;
194
+ const loopHeight = 36;
195
+ if (bounds && top - loopHeight < 16) {
196
+ const bottom = rect.y + rect.height;
197
+ const left2 = rect.x + rect.width * 0.3;
198
+ const right2 = rect.x + rect.width * 0.7;
199
+ const apex2 = Math.min(bounds.height - 16, bottom + loopHeight);
200
+ return [
201
+ { x: round1(right2), y: round1(bottom) },
202
+ { x: round1(right2), y: round1(apex2) },
203
+ { x: round1(left2), y: round1(apex2) },
204
+ { x: round1(left2), y: round1(bottom) }
205
+ ];
206
+ }
194
207
  const left = rect.x + rect.width * 0.3;
195
208
  const right = rect.x + rect.width * 0.7;
196
- const apex = top - 40;
209
+ const apex = Math.max(12, top - loopHeight);
197
210
  return [
198
211
  { x: round1(left), y: round1(top) },
199
212
  { x: round1(left), y: round1(apex) },
@@ -737,7 +750,7 @@ function createEdgeRuntime(svg, from, to, kind, label, theme, sceneId, routeObst
737
750
  const color = theme.edges[kind];
738
751
  const style = EDGE_STYLES[kind];
739
752
  const isSelfLoop = from.id === to.id;
740
- const points = isSelfLoop ? dedupePoints(selfLoopPath(from)) : dedupePoints(routeEdgePoints(from, to, routeObstacles, bounds, lane));
753
+ const points = isSelfLoop ? dedupePoints(selfLoopPath(from, bounds)) : dedupePoints(routeEdgePoints(from, to, routeObstacles, bounds, lane));
741
754
  const d = toPathD(points, 14, existingPaths);
742
755
  const len = polylineLength(points);
743
756
  const group = document.createElementNS("http://www.w3.org/2000/svg", "g");
@@ -1776,7 +1789,7 @@ function ensureNodeStyles(doc) {
1776
1789
  filter: drop-shadow(0 0 1px var(--md-hairline, rgba(15, 23, 42, 0.2))) drop-shadow(0 4px 12px var(--md-shadow, rgba(2, 6, 23, 0.15)));
1777
1790
  }
1778
1791
  .markdy-node[data-shape="diamond"][data-focal="1"] {
1779
- filter: drop-shadow(0 0 1.5px var(--md-accent)) drop-shadow(0 4px 16px color-mix(in srgb, var(--md-accent) 30%, transparent));
1792
+ filter: drop-shadow(0 0 1.5px var(--md-accent)) drop-shadow(0 4px 14px var(--md-shadow, rgba(2, 6, 23, 0.15)));
1780
1793
  }
1781
1794
  .markdy-node[data-shape="diamond"] .markdy-node__body {
1782
1795
  justify-content: center;
@@ -1868,13 +1881,10 @@ function ensureNodeStyles(doc) {
1868
1881
  background: var(--md-node-surface, var(--md-surface));
1869
1882
  }
1870
1883
  .markdy-node[data-focal="1"] {
1871
- background:
1872
- linear-gradient(180deg,
1873
- color-mix(in srgb, var(--md-accent) 12%, var(--md-node-surface-raised, var(--md-surface-raised, #ffffff))),
1874
- color-mix(in srgb, var(--md-accent) 6%, var(--md-node-surface, var(--md-surface, #ffffff))));
1875
1884
  box-shadow:
1876
- 0 2px 8px color-mix(in srgb, var(--md-accent) 20%, transparent),
1877
- inset 0 0 0 1.5px color-mix(in srgb, var(--md-accent) 60%, transparent);
1885
+ 0 2px 10px -2px var(--md-shadow, rgba(2, 6, 23, 0.18)),
1886
+ inset 0 0 0 1.5px var(--md-accent),
1887
+ 0 0 0 1px color-mix(in srgb, var(--md-accent) 25%, transparent);
1878
1888
  }
1879
1889
  .markdy-scene-root[data-markdy-theme="nebula"] .markdy-node {
1880
1890
  border: 1px solid color-mix(in srgb, var(--md-role-color, var(--md-accent)) 34%, transparent);
@@ -1885,7 +1895,7 @@ function ensureNodeStyles(doc) {
1885
1895
  .markdy-scene-root[data-markdy-theme="nebula"] .markdy-node[data-focal="1"] {
1886
1896
  box-shadow:
1887
1897
  0 0 34px -8px color-mix(in srgb, var(--md-accent) 78%, transparent),
1888
- inset 0 0 0 1px var(--md-accent);
1898
+ inset 0 0 0 1.5px var(--md-accent);
1889
1899
  }
1890
1900
  .markdy-scene-root[data-flat="1"] .markdy-node {
1891
1901
  box-shadow: inset 0 0 0 1px var(--md-hairline, color-mix(in srgb, var(--md-border) 50%, transparent));
@@ -1894,11 +1904,7 @@ function ensureNodeStyles(doc) {
1894
1904
  box-shadow: inset 0 0 0 1px var(--md-hairline, color-mix(in srgb, var(--md-border) 50%, transparent));
1895
1905
  }
1896
1906
  .markdy-scene-root[data-flat="1"] .markdy-node[data-focal="1"] {
1897
- box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--md-accent) 60%, transparent);
1898
- background:
1899
- linear-gradient(180deg,
1900
- color-mix(in srgb, var(--md-accent) 10%, var(--md-node-surface-raised, var(--md-surface-raised, #ffffff))),
1901
- color-mix(in srgb, var(--md-accent) 5%, var(--md-node-surface, var(--md-surface, #ffffff))));
1907
+ box-shadow: inset 0 0 0 1.5px var(--md-accent);
1902
1908
  }
1903
1909
  .markdy-node[data-kind="external"] {
1904
1910
  border: 1.2px dashed color-mix(in srgb, var(--md-ink, var(--md-text)) 30%, transparent);
@@ -2718,19 +2724,20 @@ function ensureSceneStyles(doc) {
2718
2724
  }
2719
2725
  .markdy-footer {
2720
2726
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
2727
+ position: relative;
2721
2728
  width: 100%;
2722
2729
  box-sizing: border-box;
2723
2730
  display: flex;
2724
2731
  align-items: center;
2725
2732
  justify-content: space-between;
2726
2733
  gap: 8px;
2727
- padding: 6px 12px;
2734
+ padding: 8px 12px 4px;
2728
2735
  color: var(--md-text, #f8fafc);
2729
2736
  background: transparent;
2730
2737
  backdrop-filter: none;
2731
2738
  -webkit-backdrop-filter: none;
2732
2739
  border-top: none;
2733
- z-index: 20;
2740
+ z-index: 100;
2734
2741
  }
2735
2742
  .markdy-controls {
2736
2743
  display: flex;
@@ -2743,6 +2750,8 @@ function ensureSceneStyles(doc) {
2743
2750
  max-width: 100%;
2744
2751
  overflow-x: auto;
2745
2752
  scrollbar-width: none;
2753
+ padding: 4px 2px;
2754
+ margin: -4px -2px;
2746
2755
  }
2747
2756
  .markdy-controls::-webkit-scrollbar {
2748
2757
  display: none;
@@ -2804,6 +2813,8 @@ function ensureSceneStyles(doc) {
2804
2813
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
2805
2814
  }
2806
2815
  .markdy-controls button:hover:not([aria-pressed="true"]) {
2816
+ position: relative;
2817
+ z-index: 2;
2807
2818
  background: var(--md-control-hover-bg, rgba(255, 255, 255, 0.1));
2808
2819
  color: var(--md-control-hover-text, #f8fafc);
2809
2820
  border-color: var(--md-control-hover-border, rgba(148, 163, 184, 0.35));
@@ -2811,12 +2822,16 @@ function ensureSceneStyles(doc) {
2811
2822
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
2812
2823
  }
2813
2824
  .markdy-controls button[aria-pressed="true"] {
2825
+ position: relative;
2826
+ z-index: 2;
2814
2827
  background: var(--accent, #10b981) !important;
2815
2828
  color: #ffffff !important;
2816
2829
  border-color: var(--accent, #10b981) !important;
2817
2830
  box-shadow: 0 0 10px var(--accent-glow, rgba(16, 185, 129, 0.4)) !important;
2818
2831
  }
2819
2832
  .markdy-controls button:focus-visible {
2833
+ position: relative;
2834
+ z-index: 3;
2820
2835
  outline: 2px solid var(--accent, #10b981);
2821
2836
  outline-offset: 1px;
2822
2837
  }
@@ -2910,10 +2925,10 @@ function ensureSceneStyles(doc) {
2910
2925
  .markdy-code-panel-overlay {
2911
2926
  position: fixed;
2912
2927
  inset: 0;
2913
- z-index: 9000;
2914
- background: rgba(2, 6, 23, 0.55);
2915
- backdrop-filter: blur(3px);
2916
- -webkit-backdrop-filter: blur(3px);
2928
+ z-index: 100000;
2929
+ background: rgba(2, 6, 23, 0.65);
2930
+ backdrop-filter: blur(4px);
2931
+ -webkit-backdrop-filter: blur(4px);
2917
2932
  display: flex;
2918
2933
  align-items: center;
2919
2934
  justify-content: center;
@@ -3448,6 +3463,7 @@ function createDiagram(opts) {
3448
3463
  let progressEl = null;
3449
3464
  if (showProgress) {
3450
3465
  progressEl = document.createElement("div");
3466
+ progressEl.className = progressMode === "bar" ? "markdy-progress-bar" : "markdy-boundary-progress";
3451
3467
  Object.assign(progressEl.style, {
3452
3468
  position: "absolute",
3453
3469
  ...progressMode === "bar" ? { left: "0", right: "0", bottom: "0", height: "3px" } : { inset: "0" },
@@ -3483,6 +3499,8 @@ function createDiagram(opts) {
3483
3499
  footer.className = "markdy-footer";
3484
3500
  applyThemeVariables(footer, plan.theme);
3485
3501
  Object.assign(footer.style, {
3502
+ position: "relative",
3503
+ zIndex: "100",
3486
3504
  display: "flex",
3487
3505
  alignItems: "center",
3488
3506
  justifyContent: "space-between",
@@ -3490,7 +3508,7 @@ function createDiagram(opts) {
3490
3508
  gap: "6px",
3491
3509
  width: "100%",
3492
3510
  boxSizing: "border-box",
3493
- padding: "4px 6px 0",
3511
+ padding: "6px 8px 2px",
3494
3512
  background: "transparent"
3495
3513
  });
3496
3514
  if (container.parentNode) container.parentNode.insertBefore(footer, container.nextSibling);
@@ -4299,7 +4317,8 @@ function createDiagram(opts) {
4299
4317
  body.appendChild(pre);
4300
4318
  panel.append(header, body);
4301
4319
  overlay.appendChild(panel);
4302
- document.body.appendChild(overlay);
4320
+ const mountHost = document.fullscreenElement ?? document.body;
4321
+ mountHost.appendChild(overlay);
4303
4322
  closeBtn.focus();
4304
4323
  let closing = false;
4305
4324
  function removePanel() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
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.20"
48
+ "@markdy/core": "1.0.21"
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.20"
55
+ "@markdy/stdlib-systems": "1.0.21"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup",