@markdy/renderer-dom 1.4.5 → 1.4.7

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 +219 -105
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -3655,6 +3655,13 @@ function ensureSceneStyles(doc) {
3655
3655
  flex-direction: column;
3656
3656
  box-sizing: border-box;
3657
3657
  width: 100%;
3658
+ border: 1px solid var(--md-card-border, rgba(148, 163, 184, 0.22));
3659
+ border-radius: 12px;
3660
+ background: var(--md-canvas, #ffffff);
3661
+ box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
3662
+ overflow: hidden;
3663
+ container-type: inline-size;
3664
+ container-name: markdy-root;
3658
3665
  }
3659
3666
  .markdy-viewport {
3660
3667
  position: relative;
@@ -3663,6 +3670,7 @@ function ensureSceneStyles(doc) {
3663
3670
  min-height: 0;
3664
3671
  overflow: hidden;
3665
3672
  box-sizing: border-box;
3673
+ border-radius: 11px 11px 0 0;
3666
3674
  }
3667
3675
  .markdy-footer {
3668
3676
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
@@ -3673,15 +3681,16 @@ function ensureSceneStyles(doc) {
3673
3681
  align-items: center;
3674
3682
  justify-content: space-between;
3675
3683
  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;
3684
+ padding: 6px 12px 6px 10px;
3685
+ color: var(--md-text, #64748b);
3686
+ background: var(--md-footer-bg, rgba(248, 250, 252, 0.82));
3687
+ backdrop-filter: blur(8px);
3688
+ -webkit-backdrop-filter: blur(8px);
3689
+ border-top: 1px solid var(--md-card-border, rgba(148, 163, 184, 0.14));
3682
3690
  z-index: 100;
3683
3691
  pointer-events: auto;
3684
3692
  flex-shrink: 0;
3693
+ border-radius: 0 0 11px 11px;
3685
3694
  }
3686
3695
  .markdy-controls {
3687
3696
  display: flex;
@@ -3690,14 +3699,14 @@ function ensureSceneStyles(doc) {
3690
3699
  flex: 1 1 auto;
3691
3700
  width: auto;
3692
3701
  min-width: 0;
3693
- gap: 8px;
3702
+ gap: 6px;
3694
3703
  max-width: 100%;
3695
3704
  overflow-x: auto;
3696
3705
  overflow-y: visible;
3697
3706
  scrollbar-width: none;
3698
3707
  -ms-overflow-style: none;
3699
3708
  -webkit-overflow-scrolling: touch;
3700
- padding: 4px 4px 6px;
3709
+ padding: 2px 2px 2px;
3701
3710
  margin: 0;
3702
3711
  position: relative;
3703
3712
  z-index: 10;
@@ -3745,27 +3754,34 @@ function ensureSceneStyles(doc) {
3745
3754
  margin: 0 2px;
3746
3755
  flex-shrink: 0;
3747
3756
  }
3757
+ .markdy-btn-label {
3758
+ display: inline;
3759
+ margin-left: 3px;
3760
+ font-size: 11px;
3761
+ font-weight: 500;
3762
+ line-height: 1;
3763
+ }
3748
3764
  .markdy-controls button {
3749
3765
  appearance: none;
3750
3766
  -webkit-appearance: none;
3751
3767
  touch-action: manipulation;
3752
3768
  user-select: none;
3753
3769
  -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);
3770
+ border: 1px solid rgba(203, 213, 225, 0.7);
3771
+ border-radius: 6px;
3772
+ background: rgba(255, 255, 255, 0.9);
3773
+ color: #475569;
3758
3774
  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;
3775
+ font: 500 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3776
+ height: 25px;
3777
+ min-width: 25px;
3778
+ padding: 0 7px;
3763
3779
  display: inline-flex;
3764
3780
  align-items: center;
3765
3781
  justify-content: center;
3766
- gap: 5px;
3782
+ gap: 3px;
3767
3783
  white-space: nowrap;
3768
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
3784
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
3769
3785
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
3770
3786
  position: relative;
3771
3787
  pointer-events: auto;
@@ -3774,30 +3790,30 @@ function ensureSceneStyles(doc) {
3774
3790
  .markdy-controls button:hover:not([aria-pressed="true"]) {
3775
3791
  position: relative;
3776
3792
  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);
3793
+ background: #ffffff;
3794
+ color: #0f172a;
3795
+ border-color: #94a3b8;
3796
+ transform: translateY(-0.5px);
3797
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
3782
3798
  }
3783
3799
  .markdy-controls-tools button:hover:not([aria-pressed="true"]) {
3784
3800
  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);
3801
+ border-color: #64748b;
3802
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
3787
3803
  }
3788
3804
  .markdy-controls button[aria-pressed="true"] {
3789
3805
  position: relative;
3790
3806
  z-index: 20;
3791
- background: var(--accent, #10b981) !important;
3807
+ background: #0f172a !important;
3792
3808
  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;
3809
+ border-color: #0f172a !important;
3810
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
3795
3811
  }
3796
3812
  .markdy-controls button:focus-visible {
3797
3813
  position: relative;
3798
3814
  z-index: 30;
3799
- outline: 2px solid var(--accent, #10b981);
3800
- outline-offset: 2px;
3815
+ outline: 2px solid #2563eb;
3816
+ outline-offset: 1px;
3801
3817
  }
3802
3818
  .markdy-controls button:active {
3803
3819
  transform: translateY(0) scale(0.96);
@@ -3808,29 +3824,29 @@ function ensureSceneStyles(doc) {
3808
3824
  vertical-align: middle;
3809
3825
  }
3810
3826
  .markdy-control-play {
3811
- background: var(--accent, #10b981) !important;
3827
+ background: #2563eb !important;
3812
3828
  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;
3829
+ border-color: #2563eb !important;
3830
+ padding: 0 9px !important;
3831
+ font-weight: 600 !important;
3832
+ box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25) !important;
3817
3833
  }
3818
3834
  .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);
3835
+ filter: brightness(1.06);
3836
+ transform: translateY(-0.5px);
3837
+ box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35) !important;
3822
3838
  }
3823
3839
  .markdy-badge {
3824
3840
  display: inline-flex;
3825
3841
  align-items: center;
3826
3842
  text-align: right;
3827
- font-family: system-ui, sans-serif;
3843
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3828
3844
  font-size: 10px;
3829
- font-weight: 400;
3830
- color: var(--md-control-text, #94a3b8);
3845
+ font-weight: 500;
3846
+ color: #94a3b8;
3831
3847
  text-decoration: none;
3832
3848
  padding: 0;
3833
- opacity: 0.7;
3849
+ opacity: 0.6;
3834
3850
  margin-left: auto;
3835
3851
  flex-shrink: 0;
3836
3852
  transition: opacity 0.15s ease, color 0.15s ease;
@@ -3838,7 +3854,58 @@ function ensureSceneStyles(doc) {
3838
3854
  }
3839
3855
  .markdy-badge:hover {
3840
3856
  opacity: 1;
3841
- color: var(--md-text, #f8fafc);
3857
+ color: #475569;
3858
+ }
3859
+ @media (max-width: 640px) {
3860
+ .markdy-btn-label {
3861
+ display: none !important;
3862
+ }
3863
+ .markdy-controls button {
3864
+ padding: 0 !important;
3865
+ width: 25px !important;
3866
+ height: 25px !important;
3867
+ min-width: 25px !important;
3868
+ justify-content: center !important;
3869
+ }
3870
+ .markdy-controls-secondary,
3871
+ .markdy-control-divider-secondary {
3872
+ display: none !important;
3873
+ }
3874
+ .markdy-speed-group {
3875
+ display: none !important;
3876
+ }
3877
+ .markdy-controls {
3878
+ gap: 4px !important;
3879
+ }
3880
+ .markdy-footer {
3881
+ padding: 5px 8px !important;
3882
+ }
3883
+ .markdy-badge {
3884
+ font-size: 9px !important;
3885
+ opacity: 0.55;
3886
+ }
3887
+ }
3888
+ @container markdy-root (max-width: 520px) {
3889
+ .markdy-btn-label {
3890
+ display: none !important;
3891
+ }
3892
+ .markdy-controls button {
3893
+ padding: 0 !important;
3894
+ width: 25px !important;
3895
+ height: 25px !important;
3896
+ min-width: 25px !important;
3897
+ justify-content: center !important;
3898
+ }
3899
+ .markdy-controls-secondary,
3900
+ .markdy-control-divider-secondary {
3901
+ display: none !important;
3902
+ }
3903
+ .markdy-speed-group {
3904
+ display: none !important;
3905
+ }
3906
+ .markdy-controls {
3907
+ gap: 4px !important;
3908
+ }
3842
3909
  }
3843
3910
  .markdy-speed-group {
3844
3911
  display: inline-flex;
@@ -3867,9 +3934,9 @@ function ensureSceneStyles(doc) {
3867
3934
  transform: none;
3868
3935
  }
3869
3936
  .markdy-speed-group .markdy-control-rate[aria-pressed="true"] {
3870
- background: var(--accent, #10b981) !important;
3937
+ background: var(--accent, #2563eb) !important;
3871
3938
  color: #ffffff !important;
3872
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
3939
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
3873
3940
  }
3874
3941
  .markdy-control-time {
3875
3942
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
@@ -3881,9 +3948,9 @@ function ensureSceneStyles(doc) {
3881
3948
  letter-spacing: -0.02em;
3882
3949
  }
3883
3950
  .markdy-btn-flashed {
3884
- background: rgba(16, 185, 129, 0.2) !important;
3885
- color: #10b981 !important;
3886
- border-color: #10b981 !important;
3951
+ background: rgba(37, 99, 235, 0.15) !important;
3952
+ color: #2563eb !important;
3953
+ border-color: #2563eb !important;
3887
3954
  }
3888
3955
  /* \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
3956
  .markdy-code-panel-overlay {
@@ -3977,16 +4044,16 @@ function ensureSceneStyles(doc) {
3977
4044
  white-space: nowrap;
3978
4045
  }
3979
4046
  .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;
4047
+ background: var(--accent-light, rgba(37, 99, 235, 0.1));
4048
+ color: var(--accent, #2563eb);
4049
+ border-color: var(--accent, #2563eb);
4050
+ font-weight: 600;
3984
4051
  }
3985
4052
  .markdy-code-panel__playground:hover {
3986
- background: var(--accent, #10b981);
4053
+ background: var(--accent, #2563eb);
3987
4054
  color: #ffffff;
3988
- border-color: var(--accent, #10b981);
3989
- transform: translateY(-1px);
4055
+ border-color: var(--accent, #2563eb);
4056
+ transform: translateY(-0.5px);
3990
4057
  }
3991
4058
  .markdy-code-panel__copy:hover,
3992
4059
  .markdy-code-panel__close:hover {
@@ -4058,8 +4125,8 @@ function ensureSceneStyles(doc) {
4058
4125
  height: 4.5px;
4059
4126
  background: linear-gradient(
4060
4127
  to right,
4061
- var(--accent, #10b981) 0%,
4062
- var(--accent, #10b981) var(--seek-pct, 0%),
4128
+ var(--accent, #2563eb) 0%,
4129
+ var(--accent, #2563eb) var(--seek-pct, 0%),
4063
4130
  rgba(148, 163, 184, 0.35) var(--seek-pct, 0%),
4064
4131
  rgba(148, 163, 184, 0.35) 100%
4065
4132
  );
@@ -4071,28 +4138,28 @@ function ensureSceneStyles(doc) {
4071
4138
  height: 13px;
4072
4139
  width: 13px;
4073
4140
  border-radius: 50%;
4074
- background: var(--accent, #10b981);
4141
+ background: var(--accent, #2563eb);
4075
4142
  border: 2px solid #ffffff;
4076
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
4143
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
4077
4144
  margin-top: -4.25px;
4078
4145
  cursor: grab;
4079
4146
  transition: transform 0.1s ease, box-shadow 0.15s ease;
4080
4147
  }
4081
4148
  .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));
4149
+ transform: scale(1.15);
4150
+ box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
4084
4151
  }
4085
4152
  .markdy-control-seek:active::-webkit-slider-thumb {
4086
4153
  cursor: grabbing;
4087
- transform: scale(1.2);
4154
+ transform: scale(1.15);
4088
4155
  }
4089
4156
  .markdy-control-seek::-moz-range-track {
4090
4157
  width: 100%;
4091
4158
  height: 4.5px;
4092
4159
  background: linear-gradient(
4093
4160
  to right,
4094
- var(--accent, #10b981) 0%,
4095
- var(--accent, #10b981) var(--seek-pct, 0%),
4161
+ var(--accent, #2563eb) 0%,
4162
+ var(--accent, #2563eb) var(--seek-pct, 0%),
4096
4163
  rgba(148, 163, 184, 0.35) var(--seek-pct, 0%),
4097
4164
  rgba(148, 163, 184, 0.35) 100%
4098
4165
  );
@@ -4102,9 +4169,9 @@ function ensureSceneStyles(doc) {
4102
4169
  height: 13px;
4103
4170
  width: 13px;
4104
4171
  border-radius: 50%;
4105
- background: var(--accent, #10b981);
4172
+ background: var(--accent, #2563eb);
4106
4173
  border: 2px solid #ffffff;
4107
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
4174
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
4108
4175
  cursor: grab;
4109
4176
  transition: transform 0.1s ease, box-shadow 0.15s ease;
4110
4177
  }
@@ -4143,17 +4210,52 @@ function ensureSceneStyles(doc) {
4143
4210
  [data-markdy-theme="nebula"] .markdy-controls button[aria-pressed="true"],
4144
4211
  :root[data-theme="dark"] .markdy-controls button[aria-pressed="true"],
4145
4212
  .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;
4213
+ background: #f8fafc !important;
4214
+ color: #0f172a !important;
4215
+ border-color: #f8fafc !important;
4216
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
4217
+ }
4218
+ [data-markdy-theme="midnight"].markdy-diagram-root,
4219
+ [data-markdy-theme="blueprint"].markdy-diagram-root,
4220
+ [data-markdy-theme="terminal"].markdy-diagram-root,
4221
+ [data-markdy-theme="graphite"].markdy-diagram-root,
4222
+ [data-markdy-theme="nebula"].markdy-diagram-root,
4223
+ :root[data-theme="dark"] .markdy-diagram-root,
4224
+ .theme-dark .markdy-diagram-root,
4225
+ .dark .markdy-diagram-root {
4226
+ border-color: var(--md-card-border, rgba(255, 255, 255, 0.09));
4227
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
4228
+ }
4229
+ [data-markdy-theme="midnight"] .markdy-footer,
4230
+ [data-markdy-theme="blueprint"] .markdy-footer,
4231
+ [data-markdy-theme="terminal"] .markdy-footer,
4232
+ [data-markdy-theme="graphite"] .markdy-footer,
4233
+ [data-markdy-theme="nebula"] .markdy-footer,
4234
+ :root[data-theme="dark"] .markdy-footer,
4235
+ .theme-dark .markdy-footer,
4236
+ .dark .markdy-footer {
4237
+ background: var(--md-footer-bg, rgba(15, 23, 42, 0.85));
4238
+ border-top-color: var(--md-card-border, rgba(255, 255, 255, 0.08));
4239
+ color: #94a3b8;
4240
+ }
4241
+ [data-markdy-theme="midnight"] .markdy-controls button:not([aria-pressed="true"]),
4242
+ [data-markdy-theme="blueprint"] .markdy-controls button:not([aria-pressed="true"]),
4243
+ [data-markdy-theme="terminal"] .markdy-controls button:not([aria-pressed="true"]),
4244
+ [data-markdy-theme="graphite"] .markdy-controls button:not([aria-pressed="true"]),
4245
+ [data-markdy-theme="nebula"] .markdy-controls button:not([aria-pressed="true"]),
4246
+ :root[data-theme="dark"] .markdy-controls button:not([aria-pressed="true"]),
4247
+ .theme-dark .markdy-controls button:not([aria-pressed="true"]),
4248
+ .dark .markdy-controls button:not([aria-pressed="true"]) {
4249
+ background: rgba(30, 41, 59, 0.7);
4250
+ border-color: rgba(71, 85, 105, 0.5);
4251
+ color: #cbd5e1;
4150
4252
  }
4151
4253
  .markdy-footer a {
4152
4254
  transition: opacity 0.15s ease, color 0.15s ease;
4153
4255
  }
4154
4256
  .markdy-footer a:hover {
4155
4257
  opacity: 1 !important;
4156
- color: #64748b !important;
4258
+ color: #94a3b8 !important;
4157
4259
  }
4158
4260
  /* Fullscreen & Fallback Pseudo-Fullscreen Views */
4159
4261
  .markdy-diagram-root:fullscreen,
@@ -6224,8 +6326,12 @@ function createDiagram(opts) {
6224
6326
  const hasInitialHeightConstraint = initialContainerHeight > 0 && !container.style.aspectRatio;
6225
6327
  function detectContainerOrientation(previous) {
6226
6328
  const width = container.clientWidth || (typeof window === "undefined" ? 1024 : window.innerWidth);
6227
- const height = hasInitialHeightConstraint ? initialContainerHeight : 0;
6329
+ const currentHeight = container.clientHeight || 0;
6330
+ const height = hasInitialHeightConstraint ? currentHeight > 0 ? currentHeight : initialContainerHeight : 0;
6228
6331
  const breakpoint = previous === "portrait" ? 672 : previous === "landscape" ? 608 : 640;
6332
+ if (width <= 440) {
6333
+ return "portrait";
6334
+ }
6229
6335
  if (height > 0) {
6230
6336
  const ratio = width / height;
6231
6337
  const ratioBreakpoint = previous === "portrait" ? 1.15 : previous === "landscape" ? 0.88 : 1;
@@ -6234,7 +6340,7 @@ function createDiagram(opts) {
6234
6340
  }
6235
6341
  return "portrait";
6236
6342
  }
6237
- return width < breakpoint ? "portrait" : "landscape";
6343
+ return "landscape";
6238
6344
  }
6239
6345
  const ast = parse(code);
6240
6346
  for (const w of ast.diagnostics) {
@@ -6305,7 +6411,7 @@ function createDiagram(opts) {
6305
6411
  let playbackRate = player.playback.rate;
6306
6412
  const rawColor = player.chrome.progressColor;
6307
6413
  const customColor = rawColor && rawColor.trim() !== "rainbow" ? rawColor.trim() : null;
6308
- 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%)";
6414
+ const DEFAULT_RAINBOW = "#f53d3d 0deg, #f57c3d 60deg, #f5d43d 120deg, #3df57c 180deg, #3db2f5 240deg, #863df5 300deg, #f53d3d 360deg";
6309
6415
  const totalDurationMs = plan.duration * 1e3;
6310
6416
  const durationSeconds = plan.duration;
6311
6417
  container.classList.add("markdy-diagram-root");
@@ -6320,7 +6426,6 @@ function createDiagram(opts) {
6320
6426
  width: "100%"
6321
6427
  });
6322
6428
  if (container.style.aspectRatio) container.style.aspectRatio = "unset";
6323
- if (container.style.overflow === "hidden") container.style.overflow = "visible";
6324
6429
  const initialBounds = computeDiagramContentBounds(plan, contentPadding !== void 0 ? { padding: contentPadding } : void 0);
6325
6430
  const contentRatio = `${initialBounds.width} / ${initialBounds.height}`;
6326
6431
  const viewport = document.createElement("div");
@@ -6396,8 +6501,6 @@ function createDiagram(opts) {
6396
6501
  gap: "6px",
6397
6502
  width: "100%",
6398
6503
  boxSizing: "border-box",
6399
- padding: "6px 8px 4px",
6400
- background: "transparent",
6401
6504
  pointerEvents: "auto",
6402
6505
  flexShrink: "0"
6403
6506
  });
@@ -6615,7 +6718,7 @@ function createDiagram(opts) {
6615
6718
  meta: {
6616
6719
  ...ast.meta,
6617
6720
  direction,
6618
- ...ast.meta.layoutMode === "auto" || responsiveLayout === true ? { explicitWidth: false, explicitHeight: false } : {}
6721
+ ...shouldAdaptOrientation ? { explicitWidth: false, explicitHeight: false } : {}
6619
6722
  }
6620
6723
  };
6621
6724
  const candidate = compilePlan(candidateAst, plan.theme);
@@ -6753,23 +6856,31 @@ function createDiagram(opts) {
6753
6856
  const isHeightConstrained = hasInitialHeightConstraint || vHeight > 0 && Math.abs(vHeight - naturalHeight) > 2;
6754
6857
  const containerRatio = vWidth / Math.max(1, vHeight);
6755
6858
  let currentOrientation = activeOrientation;
6756
- if (!isHeightConstrained || !(activeOrientation === "landscape" && containerRatio >= 1)) {
6757
- const score = (orientation) => {
6758
- const { bounds: bounds2 } = layoutForDirection(directionForOrientation(orientation));
6759
- const widthScale2 = vWidth * targetRatio / bounds2.width;
6760
- const heightScale = isHeightConstrained ? Math.max(1, vHeight - 24) * targetRatio / bounds2.height : 1;
6761
- return Math.min(1, widthScale2, heightScale);
6859
+ const score = (orientation) => {
6860
+ const { bounds: bounds2 } = layoutForDirection(directionForOrientation(orientation));
6861
+ const widthScale2 = vWidth * targetRatio / bounds2.width;
6862
+ const heightScale = isHeightConstrained ? Math.max(1, vHeight - 24) * targetRatio / bounds2.height : 1;
6863
+ return {
6864
+ fit: Math.min(1, widthScale2, heightScale),
6865
+ widthScale: widthScale2,
6866
+ bounds: bounds2
6762
6867
  };
6763
- if (activeOrientation === "landscape") {
6764
- if (detectedOrientation === "portrait" || score("portrait") > score("landscape") * 1.2) {
6765
- currentOrientation = "portrait";
6766
- }
6767
- } else {
6768
- if (detectedOrientation === "landscape" && score("landscape") >= Math.min(0.85, score("portrait"))) {
6769
- currentOrientation = "landscape";
6770
- } else if (score("landscape") > score("portrait") * 1.2) {
6771
- currentOrientation = "landscape";
6772
- }
6868
+ };
6869
+ const scoreP = score("portrait");
6870
+ const scoreL = score("landscape");
6871
+ if (activeOrientation === "landscape") {
6872
+ if (detectedOrientation === "portrait") {
6873
+ currentOrientation = "portrait";
6874
+ } else if (!isHeightConstrained && scoreP.widthScale >= 0.7 && scoreL.widthScale < 0.65) {
6875
+ currentOrientation = "portrait";
6876
+ } else if (scoreP.fit > scoreL.fit * 1.25) {
6877
+ currentOrientation = "portrait";
6878
+ }
6879
+ } else {
6880
+ if (detectedOrientation === "landscape" && (scoreL.fit >= Math.min(0.85, scoreP.fit) || scoreL.widthScale >= 0.75)) {
6881
+ currentOrientation = "landscape";
6882
+ } else if (scoreL.fit > scoreP.fit * 1.25) {
6883
+ currentOrientation = "landscape";
6773
6884
  }
6774
6885
  }
6775
6886
  if (currentOrientation !== activeOrientation) {
@@ -6984,7 +7095,7 @@ function createDiagram(opts) {
6984
7095
  function syncControls() {
6985
7096
  if (controlsPlayButton) {
6986
7097
  const playing = isPlaying;
6987
- controlsPlayButton.innerHTML = `${playing ? ICONS2.pause : ICONS2.play}${playing ? "Pause" : "Play"}`;
7098
+ controlsPlayButton.innerHTML = `${playing ? ICONS2.pause : ICONS2.play}<span class="markdy-btn-label">${playing ? "Pause" : "Play"}</span>`;
6988
7099
  const playLabel = playing ? "Pause diagram" : "Play diagram";
6989
7100
  controlsPlayButton.setAttribute("aria-label", playLabel);
6990
7101
  controlsPlayButton.title = playLabel;
@@ -7328,9 +7439,9 @@ function createDiagram(opts) {
7328
7439
  button.setAttribute("aria-label", ariaLabel);
7329
7440
  button.title = ariaLabel;
7330
7441
  if (iconSvg) {
7331
- button.innerHTML = `${iconSvg}${label}`;
7442
+ button.innerHTML = `${iconSvg}<span class="markdy-btn-label">${label}</span>`;
7332
7443
  } else {
7333
- button.textContent = label;
7444
+ button.innerHTML = `<span class="markdy-btn-label">${label}</span>`;
7334
7445
  }
7335
7446
  return button;
7336
7447
  }
@@ -7394,7 +7505,7 @@ function createDiagram(opts) {
7394
7505
  const originalHtml = button.dataset.originalHtml ?? button.innerHTML;
7395
7506
  button.dataset.originalHtml = originalHtml;
7396
7507
  const isSuccess = !message.toLowerCase().includes("fail");
7397
- button.innerHTML = isSuccess ? `${ICONS2.check}${message}` : message;
7508
+ button.innerHTML = isSuccess ? `${ICONS2.check}<span class="markdy-btn-label">${message}</span>` : `<span class="markdy-btn-label">${message}</span>`;
7398
7509
  button.classList.add("markdy-btn-flashed");
7399
7510
  setTimeout(() => {
7400
7511
  button.innerHTML = button.dataset.originalHtml ?? originalHtml;
@@ -7690,7 +7801,7 @@ function createDiagram(opts) {
7690
7801
  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;
7691
7802
  button.setAttribute("aria-pressed", isFull ? "true" : "false");
7692
7803
  button.title = isFull ? "Exit fullscreen" : "Toggle fullscreen view";
7693
- button.innerHTML = isFull ? `${ICONS2.fullscreen}Exit` : `${ICONS2.fullscreen}Full`;
7804
+ button.innerHTML = isFull ? `${ICONS2.fullscreen}<span class="markdy-btn-label">Exit</span>` : `${ICONS2.fullscreen}<span class="markdy-btn-label">Full</span>`;
7694
7805
  if (isFull) {
7695
7806
  host.classList.add("markdy-fullscreen-host");
7696
7807
  if (isPseudoFull) {
@@ -7908,14 +8019,17 @@ function createDiagram(opts) {
7908
8019
  if (svgButton || gifButton || shareButton || codeButton || themeButton) {
7909
8020
  if (toolsGroup.children.length > 0) {
7910
8021
  const divider = document.createElement("div");
7911
- divider.className = "markdy-control-divider";
8022
+ divider.className = "markdy-control-divider markdy-control-divider-secondary";
7912
8023
  toolsGroup.appendChild(divider);
7913
8024
  }
7914
- mountThemeControl(toolsGroup);
7915
- mountSvgControl(toolsGroup);
7916
- mountGifControl(toolsGroup);
7917
- mountShareControl(toolsGroup);
7918
- mountCodeControl(toolsGroup);
8025
+ const secondaryGroup = document.createElement("div");
8026
+ secondaryGroup.className = "markdy-controls-group markdy-controls-secondary";
8027
+ mountThemeControl(secondaryGroup);
8028
+ mountSvgControl(secondaryGroup);
8029
+ mountGifControl(secondaryGroup);
8030
+ mountShareControl(secondaryGroup);
8031
+ mountCodeControl(secondaryGroup);
8032
+ toolsGroup.appendChild(secondaryGroup);
7919
8033
  }
7920
8034
  if (toolsGroup.children.length > 0) toolbar.appendChild(toolsGroup);
7921
8035
  ensureFooter().insertBefore(toolbar, badge);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
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.5"
49
+ "@markdy/core": "1.4.7"
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.5"
56
+ "@markdy/stdlib-systems": "1.4.7"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",