@scalemule/nextjs 0.1.44 → 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/audio.d.mts CHANGED
@@ -73,6 +73,37 @@ interface NarrationTimings {
73
73
  /** [text, start_ms, end_ms, sentence_index] */
74
74
  words: [string, number, number, number][];
75
75
  }
76
+ declare const WORD_HIGHLIGHT = "sm-narration-word";
77
+ declare const SENTENCE_HIGHLIGHT = "sm-narration-sentence";
76
78
  declare function narrationHighlightSupported(): boolean;
79
+ /**
80
+ * Owns the live highlight for one narration player. Build once per
81
+ * (timings, article body) pair; drive with `update(currentTimeMs)`.
82
+ */
83
+ declare class NarrationHighlighter {
84
+ private words;
85
+ private ranges;
86
+ private sentenceRanges;
87
+ private currentWord;
88
+ private currentSentence;
89
+ private follow;
90
+ private detachUserScroll;
91
+ private reducedMotion;
92
+ constructor(root: Element, timings: NarrationTimings);
93
+ /** Fraction of narration words found in the article body. A low
94
+ * ratio means the body diverged from the script; callers may prefer
95
+ * to hide the toggle below ~0.5. */
96
+ matchRatio(): number;
97
+ private attachUserScroll;
98
+ /** Re-engage auto-scroll (the reader pressed the toggle or sought). */
99
+ resumeFollowing(): void;
100
+ update(timeMs: number): void;
101
+ private scrollTo;
102
+ clear(): void;
103
+ destroy(): void;
104
+ }
105
+ /** Parse a fetched timings payload; accepts the raw timings object or
106
+ * common envelopes ({timings}, {data:{timings}}). */
107
+ declare function parseTimingsPayload(body: unknown): NarrationTimings | null;
77
108
 
78
- export { AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, type NarrationTimings, narrationHighlightSupported };
109
+ export { AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, NarrationHighlighter, type NarrationTimings, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload };
package/dist/audio.d.ts CHANGED
@@ -73,6 +73,37 @@ interface NarrationTimings {
73
73
  /** [text, start_ms, end_ms, sentence_index] */
74
74
  words: [string, number, number, number][];
75
75
  }
76
+ declare const WORD_HIGHLIGHT = "sm-narration-word";
77
+ declare const SENTENCE_HIGHLIGHT = "sm-narration-sentence";
76
78
  declare function narrationHighlightSupported(): boolean;
79
+ /**
80
+ * Owns the live highlight for one narration player. Build once per
81
+ * (timings, article body) pair; drive with `update(currentTimeMs)`.
82
+ */
83
+ declare class NarrationHighlighter {
84
+ private words;
85
+ private ranges;
86
+ private sentenceRanges;
87
+ private currentWord;
88
+ private currentSentence;
89
+ private follow;
90
+ private detachUserScroll;
91
+ private reducedMotion;
92
+ constructor(root: Element, timings: NarrationTimings);
93
+ /** Fraction of narration words found in the article body. A low
94
+ * ratio means the body diverged from the script; callers may prefer
95
+ * to hide the toggle below ~0.5. */
96
+ matchRatio(): number;
97
+ private attachUserScroll;
98
+ /** Re-engage auto-scroll (the reader pressed the toggle or sought). */
99
+ resumeFollowing(): void;
100
+ update(timeMs: number): void;
101
+ private scrollTo;
102
+ clear(): void;
103
+ destroy(): void;
104
+ }
105
+ /** Parse a fetched timings payload; accepts the raw timings object or
106
+ * common envelopes ({timings}, {data:{timings}}). */
107
+ declare function parseTimingsPayload(body: unknown): NarrationTimings | null;
77
108
 
78
- export { AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, type NarrationTimings, narrationHighlightSupported };
109
+ export { AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, NarrationHighlighter, type NarrationTimings, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload };
package/dist/audio.js CHANGED
@@ -23,7 +23,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
23
23
  var audio_exports = {};
24
24
  __export(audio_exports, {
25
25
  AudioPlayer: () => AudioPlayer,
26
- narrationHighlightSupported: () => narrationHighlightSupported
26
+ NarrationHighlighter: () => NarrationHighlighter,
27
+ SENTENCE_HIGHLIGHT: () => SENTENCE_HIGHLIGHT,
28
+ WORD_HIGHLIGHT: () => WORD_HIGHLIGHT,
29
+ narrationHighlightSupported: () => narrationHighlightSupported,
30
+ parseTimingsPayload: () => parseTimingsPayload
27
31
  });
28
32
  module.exports = __toCommonJS(audio_exports);
29
33
 
@@ -680,5 +684,9 @@ function PlayerSession({
680
684
  // Annotate the CommonJS export names for ESM import in node:
681
685
  0 && (module.exports = {
682
686
  AudioPlayer,
683
- narrationHighlightSupported
687
+ NarrationHighlighter,
688
+ SENTENCE_HIGHLIGHT,
689
+ WORD_HIGHLIGHT,
690
+ narrationHighlightSupported,
691
+ parseTimingsPayload
684
692
  });
package/dist/audio.mjs CHANGED
@@ -659,5 +659,9 @@ function PlayerSession({
659
659
  }
660
660
  export {
661
661
  AudioPlayer,
662
- narrationHighlightSupported
662
+ NarrationHighlighter,
663
+ SENTENCE_HIGHLIGHT,
664
+ WORD_HIGHLIGHT,
665
+ narrationHighlightSupported,
666
+ parseTimingsPayload
663
667
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "ScaleMule SDK for Next.js applications - authentication, storage, and user management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",