@scalemule/nextjs 0.1.56 → 0.1.58

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.css CHANGED
@@ -759,3 +759,99 @@
759
759
  background: ButtonText;
760
760
  }
761
761
  }
762
+ .sm-listening-library {
763
+ margin: 12px 0 20px;
764
+ color: var(--sm-player-ink, #17201b);
765
+ font: 14px/1.5 var(--sm-player-sans, var(--font-inter, sans-serif));
766
+ }
767
+ .sm-listening-library summary {
768
+ cursor: pointer;
769
+ padding: 10px 0;
770
+ font-weight: 600;
771
+ }
772
+ .sm-listening-library summary span {
773
+ margin-left: 12px;
774
+ color: var(--sm-player-muted, #59635d);
775
+ font-weight: 400;
776
+ }
777
+ .sm-listening-library__body {
778
+ padding: 16px;
779
+ border: 1px solid var(--sm-player-line, #d8ded9);
780
+ border-radius: 14px;
781
+ background: var(--sm-player-paper, #fff);
782
+ }
783
+ .sm-listening-library__catchup {
784
+ display: flex;
785
+ flex-wrap: wrap;
786
+ align-items: center;
787
+ gap: 12px;
788
+ margin-bottom: 16px;
789
+ }
790
+ .sm-listening-library__catchup small {
791
+ flex-basis: 100%;
792
+ color: var(--sm-player-muted, #59635d);
793
+ }
794
+ .sm-listening-library button,
795
+ .sm-listening-library select {
796
+ color: inherit;
797
+ background: transparent;
798
+ border: 1px solid var(--sm-player-line, #d8ded9);
799
+ border-radius: 8px;
800
+ padding: 9px 12px;
801
+ font: inherit;
802
+ cursor: pointer;
803
+ min-height: 44px;
804
+ }
805
+ .sm-listening-library button:focus-visible,
806
+ .sm-listening-library summary:focus-visible,
807
+ .sm-listening-library select:focus-visible {
808
+ outline: 2px solid var(--sm-player-accent, #c91421);
809
+ outline-offset: 3px;
810
+ }
811
+ .sm-listening-library__catchup > button {
812
+ background: var(--sm-player-accent, #c91421);
813
+ color: white;
814
+ border-color: transparent;
815
+ }
816
+ .sm-listening-library__option {
817
+ display: flex;
818
+ align-items: center;
819
+ gap: 10px;
820
+ margin: 10px 0;
821
+ }
822
+ .sm-listening-library__option input {
823
+ accent-color: var(--sm-player-accent, #c91421);
824
+ width: 18px;
825
+ height: 18px;
826
+ }
827
+ .sm-listening-library h3 {
828
+ font: 600 20px/1.3 var(--sm-player-serif, var(--font-editorial, Georgia));
829
+ margin: 24px 0 10px;
830
+ }
831
+ .sm-listening-library ol {
832
+ list-style: none;
833
+ margin: 0 0 12px;
834
+ padding: 0;
835
+ }
836
+ .sm-listening-library li {
837
+ display: flex;
838
+ align-items: center;
839
+ justify-content: space-between;
840
+ gap: 12px;
841
+ padding: 8px 0;
842
+ border-bottom: 1px solid var(--sm-player-line, #d8ded9);
843
+ }
844
+ .sm-listening-library li > :first-child {
845
+ flex: 1;
846
+ text-align: left;
847
+ overflow-wrap: anywhere;
848
+ }
849
+ .sm-listening-library li > button:first-child {
850
+ border: 0;
851
+ }
852
+ .sm-listening-library li > button:last-child {
853
+ flex-shrink: 0;
854
+ }
855
+ .sm-network-player__tools input[type=checkbox] {
856
+ width: 18px;
857
+ }
package/dist/audio.d.mts CHANGED
@@ -139,6 +139,23 @@ interface NetworkAudioTrack {
139
139
  title: string;
140
140
  publicationName?: string;
141
141
  articleUrl: string;
142
+ /** Stable canonical story URL/ID shared by syndicated editions. */
143
+ storyId?: string;
144
+ /** An editorial revision, never a routine database updated_at value. */
145
+ revision?: string;
146
+ durationSeconds?: number;
147
+ section?: string;
148
+ publishedAt?: string;
149
+ automatic?: boolean;
150
+ }
151
+ interface ListeningRecord {
152
+ track: NetworkAudioTrack;
153
+ position: number;
154
+ duration: number;
155
+ ranges: [number, number][];
156
+ updatedAt: number;
157
+ completedAt?: number;
158
+ skippedAt?: number;
142
159
  }
143
160
  interface NetworkAudioSnapshot {
144
161
  queue: readonly NetworkAudioTrack[];
@@ -149,6 +166,13 @@ interface NetworkAudioSnapshot {
149
166
  volume: number;
150
167
  status: 'idle' | 'loading' | 'playing' | 'paused' | 'error';
151
168
  error: string | null;
169
+ history?: readonly ListeningRecord[];
170
+ autoplayNext?: boolean;
171
+ allowRepeats?: boolean;
172
+ hidden?: boolean;
173
+ historyClearedAt?: number;
174
+ settingsUpdatedAt?: number;
175
+ sessionMinutes?: number;
152
176
  }
153
177
  type ResolveNetworkAudio = (track: NetworkAudioTrack, signal: AbortSignal) => Promise<AudioPlayerSource>;
154
178
  /** One audio element per persistent layout. Safe to construct during SSR; attach on mount. */
@@ -164,6 +188,15 @@ declare class NetworkAudioController {
164
188
  private source;
165
189
  private refreshed;
166
190
  private resumePosition;
191
+ mergeListeningMemory(memory: {
192
+ rate: number;
193
+ autoplayNext: boolean;
194
+ allowRepeats: boolean;
195
+ settingsUpdatedAt: number;
196
+ historyClearedAt: number;
197
+ history: ListeningRecord[];
198
+ }): void;
199
+ private candidates;
167
200
  constructor(resolve: ResolveNetworkAudio);
168
201
  setResolver(resolve: ResolveNetworkAudio): void;
169
202
  getSnapshot: () => NetworkAudioSnapshot;
@@ -178,6 +211,17 @@ declare class NetworkAudioController {
178
211
  private cancel;
179
212
  pause(): void;
180
213
  clear(): void;
214
+ close(): void;
215
+ setAutoplay(value: boolean): void;
216
+ setRepeats(value: boolean): void;
217
+ forgetHistory(): void;
218
+ restart(): void;
219
+ skip(): void;
220
+ private remember;
221
+ private finish;
222
+ setRecommendations(tracks: NetworkAudioTrack[]): void;
223
+ /** Manual selections retain their order; recommendations are bounded and never replace them. */
224
+ catchUp(minutes?: number): void;
181
225
  seek(position: number): void;
182
226
  setRate(rate: number): void;
183
227
  setVolume(volume: number): void;
@@ -190,7 +234,13 @@ declare class NetworkAudioController {
190
234
  }
191
235
 
192
236
  type NetworkAudioCommand = {
193
- action: 'play' | 'pause' | 'clear';
237
+ action: 'play' | 'pause' | 'clear' | 'close' | 'skip' | 'restart' | 'forgetHistory';
238
+ } | {
239
+ action: 'autoplay' | 'repeats';
240
+ value: boolean;
241
+ } | {
242
+ action: 'catchUp';
243
+ value: number;
194
244
  } | {
195
245
  action: 'select' | 'remove' | 'seek' | 'rate' | 'volume';
196
246
  value: number;
@@ -210,6 +260,16 @@ interface NetworkPlayerHostOptions {
210
260
  allowedOrigins: readonly string[];
211
261
  }
212
262
 
263
+ interface ListeningPersistence {
264
+ /** Network and reader scope. Change this on account changes. */
265
+ storageKey: string;
266
+ networkId: string;
267
+ /** New player windows adopt the opener queue instead of restoring an older host queue. */
268
+ restoreQueue?: boolean;
269
+ hubUrl?: string;
270
+ allowedOrigins: readonly string[];
271
+ }
272
+
213
273
  interface NetworkAudioProviderProps {
214
274
  children: ReactNode;
215
275
  /** Resolve through your reader-authorized server route, including publication identity. */
@@ -220,6 +280,8 @@ interface NetworkAudioProviderProps {
220
280
  host?: NetworkPlayerHostOptions;
221
281
  /** Optional sessionStorage checkpoint. Scope by application/network and user; honor consent. Restores paused. */
222
282
  checkpointStorageKey?: string;
283
+ persistence?: ListeningPersistence;
284
+ loadRecommendations?: (signal: AbortSignal) => Promise<NetworkAudioTrack[]>;
223
285
  }
224
286
  interface NetworkAudioContextValue {
225
287
  snapshot: NetworkAudioSnapshot;
@@ -231,9 +293,11 @@ interface NetworkAudioContextValue {
231
293
  highlightAvailable: boolean;
232
294
  highlightEnabled: boolean;
233
295
  setHighlightEnabled: (enabled: boolean) => void;
296
+ catchUp?: (minutes: number) => Promise<void>;
297
+ recommendationsLoading: boolean;
234
298
  }
235
299
  /** Mount once in a persistent root layout, outside route keys/templates. */
236
- declare function NetworkAudioProvider({ children, resolveAudio, connection, host, checkpointStorageKey }: NetworkAudioProviderProps): react_jsx_runtime.JSX.Element;
300
+ declare function NetworkAudioProvider({ children, resolveAudio, connection, host, checkpointStorageKey, persistence, loadRecommendations }: NetworkAudioProviderProps): react_jsx_runtime.JSX.Element;
237
301
  declare function useNetworkAudio(): NetworkAudioContextValue;
238
302
  /** Attach in the article component. Unmount/hidden tab clears only highlighting, never playback. */
239
303
  declare function useArticleNarration(track: NetworkAudioTrack, narration?: AudioPlayerNarration): {
@@ -262,5 +326,9 @@ interface NetworkAudioPlayerProps {
262
326
  renderArticleLink?: (track: NetworkAudioTrack) => ReactNode;
263
327
  }
264
328
  declare function NetworkAudioPlayer({ networkName, advertisement, className, style, fixed, renderArticleLink }: NetworkAudioPlayerProps): react_jsx_runtime.JSX.Element | null;
329
+ /** Shared, compact library: available even when the player is hidden or the queue is empty. */
330
+ declare function ListeningLibrary({ open }: {
331
+ open?: boolean;
332
+ }): react_jsx_runtime.JSX.Element;
265
333
 
266
- export { ArticleAudioControls, type ArticleAudioControlsProps, AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, NarrationHighlighter, type NarrationTimings, type NetworkAudioCommand, type NetworkAudioContextValue, NetworkAudioController, NetworkAudioPlayer, type NetworkAudioPlayerProps, NetworkAudioProvider, type NetworkAudioProviderProps, type NetworkAudioSnapshot, type NetworkAudioTrack, type NetworkPlayerConnection, type NetworkPlayerHostOptions, type ResolveNetworkAudio, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
334
+ export { ArticleAudioControls, type ArticleAudioControlsProps, AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, ListeningLibrary, type ListeningPersistence, NarrationHighlighter, type NarrationTimings, type NetworkAudioCommand, type NetworkAudioContextValue, NetworkAudioController, NetworkAudioPlayer, type NetworkAudioPlayerProps, NetworkAudioProvider, type NetworkAudioProviderProps, type NetworkAudioSnapshot, type NetworkAudioTrack, type NetworkPlayerConnection, type NetworkPlayerHostOptions, type ResolveNetworkAudio, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
package/dist/audio.d.ts CHANGED
@@ -139,6 +139,23 @@ interface NetworkAudioTrack {
139
139
  title: string;
140
140
  publicationName?: string;
141
141
  articleUrl: string;
142
+ /** Stable canonical story URL/ID shared by syndicated editions. */
143
+ storyId?: string;
144
+ /** An editorial revision, never a routine database updated_at value. */
145
+ revision?: string;
146
+ durationSeconds?: number;
147
+ section?: string;
148
+ publishedAt?: string;
149
+ automatic?: boolean;
150
+ }
151
+ interface ListeningRecord {
152
+ track: NetworkAudioTrack;
153
+ position: number;
154
+ duration: number;
155
+ ranges: [number, number][];
156
+ updatedAt: number;
157
+ completedAt?: number;
158
+ skippedAt?: number;
142
159
  }
143
160
  interface NetworkAudioSnapshot {
144
161
  queue: readonly NetworkAudioTrack[];
@@ -149,6 +166,13 @@ interface NetworkAudioSnapshot {
149
166
  volume: number;
150
167
  status: 'idle' | 'loading' | 'playing' | 'paused' | 'error';
151
168
  error: string | null;
169
+ history?: readonly ListeningRecord[];
170
+ autoplayNext?: boolean;
171
+ allowRepeats?: boolean;
172
+ hidden?: boolean;
173
+ historyClearedAt?: number;
174
+ settingsUpdatedAt?: number;
175
+ sessionMinutes?: number;
152
176
  }
153
177
  type ResolveNetworkAudio = (track: NetworkAudioTrack, signal: AbortSignal) => Promise<AudioPlayerSource>;
154
178
  /** One audio element per persistent layout. Safe to construct during SSR; attach on mount. */
@@ -164,6 +188,15 @@ declare class NetworkAudioController {
164
188
  private source;
165
189
  private refreshed;
166
190
  private resumePosition;
191
+ mergeListeningMemory(memory: {
192
+ rate: number;
193
+ autoplayNext: boolean;
194
+ allowRepeats: boolean;
195
+ settingsUpdatedAt: number;
196
+ historyClearedAt: number;
197
+ history: ListeningRecord[];
198
+ }): void;
199
+ private candidates;
167
200
  constructor(resolve: ResolveNetworkAudio);
168
201
  setResolver(resolve: ResolveNetworkAudio): void;
169
202
  getSnapshot: () => NetworkAudioSnapshot;
@@ -178,6 +211,17 @@ declare class NetworkAudioController {
178
211
  private cancel;
179
212
  pause(): void;
180
213
  clear(): void;
214
+ close(): void;
215
+ setAutoplay(value: boolean): void;
216
+ setRepeats(value: boolean): void;
217
+ forgetHistory(): void;
218
+ restart(): void;
219
+ skip(): void;
220
+ private remember;
221
+ private finish;
222
+ setRecommendations(tracks: NetworkAudioTrack[]): void;
223
+ /** Manual selections retain their order; recommendations are bounded and never replace them. */
224
+ catchUp(minutes?: number): void;
181
225
  seek(position: number): void;
182
226
  setRate(rate: number): void;
183
227
  setVolume(volume: number): void;
@@ -190,7 +234,13 @@ declare class NetworkAudioController {
190
234
  }
191
235
 
192
236
  type NetworkAudioCommand = {
193
- action: 'play' | 'pause' | 'clear';
237
+ action: 'play' | 'pause' | 'clear' | 'close' | 'skip' | 'restart' | 'forgetHistory';
238
+ } | {
239
+ action: 'autoplay' | 'repeats';
240
+ value: boolean;
241
+ } | {
242
+ action: 'catchUp';
243
+ value: number;
194
244
  } | {
195
245
  action: 'select' | 'remove' | 'seek' | 'rate' | 'volume';
196
246
  value: number;
@@ -210,6 +260,16 @@ interface NetworkPlayerHostOptions {
210
260
  allowedOrigins: readonly string[];
211
261
  }
212
262
 
263
+ interface ListeningPersistence {
264
+ /** Network and reader scope. Change this on account changes. */
265
+ storageKey: string;
266
+ networkId: string;
267
+ /** New player windows adopt the opener queue instead of restoring an older host queue. */
268
+ restoreQueue?: boolean;
269
+ hubUrl?: string;
270
+ allowedOrigins: readonly string[];
271
+ }
272
+
213
273
  interface NetworkAudioProviderProps {
214
274
  children: ReactNode;
215
275
  /** Resolve through your reader-authorized server route, including publication identity. */
@@ -220,6 +280,8 @@ interface NetworkAudioProviderProps {
220
280
  host?: NetworkPlayerHostOptions;
221
281
  /** Optional sessionStorage checkpoint. Scope by application/network and user; honor consent. Restores paused. */
222
282
  checkpointStorageKey?: string;
283
+ persistence?: ListeningPersistence;
284
+ loadRecommendations?: (signal: AbortSignal) => Promise<NetworkAudioTrack[]>;
223
285
  }
224
286
  interface NetworkAudioContextValue {
225
287
  snapshot: NetworkAudioSnapshot;
@@ -231,9 +293,11 @@ interface NetworkAudioContextValue {
231
293
  highlightAvailable: boolean;
232
294
  highlightEnabled: boolean;
233
295
  setHighlightEnabled: (enabled: boolean) => void;
296
+ catchUp?: (minutes: number) => Promise<void>;
297
+ recommendationsLoading: boolean;
234
298
  }
235
299
  /** Mount once in a persistent root layout, outside route keys/templates. */
236
- declare function NetworkAudioProvider({ children, resolveAudio, connection, host, checkpointStorageKey }: NetworkAudioProviderProps): react_jsx_runtime.JSX.Element;
300
+ declare function NetworkAudioProvider({ children, resolveAudio, connection, host, checkpointStorageKey, persistence, loadRecommendations }: NetworkAudioProviderProps): react_jsx_runtime.JSX.Element;
237
301
  declare function useNetworkAudio(): NetworkAudioContextValue;
238
302
  /** Attach in the article component. Unmount/hidden tab clears only highlighting, never playback. */
239
303
  declare function useArticleNarration(track: NetworkAudioTrack, narration?: AudioPlayerNarration): {
@@ -262,5 +326,9 @@ interface NetworkAudioPlayerProps {
262
326
  renderArticleLink?: (track: NetworkAudioTrack) => ReactNode;
263
327
  }
264
328
  declare function NetworkAudioPlayer({ networkName, advertisement, className, style, fixed, renderArticleLink }: NetworkAudioPlayerProps): react_jsx_runtime.JSX.Element | null;
329
+ /** Shared, compact library: available even when the player is hidden or the queue is empty. */
330
+ declare function ListeningLibrary({ open }: {
331
+ open?: boolean;
332
+ }): react_jsx_runtime.JSX.Element;
265
333
 
266
- export { ArticleAudioControls, type ArticleAudioControlsProps, AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, NarrationHighlighter, type NarrationTimings, type NetworkAudioCommand, type NetworkAudioContextValue, NetworkAudioController, NetworkAudioPlayer, type NetworkAudioPlayerProps, NetworkAudioProvider, type NetworkAudioProviderProps, type NetworkAudioSnapshot, type NetworkAudioTrack, type NetworkPlayerConnection, type NetworkPlayerHostOptions, type ResolveNetworkAudio, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
334
+ export { ArticleAudioControls, type ArticleAudioControlsProps, AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, ListeningLibrary, type ListeningPersistence, NarrationHighlighter, type NarrationTimings, type NetworkAudioCommand, type NetworkAudioContextValue, NetworkAudioController, NetworkAudioPlayer, type NetworkAudioPlayerProps, NetworkAudioProvider, type NetworkAudioProviderProps, type NetworkAudioSnapshot, type NetworkAudioTrack, type NetworkPlayerConnection, type NetworkPlayerHostOptions, type ResolveNetworkAudio, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };