@real-music-packages/web-core 0.35.0 → 0.36.1

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.
@@ -1,7 +1,9 @@
1
1
  import { A as AudioClock, S as Score, a as LayerFactory, R as RenderCtx, b as ScoreFromMusicXMLOpts, T as TempoMap, c as ScoreNote } from '../waveform-DdSMAbYQ.js';
2
2
  export { L as Layer, d as SpectrumInput, e as SpectrumProps, W as WaveformInput, f as WaveformProps, s as scoreFromMusicXML, g as spectrumFactory, w as waveformFactory } from '../waveform-DdSMAbYQ.js';
3
3
  import { PromoTheme, RecordOpts, Scene, SafeBox } from '../video.js';
4
- import { RenderedNotation, Box, StaffMeasureBox, MeasureColumnBox } from '../promo.js';
4
+ import { RenderedNotation, Box } from '../promo.js';
5
+ import { N as NotationLayout } from '../notationGeometry-CZJ0U6PQ.js';
6
+ export { F as FOLLOW_BARS, a as FOLLOW_PAD, b as NotationLayoutOpts, c as NotationRect, P as PlayheadLine, d as audioPlayheadLine, e as cropAroundBox, f as cubicEaseInOut, g as distinctMeasureIndices, h as distinctOnsets, i as firstMeasureBox, j as followBoxAt, k as followWindowStart, l as lerpBox, m as measureColumnsFromLayout, n as measureCount, o as measureSpanBox, p as measureSystemMap, q as notationLayout, r as playheadLine, s as systemBox, v as vstackAudioPlayheadLine, t as vstackFollowBox } from '../notationGeometry-CZJ0U6PQ.js';
5
7
 
6
8
  /** One scheduled audio event, in seconds RELATIVE to the schedule start. */
