@markdy/renderer-dom 1.4.6 → 1.4.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 (2) hide show
  1. package/dist/index.js +239 -99
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -3472,9 +3472,12 @@ function ensureSceneStyles(doc) {
3472
3472
  const style = doc.createElement("style");
3473
3473
  style.id = SCENE_STYLE_ID;
3474
3474
  style.textContent = `
3475
+ .markdy-viewport,
3475
3476
  .markdy-scene-root {
3476
3477
  isolation: isolate;
3477
3478
  }
3479
+ .markdy-viewport::before,
3480
+ .markdy-viewport::after,
3478
3481
  .markdy-scene-root::before,
3479
3482
  .markdy-scene-root::after {
3480
3483
  content: "";
@@ -3482,6 +3485,7 @@ function ensureSceneStyles(doc) {
3482
3485
  inset: 0;
3483
3486
  pointer-events: none;
3484
3487
  }
3488
+ .markdy-viewport::before,
3485
3489
  .markdy-scene-root::before {
3486
3490
  z-index: 0;
3487
3491
  background:
@@ -3491,6 +3495,7 @@ function ensureSceneStyles(doc) {
3491
3495
  mask-image: radial-gradient(ellipse at 50% 48%, #000 65%, transparent 100%);
3492
3496
  opacity: 0.55;
3493
3497
  }
3498
+ .markdy-viewport::after,
3494
3499
  .markdy-scene-root::after {
3495
3500
  z-index: 1;
3496
3501
  background:
@@ -3499,6 +3504,14 @@ function ensureSceneStyles(doc) {
3499
3504
  opacity: 0.68;
3500
3505
  }
3501
3506
  .markdy-scene-content { z-index: 2; }
3507
+ .markdy-viewport .markdy-scene-root {
3508
+ background: transparent !important;
3509
+ }
3510
+ .markdy-viewport .markdy-scene-root::before,
3511
+ .markdy-viewport .markdy-scene-root::after {
3512
+ display: none !important;
3513
+ }
3514
+ .markdy-viewport[data-markdy-theme="nebula"]::before,
3502
3515
  .markdy-scene-root[data-markdy-theme="nebula"]::before {
3503
3516
  background:
3504
3517
  radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--md-soft) 20%, transparent), transparent 36%),
@@ -3507,32 +3520,38 @@ function ensureSceneStyles(doc) {
3507
3520
  mask-image: radial-gradient(ellipse at 50% 50%, #000 70%, transparent 100%);
3508
3521
  opacity: 0.95;
3509
3522
  }
3523
+ .markdy-viewport[data-markdy-theme="nebula"]::after,
3510
3524
  .markdy-scene-root[data-markdy-theme="nebula"]::after {
3511
3525
  background:
3512
3526
  radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--md-accent) 16%, transparent), transparent 56%),
3513
3527
  linear-gradient(180deg, transparent 0%, var(--md-vignette) 100%);
3514
3528
  opacity: 0.85;
3515
3529
  }
3530
+ .markdy-viewport[data-markdy-theme="terminal"]::before,
3516
3531
  .markdy-scene-root[data-markdy-theme="terminal"]::before {
3517
3532
  background:
3518
3533
  radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 20px 20px;
3519
3534
  mask-image: none;
3520
3535
  opacity: 0.45;
3521
3536
  }
3537
+ .markdy-viewport[data-markdy-theme="terminal"]::after,
3522
3538
  .markdy-scene-root[data-markdy-theme="terminal"]::after {
3523
3539
  background:
3524
3540
  radial-gradient(ellipse at 50% 0%, rgba(255, 90, 54, 0.1), transparent 52%),
3525
3541
  linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55) 100%);
3526
3542
  opacity: 0.75;
3527
3543
  }
3544
+ .markdy-viewport[data-markdy-theme="sketchy"]::before,
3528
3545
  .markdy-scene-root[data-markdy-theme="sketchy"]::before {
3529
3546
  background: none;
3530
3547
  opacity: 0;
3531
3548
  }
3549
+ .markdy-viewport[data-markdy-theme="sketchy"]::after,
3532
3550
  .markdy-scene-root[data-markdy-theme="sketchy"]::after {
3533
3551
  background: none;
3534
3552
  opacity: 0;
3535
3553
  }
3554
+ .markdy-viewport[data-markdy-theme="ink"]::before,
3536
3555
  .markdy-scene-root[data-markdy-theme="ink"]::before {
3537
3556
  background:
3538
3557
  radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--md-accent) 9%, transparent) 1px, transparent 1px) 0 0 / 20px 20px,
@@ -3541,6 +3560,7 @@ function ensureSceneStyles(doc) {
3541
3560
  mask-image: radial-gradient(ellipse at 50% 50%, #000 75%, transparent 100%);
3542
3561
  opacity: 0.75;
3543
3562
  }
3563
+ .markdy-viewport[data-markdy-theme="ink"]::after,
3544
3564
  .markdy-scene-root[data-markdy-theme="ink"]::after {
3545
3565
  background:
3546
3566
  radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--md-accent) 12%, transparent), transparent 50%),
@@ -3548,12 +3568,14 @@ function ensureSceneStyles(doc) {
3548
3568
  linear-gradient(180deg, transparent 0%, rgba(219, 234, 254, 0.25) 80%, var(--md-vignette) 100%);
3549
3569
  opacity: 0.85;
3550
3570
  }
3571
+ .markdy-viewport[data-markdy-theme="doodle"]::before,
3551
3572
  .markdy-scene-root[data-markdy-theme="doodle"]::before {
3552
3573
  background:
3553
3574
  radial-gradient(circle at 50% 50%, rgba(24, 24, 27, 0.06) 1.5px, transparent 1.5px) 0 0 / 20px 20px;
3554
3575
  mask-image: none;
3555
3576
  opacity: 0.7;
3556
3577
  }
3578
+ .markdy-viewport[data-markdy-theme="doodle"]::after,
3557
3579
  .markdy-scene-root[data-markdy-theme="doodle"]::after {
3558
3580
  background:
3559
3581
  radial-gradient(ellipse at 85% 15%, rgba(244, 63, 94, 0.05), transparent 45%),
@@ -3655,6 +3677,13 @@ function ensureSceneStyles(doc) {
3655
3677
  flex-direction: column;
3656
3678
  box-sizing: border-box;
3657
3679
  width: 100%;
3680
+ border: 1px solid var(--md-card-border, rgba(148, 163, 184, 0.22));
3681
+ border-radius: 12px;
3682
+ background: var(--md-canvas, #ffffff);
3683
+ box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
3684
+ overflow: hidden;
3685
+ container-type: inline-size;
3686
+ container-name: markdy-root;
3658
3687
  }
3659
3688
  .markdy-viewport {
3660
3689
  position: relative;
@@ -3663,6 +3692,7 @@ function ensureSceneStyles(doc) {
3663
3692
  min-height: 0;
3664
3693
  overflow: hidden;
3665
3694
  box-sizing: border-box;
3695
+ border-radius: 11px 11px 0 0;
3666
3696
  }
3667
3697
  .markdy-footer {
3668
3698
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
@@ -3673,15 +3703,16 @@ function ensureSceneStyles(doc) {
3673
3703
  align-items: center;
3674
3704
  justify-content: space-between;
3675
3705
  gap: 8px;
3676
- padding: 8px 12px 6px;
3677
- color: var(--md-text, #f8fafc);
3678
- background: transparent;
3679
- backdrop-filter: none;
3680
- -webkit-backdrop-filter: none;
3681
- border-top: none;
3706
+ padding: 6px 12px 6px 10px;
3707
+ color: var(--md-text, #64748b);
3708
+ background: var(--md-footer-bg, rgba(248, 250, 252, 0.82));
3709
+ backdrop-filter: blur(8px);
3710
+ -webkit-backdrop-filter: blur(8px);
3711
+ border-top: 1px solid var(--md-card-border, rgba(148, 163, 184, 0.14));
3682
3712
  z-index: 100;
3683
3713
  pointer-events: auto;
3684
3714
  flex-shrink: 0;
3715
+ border-radius: 0 0 11px 11px;
3685
3716
  }
3686
3717
  .markdy-controls {
3687
3718
  display: flex;
@@ -3690,14 +3721,14 @@ function ensureSceneStyles(doc) {
3690
3721
  flex: 1 1 auto;
3691
3722
  width: auto;
3692
3723
  min-width: 0;
3693
- gap: 8px;
3724
+ gap: 6px;
3694
3725
  max-width: 100%;
3695
3726
  overflow-x: auto;
3696
3727
  overflow-y: visible;
3697
3728
  scrollbar-width: none;
3698
3729
  -ms-overflow-style: none;
3699
3730
  -webkit-overflow-scrolling: touch;
3700
- padding: 4px 4px 6px;
3731
+ padding: 2px 2px 2px;
3701
3732
  margin: 0;
3702
3733
  position: relative;
3703
3734
  z-index: 10;
@@ -3745,27 +3776,34 @@ function ensureSceneStyles(doc) {
3745
3776
  margin: 0 2px;
3746
3777
  flex-shrink: 0;
3747
3778
  }
3779
+ .markdy-btn-label {
3780
+ display: inline;
3781
+ margin-left: 3px;
3782
+ font-size: 11px;
3783
+ font-weight: 500;
3784
+ line-height: 1;
3785
+ }
3748
3786
  .markdy-controls button {
3749
3787
  appearance: none;
3750
3788
  -webkit-appearance: none;
3751
3789
  touch-action: manipulation;
3752
3790
  user-select: none;
3753
3791
  -webkit-user-select: none;
3754
- border: 1px solid var(--md-control-border, rgba(148, 163, 184, 0.2));
3755
- border-radius: 7px;
3756
- background: var(--md-control-bg, rgba(255, 255, 255, 0.04));
3757
- color: var(--md-control-text, #94a3b8);
3792
+ border: 1px solid rgba(203, 213, 225, 0.7);
3793
+ border-radius: 6px;
3794
+ background: rgba(255, 255, 255, 0.9);
3795
+ color: #475569;
3758
3796
  cursor: pointer;
3759
- font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3760
- height: 27px;
3761
- min-width: 27px;
3762
- padding: 0 6px;
3797
+ font: 500 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3798
+ height: 25px;
3799
+ min-width: 25px;
3800
+ padding: 0 7px;
3763
3801
  display: inline-flex;
3764
3802
  align-items: center;
3765
3803
  justify-content: center;
3766
- gap: 5px;
3804
+ gap: 3px;
3767
3805
  white-space: nowrap;
3768
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
3806
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
3769
3807
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
3770
3808
  position: relative;
3771
3809
  pointer-events: auto;
@@ -3774,30 +3812,30 @@ function ensureSceneStyles(doc) {
3774
3812
  .markdy-controls button:hover:not([aria-pressed="true"]) {
3775
3813
  position: relative;
3776
3814
  z-index: 20;
3777
- background: var(--md-control-hover-bg, rgba(255, 255, 255, 0.1));
3778
- color: var(--md-control-hover-text, #f8fafc);
3779
- border-color: var(--md-control-hover-border, rgba(148, 163, 184, 0.35));
3780
- transform: translateY(-1px);
3781
- box-shadow: 0 3px 6px rgba(0, 0, 0, 0.14);
3815
+ background: #ffffff;
3816
+ color: #0f172a;
3817
+ border-color: #94a3b8;
3818
+ transform: translateY(-0.5px);
3819
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
3782
3820
  }
3783
3821
  .markdy-controls-tools button:hover:not([aria-pressed="true"]) {
3784
3822
  z-index: 25;
3785
- border-color: var(--md-control-hover-border, rgba(148, 163, 184, 0.45));
3786
- box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
3823
+ border-color: #64748b;
3824
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
3787
3825
  }
3788
3826
  .markdy-controls button[aria-pressed="true"] {
3789
3827
  position: relative;
3790
3828
  z-index: 20;
3791
- background: var(--accent, #10b981) !important;
3829
+ background: #0f172a !important;
3792
3830
  color: #ffffff !important;
3793
- border-color: var(--accent, #10b981) !important;
3794
- box-shadow: 0 0 10px var(--accent-glow, rgba(16, 185, 129, 0.4)) !important;
3831
+ border-color: #0f172a !important;
3832
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
3795
3833
  }
3796
3834
  .markdy-controls button:focus-visible {
3797
3835
  position: relative;
3798
3836
  z-index: 30;
3799
- outline: 2px solid var(--accent, #10b981);
3800
- outline-offset: 2px;
3837
+ outline: 2px solid #2563eb;
3838
+ outline-offset: 1px;
3801
3839
  }
3802
3840
  .markdy-controls button:active {
3803
3841
  transform: translateY(0) scale(0.96);
@@ -3808,29 +3846,29 @@ function ensureSceneStyles(doc) {
3808
3846
  vertical-align: middle;
3809
3847
  }
3810
3848
  .markdy-control-play {
3811
- background: var(--accent, #10b981) !important;
3849
+ background: #2563eb !important;
3812
3850
  color: #ffffff !important;
3813
- border-color: var(--accent, #10b981) !important;
3814
- padding: 0 10px !important;
3815
- font-weight: 700 !important;
3816
- box-shadow: 0 2px 8px var(--accent-glow, rgba(16, 185, 129, 0.35)) !important;
3851
+ border-color: #2563eb !important;
3852
+ padding: 0 9px !important;
3853
+ font-weight: 600 !important;
3854
+ box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25) !important;
3817
3855
  }
3818
3856
  .markdy-control-play:hover {
3819
- filter: brightness(1.08);
3820
- box-shadow: 0 2px 12px var(--accent-glow, rgba(16, 185, 129, 0.55)) !important;
3821
- transform: translateY(-1px) scale(1.02);
3857
+ filter: brightness(1.06);
3858
+ transform: translateY(-0.5px);
3859
+ box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35) !important;
3822
3860
  }
3823
3861
  .markdy-badge {
3824
3862
  display: inline-flex;
3825
3863
  align-items: center;
3826
3864
  text-align: right;
3827
- font-family: system-ui, sans-serif;
3865
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3828
3866
  font-size: 10px;
3829
- font-weight: 400;
3830
- color: var(--md-control-text, #94a3b8);
3867
+ font-weight: 500;
3868
+ color: #94a3b8;
3831
3869
  text-decoration: none;
3832
3870
  padding: 0;
3833
- opacity: 0.7;
3871
+ opacity: 0.6;
3834
3872
  margin-left: auto;
3835
3873
  flex-shrink: 0;
3836
3874
  transition: opacity 0.15s ease, color 0.15s ease;
@@ -3838,7 +3876,58 @@ function ensureSceneStyles(doc) {
3838
3876
  }
3839
3877
  .markdy-badge:hover {
3840
3878
  opacity: 1;
3841
- color: var(--md-text, #f8fafc);
3879
+ color: #475569;
3880
+ }
3881
+ @media (max-width: 640px) {
3882
+ .markdy-btn-label {
3883
+ display: none !important;
3884
+ }
3885
+ .markdy-controls button {
3886
+ padding: 0 !important;
3887
+ width: 25px !important;
3888
+ height: 25px !important;
3889
+ min-width: 25px !important;
3890
+ justify-content: center !important;
3891
+ }
3892
+ .markdy-controls-secondary,
3893
+ .markdy-control-divider-secondary {
3894
+ display: none !important;
3895
+ }
3896
+ .markdy-speed-group {
3897
+ display: none !important;
3898
+ }
3899
+ .markdy-controls {
3900
+ gap: 4px !important;
3901
+ }
3902
+ .markdy-footer {
3903
+ padding: 5px 8px !important;
3904
+ }
3905
+ .markdy-badge {
3906
+ font-size: 9px !important;
3907
+ opacity: 0.55;
3908
+ }
3909
+ }
3910
+ @container markdy-root (max-width: 520px) {
3911
+ .markdy-btn-label {
3912
+ display: none !important;
3913
+ }
3914
+ .markdy-controls button {
3915
+ padding: 0 !important;
3916
+ width: 25px !important;
3917
+ height: 25px !important;
3918
+ min-width: 25px !important;
3919
+ justify-content: center !important;
3920
+ }
3921
+ .markdy-controls-secondary,
3922
+ .markdy-control-divider-secondary {
3923
+ display: none !important;
3924
+ }
3925
+ .markdy-speed-group {
3926
+ display: none !important;
3927
+ }
3928
+ .markdy-controls {
3929
+ gap: 4px !important;
3930
+ }
3842
3931
  }
3843
3932
  .markdy-speed-group {
3844
3933
  display: inline-flex;
@@ -3867,9 +3956,9 @@ function ensureSceneStyles(doc) {
3867
3956
  transform: none;
3868
3957
  }
3869
3958
  .markdy-speed-group .markdy-control-rate[aria-pressed="true"] {
3870
- background: var(--accent, #10b981) !important;
3959
+ background: var(--accent, #2563eb) !important;
3871
3960
  color: #ffffff !important;
3872
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
3961
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
3873
3962
  }
3874
3963
  .markdy-control-time {
3875
3964
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
@@ -3881,9 +3970,9 @@ function ensureSceneStyles(doc) {
3881
3970
  letter-spacing: -0.02em;
3882
3971
  }
3883
3972
  .markdy-btn-flashed {
3884
- background: rgba(16, 185, 129, 0.2) !important;
3885
- color: #10b981 !important;
3886
- border-color: #10b981 !important;
3973
+ background: rgba(37, 99, 235, 0.15) !important;
3974
+ color: #2563eb !important;
3975
+ border-color: #2563eb !important;
3887
3976
  }
3888
3977
  /* \u2500\u2500 Code panel overlay \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
3889
3978
  .markdy-code-panel-overlay {
@@ -3977,16 +4066,16 @@ function ensureSceneStyles(doc) {
3977
4066
  white-space: nowrap;
3978
4067
  }
3979
4068
  .markdy-code-panel__playground {
3980
- background: var(--accent-light, rgba(16, 185, 129, 0.15));
3981
- color: var(--accent, #10b981);
3982
- border-color: var(--accent, #10b981);
3983
- font-weight: 700;
4069
+ background: var(--accent-light, rgba(37, 99, 235, 0.1));
4070
+ color: var(--accent, #2563eb);
4071
+ border-color: var(--accent, #2563eb);
4072
+ font-weight: 600;
3984
4073
  }
3985
4074
  .markdy-code-panel__playground:hover {
3986
- background: var(--accent, #10b981);
4075
+ background: var(--accent, #2563eb);
3987
4076
  color: #ffffff;
3988
- border-color: var(--accent, #10b981);
3989
- transform: translateY(-1px);
4077
+ border-color: var(--accent, #2563eb);
4078
+ transform: translateY(-0.5px);
3990
4079
  }
3991
4080
  .markdy-code-panel__copy:hover,
3992
4081
  .markdy-code-panel__close:hover {
@@ -4058,8 +4147,8 @@ function ensureSceneStyles(doc) {
4058
4147
  height: 4.5px;
4059
4148
  background: linear-gradient(
4060
4149
  to right,
4061
- var(--accent, #10b981) 0%,
4062
- var(--accent, #10b981) var(--seek-pct, 0%),
4150
+ var(--accent, #2563eb) 0%,
4151
+ var(--accent, #2563eb) var(--seek-pct, 0%),
4063
4152
  rgba(148, 163, 184, 0.35) var(--seek-pct, 0%),
4064
4153
  rgba(148, 163, 184, 0.35) 100%
4065
4154
  );
@@ -4071,28 +4160,28 @@ function ensureSceneStyles(doc) {
4071
4160
  height: 13px;
4072
4161
  width: 13px;
4073
4162
  border-radius: 50%;
4074
- background: var(--accent, #10b981);
4163
+ background: var(--accent, #2563eb);
4075
4164
  border: 2px solid #ffffff;
4076
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
4165
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
4077
4166
  margin-top: -4.25px;
4078
4167
  cursor: grab;
4079
4168
  transition: transform 0.1s ease, box-shadow 0.15s ease;
4080
4169
  }
4081
4170
  .markdy-control-seek:hover::-webkit-slider-thumb {
4082
- transform: scale(1.2);
4083
- box-shadow: 0 0 8px var(--accent-glow, rgba(16, 185, 129, 0.6));
4171
+ transform: scale(1.15);
4172
+ box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
4084
4173
  }
4085
4174
  .markdy-control-seek:active::-webkit-slider-thumb {
4086
4175
  cursor: grabbing;
4087
- transform: scale(1.2);
4176
+ transform: scale(1.15);
4088
4177
  }
4089
4178
  .markdy-control-seek::-moz-range-track {
4090
4179
  width: 100%;
4091
4180
  height: 4.5px;
4092
4181
  background: linear-gradient(
4093
4182
  to right,
4094
- var(--accent, #10b981) 0%,
4095
- var(--accent, #10b981) var(--seek-pct, 0%),
4183
+ var(--accent, #2563eb) 0%,
4184
+ var(--accent, #2563eb) var(--seek-pct, 0%),
4096
4185
  rgba(148, 163, 184, 0.35) var(--seek-pct, 0%),
4097
4186
  rgba(148, 163, 184, 0.35) 100%
4098
4187
  );
@@ -4102,9 +4191,9 @@ function ensureSceneStyles(doc) {
4102
4191
  height: 13px;
4103
4192
  width: 13px;
4104
4193
  border-radius: 50%;
4105
- background: var(--accent, #10b981);
4194
+ background: var(--accent, #2563eb);
4106
4195
  border: 2px solid #ffffff;
4107
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
4196
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
4108
4197
  cursor: grab;
4109
4198
  transition: transform 0.1s ease, box-shadow 0.15s ease;
4110
4199
  }
@@ -4143,17 +4232,52 @@ function ensureSceneStyles(doc) {
4143
4232
  [data-markdy-theme="nebula"] .markdy-controls button[aria-pressed="true"],
4144
4233
  :root[data-theme="dark"] .markdy-controls button[aria-pressed="true"],
4145
4234
  .theme-dark .markdy-controls button[aria-pressed="true"] {
4146
- background: var(--accent, #3b82f6) !important;
4147
- color: #ffffff !important;
4148
- border-color: var(--accent, #3b82f6) !important;
4149
- box-shadow: 0 0 10px var(--accent-glow, rgba(59, 130, 246, 0.5)) !important;
4235
+ background: #f8fafc !important;
4236
+ color: #0f172a !important;
4237
+ border-color: #f8fafc !important;
4238
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
4239
+ }
4240
+ [data-markdy-theme="midnight"].markdy-diagram-root,
4241
+ [data-markdy-theme="blueprint"].markdy-diagram-root,
4242
+ [data-markdy-theme="terminal"].markdy-diagram-root,
4243
+ [data-markdy-theme="graphite"].markdy-diagram-root,
4244
+ [data-markdy-theme="nebula"].markdy-diagram-root,
4245
+ :root[data-theme="dark"] .markdy-diagram-root,
4246
+ .theme-dark .markdy-diagram-root,
4247
+ .dark .markdy-diagram-root {
4248
+ border-color: var(--md-card-border, rgba(255, 255, 255, 0.09));
4249
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
4250
+ }
4251
+ [data-markdy-theme="midnight"] .markdy-footer,
4252
+ [data-markdy-theme="blueprint"] .markdy-footer,
4253
+ [data-markdy-theme="terminal"] .markdy-footer,
4254
+ [data-markdy-theme="graphite"] .markdy-footer,
4255
+ [data-markdy-theme="nebula"] .markdy-footer,
4256
+ :root[data-theme="dark"] .markdy-footer,
4257
+ .theme-dark .markdy-footer,
4258
+ .dark .markdy-footer {
4259
+ background: var(--md-footer-bg, rgba(15, 23, 42, 0.85));
4260
+ border-top-color: var(--md-card-border, rgba(255, 255, 255, 0.08));
4261
+ color: #94a3b8;
4262
+ }
4263
+ [data-markdy-theme="midnight"] .markdy-controls button:not([aria-pressed="true"]),
4264
+ [data-markdy-theme="blueprint"] .markdy-controls button:not([aria-pressed="true"]),
4265
+ [data-markdy-theme="terminal"] .markdy-controls button:not([aria-pressed="true"]),
4266
+ [data-markdy-theme="graphite"] .markdy-controls button:not([aria-pressed="true"]),
4267
+ [data-markdy-theme="nebula"] .markdy-controls button:not([aria-pressed="true"]),
4268
+ :root[data-theme="dark"] .markdy-controls button:not([aria-pressed="true"]),
4269
+ .theme-dark .markdy-controls button:not([aria-pressed="true"]),
4270
+ .dark .markdy-controls button:not([aria-pressed="true"]) {
4271
+ background: rgba(30, 41, 59, 0.7);
4272
+ border-color: rgba(71, 85, 105, 0.5);
4273
+ color: #cbd5e1;
4150
4274
  }
4151
4275
  .markdy-footer a {
4152
4276
  transition: opacity 0.15s ease, color 0.15s ease;
4153
4277
  }
4154
4278
  .markdy-footer a:hover {
4155
4279
  opacity: 1 !important;
4156
- color: #64748b !important;
4280
+ color: #94a3b8 !important;
4157
4281
  }
4158
4282
  /* Fullscreen & Fallback Pseudo-Fullscreen Views */
4159
4283
  .markdy-diagram-root:fullscreen,
@@ -6190,6 +6314,16 @@ function computeDiagramContentBounds(plan, options) {
6190
6314
  const height = Math.max(maxY - minY, 80);
6191
6315
  return { minX, minY, maxX, maxY, width, height };
6192
6316
  }
6317
+ function computeSymmetricContentSpan(plan, bounds) {
6318
+ const canvasCenterX = plan.meta.width / 2;
6319
+ const leftSpan = Math.max(0, canvasCenterX - bounds.minX);
6320
+ const rightSpan = Math.max(0, bounds.maxX - canvasCenterX);
6321
+ const halfSpanX = Math.max(plan.meta.width / 2, leftSpan, rightSpan);
6322
+ return {
6323
+ symmetricContentW: halfSpanX * 2,
6324
+ symmetricMinX: canvasCenterX - halfSpanX
6325
+ };
6326
+ }
6193
6327
  function createDiagram(opts) {
6194
6328
  const {
6195
6329
  container,
@@ -6309,7 +6443,7 @@ function createDiagram(opts) {
6309
6443
  let playbackRate = player.playback.rate;
6310
6444
  const rawColor = player.chrome.progressColor;
6311
6445
  const customColor = rawColor && rawColor.trim() !== "rainbow" ? rawColor.trim() : null;
6312
- 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%)";
6446
+ const DEFAULT_RAINBOW = "#f53d3d 0deg, #f57c3d 60deg, #f5d43d 120deg, #3df57c 180deg, #3db2f5 240deg, #863df5 300deg, #f53d3d 360deg";
6313
6447
  const totalDurationMs = plan.duration * 1e3;
6314
6448
  const durationSeconds = plan.duration;
6315
6449
  container.classList.add("markdy-diagram-root");
@@ -6324,9 +6458,9 @@ function createDiagram(opts) {
6324
6458
  width: "100%"
6325
6459
  });
6326
6460
  if (container.style.aspectRatio) container.style.aspectRatio = "unset";
6327
- if (container.style.overflow === "hidden") container.style.overflow = "visible";
6328
6461
  const initialBounds = computeDiagramContentBounds(plan, contentPadding !== void 0 ? { padding: contentPadding } : void 0);
6329
- const contentRatio = `${initialBounds.width} / ${initialBounds.height}`;
6462
+ const { symmetricContentW: initialSymmetricW } = computeSymmetricContentSpan(plan, initialBounds);
6463
+ const contentRatio = `${initialSymmetricW} / ${initialBounds.height}`;
6330
6464
  const viewport = document.createElement("div");
6331
6465
  viewport.className = "markdy-viewport";
6332
6466
  applyThemeVariables(viewport, plan.theme);
@@ -6400,8 +6534,6 @@ function createDiagram(opts) {
6400
6534
  gap: "6px",
6401
6535
  width: "100%",
6402
6536
  boxSizing: "border-box",
6403
- padding: "6px 8px 4px",
6404
- background: "transparent",
6405
6537
  pointerEvents: "auto",
6406
6538
  flexShrink: "0"
6407
6539
  });
@@ -6635,7 +6767,8 @@ function createDiagram(opts) {
6635
6767
  Object.assign(ast.meta, newPlan.meta);
6636
6768
  scene.style.width = `${newPlan.meta.width}px`;
6637
6769
  scene.style.height = `${newPlan.meta.height}px`;
6638
- viewport.style.aspectRatio = `${newBounds.width} / ${newBounds.height}`;
6770
+ const { symmetricContentW: newSymmetricW } = computeSymmetricContentSpan(newPlan, newBounds);
6771
+ viewport.style.aspectRatio = `${newSymmetricW} / ${newBounds.height}`;
6639
6772
  Object.assign(plan, newPlan);
6640
6773
  contentBounds = newBounds;
6641
6774
  for (const node of plan.nodes) {
@@ -6716,7 +6849,8 @@ function createDiagram(opts) {
6716
6849
  ...buildBeatCaptionAnimations(plan.beats, captionLayer)
6717
6850
  ];
6718
6851
  contentBounds = computeDiagramContentBounds(plan, { padding: contentPadding, routedEdges: edgeRuntimes.values() });
6719
- viewport.style.aspectRatio = `${contentBounds.width} / ${contentBounds.height}`;
6852
+ const { symmetricContentW: relayoutSymmetricW } = computeSymmetricContentSpan(plan, contentBounds);
6853
+ viewport.style.aspectRatio = `${relayoutSymmetricW} / ${contentBounds.height}`;
6720
6854
  applyCurrentTime();
6721
6855
  scaleScene();
6722
6856
  }
@@ -6793,7 +6927,8 @@ function createDiagram(opts) {
6793
6927
  const bounds = computeContentBounds();
6794
6928
  const contentW = bounds.width;
6795
6929
  const contentH = bounds.height;
6796
- const widthScale = vWidth * targetRatio / contentW;
6930
+ const { symmetricContentW, symmetricMinX } = computeSymmetricContentSpan(plan, bounds);
6931
+ const widthScale = vWidth * targetRatio / symmetricContentW;
6797
6932
  if (resolvedFit === "contain") {
6798
6933
  const heightScale = (vHeight - 24) * targetRatio / contentH;
6799
6934
  fitScale = Math.min(widthScale, heightScale);
@@ -6805,18 +6940,20 @@ function createDiagram(opts) {
6805
6940
  const minimum = Number.isFinite(minReadableScale) && minReadableScale >= 0 && minReadableScale <= 1 ? minReadableScale : 0.9;
6806
6941
  fitScale = Math.max(fitScale, minimum);
6807
6942
  }
6808
- scene.style.setProperty("--markdy-scale", fitScale.toFixed(4));
6809
- viewport.style.setProperty("--markdy-scale", fitScale.toFixed(4));
6810
- container.style.setProperty("--markdy-scale", fitScale.toFixed(4));
6943
+ const scaleStr = fitScale.toFixed(4);
6944
+ const roundedScale = parseFloat(scaleStr);
6945
+ scene.style.setProperty("--markdy-scale", scaleStr);
6946
+ viewport.style.setProperty("--markdy-scale", scaleStr);
6947
+ container.style.setProperty("--markdy-scale", scaleStr);
6811
6948
  if (titleEl && contentW > 0) {
6812
6949
  titleEl.style.maxWidth = `${Math.max(contentW - 112, 280)}px`;
6813
6950
  }
6814
- const scaledContentW = contentW * fitScale;
6951
+ const scaledSymmetricW = symmetricContentW * fitScale;
6815
6952
  const scaledContentH = contentH * fitScale;
6816
6953
  const resetScroll = !scrollableViewport || lastScrollBounds !== bounds;
6817
- scrollableViewport = fitMode === "auto" && (scaledContentW > vWidth || scaledContentH > vHeight);
6954
+ scrollableViewport = fitMode === "auto" && (scaledSymmetricW > vWidth || scaledContentH > vHeight);
6818
6955
  lastScrollBounds = bounds;
6819
- const frameWidth = scrollableViewport ? Math.max(vWidth, scaledContentW + 24) : vWidth;
6956
+ const frameWidth = scrollableViewport ? Math.max(vWidth, scaledSymmetricW + 24) : vWidth;
6820
6957
  const frameHeight = scrollableViewport ? Math.max(vHeight, scaledContentH + 28) : vHeight;
6821
6958
  sceneFrame.style.width = scrollableViewport ? `${frameWidth}px` : "100%";
6822
6959
  sceneFrame.style.height = scrollableViewport ? `${frameHeight}px` : "100%";
@@ -6830,17 +6967,17 @@ function createDiagram(opts) {
6830
6967
  viewport.removeAttribute("tabindex");
6831
6968
  viewport.removeAttribute("aria-label");
6832
6969
  }
6833
- sceneOffsetX = (frameWidth - scaledContentW) / 2 - bounds.minX * fitScale;
6970
+ sceneOffsetX = (frameWidth - scaledSymmetricW) / 2 - symmetricMinX * fitScale;
6834
6971
  if (resolvedFit === "contain") {
6835
6972
  sceneOffsetY = (frameHeight - scaledContentH) / 2 - bounds.minY * fitScale;
6836
6973
  } else {
6837
- const topSafeMargin = scaledContentH <= vHeight ? Math.max(14, Math.min(24, (vHeight - scaledContentH) / 2)) : 14;
6974
+ const topSafeMargin = scaledContentH <= vHeight ? Math.max(16, (vHeight - scaledContentH) / 2) : 16;
6838
6975
  sceneOffsetY = topSafeMargin - bounds.minY * fitScale;
6839
6976
  }
6840
6977
  scene.style.left = `${sceneOffsetX}px`;
6841
6978
  scene.style.top = `${sceneOffsetY}px`;
6842
6979
  scene.style.transformOrigin = "0 0";
6843
- scene.style.transform = `scale(${fitScale})`;
6980
+ scene.style.transform = `scale(${roundedScale})`;
6844
6981
  if (scrollableViewport || fitViewActive) {
6845
6982
  cameraLayer.style.setProperty("transform", "none", "important");
6846
6983
  } else if (cameraLayer.style.getPropertyPriority("transform") === "important") {
@@ -6996,7 +7133,7 @@ function createDiagram(opts) {
6996
7133
  function syncControls() {
6997
7134
  if (controlsPlayButton) {
6998
7135
  const playing = isPlaying;
6999
- controlsPlayButton.innerHTML = `${playing ? ICONS2.pause : ICONS2.play}${playing ? "Pause" : "Play"}`;
7136
+ controlsPlayButton.innerHTML = `${playing ? ICONS2.pause : ICONS2.play}<span class="markdy-btn-label">${playing ? "Pause" : "Play"}</span>`;
7000
7137
  const playLabel = playing ? "Pause diagram" : "Play diagram";
7001
7138
  controlsPlayButton.setAttribute("aria-label", playLabel);
7002
7139
  controlsPlayButton.title = playLabel;
@@ -7340,9 +7477,9 @@ function createDiagram(opts) {
7340
7477
  button.setAttribute("aria-label", ariaLabel);
7341
7478
  button.title = ariaLabel;
7342
7479
  if (iconSvg) {
7343
- button.innerHTML = `${iconSvg}${label}`;
7480
+ button.innerHTML = `${iconSvg}<span class="markdy-btn-label">${label}</span>`;
7344
7481
  } else {
7345
- button.textContent = label;
7482
+ button.innerHTML = `<span class="markdy-btn-label">${label}</span>`;
7346
7483
  }
7347
7484
  return button;
7348
7485
  }
@@ -7406,7 +7543,7 @@ function createDiagram(opts) {
7406
7543
  const originalHtml = button.dataset.originalHtml ?? button.innerHTML;
7407
7544
  button.dataset.originalHtml = originalHtml;
7408
7545
  const isSuccess = !message.toLowerCase().includes("fail");
7409
- button.innerHTML = isSuccess ? `${ICONS2.check}${message}` : message;
7546
+ button.innerHTML = isSuccess ? `${ICONS2.check}<span class="markdy-btn-label">${message}</span>` : `<span class="markdy-btn-label">${message}</span>`;
7410
7547
  button.classList.add("markdy-btn-flashed");
7411
7548
  setTimeout(() => {
7412
7549
  button.innerHTML = button.dataset.originalHtml ?? originalHtml;
@@ -7702,7 +7839,7 @@ function createDiagram(opts) {
7702
7839
  const isFull = typeof explicitFull === "boolean" ? explicitFull : isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === viewport || document.mozFullScreenElement === host || document.msFullscreenElement === host;
7703
7840
  button.setAttribute("aria-pressed", isFull ? "true" : "false");
7704
7841
  button.title = isFull ? "Exit fullscreen" : "Toggle fullscreen view";
7705
- button.innerHTML = isFull ? `${ICONS2.fullscreen}Exit` : `${ICONS2.fullscreen}Full`;
7842
+ button.innerHTML = isFull ? `${ICONS2.fullscreen}<span class="markdy-btn-label">Exit</span>` : `${ICONS2.fullscreen}<span class="markdy-btn-label">Full</span>`;
7706
7843
  if (isFull) {
7707
7844
  host.classList.add("markdy-fullscreen-host");
7708
7845
  if (isPseudoFull) {
@@ -7920,14 +8057,17 @@ function createDiagram(opts) {
7920
8057
  if (svgButton || gifButton || shareButton || codeButton || themeButton) {
7921
8058
  if (toolsGroup.children.length > 0) {
7922
8059
  const divider = document.createElement("div");
7923
- divider.className = "markdy-control-divider";
8060
+ divider.className = "markdy-control-divider markdy-control-divider-secondary";
7924
8061
  toolsGroup.appendChild(divider);
7925
8062
  }
7926
- mountThemeControl(toolsGroup);
7927
- mountSvgControl(toolsGroup);
7928
- mountGifControl(toolsGroup);
7929
- mountShareControl(toolsGroup);
7930
- mountCodeControl(toolsGroup);
8063
+ const secondaryGroup = document.createElement("div");
8064
+ secondaryGroup.className = "markdy-controls-group markdy-controls-secondary";
8065
+ mountThemeControl(secondaryGroup);
8066
+ mountSvgControl(secondaryGroup);
8067
+ mountGifControl(secondaryGroup);
8068
+ mountShareControl(secondaryGroup);
8069
+ mountCodeControl(secondaryGroup);
8070
+ toolsGroup.appendChild(secondaryGroup);
7931
8071
  }
7932
8072
  if (toolsGroup.children.length > 0) toolbar.appendChild(toolsGroup);
7933
8073
  ensureFooter().insertBefore(toolbar, badge);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.4.6",
3
+ "version": "1.4.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.4.6"
49
+ "@markdy/core": "1.4.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.4.6"
56
+ "@markdy/stdlib-systems": "1.4.8"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",