@scalemule/nextjs 0.1.46 → 0.1.48
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 +2 -1
- package/dist/audio.d.mts +5 -0
- package/dist/audio.d.ts +5 -0
- package/dist/audio.js +11 -13
- package/dist/audio.mjs +13 -14
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -44
- package/dist/index.mjs +13 -44
- package/package.json +1 -1
package/dist/audio.css
CHANGED
package/dist/audio.d.mts
CHANGED
|
@@ -42,6 +42,11 @@ interface AudioPlayerProps {
|
|
|
42
42
|
preload?: 'none' | 'metadata';
|
|
43
43
|
/** Called at most once automatically per play attempt. Honor signal to cancel network work. */
|
|
44
44
|
onRefresh?: (signal: AbortSignal) => Promise<AudioPlayerSource>;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated No-op. Players never show a manual Refresh control: expired
|
|
47
|
+
* URLs are refreshed silently through `onRefresh`. Kept so existing callers
|
|
48
|
+
* still compile.
|
|
49
|
+
*/
|
|
45
50
|
showRefreshButton?: boolean;
|
|
46
51
|
onPlaybackError?: () => void;
|
|
47
52
|
/** Shared with the existing ScaleMule blog player. Set null to disable persistence. */
|
package/dist/audio.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ interface AudioPlayerProps {
|
|
|
42
42
|
preload?: 'none' | 'metadata';
|
|
43
43
|
/** Called at most once automatically per play attempt. Honor signal to cancel network work. */
|
|
44
44
|
onRefresh?: (signal: AbortSignal) => Promise<AudioPlayerSource>;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated No-op. Players never show a manual Refresh control: expired
|
|
47
|
+
* URLs are refreshed silently through `onRefresh`. Kept so existing callers
|
|
48
|
+
* still compile.
|
|
49
|
+
*/
|
|
45
50
|
showRefreshButton?: boolean;
|
|
46
51
|
onPlaybackError?: () => void;
|
|
47
52
|
/** Shared with the existing ScaleMule blog player. Set null to disable persistence. */
|
package/dist/audio.js
CHANGED
|
@@ -343,6 +343,8 @@ function parseTimingsPayload(body) {
|
|
|
343
343
|
|
|
344
344
|
// src/components/audio-player.tsx
|
|
345
345
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
346
|
+
var subscribeNever = () => () => {
|
|
347
|
+
};
|
|
346
348
|
var SPEEDS = [1, 1.25, 1.5, 2, 3];
|
|
347
349
|
var PLAY_EVENT = "scalemule:audio:play";
|
|
348
350
|
var HIGHLIGHT_PREF_KEY = "scalemule:audio:highlight";
|
|
@@ -364,7 +366,6 @@ function PlayerSession({
|
|
|
364
366
|
style,
|
|
365
367
|
preload = "none",
|
|
366
368
|
onRefresh,
|
|
367
|
-
showRefreshButton = false,
|
|
368
369
|
onPlaybackError,
|
|
369
370
|
playbackRateStorageKey = "scalemule:audio:playback-rate",
|
|
370
371
|
exclusivePlayback = true,
|
|
@@ -387,7 +388,14 @@ function PlayerSession({
|
|
|
387
388
|
const sliderId = (0, import_react.useId)();
|
|
388
389
|
const labelId = (0, import_react.useId)();
|
|
389
390
|
const rate = (0, import_react.useRef)(1);
|
|
390
|
-
const
|
|
391
|
+
const highlightSupported = (0, import_react.useSyncExternalStore)(
|
|
392
|
+
subscribeNever,
|
|
393
|
+
narrationHighlightSupported,
|
|
394
|
+
// The server can't detect support; render the toggle only after
|
|
395
|
+
// hydration so server and client markup always match.
|
|
396
|
+
() => false
|
|
397
|
+
);
|
|
398
|
+
const narrationOffered = !!narration && audio.has_word_timings !== false && highlightSupported;
|
|
391
399
|
const [highlightOn, setHighlightOn] = (0, import_react.useState)(false);
|
|
392
400
|
const [highlightBusy, setHighlightBusy] = (0, import_react.useState)(false);
|
|
393
401
|
const highlighter = (0, import_react.useRef)(null);
|
|
@@ -780,19 +788,9 @@ function PlayerSession({
|
|
|
780
788
|
"\xD7"
|
|
781
789
|
]
|
|
782
790
|
}
|
|
783
|
-
),
|
|
784
|
-
onRefresh && showRefreshButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
785
|
-
"button",
|
|
786
|
-
{
|
|
787
|
-
type: "button",
|
|
788
|
-
className: "sm-audio__refresh",
|
|
789
|
-
disabled: busy,
|
|
790
|
-
onClick: () => void recover(true),
|
|
791
|
-
children: "Refresh"
|
|
792
|
-
}
|
|
793
791
|
)
|
|
794
792
|
] }),
|
|
795
|
-
(busy || error) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "sm-audio__status", role: "status", children: busy ? "
|
|
793
|
+
(busy || error) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "sm-audio__status", role: "status", children: busy ? "Loading audio\u2026" : error })
|
|
796
794
|
]
|
|
797
795
|
}
|
|
798
796
|
);
|
package/dist/audio.mjs
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
useId,
|
|
8
8
|
useMemo,
|
|
9
9
|
useRef,
|
|
10
|
-
useState
|
|
10
|
+
useState,
|
|
11
|
+
useSyncExternalStore
|
|
11
12
|
} from "react";
|
|
12
13
|
|
|
13
14
|
// src/components/narration-highlight.ts
|
|
@@ -319,6 +320,8 @@ function parseTimingsPayload(body) {
|
|
|
319
320
|
|
|
320
321
|
// src/components/audio-player.tsx
|
|
321
322
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
323
|
+
var subscribeNever = () => () => {
|
|
324
|
+
};
|
|
322
325
|
var SPEEDS = [1, 1.25, 1.5, 2, 3];
|
|
323
326
|
var PLAY_EVENT = "scalemule:audio:play";
|
|
324
327
|
var HIGHLIGHT_PREF_KEY = "scalemule:audio:highlight";
|
|
@@ -340,7 +343,6 @@ function PlayerSession({
|
|
|
340
343
|
style,
|
|
341
344
|
preload = "none",
|
|
342
345
|
onRefresh,
|
|
343
|
-
showRefreshButton = false,
|
|
344
346
|
onPlaybackError,
|
|
345
347
|
playbackRateStorageKey = "scalemule:audio:playback-rate",
|
|
346
348
|
exclusivePlayback = true,
|
|
@@ -363,7 +365,14 @@ function PlayerSession({
|
|
|
363
365
|
const sliderId = useId();
|
|
364
366
|
const labelId = useId();
|
|
365
367
|
const rate = useRef(1);
|
|
366
|
-
const
|
|
368
|
+
const highlightSupported = useSyncExternalStore(
|
|
369
|
+
subscribeNever,
|
|
370
|
+
narrationHighlightSupported,
|
|
371
|
+
// The server can't detect support; render the toggle only after
|
|
372
|
+
// hydration so server and client markup always match.
|
|
373
|
+
() => false
|
|
374
|
+
);
|
|
375
|
+
const narrationOffered = !!narration && audio.has_word_timings !== false && highlightSupported;
|
|
367
376
|
const [highlightOn, setHighlightOn] = useState(false);
|
|
368
377
|
const [highlightBusy, setHighlightBusy] = useState(false);
|
|
369
378
|
const highlighter = useRef(null);
|
|
@@ -756,19 +765,9 @@ function PlayerSession({
|
|
|
756
765
|
"\xD7"
|
|
757
766
|
]
|
|
758
767
|
}
|
|
759
|
-
),
|
|
760
|
-
onRefresh && showRefreshButton && /* @__PURE__ */ jsx(
|
|
761
|
-
"button",
|
|
762
|
-
{
|
|
763
|
-
type: "button",
|
|
764
|
-
className: "sm-audio__refresh",
|
|
765
|
-
disabled: busy,
|
|
766
|
-
onClick: () => void recover(true),
|
|
767
|
-
children: "Refresh"
|
|
768
|
-
}
|
|
769
768
|
)
|
|
770
769
|
] }),
|
|
771
|
-
(busy || error) && /* @__PURE__ */ jsx("p", { className: "sm-audio__status", role: "status", children: busy ? "
|
|
770
|
+
(busy || error) && /* @__PURE__ */ jsx("p", { className: "sm-audio__status", role: "status", children: busy ? "Loading audio\u2026" : error })
|
|
772
771
|
]
|
|
773
772
|
}
|
|
774
773
|
);
|
package/dist/index.d.mts
CHANGED
|
@@ -486,10 +486,11 @@ interface NarrationPlayerProps {
|
|
|
486
486
|
narrationLabel?: string;
|
|
487
487
|
refreshing?: boolean;
|
|
488
488
|
onRefresh?: () => void | Promise<void>;
|
|
489
|
+
/** @deprecated No-op: no manual Refresh control is ever shown. */
|
|
489
490
|
showRefreshButton?: boolean;
|
|
490
491
|
onPlaybackError?: () => void;
|
|
491
492
|
}
|
|
492
|
-
declare function NarrationPlayer({ audio, className, providerLabel, narrationLabel, refreshing, onRefresh,
|
|
493
|
+
declare function NarrationPlayer({ audio, className, providerLabel, narrationLabel, refreshing, onRefresh, onPlaybackError, }: NarrationPlayerProps): react_jsx_runtime.JSX.Element | null;
|
|
493
494
|
|
|
494
495
|
/**
|
|
495
496
|
* Conversation kinds recognized by the chat realtime channel naming scheme.
|
package/dist/index.d.ts
CHANGED
|
@@ -486,10 +486,11 @@ interface NarrationPlayerProps {
|
|
|
486
486
|
narrationLabel?: string;
|
|
487
487
|
refreshing?: boolean;
|
|
488
488
|
onRefresh?: () => void | Promise<void>;
|
|
489
|
+
/** @deprecated No-op: no manual Refresh control is ever shown. */
|
|
489
490
|
showRefreshButton?: boolean;
|
|
490
491
|
onPlaybackError?: () => void;
|
|
491
492
|
}
|
|
492
|
-
declare function NarrationPlayer({ audio, className, providerLabel, narrationLabel, refreshing, onRefresh,
|
|
493
|
+
declare function NarrationPlayer({ audio, className, providerLabel, narrationLabel, refreshing, onRefresh, onPlaybackError, }: NarrationPlayerProps): react_jsx_runtime.JSX.Element | null;
|
|
493
494
|
|
|
494
495
|
/**
|
|
495
496
|
* Conversation kinds recognized by the chat realtime channel naming scheme.
|
package/dist/index.js
CHANGED
|
@@ -2979,19 +2979,7 @@ var styles = {
|
|
|
2979
2979
|
color: "#334155",
|
|
2980
2980
|
boxShadow: "0 1px 3px rgba(15, 23, 42, 0.08)",
|
|
2981
2981
|
cursor: "pointer"
|
|
2982
|
-
}
|
|
2983
|
-
refreshButton: {
|
|
2984
|
-
borderRadius: "9999px",
|
|
2985
|
-
border: "1px solid #cad5e2",
|
|
2986
|
-
backgroundColor: "rgba(255, 255, 255, 0.75)",
|
|
2987
|
-
padding: "0.5rem 1rem",
|
|
2988
|
-
fontSize: "0.875rem",
|
|
2989
|
-
fontWeight: 600,
|
|
2990
|
-
color: "#334155",
|
|
2991
|
-
cursor: "pointer"
|
|
2992
|
-
},
|
|
2993
|
-
disabled: { cursor: "not-allowed", opacity: 0.6 }
|
|
2994
|
-
};
|
|
2982
|
+
}};
|
|
2995
2983
|
function NarrationPlayer({
|
|
2996
2984
|
audio,
|
|
2997
2985
|
className,
|
|
@@ -2999,7 +2987,6 @@ function NarrationPlayer({
|
|
|
2999
2987
|
narrationLabel = "AI-Narrated",
|
|
3000
2988
|
refreshing = false,
|
|
3001
2989
|
onRefresh,
|
|
3002
|
-
showRefreshButton = false,
|
|
3003
2990
|
onPlaybackError
|
|
3004
2991
|
}) {
|
|
3005
2992
|
const audioRef = React.useRef(null);
|
|
@@ -3130,12 +3117,6 @@ function NarrationPlayer({
|
|
|
3130
3117
|
break;
|
|
3131
3118
|
}
|
|
3132
3119
|
}
|
|
3133
|
-
function handleManualRefresh() {
|
|
3134
|
-
if (!onRefresh || refreshing) return;
|
|
3135
|
-
Promise.resolve(onRefresh()).catch(() => {
|
|
3136
|
-
onPlaybackError?.();
|
|
3137
|
-
});
|
|
3138
|
-
}
|
|
3139
3120
|
const progress = duration > 0 ? Math.min(1, currentTime / duration) : 0;
|
|
3140
3121
|
const expiresLabel = audio.expires_at ? new Date(audio.expires_at).toLocaleTimeString([], {
|
|
3141
3122
|
hour: "numeric",
|
|
@@ -3258,30 +3239,18 @@ function NarrationPlayer({
|
|
|
3258
3239
|
] })
|
|
3259
3240
|
] })
|
|
3260
3241
|
] }),
|
|
3261
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
),
|
|
3274
|
-
onRefresh && showRefreshButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3275
|
-
"button",
|
|
3276
|
-
{
|
|
3277
|
-
type: "button",
|
|
3278
|
-
onClick: handleManualRefresh,
|
|
3279
|
-
disabled: refreshing,
|
|
3280
|
-
style: refreshing ? { ...styles.refreshButton, ...styles.disabled } : styles.refreshButton,
|
|
3281
|
-
children: refreshing ? "Refreshing\u2026" : "Refresh"
|
|
3282
|
-
}
|
|
3283
|
-
)
|
|
3284
|
-
] })
|
|
3242
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.controls, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3243
|
+
"button",
|
|
3244
|
+
{
|
|
3245
|
+
type: "button",
|
|
3246
|
+
onClick: () => setSpeed((currentSpeed) => getNextSpeed(currentSpeed)),
|
|
3247
|
+
style: styles.secondaryButton,
|
|
3248
|
+
children: [
|
|
3249
|
+
speed,
|
|
3250
|
+
"\xD7"
|
|
3251
|
+
]
|
|
3252
|
+
}
|
|
3253
|
+
) })
|
|
3285
3254
|
] })
|
|
3286
3255
|
] });
|
|
3287
3256
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2959,19 +2959,7 @@ var styles = {
|
|
|
2959
2959
|
color: "#334155",
|
|
2960
2960
|
boxShadow: "0 1px 3px rgba(15, 23, 42, 0.08)",
|
|
2961
2961
|
cursor: "pointer"
|
|
2962
|
-
}
|
|
2963
|
-
refreshButton: {
|
|
2964
|
-
borderRadius: "9999px",
|
|
2965
|
-
border: "1px solid #cad5e2",
|
|
2966
|
-
backgroundColor: "rgba(255, 255, 255, 0.75)",
|
|
2967
|
-
padding: "0.5rem 1rem",
|
|
2968
|
-
fontSize: "0.875rem",
|
|
2969
|
-
fontWeight: 600,
|
|
2970
|
-
color: "#334155",
|
|
2971
|
-
cursor: "pointer"
|
|
2972
|
-
},
|
|
2973
|
-
disabled: { cursor: "not-allowed", opacity: 0.6 }
|
|
2974
|
-
};
|
|
2962
|
+
}};
|
|
2975
2963
|
function NarrationPlayer({
|
|
2976
2964
|
audio,
|
|
2977
2965
|
className,
|
|
@@ -2979,7 +2967,6 @@ function NarrationPlayer({
|
|
|
2979
2967
|
narrationLabel = "AI-Narrated",
|
|
2980
2968
|
refreshing = false,
|
|
2981
2969
|
onRefresh,
|
|
2982
|
-
showRefreshButton = false,
|
|
2983
2970
|
onPlaybackError
|
|
2984
2971
|
}) {
|
|
2985
2972
|
const audioRef = useRef(null);
|
|
@@ -3110,12 +3097,6 @@ function NarrationPlayer({
|
|
|
3110
3097
|
break;
|
|
3111
3098
|
}
|
|
3112
3099
|
}
|
|
3113
|
-
function handleManualRefresh() {
|
|
3114
|
-
if (!onRefresh || refreshing) return;
|
|
3115
|
-
Promise.resolve(onRefresh()).catch(() => {
|
|
3116
|
-
onPlaybackError?.();
|
|
3117
|
-
});
|
|
3118
|
-
}
|
|
3119
3100
|
const progress = duration > 0 ? Math.min(1, currentTime / duration) : 0;
|
|
3120
3101
|
const expiresLabel = audio.expires_at ? new Date(audio.expires_at).toLocaleTimeString([], {
|
|
3121
3102
|
hour: "numeric",
|
|
@@ -3238,30 +3219,18 @@ function NarrationPlayer({
|
|
|
3238
3219
|
] })
|
|
3239
3220
|
] })
|
|
3240
3221
|
] }),
|
|
3241
|
-
/* @__PURE__ */
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
),
|
|
3254
|
-
onRefresh && showRefreshButton && /* @__PURE__ */ jsx(
|
|
3255
|
-
"button",
|
|
3256
|
-
{
|
|
3257
|
-
type: "button",
|
|
3258
|
-
onClick: handleManualRefresh,
|
|
3259
|
-
disabled: refreshing,
|
|
3260
|
-
style: refreshing ? { ...styles.refreshButton, ...styles.disabled } : styles.refreshButton,
|
|
3261
|
-
children: refreshing ? "Refreshing\u2026" : "Refresh"
|
|
3262
|
-
}
|
|
3263
|
-
)
|
|
3264
|
-
] })
|
|
3222
|
+
/* @__PURE__ */ jsx("div", { style: styles.controls, children: /* @__PURE__ */ jsxs(
|
|
3223
|
+
"button",
|
|
3224
|
+
{
|
|
3225
|
+
type: "button",
|
|
3226
|
+
onClick: () => setSpeed((currentSpeed) => getNextSpeed(currentSpeed)),
|
|
3227
|
+
style: styles.secondaryButton,
|
|
3228
|
+
children: [
|
|
3229
|
+
speed,
|
|
3230
|
+
"\xD7"
|
|
3231
|
+
]
|
|
3232
|
+
}
|
|
3233
|
+
) })
|
|
3265
3234
|
] })
|
|
3266
3235
|
] });
|
|
3267
3236
|
}
|
package/package.json
CHANGED