7
9
  interface AudioEvent {
@@ -595,138 +597,6 @@ interface ScrollCursorProps {
595
597
  }
596
598
  declare const scrollCursorFactory: LayerFactory<ScrollCursorProps>;
597
599
 
598
- /** measures (= rows) visible at once in the follow window. */
599
- declare const FOLLOW_BARS = 2;
600
- /** breathing room around the follow window. */
601
- declare const FOLLOW_PAD = 1.06;
602
- /** Cubic ease-in-out, t in [0,1] (RSR port of stave-video core/camera.py). */
603
- declare function cubicEaseInOut(t: number): number;
604
- /** Linear interpolation of two boxes. (RSR lerpBox) */
605
- declare function lerpBox(a: Box, b: Box, e: number): Box;
606
- /** Smallest crop of `aspect` containing `box` padded by `pad`, clamped to the
607
- * canvas. (RSR cropAroundBox) */
608
- declare function cropAroundBox(box: Box, aspect: number, pad: number, cw: number, ch: number): Box;
609
- /** Union (canvas coords) of all staff measure boxes with index in [lo,hi).
610
- * (RSR measureSpanBox) */
611
- declare function measureSpanBox(rn: RenderedNotation, lo: number, hi: number): Box | null;
612
- /** Union of the index-0 measure boxes — the opening focal. (RSR firstMeasureBox) */
613
- declare function firstMeasureBox(rn: RenderedNotation): Box | null;
614
- /** Number of distinct measures in the notation. (RSR measureCount) */
615
- declare function measureCount(rn: RenderedNotation): number;
616
- /** The DISTINCT measure indices present in the engraving, ASCENDING. For excerpts
617
- * these do NOT start at 0 (e.g. bars 5-8 → [4,5,6,7]) and may be non-contiguous,
618
- * so the follow window must scroll across THESE indices, not a 0..measureCount
619
- * range. (measureCount returns maxIndex+1 — a count valid only for 0-based scores.) */
620
- declare function distinctMeasureIndices(rn: RenderedNotation): number[];
621
- /** The follow window (canvas coords) for a continuous measure-start position,
622
- * spanning FOLLOW_BARS and lerping between adjacent windows. (RSR followBoxAt) */
623
- declare function followBoxAt(rn: RenderedNotation, posMeasures: number): Box | null;
624
- /**
625
- * The continuous follow-window START measure (ABSOLUTE index) for an hstack
626
- * audio-clock progress 0..1.
627
- *
628
- * hstack (single horizontal staffline): pan CONTINUOUSLY so the playhead sits at a
629
- * stable fraction (`HSTACK_PLAYHEAD_LEAD`) from the LEFT of the window — the playing
630
- * bar is always on screen with look-ahead to its right, and the cursor never drifts
631
- * to the screen edge.
632
- *
633
- * BUG FIX (web-core 0.21.0) — playhead pinned at the right edge for EXCERPTS. This
634
- * used to take `nBars = measureCount(rn) = maxIndex+1` and pan progress across a
635
- * 0..nBars range. That is only correct when measure indices are 0-based: RSR's
636
- * excerpts engrave e.g. bars 5-8 → indices [4,5,6,7], so measureCount=8 but only 4
637
- * measures exist. The window then panned a phantom 0..8 axis while the playhead
638
- * (which steps over the 4 REAL columns) raced ahead — pinning the cursor at the far
639
- * right while the music barely scrolled. We now pan across the ACTUAL distinct
640
- * indices: progress 0..1 maps to absolute index `firstIndex .. firstIndex+nReal`,
641
- * and `followBoxAt` (which already indexes absolute measures via measureSpanBox)
642
- * frames the right bars. Clamped so the window never runs past the last measure.
643
- *
644
- * Pass the RenderedNotation so the real index range is known. (The legacy 0-based
645
- * `nBars`-only call still works via the `firstIndex=0, nReal=nBars` fallback.)
646
- */
647
- declare function followWindowStart(rn: RenderedNotation | number, camProgress01: number): number;
648
- /** For each measure index, the system (row) it lives on — ordered by index.
649
- * Empty when geometry is missing. */
650
- declare function measureSystemMap(rn: RenderedNotation): number[];
651
- /** Union (canvas coords) of every measure box on system `sys`. Falls back to the
652
- * system's own box when no measures map to it. */
653
- declare function systemBox(rn: RenderedNotation, sys: number, sysMap?: number[]): Box | null;
654
- /**
655
- * vstack follow window (canvas coords) for an audio-clock progress 0..1. Frames
656
- * the ACTIVE system (the row the playhead's current bar is on) and eases
657
- * VERTICALLY to the NEXT system over the tail of the active system's last bar, so
658
- * the next row slides up just as the playhead crosses into it. Within a system
659
- * the box is fixed (the playhead pans L→R inside it). No measure-window vertical
660
- * jumps: the focusBox always spans an integer-or-tween of FULL systems.
661
- *
662
- * The box keeps a constant size (the larger of the two framed systems' extents)
663
- * so the dest mapping doesn't breathe as it scrolls — the camera just translates.
664
- */
665
- declare function vstackFollowBox(rn: RenderedNotation, camProgress01: number): Box | null;
666
- /** The dest rect a notation frame is drawn into, on screen. */
667
- interface NotationRect {
668
- dx: number;
669
- dy: number;
670
- dw: number;
671
- dh: number;
672
- }
673
- /** Geometry result of laying out the notation for one frame: which canvas `src`
674
- * rect is blitted to which screen `dest` rect, plus the mapped boxes. */
675
- interface NotationLayout {
676
- /** Canvas-space crop blitted this frame. */
677
- src: Box;
678
- /** Screen-space dest rect. */
679
- rect: NotationRect;
680
- /** Per-row system boxes mapped into screen coords (for the playhead fallback). */
681
- systems: Box[];
682
- /** Per-(measure,staff) boxes mapped into screen coords (for highlights/cursor). */
683
- measures: StaffMeasureBox[];
684
- }
685
- interface NotationLayoutOpts {
686
- /** 0 = zoomed on bar 1, 1 = full excerpt (opening camera). Default 1. */
687
- zoom01?: number;
688
- /** Follow window (canvas coords); when set, overrides zoom and scrolls. */
689
- focusBox?: Box | null;
690
- }
691
- /**
692
- * Compute the notation layout (src crop + dest rect + mapped boxes) for one
693
- * frame. This is RSR's `drawNotation` with the single `ctx.drawImage` call REMOVED
694
- * — pure geometry, so it is testable headless and shared by the notation +
695
- * scroll-cursor layers. The layer does the drawImage using `src` + `rect`.
696
- */
697
- declare function notationLayout(rn: RenderedNotation, W: number, H: number, boxTop: number, boxH: number, opts?: NotationLayoutOpts): NotationLayout;
698
- /** Per-measure grand-staff column boxes (both staves unioned) from a frame's
699
- * mapped measures, in render order. (RSR measureColumns) */
700
- declare function measureColumnsFromLayout(measures: StaffMeasureBox[]): MeasureColumnBox[];
701
- /** The playhead line + alpha for progress `t01`. null when fully faded. (RSR
702
- * drawPlayhead, with the actual stroke factored out into the layer.) */
703
- interface PlayheadLine {
704
- x: number;
705
- y0: number;
706
- y1: number;
707
- alpha: number;
708
- }
709
- declare function playheadLine(layout: NotationLayout, t01: number): PlayheadLine | null;
710
- /** Distinct, sorted note onsets from a Score's notes. */
711
- declare function distinctOnsets(notes: {
712
- onsetMs: number;
713
- }[]): number[];
714
- /**
715
- * The FOOLPROOF audio-driven playhead line for absolute audio time `tMs`.
716
- *
717
- * `tMs` is the audio clock; `onsetsMs` are the score's distinct note onsets
718
- * (sorted). The cursor is the time-lerp of the two anchors bracketing `tMs`:
719
- * before the first onset it holds on anchor 0; after the last it holds on the
720
- * last; in a gap it eases between the bracketing onsets. Pure function of
721
- * (layout, onsetsMs, tMs). Returns null only when there is no geometry to anchor
722
- * to (falls back to the rect sweep in the layer, same as `playheadLine`).
723
- *
724
- * Fade in/out mirrors `playheadLine` but is keyed on position in the ONSET span
725
- * (first→last onset), not on musicMs — so the fade tracks the notes too.
726
- */
727
- declare function audioPlayheadLine(layout: NotationLayout, onsetsMs: number[], tMs: number, barDurMs?: number, noteCols?: number[]): PlayheadLine | null;
728
- declare function vstackAudioPlayheadLine(layout: NotationLayout, onsetsMs: number[], tMs: number, nBars: number, noteCols?: number[]): PlayheadLine | null;
729
-
730
600
  /** Map a canvas-space box through a base notation layout into world/screen coords. */
731
601
  declare function mapBoxThroughLayout(base: NotationLayout, b: Box): Box;
732
602
  /** RSR's per-frame `src` crop from a follow box (FOLLOW_PAD expand + clamp) —
@@ -1825,4 +1695,4 @@ interface ImageRevealProps {
1825
1695
  }
1826
1696
  declare const imageRevealFactory: LayerFactory<ImageRevealProps>;
1827
1697
 
1828
- export { type Affine, AudioClock, type AudioEvent, type BackgroundProps, type BeatGridOpts, type BeatPulseProps, type BeatTick, type BrandingProps, type BufferFactory, type BuildSceneOpts, type BuiltScene, type CameraState, type CaptionCue, type CaptionProps, type CaptionScript, type CaptionStyle, type ChordRibbonProps, type ChordSpan, type CircleOfFifthsProps, type CirclePoint, type ClickTrackOpts, type ColorBy, type ContourPlot, type ContourPoint, type CountInOpts, type CountdownProps, type CountingTrackProps, type CtaProps, DEFAULT_FUNCTION_COLORS, type DegreeLabel, type DegreeLabelsProps, type DroneOpts, type DuckWindow, type Easing, type EndCardProps, type ExtendedDemoOpts, FIFTHS_MAJOR, FIFTHS_MINOR, FOLLOW_BARS, FOLLOW_PAD, type FallingKeyboardDemoOpts, type FallingNotesProps, type FretboardProps, type FunctionColors, type FunctionalHarmonyProps, type GateError, type GateInput, type HandColors, type HarmonicFunction, type HarmonyMode, type HighlightRegion, type HookProps, type ImageRevealMode, type ImageRevealProps, type IntervalArcsProps, type KaraokeCaptionProps, type KaraokeWord, type KeyRect, type KeyboardLayout, type KeyboardLayoutOpts, type KeyboardProps, type KineticMode, type KineticTextProps, type LabelMode, LayerFactory, type McqCardProps, type NotationEngraving, type NotationLayout, type NotationLayoutOpts, type NotationProps, type NotationRect, type OutputProbe, PIANO_HIGH, PIANO_LOW, type ParticleBurstProps, type PitchContourProps, type Placement, type PlayheadLine, type PortraitProps, type ProgressRingProps, type PromoCardsDemoOpts, type PulseStyle, type Quiz, type QuizOption, type QuizPhase, type RadialSpectrumProps, type RayEndpoints, type RecordSceneSpecOpts, type Rect, RenderCtx, type ResolvedSegment, type RevealEasing, type RevealProps, SCALE_INTERVALS, type SafeGuidesProps, type ScaleHighlightProps, type SceneSpec, type ScheduleTarget, Score, ScoreFromMusicXMLOpts, ScoreNote, type ScrollCursorProps, type Section, type SectionMinimapProps, type SegmentAudio, type SegmentAudioCtx, type SegmentTransition, type SpecLayer, type StaffKeyboardRayProps, type StatCounterProps, TempoMap, type TensionGraphProps, type TensionPoint, type TextureProps, type TimeAnchor, type TimelineSegment, activeChord, activeCue, activeSection, animatedSlot, applySchedule, applyToContext, assertGate, audioPlayheadLine, ballArc, ballX, beatGrid, beatPhase, beatPulseFactory, blackKeys, bpmOf, brandingFactory, buildScene, cameraForFollow, cameraTransform, chordRibbonFactory, circleOfFifthsDemoSpec, circleOfFifthsFactory, clamp, clickTrackSchedule, contourMinimapDemoSpec, contourPoints, contourPolyline, countInLeadSec, countInSchedule, countdownFactory, countdownRemaining, countdownSeconds, countingDegreeDemoSpec, countingTrackFactory, cropAroundBox, ctaFactory, cubicEaseInOut, cueOpacity, degreeLabel, degreeLabelsFactory, distinctMeasureIndices, distinctOnsets, dotAt, drawCaption, drawHighlight, droneSchedule, duckGainAt, easeIn, easeInOut, easeOut, endCardFactory, fallingKeyboardDemoScore, fallingKeyboardDemoSpec, fallingNotesFactory, firstMeasureBox, followBoxAt, followSrcBox, followWindowStart, fracSlotPoint, frameRect, fretboardFactory, functionColor, functionalHarmonyFactory, getKeyboardLayout, getLayerFactory, getNotationEngraving, harmonyDemoSpec, highlightIntensity, hookFactory, identityCamera, imageRevealFactory, inRange, intervalArcsFactory, invLerp, isBlackKey, karaokeCaptionFactory, kenBurns, keyCenterX, keyColumnWidth, keyRect, keySlot, keyboardFactory, keyboardLayout, kineticTextFactory, lerp, lerpBox, lerpCamera, linear, mapBoxThroughLayout, mcqCardFactory, mcqDemoSpec, measureColumnsFromLayout, measureCount, measureSpanBox, measureSpans, measureSystemMap, timeToX as minimapTimeToX, msPerBeat, notationFactory, notationLayout, noteColor, noteSetXRange, parseKey, parseTimeSig, particleBurstFactory, pcToSlot, pitchAt, pitchContourFactory, pitchRange, playheadLine, portraitFactory, progress01, progressRingFactory, projectPoint, promoCardsDemoSpec, pulseAt, quizPhase, radialSpectrumFactory, rayEndpoints, rayPointAt, recordSceneSpec, registerLayer, registeredKeys, resolveAnchor, resolveKeyboardLayout, resolveTimeline, revealFactory, revealProgress, runGate, safeGuidesFactory, scaleHighlightFactory, scorePitchSpan, scrollCursorFactory, sectionMinimapFactory, setFollowLayoutProvider, setKeyboardLayout, setNotationEngraving, slotAngle, slotPc, slotPoint, staffAnchor, staffKeyboardRayFactory, staffRayDemoSpec, statCounterFactory, systemBox, tensionGraphFactory, textureFactory, transitionProgress, validateChordTrack, validateQuiz, validateSections, visualTimelineMs, vstackAudioPlayheadLine, vstackFollowBox, whiteKeys, worldToViewport };
1698
+ export { type Affine, AudioClock, type AudioEvent, type BackgroundProps, type BeatGridOpts, type BeatPulseProps, type BeatTick, type BrandingProps, type BufferFactory, type BuildSceneOpts, type BuiltScene, type CameraState, type CaptionCue, type CaptionProps, type CaptionScript, type CaptionStyle, type ChordRibbonProps, type ChordSpan, type CircleOfFifthsProps, type CirclePoint, type ClickTrackOpts, type ColorBy, type ContourPlot, type ContourPoint, type CountInOpts, type CountdownProps, type CountingTrackProps, type CtaProps, DEFAULT_FUNCTION_COLORS, type DegreeLabel, type DegreeLabelsProps, type DroneOpts, type DuckWindow, type Easing, type EndCardProps, type ExtendedDemoOpts, FIFTHS_MAJOR, FIFTHS_MINOR, type FallingKeyboardDemoOpts, type FallingNotesProps, type FretboardProps, type FunctionColors, type FunctionalHarmonyProps, type GateError, type GateInput, type HandColors, type HarmonicFunction, type HarmonyMode, type HighlightRegion, type HookProps, type ImageRevealMode, type ImageRevealProps, type IntervalArcsProps, type KaraokeCaptionProps, type KaraokeWord, type KeyRect, type KeyboardLayout, type KeyboardLayoutOpts, type KeyboardProps, type KineticMode, type KineticTextProps, type LabelMode, LayerFactory, type McqCardProps, type NotationEngraving, NotationLayout, type NotationProps, type OutputProbe, PIANO_HIGH, PIANO_LOW, type ParticleBurstProps, type PitchContourProps, type Placement, type PortraitProps, type ProgressRingProps, type PromoCardsDemoOpts, type PulseStyle, type Quiz, type QuizOption, type QuizPhase, type RadialSpectrumProps, type RayEndpoints, type RecordSceneSpecOpts, type Rect, RenderCtx, type ResolvedSegment, type RevealEasing, type RevealProps, SCALE_INTERVALS, type SafeGuidesProps, type ScaleHighlightProps, type SceneSpec, type ScheduleTarget, Score, ScoreFromMusicXMLOpts, ScoreNote, type ScrollCursorProps, type Section, type SectionMinimapProps, type SegmentAudio, type SegmentAudioCtx, type SegmentTransition, type SpecLayer, type StaffKeyboardRayProps, type StatCounterProps, TempoMap, type TensionGraphProps, type TensionPoint, type TextureProps, type TimeAnchor, type TimelineSegment, activeChord, activeCue, activeSection, animatedSlot, applySchedule, applyToContext, assertGate, ballArc, ballX, beatGrid, beatPhase, beatPulseFactory, blackKeys, bpmOf, brandingFactory, buildScene, cameraForFollow, cameraTransform, chordRibbonFactory, circleOfFifthsDemoSpec, circleOfFifthsFactory, clamp, clickTrackSchedule, contourMinimapDemoSpec, contourPoints, contourPolyline, countInLeadSec, countInSchedule, countdownFactory, countdownRemaining, countdownSeconds, countingDegreeDemoSpec, countingTrackFactory, ctaFactory, cueOpacity, degreeLabel, degreeLabelsFactory, dotAt, drawCaption, drawHighlight, droneSchedule, duckGainAt, easeIn, easeInOut, easeOut, endCardFactory, fallingKeyboardDemoScore, fallingKeyboardDemoSpec, fallingNotesFactory, followSrcBox, fracSlotPoint, frameRect, fretboardFactory, functionColor, functionalHarmonyFactory, getKeyboardLayout, getLayerFactory, getNotationEngraving, harmonyDemoSpec, highlightIntensity, hookFactory, identityCamera, imageRevealFactory, inRange, intervalArcsFactory, invLerp, isBlackKey, karaokeCaptionFactory, kenBurns, keyCenterX, keyColumnWidth, keyRect, keySlot, keyboardFactory, keyboardLayout, kineticTextFactory, lerp, lerpCamera, linear, mapBoxThroughLayout, mcqCardFactory, mcqDemoSpec, measureSpans, timeToX as minimapTimeToX, msPerBeat, notationFactory, noteColor, noteSetXRange, parseKey, parseTimeSig, particleBurstFactory, pcToSlot, pitchAt, pitchContourFactory, pitchRange, portraitFactory, progress01, progressRingFactory, projectPoint, promoCardsDemoSpec, pulseAt, quizPhase, radialSpectrumFactory, rayEndpoints, rayPointAt, recordSceneSpec, registerLayer, registeredKeys, resolveAnchor, resolveKeyboardLayout, resolveTimeline, revealFactory, revealProgress, runGate, safeGuidesFactory, scaleHighlightFactory, scorePitchSpan, scrollCursorFactory, sectionMinimapFactory, setFollowLayoutProvider, setKeyboardLayout, setNotationEngraving, slotAngle, slotPc, slotPoint, staffAnchor, staffKeyboardRayFactory, staffRayDemoSpec, statCounterFactory, tensionGraphFactory, textureFactory, transitionProgress, validateChordTrack, validateQuiz, validateSections, visualTimelineMs, whiteKeys, worldToViewport };