@markdy/renderer-dom 1.4.10 → 1.4.12

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 +402 -84
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -3703,40 +3703,151 @@ function ensureSceneStyles(doc) {
3703
3703
  align-items: center;
3704
3704
  justify-content: space-between;
3705
3705
  gap: 8px;
3706
- padding: 6px 12px 6px 10px;
3706
+ padding: 8px 12px 7px 10px;
3707
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));
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
3712
  z-index: 100;
3713
3713
  pointer-events: auto;
3714
3714
  flex-shrink: 0;
3715
3715
  border-radius: 0 0 11px 11px;
3716
+ transition: background 0.2s ease, border-color 0.2s ease;
3717
+ }
3718
+ /* \u2500\u2500 Real Embedded Footer Scrubber \u2500\u2500 */
3719
+ .markdy-player-scrubber {
3720
+ position: absolute;
3721
+ top: 0;
3722
+ left: 0;
3723
+ right: 0;
3724
+ width: 100%;
3725
+ height: 12px;
3726
+ transform: translateY(-50%);
3727
+ cursor: pointer;
3728
+ z-index: 50;
3729
+ display: flex;
3730
+ align-items: center;
3731
+ padding: 0;
3732
+ margin: 0;
3733
+ }
3734
+ .markdy-player-scrubber-track {
3735
+ position: relative;
3736
+ width: 100%;
3737
+ height: 3px;
3738
+ background: var(--md-scrubber-bg, rgba(148, 163, 184, 0.25));
3739
+ border-radius: 9999px;
3740
+ transition: height 0.15s cubic-bezier(0.4, 0, 0.2, 1);
3741
+ overflow: visible;
3742
+ }
3743
+ .markdy-player-scrubber:hover .markdy-player-scrubber-track,
3744
+ .markdy-player-scrubber:active .markdy-player-scrubber-track {
3745
+ height: 5px;
3746
+ }
3747
+ .markdy-player-scrubber-fill {
3748
+ position: absolute;
3749
+ left: 0;
3750
+ top: 0;
3751
+ bottom: 0;
3752
+ width: 0%;
3753
+ background: var(--accent, #2563eb);
3754
+ border-radius: 9999px;
3755
+ pointer-events: none;
3756
+ transition: background 0.15s ease;
3757
+ }
3758
+ .markdy-player-scrubber-thumb {
3759
+ position: absolute;
3760
+ top: 50%;
3761
+ left: 0%;
3762
+ width: 11px;
3763
+ height: 11px;
3764
+ border-radius: 50%;
3765
+ background: var(--accent, #2563eb);
3766
+ border: 2px solid #ffffff;
3767
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
3768
+ transform: translate(-50%, -50%) scale(0);
3769
+ transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
3770
+ pointer-events: none;
3771
+ }
3772
+ .markdy-player-scrubber:hover .markdy-player-scrubber-thumb,
3773
+ .markdy-player-scrubber:active .markdy-player-scrubber-thumb {
3774
+ transform: translate(-50%, -50%) scale(1);
3775
+ }
3776
+ .markdy-player-scrubber-tick {
3777
+ position: absolute;
3778
+ top: 0;
3779
+ bottom: 0;
3780
+ width: 1.5px;
3781
+ background: var(--md-scrubber-tick, rgba(255, 255, 255, 0.6));
3782
+ transform: translateX(-50%);
3783
+ pointer-events: none;
3784
+ z-index: 2;
3785
+ }
3786
+ .markdy-player-scrubber .markdy-control-seek {
3787
+ position: absolute;
3788
+ inset: 0;
3789
+ width: 100%;
3790
+ height: 100%;
3791
+ opacity: 0;
3792
+ cursor: pointer;
3793
+ margin: 0;
3794
+ padding: 0;
3795
+ z-index: 10;
3796
+ appearance: none;
3797
+ -webkit-appearance: none;
3798
+ }
3799
+ .markdy-player-scrubber-tooltip {
3800
+ position: absolute;
3801
+ bottom: 16px;
3802
+ left: 0%;
3803
+ transform: translateX(-50%);
3804
+ padding: 2px 6px;
3805
+ font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
3806
+ font-size: 10px;
3807
+ font-weight: 600;
3808
+ color: #ffffff;
3809
+ background: rgba(15, 23, 42, 0.9);
3810
+ border: 1px solid rgba(255, 255, 255, 0.1);
3811
+ border-radius: 4px;
3812
+ pointer-events: none;
3813
+ opacity: 0;
3814
+ transition: opacity 0.1s ease;
3815
+ white-space: nowrap;
3816
+ z-index: 60;
3817
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
3818
+ }
3819
+ .markdy-player-beat-chip {
3820
+ display: inline-flex;
3821
+ align-items: center;
3822
+ padding: 2px 7px;
3823
+ font-size: 10px;
3824
+ font-weight: 600;
3825
+ color: var(--md-control-text, #475569);
3826
+ background: var(--md-segmented-bg, rgba(148, 163, 184, 0.12));
3827
+ border: 1px solid var(--md-control-border, rgba(148, 163, 184, 0.18));
3828
+ border-radius: 9999px;
3829
+ white-space: nowrap;
3830
+ max-width: 140px;
3831
+ overflow: hidden;
3832
+ text-overflow: ellipsis;
3833
+ letter-spacing: -0.01em;
3834
+ flex-shrink: 1;
3716
3835
  }
3717
3836
  .markdy-controls {
3718
3837
  display: flex;
3719
3838
  align-items: center;
3720
- justify-content: flex-start;
3839
+ justify-content: space-between;
3721
3840
  flex: 1 1 auto;
3722
3841
  width: auto;
3723
3842
  min-width: 0;
3724
3843
  gap: 6px;
3725
3844
  max-width: 100%;
3726
- overflow-x: auto;
3727
- overflow-y: visible;
3728
- scrollbar-width: none;
3729
- -ms-overflow-style: none;
3730
- -webkit-overflow-scrolling: touch;
3731
- padding: 2px 2px 2px;
3845
+ padding: 0;
3732
3846
  margin: 0;
3733
3847
  position: relative;
3734
3848
  z-index: 10;
3735
3849
  pointer-events: auto;
3736
3850
  }
3737
- .markdy-controls::-webkit-scrollbar {
3738
- display: none;
3739
- }
3740
3851
  .markdy-controls-group {
3741
3852
  display: inline-flex;
3742
3853
  align-items: center;
@@ -3749,25 +3860,15 @@ function ensureSceneStyles(doc) {
3749
3860
  .markdy-controls-playback {
3750
3861
  display: inline-flex;
3751
3862
  align-items: center;
3752
- gap: 4px;
3863
+ gap: 5px;
3753
3864
  flex-shrink: 0;
3754
3865
  }
3755
- .markdy-controls-timeline {
3756
- display: flex;
3757
- align-items: center;
3758
- gap: 8px;
3759
- flex: 1 1 180px;
3760
- min-width: 110px;
3761
- max-width: 340px;
3762
- }
3763
3866
  .markdy-controls-tools {
3764
3867
  display: inline-flex;
3765
3868
  align-items: center;
3766
3869
  gap: 4px;
3767
3870
  flex-shrink: 0;
3768
- position: relative;
3769
- z-index: 5;
3770
- pointer-events: auto;
3871
+ margin-left: auto;
3771
3872
  }
3772
3873
  .markdy-control-divider {
3773
3874
  width: 1px;
@@ -3882,6 +3983,9 @@ function ensureSceneStyles(doc) {
3882
3983
  .markdy-btn-label {
3883
3984
  display: none !important;
3884
3985
  }
3986
+ .markdy-player-beat-chip {
3987
+ display: none !important;
3988
+ }
3885
3989
  .markdy-controls button {
3886
3990
  padding: 0 !important;
3887
3991
  width: 25px !important;
@@ -3900,7 +4004,7 @@ function ensureSceneStyles(doc) {
3900
4004
  gap: 4px !important;
3901
4005
  }
3902
4006
  .markdy-footer {
3903
- padding: 5px 8px !important;
4007
+ padding: 6px 10px 5px 8px !important;
3904
4008
  }
3905
4009
  .markdy-badge {
3906
4010
  font-size: 9px !important;
@@ -3911,6 +4015,9 @@ function ensureSceneStyles(doc) {
3911
4015
  .markdy-btn-label {
3912
4016
  display: none !important;
3913
4017
  }
4018
+ .markdy-player-beat-chip {
4019
+ display: none !important;
4020
+ }
3914
4021
  .markdy-controls button {
3915
4022
  padding: 0 !important;
3916
4023
  width: 25px !important;
@@ -4256,10 +4363,32 @@ function ensureSceneStyles(doc) {
4256
4363
  :root[data-theme="dark"] .markdy-footer,
4257
4364
  .theme-dark .markdy-footer,
4258
4365
  .dark .markdy-footer {
4259
- background: var(--md-footer-bg, rgba(15, 23, 42, 0.85));
4366
+ background: var(--md-footer-bg, rgba(15, 23, 42, 0.88));
4260
4367
  border-top-color: var(--md-card-border, rgba(255, 255, 255, 0.08));
4261
4368
  color: #94a3b8;
4262
4369
  }
4370
+ [data-markdy-theme="midnight"] .markdy-player-scrubber-track,
4371
+ [data-markdy-theme="blueprint"] .markdy-player-scrubber-track,
4372
+ [data-markdy-theme="terminal"] .markdy-player-scrubber-track,
4373
+ [data-markdy-theme="graphite"] .markdy-player-scrubber-track,
4374
+ [data-markdy-theme="nebula"] .markdy-player-scrubber-track,
4375
+ :root[data-theme="dark"] .markdy-player-scrubber-track,
4376
+ .theme-dark .markdy-player-scrubber-track,
4377
+ .dark .markdy-player-scrubber-track {
4378
+ background: rgba(255, 255, 255, 0.14);
4379
+ }
4380
+ [data-markdy-theme="midnight"] .markdy-player-beat-chip,
4381
+ [data-markdy-theme="blueprint"] .markdy-player-beat-chip,
4382
+ [data-markdy-theme="terminal"] .markdy-player-beat-chip,
4383
+ [data-markdy-theme="graphite"] .markdy-player-beat-chip,
4384
+ [data-markdy-theme="nebula"] .markdy-player-beat-chip,
4385
+ :root[data-theme="dark"] .markdy-player-beat-chip,
4386
+ .theme-dark .markdy-player-beat-chip,
4387
+ .dark .markdy-player-beat-chip {
4388
+ background: rgba(255, 255, 255, 0.08);
4389
+ border-color: rgba(255, 255, 255, 0.12);
4390
+ color: #cbd5e1;
4391
+ }
4263
4392
  [data-markdy-theme="midnight"] .markdy-controls button:not([aria-pressed="true"]),
4264
4393
  [data-markdy-theme="blueprint"] .markdy-controls button:not([aria-pressed="true"]),
4265
4394
  [data-markdy-theme="terminal"] .markdy-controls button:not([aria-pressed="true"]),
@@ -4280,16 +4409,59 @@ function ensureSceneStyles(doc) {
4280
4409
  color: #94a3b8 !important;
4281
4410
  }
4282
4411
  /* Fullscreen & Fallback Pseudo-Fullscreen Views */
4412
+ .markdy-fullscreen-host,
4413
+ .markdy--pseudo-fullscreen,
4283
4414
  .markdy-diagram-root:fullscreen,
4415
+ .markdy-viewport:fullscreen {
4416
+ position: fixed !important;
4417
+ inset: 0 !important;
4418
+ top: 0 !important;
4419
+ left: 0 !important;
4420
+ right: 0 !important;
4421
+ bottom: 0 !important;
4422
+ margin: 0 !important;
4423
+ border: none !important;
4424
+ border-radius: 0 !important;
4425
+ box-shadow: none !important;
4426
+ aspect-ratio: auto !important;
4427
+ transform: none !important;
4428
+ z-index: 999999 !important;
4429
+ width: 100vw !important;
4430
+ width: 100dvw !important;
4431
+ height: 100vh !important;
4432
+ height: 100dvh !important;
4433
+ max-width: 100vw !important;
4434
+ max-width: 100dvw !important;
4435
+ max-height: 100vh !important;
4436
+ max-height: 100dvh !important;
4437
+ background-color: var(--md-canvas, #0b101b) !important;
4438
+ box-sizing: border-box !important;
4439
+ display: flex !important;
4440
+ flex-direction: column !important;
4441
+ justify-content: space-between !important;
4442
+ align-items: center !important;
4443
+ padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
4444
+ padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
4445
+ padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
4446
+ padding-bottom: 0 !important;
4447
+ overflow: hidden !important;
4448
+ touch-action: pan-x pan-y !important;
4449
+ -webkit-overflow-scrolling: touch !important;
4450
+ }
4284
4451
  .markdy-diagram-root:-webkit-full-screen,
4285
- .markdy-diagram-root:-moz-full-screen,
4286
- .markdy-diagram-root:-ms-fullscreen,
4287
- .markdy-viewport:fullscreen,
4288
- .markdy-viewport:-webkit-full-screen,
4289
- .markdy-fullscreen-host,
4290
- .markdy--pseudo-fullscreen {
4452
+ .markdy-viewport:-webkit-full-screen {
4291
4453
  position: fixed !important;
4292
4454
  inset: 0 !important;
4455
+ top: 0 !important;
4456
+ left: 0 !important;
4457
+ right: 0 !important;
4458
+ bottom: 0 !important;
4459
+ margin: 0 !important;
4460
+ border: none !important;
4461
+ border-radius: 0 !important;
4462
+ box-shadow: none !important;
4463
+ aspect-ratio: auto !important;
4464
+ transform: none !important;
4293
4465
  z-index: 999999 !important;
4294
4466
  width: 100vw !important;
4295
4467
  width: 100dvw !important;
@@ -4305,8 +4477,13 @@ function ensureSceneStyles(doc) {
4305
4477
  flex-direction: column !important;
4306
4478
  justify-content: space-between !important;
4307
4479
  align-items: center !important;
4308
- padding: max(16px, env(safe-area-inset-top, 16px)) max(20px, env(safe-area-inset-right, 20px)) max(12px, env(safe-area-inset-bottom, 12px)) max(20px, env(safe-area-inset-left, 20px)) !important;
4480
+ padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
4481
+ padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
4482
+ padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
4483
+ padding-bottom: 0 !important;
4309
4484
  overflow: hidden !important;
4485
+ touch-action: pan-x pan-y !important;
4486
+ -webkit-overflow-scrolling: touch !important;
4310
4487
  }
4311
4488
  .markdy-fullscreen-host .markdy-diagram-root,
4312
4489
  .markdy--pseudo-fullscreen .markdy-diagram-root {
@@ -4318,33 +4495,49 @@ function ensureSceneStyles(doc) {
4318
4495
  justify-content: space-between !important;
4319
4496
  align-items: center !important;
4320
4497
  }
4321
- .markdy-diagram-root:fullscreen .markdy-viewport,
4322
- .markdy-diagram-root:-webkit-full-screen .markdy-viewport,
4323
- .markdy-diagram-root:-moz-full-screen .markdy-viewport,
4324
- .markdy-diagram-root:-ms-fullscreen .markdy-viewport,
4325
4498
  .markdy-fullscreen-host .markdy-viewport,
4326
- .markdy--pseudo-fullscreen .markdy-viewport {
4499
+ .markdy--pseudo-fullscreen .markdy-viewport,
4500
+ .markdy-diagram-root:fullscreen .markdy-viewport {
4501
+ flex: 1 1 auto !important;
4502
+ width: 100% !important;
4503
+ height: 100% !important;
4504
+ max-width: 100% !important;
4505
+ max-height: calc(100vh - 54px) !important;
4506
+ max-height: calc(100dvh - 54px) !important;
4507
+ aspect-ratio: auto !important;
4508
+ display: flex !important;
4509
+ align-items: center !important;
4510
+ justify-content: center !important;
4511
+ }
4512
+ .markdy-diagram-root:-webkit-full-screen .markdy-viewport {
4327
4513
  flex: 1 1 auto !important;
4328
4514
  width: 100% !important;
4329
4515
  height: 100% !important;
4330
4516
  max-width: 100% !important;
4331
- max-height: calc(100vh - 64px) !important;
4332
- max-height: calc(100dvh - 64px) !important;
4517
+ max-height: calc(100vh - 54px) !important;
4518
+ max-height: calc(100dvh - 54px) !important;
4519
+ aspect-ratio: auto !important;
4333
4520
  display: flex !important;
4334
4521
  align-items: center !important;
4335
4522
  justify-content: center !important;
4336
4523
  }
4337
- .markdy-diagram-root:fullscreen .markdy-footer,
4338
- .markdy-diagram-root:-webkit-full-screen .markdy-footer,
4339
- .markdy-diagram-root:-moz-full-screen .markdy-footer,
4340
- .markdy-diagram-root:-ms-fullscreen .markdy-footer,
4341
4524
  .markdy-fullscreen-host .markdy-footer,
4342
- .markdy--pseudo-fullscreen .markdy-footer {
4525
+ .markdy--pseudo-fullscreen .markdy-footer,
4526
+ .markdy-diagram-root:fullscreen .markdy-footer {
4343
4527
  flex-shrink: 0 !important;
4344
4528
  width: 100% !important;
4345
4529
  max-width: 1400px !important;
4346
4530
  margin: 0 auto !important;
4347
- padding: 8px 12px max(4px, env(safe-area-inset-bottom, 4px)) !important;
4531
+ padding: 6px 12px max(12px, env(safe-area-inset-bottom, 12px)) !important;
4532
+ box-sizing: border-box !important;
4533
+ }
4534
+ .markdy-diagram-root:-webkit-full-screen .markdy-footer {
4535
+ flex-shrink: 0 !important;
4536
+ width: 100% !important;
4537
+ max-width: 1400px !important;
4538
+ margin: 0 auto !important;
4539
+ padding: 6px 12px max(12px, env(safe-area-inset-bottom, 12px)) !important;
4540
+ box-sizing: border-box !important;
4348
4541
  }
4349
4542
  @media (hover: none) and (pointer: coarse) {
4350
4543
  .markdy-controls {
@@ -6477,6 +6670,18 @@ function createDiagram(opts) {
6477
6670
  background: plan.theme.canvas
6478
6671
  });
6479
6672
  container.appendChild(viewport);
6673
+ let controlsScrubber = null;
6674
+ let controlsScrubberTrack = null;
6675
+ let controlsScrubberFill = null;
6676
+ let controlsScrubberThumb = null;
6677
+ let controlsScrubberTooltip = null;
6678
+ let controlsBeatChip = null;
6679
+ let controlsPlayButton = null;
6680
+ let controlsRateButtons = [];
6681
+ let controlsSeekBar = null;
6682
+ let controlsTimeEl = null;
6683
+ let controlsFitButton = null;
6684
+ let closeCodePanel = null;
6480
6685
  let progressEl = null;
6481
6686
  if (showProgress) {
6482
6687
  progressEl = document.createElement("div");
@@ -6498,14 +6703,39 @@ function createDiagram(opts) {
6498
6703
  viewport.appendChild(progressEl);
6499
6704
  }
6500
6705
  function updateProgressBar(pct) {
6706
+ const clamped = Math.max(0, Math.min(1, pct));
6707
+ if (controlsScrubberFill) {
6708
+ controlsScrubberFill.style.width = `${clamped * 100}%`;
6709
+ }
6710
+ if (controlsScrubberThumb) {
6711
+ controlsScrubberThumb.style.left = `${clamped * 100}%`;
6712
+ }
6713
+ if (controlsSeekBar) {
6714
+ controlsSeekBar.value = String(sceneMs / 1e3);
6715
+ controlsSeekBar.style.setProperty("--seek-pct", `${clamped * 100}%`);
6716
+ }
6717
+ if (controlsTimeEl) {
6718
+ const cur = (sceneMs / 1e3).toFixed(1);
6719
+ const tot = durationSeconds.toFixed(1);
6720
+ controlsTimeEl.textContent = `${cur}s / ${tot}s`;
6721
+ }
6722
+ if (controlsBeatChip && plan.beats.length > 1) {
6723
+ const currentSec = sceneMs / 1e3;
6724
+ const currentBeat = plan.beats.find((b) => currentSec >= b.start && currentSec < b.end) || plan.beats[plan.beats.length - 1];
6725
+ if (currentBeat) {
6726
+ const beatIdx = plan.beats.indexOf(currentBeat) + 1;
6727
+ controlsBeatChip.textContent = currentBeat.label ? `${beatIdx}. ${currentBeat.label}` : `Beat ${beatIdx}`;
6728
+ controlsBeatChip.title = `Current beat: ${currentBeat.label || currentBeat.name}`;
6729
+ }
6730
+ }
6501
6731
  if (!progressEl) return;
6502
6732
  if (progressMode === "bar") {
6503
6733
  progressEl.style.background = customColor ?? plan.theme.accent ?? "#2563eb";
6504
6734
  progressEl.style.transformOrigin = "left center";
6505
- progressEl.style.transform = `scaleX(${pct})`;
6735
+ progressEl.style.transform = `scaleX(${clamped})`;
6506
6736
  return;
6507
6737
  }
6508
- const deg = pct * 360;
6738
+ const deg = clamped * 360;
6509
6739
  const colorStops = customColor ? customColor.includes(",") ? customColor : `${customColor} 0deg, ${customColor}` : DEFAULT_RAINBOW;
6510
6740
  const vw = progressEl.clientWidth || viewport.clientWidth || plan.meta.width;
6511
6741
  const vh = progressEl.clientHeight || viewport.clientHeight || plan.meta.height;
@@ -6870,7 +7100,8 @@ function createDiagram(opts) {
6870
7100
  const initialMeasureBounds = computeContentBounds();
6871
7101
  const { symmetricContentW: initSymW } = computeSymmetricContentSpan(plan, initialMeasureBounds);
6872
7102
  const naturalHeight = vWidth * initialMeasureBounds.height / initSymW;
6873
- const isHeightConstrained = hasInitialHeightConstraint;
7103
+ const isFullscreenActive = container.classList.contains("markdy-fullscreen-host") || container.classList.contains("markdy--pseudo-fullscreen") || typeof document !== "undefined" && (document.fullscreenElement === container || document.fullscreenElement === viewport || document.webkitFullscreenElement === container || document.webkitFullscreenElement === viewport);
7104
+ const isHeightConstrained = hasInitialHeightConstraint || isFullscreenActive;
6874
7105
  const vHeight = isHeightConstrained ? viewport.clientHeight || container.clientHeight || naturalHeight : naturalHeight;
6875
7106
  const resolvedFit = fitViewActive ? "contain" : fitMode === "auto" ? isHeightConstrained ? "contain" : "width" : fitMode;
6876
7107
  const defaultTargetRatio = vWidth <= 480 ? 0.95 : 0.9;
@@ -7019,12 +7250,6 @@ function createDiagram(opts) {
7019
7250
  let dragLastY = 0;
7020
7251
  let dragMoved = false;
7021
7252
  let suppressNextClick = false;
7022
- let controlsPlayButton = null;
7023
- let controlsRateButtons = [];
7024
- let controlsSeekBar = null;
7025
- let controlsTimeEl = null;
7026
- let controlsFitButton = null;
7027
- let closeCodePanel = null;
7028
7253
  const explicitFit = defaultFit ?? explicitFitOption;
7029
7254
  let fitViewActive = explicitFit !== void 0 ? Boolean(explicitFit) : plan.meta.player?.controls?.fit !== void 0 ? Boolean(plan.meta.player.controls.fit) : opts.fitMode === "contain" || Boolean(fitViewButton);
7030
7255
  if (fitViewActive) {
@@ -7039,6 +7264,7 @@ function createDiagram(opts) {
7039
7264
  fit: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>',
7040
7265
  resetView: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/></svg>',
7041
7266
  fullscreen: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>',
7267
+ fullscreenExit: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"/></svg>',
7042
7268
  svg: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',
7043
7269
  gif: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="3"/><circle cx="7" cy="7" r="1.5" fill="currentColor"/><circle cx="17" cy="7" r="1.5" fill="currentColor"/><circle cx="7" cy="17" r="1.5" fill="currentColor"/><circle cx="17" cy="17" r="1.5" fill="currentColor"/><path d="M10 10l5 2-5 2z" fill="currentColor"/></svg>',
7044
7270
  share: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>',
@@ -7136,6 +7362,14 @@ function createDiagram(opts) {
7136
7362
  resetViewportTransform();
7137
7363
  }
7138
7364
  function syncControls() {
7365
+ const pct = totalDurationMs > 0 ? sceneMs / totalDurationMs : 0;
7366
+ const clamped = Math.max(0, Math.min(1, pct));
7367
+ if (controlsScrubberFill) {
7368
+ controlsScrubberFill.style.width = `${clamped * 100}%`;
7369
+ }
7370
+ if (controlsScrubberThumb) {
7371
+ controlsScrubberThumb.style.left = `${clamped * 100}%`;
7372
+ }
7139
7373
  if (controlsPlayButton) {
7140
7374
  const playing = isPlaying;
7141
7375
  controlsPlayButton.innerHTML = `${playing ? ICONS2.pause : ICONS2.play}<span class="markdy-btn-label">${playing ? "Pause" : "Play"}</span>`;
@@ -7150,14 +7384,22 @@ function createDiagram(opts) {
7150
7384
  }
7151
7385
  if (controlsSeekBar) {
7152
7386
  controlsSeekBar.value = String(sceneMs / 1e3);
7153
- const pct = totalDurationMs > 0 ? sceneMs / totalDurationMs * 100 : 0;
7154
- controlsSeekBar.style.setProperty("--seek-pct", `${pct}%`);
7387
+ controlsSeekBar.style.setProperty("--seek-pct", `${clamped * 100}%`);
7155
7388
  }
7156
7389
  if (controlsTimeEl) {
7157
7390
  const cur = (sceneMs / 1e3).toFixed(1);
7158
7391
  const tot = durationSeconds.toFixed(1);
7159
7392
  controlsTimeEl.textContent = `${cur}s / ${tot}s`;
7160
7393
  }
7394
+ if (controlsBeatChip && plan.beats.length > 1) {
7395
+ const currentSec = sceneMs / 1e3;
7396
+ const currentBeat = plan.beats.find((b) => currentSec >= b.start && currentSec < b.end) || plan.beats[plan.beats.length - 1];
7397
+ if (currentBeat) {
7398
+ const beatIdx = plan.beats.indexOf(currentBeat) + 1;
7399
+ controlsBeatChip.textContent = currentBeat.label ? `${beatIdx}. ${currentBeat.label}` : `Beat ${beatIdx}`;
7400
+ controlsBeatChip.title = `Current beat: ${currentBeat.label || currentBeat.name}`;
7401
+ }
7402
+ }
7161
7403
  if (controlsFitButton) {
7162
7404
  controlsFitButton.setAttribute("aria-pressed", fitViewActive ? "true" : "false");
7163
7405
  }
@@ -7515,8 +7757,39 @@ function createDiagram(opts) {
7515
7757
  });
7516
7758
  toolbar.appendChild(button);
7517
7759
  }
7518
- function mountSeekControl(toolbar) {
7760
+ function mountScrubber(footerEl) {
7519
7761
  if (!seekBar) return;
7762
+ controlsScrubber = document.createElement("div");
7763
+ controlsScrubber.className = "markdy-player-scrubber";
7764
+ controlsScrubber.setAttribute("role", "presentation");
7765
+ controlsScrubberTrack = document.createElement("div");
7766
+ controlsScrubberTrack.className = "markdy-player-scrubber-track";
7767
+ if (plan.beats.length > 1 && totalDurationMs > 0) {
7768
+ for (let i = 1; i < plan.beats.length; i++) {
7769
+ const beat = plan.beats[i];
7770
+ const tick = document.createElement("div");
7771
+ tick.className = "markdy-player-scrubber-tick";
7772
+ tick.style.left = `${beat.start / durationSeconds * 100}%`;
7773
+ tick.title = beat.label || beat.name;
7774
+ controlsScrubberTrack.appendChild(tick);
7775
+ }
7776
+ }
7777
+ controlsScrubberFill = document.createElement("div");
7778
+ controlsScrubberFill.className = "markdy-player-scrubber-fill";
7779
+ if (customColor) {
7780
+ controlsScrubberFill.style.background = customColor;
7781
+ }
7782
+ controlsScrubberTrack.appendChild(controlsScrubberFill);
7783
+ controlsScrubberThumb = document.createElement("div");
7784
+ controlsScrubberThumb.className = "markdy-player-scrubber-thumb";
7785
+ if (customColor) {
7786
+ controlsScrubberThumb.style.background = customColor;
7787
+ }
7788
+ controlsScrubberTrack.appendChild(controlsScrubberThumb);
7789
+ controlsScrubberTooltip = document.createElement("div");
7790
+ controlsScrubberTooltip.className = "markdy-player-scrubber-tooltip";
7791
+ controlsScrubberTooltip.textContent = "0.0s";
7792
+ controlsScrubber.appendChild(controlsScrubberTooltip);
7520
7793
  controlsSeekBar = document.createElement("input");
7521
7794
  controlsSeekBar.className = "markdy-control-seek";
7522
7795
  controlsSeekBar.type = "range";
@@ -7525,12 +7798,28 @@ function createDiagram(opts) {
7525
7798
  controlsSeekBar.step = "0.01";
7526
7799
  controlsSeekBar.value = String(sceneMs / 1e3);
7527
7800
  controlsSeekBar.setAttribute("aria-label", "Seek diagram timeline");
7528
- controlsSeekBar.addEventListener("input", () => diagram.seek(Number(controlsSeekBar?.value ?? 0)));
7529
- toolbar.appendChild(controlsSeekBar);
7530
- controlsTimeEl = document.createElement("span");
7531
- controlsTimeEl.className = "markdy-control-time";
7532
- controlsTimeEl.textContent = `${(sceneMs / 1e3).toFixed(1)}s / ${durationSeconds.toFixed(1)}s`;
7533
- toolbar.appendChild(controlsTimeEl);
7801
+ controlsSeekBar.addEventListener("input", () => {
7802
+ const val = Number(controlsSeekBar?.value ?? 0);
7803
+ diagram.seek(val);
7804
+ });
7805
+ controlsScrubber.addEventListener("pointermove", (e) => {
7806
+ if (!controlsScrubber || !controlsScrubberTooltip) return;
7807
+ const rect = controlsScrubber.getBoundingClientRect();
7808
+ if (rect.width <= 0) return;
7809
+ const ratio = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
7810
+ const hoverSec = ratio * durationSeconds;
7811
+ controlsScrubberTooltip.textContent = `${hoverSec.toFixed(1)}s`;
7812
+ controlsScrubberTooltip.style.left = `${ratio * 100}%`;
7813
+ controlsScrubberTooltip.style.opacity = "1";
7814
+ });
7815
+ controlsScrubber.addEventListener("pointerleave", () => {
7816
+ if (controlsScrubberTooltip) {
7817
+ controlsScrubberTooltip.style.opacity = "0";
7818
+ }
7819
+ });
7820
+ controlsScrubber.appendChild(controlsScrubberTrack);
7821
+ controlsScrubber.appendChild(controlsSeekBar);
7822
+ footerEl.insertBefore(controlsScrubber, footerEl.firstChild);
7534
7823
  }
7535
7824
  function mountSpeedControls(toolbar) {
7536
7825
  if (!speedControls) return;
@@ -7828,12 +8117,14 @@ function createDiagram(opts) {
7828
8117
  const button = makeControlButton("Full", "Toggle fullscreen view", ICONS2.fullscreen);
7829
8118
  button.className = "markdy-control-fullscreen";
7830
8119
  button.setAttribute("aria-pressed", "false");
8120
+ button.style.touchAction = "manipulation";
7831
8121
  const host = container;
7832
8122
  let isPseudoFull = false;
7833
8123
  let originalBodyOverflow = null;
8124
+ let originalHtmlOverflow = null;
7834
8125
  function isNativeFullscreenSupported() {
7835
8126
  if (typeof document === "undefined") return false;
7836
- if (typeof navigator !== "undefined" && /iPhone|iPod/i.test(navigator.userAgent)) {
8127
+ if (typeof navigator !== "undefined" && (/iPhone|iPad|iPod/i.test(navigator.userAgent) || navigator.platform === "MacIntel" && (navigator.maxTouchPoints || 0) > 1)) {
7837
8128
  return false;
7838
8129
  }
7839
8130
  return Boolean(
@@ -7844,22 +8135,34 @@ function createDiagram(opts) {
7844
8135
  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;
7845
8136
  button.setAttribute("aria-pressed", isFull ? "true" : "false");
7846
8137
  button.title = isFull ? "Exit fullscreen" : "Toggle fullscreen view";
7847
- button.innerHTML = isFull ? `${ICONS2.fullscreen}<span class="markdy-btn-label">Exit</span>` : `${ICONS2.fullscreen}<span class="markdy-btn-label">Full</span>`;
8138
+ button.innerHTML = isFull ? `${ICONS2.fullscreenExit}<span class="markdy-btn-label">Exit</span>` : `${ICONS2.fullscreen}<span class="markdy-btn-label">Full</span>`;
7848
8139
  if (isFull) {
7849
8140
  host.classList.add("markdy-fullscreen-host");
7850
8141
  if (isPseudoFull) {
7851
8142
  host.classList.add("markdy--pseudo-fullscreen");
7852
- if (typeof document !== "undefined" && document.body && originalBodyOverflow === null) {
7853
- originalBodyOverflow = document.body.style.overflow;
7854
- document.body.style.overflow = "hidden";
8143
+ if (typeof document !== "undefined") {
8144
+ if (document.documentElement && originalHtmlOverflow === null) {
8145
+ originalHtmlOverflow = document.documentElement.style.overflow;
8146
+ document.documentElement.style.overflow = "hidden";
8147
+ }
8148
+ if (document.body && originalBodyOverflow === null) {
8149
+ originalBodyOverflow = document.body.style.overflow;
8150
+ document.body.style.overflow = "hidden";
8151
+ }
7855
8152
  }
7856
8153
  }
7857
8154
  } else {
7858
8155
  host.classList.remove("markdy-fullscreen-host");
7859
8156
  host.classList.remove("markdy--pseudo-fullscreen");
7860
- if (typeof document !== "undefined" && document.body && originalBodyOverflow !== null) {
7861
- document.body.style.overflow = originalBodyOverflow;
7862
- originalBodyOverflow = null;
8157
+ if (typeof document !== "undefined") {
8158
+ if (document.documentElement && originalHtmlOverflow !== null) {
8159
+ document.documentElement.style.overflow = originalHtmlOverflow;
8160
+ originalHtmlOverflow = null;
8161
+ }
8162
+ if (document.body && originalBodyOverflow !== null) {
8163
+ document.body.style.overflow = originalBodyOverflow;
8164
+ originalBodyOverflow = null;
8165
+ }
7863
8166
  }
7864
8167
  }
7865
8168
  requestAnimationFrame(() => {
@@ -7954,9 +8257,15 @@ function createDiagram(opts) {
7954
8257
  document.removeEventListener("mozfullscreenchange", syncFullscreenState);
7955
8258
  document.removeEventListener("MSFullscreenChange", syncFullscreenState);
7956
8259
  window.removeEventListener("keydown", handleEscKey);
7957
- if (originalBodyOverflow !== null && typeof document !== "undefined" && document.body) {
7958
- document.body.style.overflow = originalBodyOverflow;
7959
- originalBodyOverflow = null;
8260
+ if (typeof document !== "undefined") {
8261
+ if (originalHtmlOverflow !== null && document.documentElement) {
8262
+ document.documentElement.style.overflow = originalHtmlOverflow;
8263
+ originalHtmlOverflow = null;
8264
+ }
8265
+ if (originalBodyOverflow !== null && document.body) {
8266
+ document.body.style.overflow = originalBodyOverflow;
8267
+ originalBodyOverflow = null;
8268
+ }
7960
8269
  }
7961
8270
  if (isPseudoFull) {
7962
8271
  isPseudoFull = false;
@@ -8003,6 +8312,7 @@ function createDiagram(opts) {
8003
8312
  display: "flex",
8004
8313
  alignItems: "center",
8005
8314
  justifyContent: "flex-start",
8315
+ width: "100%",
8006
8316
  maxWidth: "100%",
8007
8317
  border: "0",
8008
8318
  borderRadius: "0",
@@ -8028,19 +8338,27 @@ function createDiagram(opts) {
8028
8338
  ]) {
8029
8339
  toolbar.addEventListener(eventName, (event) => event.stopPropagation());
8030
8340
  }
8341
+ if (seekBar) {
8342
+ mountScrubber(toolbar);
8343
+ }
8031
8344
  const playbackGroup = document.createElement("div");
8032
8345
  playbackGroup.className = "markdy-controls-group markdy-controls-playback";
8033
8346
  mountPlayControl(playbackGroup);
8034
8347
  mountBeatNavControls(playbackGroup, "prev");
8035
8348
  mountBeatNavControls(playbackGroup, "next");
8036
8349
  mountRestartControl(playbackGroup);
8037
- if (playbackGroup.children.length > 0) toolbar.appendChild(playbackGroup);
8038
- if (seekBar) {
8039
- const timelineGroup = document.createElement("div");
8040
- timelineGroup.className = "markdy-controls-group markdy-controls-timeline";
8041
- mountSeekControl(timelineGroup);
8042
- toolbar.appendChild(timelineGroup);
8350
+ controlsTimeEl = document.createElement("span");
8351
+ controlsTimeEl.className = "markdy-control-time";
8352
+ controlsTimeEl.textContent = `${(sceneMs / 1e3).toFixed(1)}s / ${durationSeconds.toFixed(1)}s`;
8353
+ playbackGroup.appendChild(controlsTimeEl);
8354
+ if (plan.beats.length > 1) {
8355
+ controlsBeatChip = document.createElement("span");
8356
+ controlsBeatChip.className = "markdy-player-beat-chip";
8357
+ const firstBeat = plan.beats[0];
8358
+ controlsBeatChip.textContent = firstBeat.label ? `1. ${firstBeat.label}` : "Beat 1";
8359
+ playbackGroup.appendChild(controlsBeatChip);
8043
8360
  }
8361
+ if (playbackGroup.children.length > 0) toolbar.appendChild(playbackGroup);
8044
8362
  const toolsGroup = document.createElement("div");
8045
8363
  toolsGroup.className = "markdy-controls-group markdy-controls-tools";
8046
8364
  if (speedControls) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.4.10",
3
+ "version": "1.4.12",
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.10"
49
+ "@markdy/core": "1.4.12"
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.10"
56
+ "@markdy/stdlib-systems": "1.4.12"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",