@markdy/renderer-dom 1.5.5 → 1.5.6

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/index.d.ts CHANGED
@@ -163,6 +163,11 @@ interface DiagramOptions {
163
163
  clickToPlay?: boolean;
164
164
  /** Base URL for the Share control. Defaults to the Markdy playground. */
165
165
  shareUrl?: string;
166
+ /**
167
+ * Show floating Studio playground link button at top-right corner.
168
+ * Defaults to true when undefined. Set to false to disable.
169
+ */
170
+ studioLink?: boolean;
166
171
  /** Host controls override. `true` enables the legacy default set; `false` suppresses script controls; or pass a granular controls configuration object. */
167
172
  controls?: boolean | (PlayerControlsConfig & {
168
173
  playback?: boolean;
package/dist/index.js CHANGED
@@ -3692,28 +3692,28 @@ function ensureSceneStyles(doc) {
3692
3692
  min-height: 0;
3693
3693
  overflow: hidden;
3694
3694
  box-sizing: border-box;
3695
- border-radius: 11px 11px 0 0;
3695
+ border-radius: 11px;
3696
3696
  }
3697
3697
  .markdy-footer {
3698
3698
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
3699
- position: relative;
3699
+ position: static;
3700
3700
  width: 100%;
3701
3701
  box-sizing: border-box;
3702
3702
  display: flex;
3703
3703
  align-items: center;
3704
3704
  justify-content: space-between;
3705
- gap: 8px;
3706
- padding: 8px 12px 7px 10px;
3705
+ gap: 6px;
3706
+ padding: 0;
3707
+ height: 0;
3708
+ min-height: 0;
3709
+ line-height: 0;
3710
+ background: transparent;
3711
+ border-top: none;
3712
+ overflow: visible;
3707
3713
  color: var(--md-text, #64748b);
3708
- background: var(--md-footer-bg, rgba(248, 250, 252, 0.88));
3709
- backdrop-filter: blur(12px);
3710
- -webkit-backdrop-filter: blur(12px);
3711
- border-top: 1px solid var(--md-card-border, rgba(148, 163, 184, 0.16));
3712
- z-index: 100;
3714
+ z-index: 40;
3713
3715
  pointer-events: auto;
3714
3716
  flex-shrink: 0;
3715
- border-radius: 0 0 11px 11px;
3716
- transition: background 0.2s ease, border-color 0.2s ease;
3717
3717
  }
3718
3718
  /* \u2500\u2500 Real Embedded Footer Scrubber \u2500\u2500 */
3719
3719
  .markdy-player-scrubber {
@@ -3817,24 +3817,32 @@ function ensureSceneStyles(doc) {
3817
3817
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
3818
3818
  }
3819
3819
  .markdy-controls {
3820
+ position: absolute;
3821
+ bottom: 8px;
3822
+ left: 8px;
3820
3823
  display: inline-flex;
3821
3824
  align-items: center;
3822
3825
  justify-content: flex-start;
3823
3826
  flex: 0 1 auto;
3824
3827
  width: auto;
3825
3828
  min-width: 0;
3826
- gap: 6px;
3829
+ gap: 3px;
3827
3830
  max-width: 100%;
3828
- padding: 0;
3831
+ padding: 3px 4px;
3829
3832
  margin: 0;
3830
- position: relative;
3831
- z-index: 10;
3833
+ border-radius: 6px;
3834
+ background: rgba(255, 255, 255, 0.75);
3835
+ backdrop-filter: blur(8px);
3836
+ -webkit-backdrop-filter: blur(8px);
3837
+ border: 1px solid rgba(203, 213, 225, 0.6);
3838
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
3839
+ z-index: 50;
3832
3840
  pointer-events: auto;
3833
3841
  }
3834
3842
  .markdy-controls-group {
3835
3843
  display: inline-flex;
3836
3844
  align-items: center;
3837
- gap: 4px;
3845
+ gap: 3px;
3838
3846
  flex-shrink: 0;
3839
3847
  position: relative;
3840
3848
  z-index: 5;
@@ -3843,7 +3851,7 @@ function ensureSceneStyles(doc) {
3843
3851
  .markdy-controls-tools {
3844
3852
  display: inline-flex;
3845
3853
  align-items: center;
3846
- gap: 4px;
3854
+ gap: 3px;
3847
3855
  flex-shrink: 0;
3848
3856
  margin-left: 0;
3849
3857
  }
@@ -3855,11 +3863,7 @@ function ensureSceneStyles(doc) {
3855
3863
  flex-shrink: 0;
3856
3864
  }
3857
3865
  .markdy-btn-label {
3858
- display: inline;
3859
- margin-left: 3px;
3860
- font-size: 11px;
3861
- font-weight: 500;
3862
- line-height: 1;
3866
+ display: none;
3863
3867
  }
3864
3868
  .markdy-controls button {
3865
3869
  appearance: none;
@@ -3867,49 +3871,45 @@ function ensureSceneStyles(doc) {
3867
3871
  touch-action: manipulation;
3868
3872
  user-select: none;
3869
3873
  -webkit-user-select: none;
3870
- border: 1px solid rgba(203, 213, 225, 0.7);
3871
- border-radius: 6px;
3872
- background: rgba(255, 255, 255, 0.9);
3873
- color: #475569;
3874
- cursor: pointer;
3875
- font: 500 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3876
- height: 25px;
3877
- min-width: 25px;
3878
- padding: 0 7px;
3874
+ width: 24px;
3875
+ height: 24px;
3876
+ min-width: 24px;
3877
+ padding: 0;
3879
3878
  display: inline-flex;
3880
3879
  align-items: center;
3881
3880
  justify-content: center;
3882
- gap: 3px;
3883
- white-space: nowrap;
3884
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
3885
- transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
3881
+ border-radius: 4px;
3882
+ background: transparent;
3883
+ border: none;
3884
+ box-shadow: none;
3885
+ color: #64748b;
3886
+ opacity: 0.75;
3887
+ cursor: pointer;
3888
+ transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
3886
3889
  position: relative;
3887
3890
  pointer-events: auto;
3888
- isolation: isolate;
3889
- overflow: hidden;
3890
- text-overflow: ellipsis;
3891
+ }
3892
+ .markdy-controls button svg,
3893
+ .markdy-controls button .markdy-icon {
3894
+ width: 13px;
3895
+ height: 13px;
3891
3896
  }
3892
3897
  .markdy-controls button:hover:not([aria-pressed="true"]) {
3893
- position: relative;
3894
- z-index: 20;
3895
- background: #ffffff;
3898
+ background: rgba(148, 163, 184, 0.15);
3896
3899
  color: #0f172a;
3897
- border-color: #94a3b8;
3898
- transform: translateY(-0.5px);
3899
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
3900
+ opacity: 1;
3901
+ transform: none;
3902
+ box-shadow: none;
3900
3903
  }
3901
3904
  .markdy-controls-tools button:hover:not([aria-pressed="true"]) {
3902
- z-index: 25;
3903
- border-color: #64748b;
3904
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
3905
+ background: rgba(148, 163, 184, 0.15);
3906
+ color: #0f172a;
3907
+ opacity: 1;
3905
3908
  }
3906
3909
  .markdy-controls button[aria-pressed="true"] {
3907
- position: relative;
3908
- z-index: 20;
3909
3910
  background: #0f172a !important;
3910
3911
  color: #ffffff !important;
3911
- border-color: #0f172a !important;
3912
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
3912
+ opacity: 1 !important;
3913
3913
  }
3914
3914
  .markdy-controls button:focus-visible {
3915
3915
  position: relative;
@@ -3918,7 +3918,7 @@ function ensureSceneStyles(doc) {
3918
3918
  outline-offset: 1px;
3919
3919
  }
3920
3920
  .markdy-controls button:active {
3921
- transform: translateY(0) scale(0.96);
3921
+ transform: scale(0.96);
3922
3922
  }
3923
3923
  .markdy-icon {
3924
3924
  display: inline-block;
@@ -3926,27 +3926,77 @@ function ensureSceneStyles(doc) {
3926
3926
  vertical-align: middle;
3927
3927
  }
3928
3928
  .markdy-badge {
3929
+ position: absolute;
3930
+ bottom: 8px;
3931
+ right: 8px;
3929
3932
  display: inline-flex;
3930
3933
  align-items: center;
3931
3934
  gap: 4px;
3932
3935
  text-align: right;
3933
3936
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3934
- font-size: 11px;
3937
+ font-size: 9px;
3935
3938
  line-height: 1;
3936
3939
  color: #64748b;
3937
3940
  text-decoration: none;
3938
- padding: 3px 6px;
3939
- border-radius: 5px;
3940
- opacity: 0.75;
3941
+ padding: 2px 4px;
3942
+ letter-spacing: 0.01em;
3943
+ border-radius: 4px;
3944
+ background: transparent;
3945
+ border: none;
3946
+ opacity: 0.35;
3941
3947
  margin-left: auto;
3942
3948
  flex-shrink: 0;
3949
+ z-index: 50;
3943
3950
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
3944
3951
  white-space: nowrap;
3952
+ pointer-events: auto;
3945
3953
  }
3946
3954
  .markdy-badge:hover {
3947
- opacity: 1;
3948
- color: #1e293b;
3949
- background-color: rgba(148, 163, 184, 0.12);
3955
+ opacity: 0.8;
3956
+ color: #0f172a;
3957
+ background-color: rgba(148, 163, 184, 0.1);
3958
+ }
3959
+ .markdy-studio-link {
3960
+ position: absolute;
3961
+ top: 8px;
3962
+ right: 8px;
3963
+ z-index: 50;
3964
+ display: inline-flex;
3965
+ align-items: center;
3966
+ justify-content: center;
3967
+ width: 28px;
3968
+ height: 28px;
3969
+ border-radius: 6px;
3970
+ background: rgba(255, 255, 255, 0.75);
3971
+ backdrop-filter: blur(8px);
3972
+ -webkit-backdrop-filter: blur(8px);
3973
+ border: 1px solid rgba(203, 213, 225, 0.6);
3974
+ color: #64748b;
3975
+ text-decoration: none;
3976
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
3977
+ transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
3978
+ pointer-events: auto;
3979
+ }
3980
+ @media (hover: hover) {
3981
+ .markdy-studio-link {
3982
+ opacity: 0;
3983
+ }
3984
+ .markdy-diagram-root:hover .markdy-studio-link {
3985
+ opacity: 0.75;
3986
+ }
3987
+ .markdy-studio-link:hover {
3988
+ opacity: 1 !important;
3989
+ color: #0f172a;
3990
+ background: rgba(255, 255, 255, 0.95);
3991
+ }
3992
+ }
3993
+ @media (hover: none) {
3994
+ .markdy-studio-link {
3995
+ opacity: 0.75;
3996
+ }
3997
+ .markdy-studio-link:active {
3998
+ opacity: 1;
3999
+ }
3950
4000
  }
3951
4001
  .markdy-badge-prefix {
3952
4002
  font-weight: 400;
@@ -4361,10 +4411,22 @@ function ensureSceneStyles(doc) {
4361
4411
  :root[data-theme="dark"] .markdy-footer,
4362
4412
  .theme-dark .markdy-footer,
4363
4413
  .dark .markdy-footer {
4364
- background: var(--md-footer-bg, rgba(15, 23, 42, 0.88));
4365
- border-top-color: var(--md-card-border, rgba(255, 255, 255, 0.08));
4414
+ background: transparent;
4415
+ border-top: none;
4366
4416
  color: #94a3b8;
4367
4417
  }
4418
+ [data-markdy-theme="midnight"] .markdy-controls,
4419
+ [data-markdy-theme="blueprint"] .markdy-controls,
4420
+ [data-markdy-theme="terminal"] .markdy-controls,
4421
+ [data-markdy-theme="graphite"] .markdy-controls,
4422
+ [data-markdy-theme="nebula"] .markdy-controls,
4423
+ :root[data-theme="dark"] .markdy-controls,
4424
+ .theme-dark .markdy-controls,
4425
+ .dark .markdy-controls {
4426
+ background: rgba(15, 23, 42, 0.65);
4427
+ border-color: rgba(255, 255, 255, 0.08);
4428
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
4429
+ }
4368
4430
  [data-markdy-theme="midnight"] .markdy-player-scrubber-track,
4369
4431
  [data-markdy-theme="blueprint"] .markdy-player-scrubber-track,
4370
4432
  [data-markdy-theme="terminal"] .markdy-player-scrubber-track,
@@ -4382,9 +4444,34 @@ function ensureSceneStyles(doc) {
4382
4444
  :root[data-theme="dark"] .markdy-controls button:not([aria-pressed="true"]),
4383
4445
  .theme-dark .markdy-controls button:not([aria-pressed="true"]),
4384
4446
  .dark .markdy-controls button:not([aria-pressed="true"]) {
4385
- background: rgba(30, 41, 59, 0.7);
4386
- border-color: rgba(71, 85, 105, 0.5);
4387
- color: #cbd5e1;
4447
+ background: transparent;
4448
+ border: none;
4449
+ color: #94a3b8;
4450
+ opacity: 0.75;
4451
+ }
4452
+ [data-markdy-theme="midnight"] .markdy-controls button:hover:not([aria-pressed="true"]),
4453
+ [data-markdy-theme="blueprint"] .markdy-controls button:hover:not([aria-pressed="true"]),
4454
+ [data-markdy-theme="terminal"] .markdy-controls button:hover:not([aria-pressed="true"]),
4455
+ [data-markdy-theme="graphite"] .markdy-controls button:hover:not([aria-pressed="true"]),
4456
+ [data-markdy-theme="nebula"] .markdy-controls button:hover:not([aria-pressed="true"]),
4457
+ :root[data-theme="dark"] .markdy-controls button:hover:not([aria-pressed="true"]),
4458
+ .theme-dark .markdy-controls button:hover:not([aria-pressed="true"]),
4459
+ .dark .markdy-controls button:hover:not([aria-pressed="true"]) {
4460
+ background: rgba(255, 255, 255, 0.1);
4461
+ color: #f8fafc;
4462
+ opacity: 1;
4463
+ }
4464
+ [data-markdy-theme="midnight"] .markdy-controls button[aria-pressed="true"],
4465
+ [data-markdy-theme="blueprint"] .markdy-controls button[aria-pressed="true"],
4466
+ [data-markdy-theme="terminal"] .markdy-controls button[aria-pressed="true"],
4467
+ [data-markdy-theme="graphite"] .markdy-controls button[aria-pressed="true"],
4468
+ [data-markdy-theme="nebula"] .markdy-controls button[aria-pressed="true"],
4469
+ :root[data-theme="dark"] .markdy-controls button[aria-pressed="true"],
4470
+ .theme-dark .markdy-controls button[aria-pressed="true"],
4471
+ .dark .markdy-controls button[aria-pressed="true"] {
4472
+ background: #3b82f6 !important;
4473
+ color: #ffffff !important;
4474
+ opacity: 1 !important;
4388
4475
  }
4389
4476
  .markdy-footer a {
4390
4477
  transition: opacity 0.15s ease, color 0.15s ease;
@@ -4398,6 +4485,7 @@ function ensureSceneStyles(doc) {
4398
4485
  .theme-dark .markdy-badge,
4399
4486
  .dark .markdy-badge {
4400
4487
  color: #94a3b8;
4488
+ background: transparent;
4401
4489
  }
4402
4490
  [data-markdy-theme="midnight"] .markdy-badge:hover,
4403
4491
  [data-markdy-theme="blueprint"] .markdy-badge:hover,
@@ -4409,6 +4497,33 @@ function ensureSceneStyles(doc) {
4409
4497
  .dark .markdy-badge:hover {
4410
4498
  color: #f1f5f9 !important;
4411
4499
  background-color: rgba(255, 255, 255, 0.08);
4500
+ opacity: 0.8 !important;
4501
+ }
4502
+ [data-markdy-theme="midnight"] .markdy-studio-link,
4503
+ [data-markdy-theme="blueprint"] .markdy-studio-link,
4504
+ [data-markdy-theme="terminal"] .markdy-studio-link,
4505
+ [data-markdy-theme="graphite"] .markdy-studio-link,
4506
+ [data-markdy-theme="nebula"] .markdy-studio-link,
4507
+ :root[data-theme="dark"] .markdy-studio-link,
4508
+ .theme-dark .markdy-studio-link,
4509
+ .dark .markdy-studio-link {
4510
+ background: rgba(15, 23, 42, 0.65);
4511
+ border-color: rgba(255, 255, 255, 0.08);
4512
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
4513
+ color: #94a3b8;
4514
+ }
4515
+ @media (hover: hover) {
4516
+ [data-markdy-theme="midnight"] .markdy-studio-link:hover,
4517
+ [data-markdy-theme="blueprint"] .markdy-studio-link:hover,
4518
+ [data-markdy-theme="terminal"] .markdy-studio-link:hover,
4519
+ [data-markdy-theme="graphite"] .markdy-studio-link:hover,
4520
+ [data-markdy-theme="nebula"] .markdy-studio-link:hover,
4521
+ :root[data-theme="dark"] .markdy-studio-link:hover,
4522
+ .theme-dark .markdy-studio-link:hover,
4523
+ .dark .markdy-studio-link:hover {
4524
+ color: #f8fafc;
4525
+ background: rgba(30, 41, 59, 0.9);
4526
+ }
4412
4527
  }
4413
4528
  [data-markdy-theme="midnight"] .markdy-badge-brand,
4414
4529
  [data-markdy-theme="blueprint"] .markdy-badge-brand,
@@ -6828,7 +6943,7 @@ function createDiagram(opts) {
6828
6943
  footer.className = "markdy-footer";
6829
6944
  applyThemeVariables(footer, plan.theme);
6830
6945
  Object.assign(footer.style, {
6831
- position: "relative",
6946
+ position: "static",
6832
6947
  zIndex: "100",
6833
6948
  display: "flex",
6834
6949
  alignItems: "center",
@@ -6838,7 +6953,14 @@ function createDiagram(opts) {
6838
6953
  width: "100%",
6839
6954
  boxSizing: "border-box",
6840
6955
  pointerEvents: "auto",
6841
- flexShrink: "0"
6956
+ flexShrink: "0",
6957
+ height: "0",
6958
+ minHeight: "0",
6959
+ padding: "0",
6960
+ margin: "0",
6961
+ background: "transparent",
6962
+ borderTop: "none",
6963
+ overflow: "visible"
6842
6964
  });
6843
6965
  for (const eventName of [
6844
6966
  "click",
@@ -6877,6 +6999,19 @@ function createDiagram(opts) {
6877
6999
  badge.appendChild(badgeBrand);
6878
7000
  ensureFooter().appendChild(badge);
6879
7001
  }
7002
+ let studioLink = null;
7003
+ const studioLinkEnabled = opts.studioLink !== false;
7004
+ if (studioLinkEnabled) {
7005
+ studioLink = document.createElement("a");
7006
+ studioLink.className = "markdy-studio-link";
7007
+ studioLink.href = `${shareUrl ?? MARKDY_PLAYGROUND_URL}#code=${encodeCodeForPlaygroundHash(code)}`;
7008
+ studioLink.target = "_blank";
7009
+ studioLink.rel = "noopener noreferrer";
7010
+ studioLink.title = "Open in Markdy Studio";
7011
+ studioLink.setAttribute("aria-label", "Open in Markdy Studio");
7012
+ studioLink.innerHTML = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M10 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-4M14 4h6v6m0-6L10 14"/></svg>`;
7013
+ container.appendChild(studioLink);
7014
+ }
6880
7015
  ensureSceneStyles(document);
6881
7016
  ensureNodeStyles(document);
6882
7017
  const sceneFrame = document.createElement("div");
@@ -7835,6 +7970,7 @@ function createDiagram(opts) {
7835
7970
  container.classList.remove("markdy--pseudo-fullscreen");
7836
7971
  if (progressEl?.parentNode === viewport) viewport.removeChild(progressEl);
7837
7972
  if (footer?.parentNode === container) container.removeChild(footer);
7973
+ if (studioLink?.parentNode === container) container.removeChild(studioLink);
7838
7974
  if (viewport.parentNode === container) container.removeChild(viewport);
7839
7975
  }
7840
7976
  };
@@ -8582,20 +8718,15 @@ function createDiagram(opts) {
8582
8718
  toolbar.setAttribute("role", "toolbar");
8583
8719
  toolbar.setAttribute("aria-label", "Diagram controls");
8584
8720
  Object.assign(toolbar.style, {
8585
- position: "relative",
8721
+ position: "absolute",
8722
+ bottom: "8px",
8723
+ left: "8px",
8586
8724
  display: "inline-flex",
8587
8725
  alignItems: "center",
8588
8726
  justifyContent: "flex-start",
8589
- width: "auto",
8590
- maxWidth: "100%",
8591
- border: "0",
8592
- borderRadius: "0",
8593
- background: "transparent",
8594
- boxShadow: "none",
8595
- backdropFilter: "none",
8596
- transform: "none",
8597
- pointerEvents: "auto",
8598
- zIndex: "10"
8727
+ gap: "3px",
8728
+ zIndex: "50",
8729
+ pointerEvents: "auto"
8599
8730
  });
8600
8731
  for (const eventName of [
8601
8732
  "click",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
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.5"
49
+ "@markdy/core": "1.5.6"
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.5"
56
+ "@markdy/stdlib-systems": "1.5.6"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",