@scalemule/nextjs 0.1.55 → 0.1.57

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
@@ -296,12 +296,21 @@
296
296
  flex: 0 0 20px;
297
297
  }
298
298
  .sm-network-player__row {
299
+ position: relative;
299
300
  display: flex;
300
301
  align-items: center;
301
302
  gap: 20px;
302
303
  max-width: 1320px;
303
304
  margin: auto;
304
305
  }
306
+ .sm-network-player .sm-network-player__close {
307
+ flex: 0 0 44px;
308
+ width: 44px;
309
+ height: 44px;
310
+ padding: 0;
311
+ border-color: transparent;
312
+ color: var(--sm-player-muted);
313
+ }
305
314
  .sm-network-player .sm-network-player__play,
306
315
  .sm-network-article__disc {
307
316
  width: 48px;
@@ -655,6 +664,12 @@
655
664
  }
656
665
  .sm-network-player__story {
657
666
  flex: 1 1 calc(100% - 60px);
667
+ padding-right: 56px;
668
+ }
669
+ .sm-network-player .sm-network-player__close {
670
+ position: absolute;
671
+ top: 2px;
672
+ right: 0;
658
673
  }
659
674
  .sm-network-player__story a {
660
675
  font-size: 17px;
@@ -744,3 +759,99 @@
744
759
  background: ButtonText;
745
760
  }
746
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,14 @@ 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
+ hubUrl?: string;
268
+ allowedOrigins: readonly string[];
269
+ }
270
+
213
271
  interface NetworkAudioProviderProps {
214
272
  children: ReactNode;
215
273
  /** Resolve through your reader-authorized server route, including publication identity. */
@@ -220,6 +278,8 @@ interface NetworkAudioProviderProps {
220
278
  host?: NetworkPlayerHostOptions;
221
279
  /** Optional sessionStorage checkpoint. Scope by application/network and user; honor consent. Restores paused. */
222
280
  checkpointStorageKey?: string;
281
+ persistence?: ListeningPersistence;
282
+ loadRecommendations?: (signal: AbortSignal) => Promise<NetworkAudioTrack[]>;
223
283
  }
224
284
  interface NetworkAudioContextValue {
225
285
  snapshot: NetworkAudioSnapshot;
@@ -231,9 +291,11 @@ interface NetworkAudioContextValue {
231
291
  highlightAvailable: boolean;
232
292
  highlightEnabled: boolean;
233
293
  setHighlightEnabled: (enabled: boolean) => void;
294
+ catchUp?: (minutes: number) => Promise<void>;
295
+ recommendationsLoading: boolean;
234
296
  }
235
297
  /** 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;
298
+ declare function NetworkAudioProvider({ children, resolveAudio, connection, host, checkpointStorageKey, persistence, loadRecommendations }: NetworkAudioProviderProps): react_jsx_runtime.JSX.Element;
237
299
  declare function useNetworkAudio(): NetworkAudioContextValue;
238
300
  /** Attach in the article component. Unmount/hidden tab clears only highlighting, never playback. */
239
301
  declare function useArticleNarration(track: NetworkAudioTrack, narration?: AudioPlayerNarration): {
@@ -262,5 +324,9 @@ interface NetworkAudioPlayerProps {
262
324
  renderArticleLink?: (track: NetworkAudioTrack) => ReactNode;
263
325
  }
264
326
  declare function NetworkAudioPlayer({ networkName, advertisement, className, style, fixed, renderArticleLink }: NetworkAudioPlayerProps): react_jsx_runtime.JSX.Element | null;
327
+ /** Shared, compact library: available even when the player is hidden or the queue is empty. */
328
+ declare function ListeningLibrary({ open }: {
329
+ open?: boolean;
330
+ }): react_jsx_runtime.JSX.Element;
265
331
 
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 };
332
+ 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,14 @@ 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
+ hubUrl?: string;
268
+ allowedOrigins: readonly string[];
269
+ }
270
+
213
271
  interface NetworkAudioProviderProps {
214
272
  children: ReactNode;
215
273
  /** Resolve through your reader-authorized server route, including publication identity. */
@@ -220,6 +278,8 @@ interface NetworkAudioProviderProps {
220
278
  host?: NetworkPlayerHostOptions;
221
279
  /** Optional sessionStorage checkpoint. Scope by application/network and user; honor consent. Restores paused. */
222
280
  checkpointStorageKey?: string;
281
+ persistence?: ListeningPersistence;
282
+ loadRecommendations?: (signal: AbortSignal) => Promise<NetworkAudioTrack[]>;
223
283
  }
224
284
  interface NetworkAudioContextValue {
225
285
  snapshot: NetworkAudioSnapshot;
@@ -231,9 +291,11 @@ interface NetworkAudioContextValue {
231
291
  highlightAvailable: boolean;
232
292
  highlightEnabled: boolean;
233
293
  setHighlightEnabled: (enabled: boolean) => void;
294
+ catchUp?: (minutes: number) => Promise<void>;
295
+ recommendationsLoading: boolean;
234
296
  }
235
297
  /** 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;
298
+ declare function NetworkAudioProvider({ children, resolveAudio, connection, host, checkpointStorageKey, persistence, loadRecommendations }: NetworkAudioProviderProps): react_jsx_runtime.JSX.Element;
237
299
  declare function useNetworkAudio(): NetworkAudioContextValue;
238
300
  /** Attach in the article component. Unmount/hidden tab clears only highlighting, never playback. */
239
301
  declare function useArticleNarration(track: NetworkAudioTrack, narration?: AudioPlayerNarration): {
@@ -262,5 +324,9 @@ interface NetworkAudioPlayerProps {
262
324
  renderArticleLink?: (track: NetworkAudioTrack) => ReactNode;
263
325
  }
264
326
  declare function NetworkAudioPlayer({ networkName, advertisement, className, style, fixed, renderArticleLink }: NetworkAudioPlayerProps): react_jsx_runtime.JSX.Element | null;
327
+ /** Shared, compact library: available even when the player is hidden or the queue is empty. */
328
+ declare function ListeningLibrary({ open }: {
329
+ open?: boolean;
330
+ }): react_jsx_runtime.JSX.Element;
265
331
 
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 };
332
+ 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 };