@geekapps/silo-elements-nextjs 0.2.53 → 0.2.55
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/VideoPlayer.d.ts +13 -1
- package/dist/VideoPlayer.js +54 -3
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +56 -9
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/styles.css +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { ImageUploader } from './ImageUploader.js';
|
|
|
2
2
|
export { VideoUploader } from './VideoUploader.js';
|
|
3
3
|
export { FileUploader } from './FileUploader.js';
|
|
4
4
|
export { MediaUploader } from './MediaUploader.js';
|
|
5
|
-
export { Captions, CaptionsProps, Source, SourceProps, Storyboard, StoryboardFrame, StoryboardFrameProps, StoryboardProps, Video, VideoPlayer, VideoSourceType, VideoThumbnail, ThumbnailProps as VideoThumbnailProps } from './VideoPlayer.js';
|
|
5
|
+
export { Captions, CaptionsProps, Chapters, ChaptersProps, Source, SourceProps, Storyboard, StoryboardFrame, StoryboardFrameProps, StoryboardProps, Video, VideoPlayer, VideoSourceType, VideoThumbnail, ThumbnailProps as VideoThumbnailProps } from './VideoPlayer.js';
|
|
6
6
|
export { DropZone } from './components/DropZone.js';
|
|
7
7
|
export { ProgressBar } from './components/ProgressBar.js';
|
|
8
8
|
import * as react from 'react';
|
package/dist/index.js
CHANGED
|
@@ -1144,6 +1144,10 @@ function Captions(_props) {
|
|
|
1144
1144
|
return null;
|
|
1145
1145
|
}
|
|
1146
1146
|
Captions.displayName = "SiloCaptions";
|
|
1147
|
+
function Chapters(_props) {
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
Chapters.displayName = "SiloChapters";
|
|
1147
1151
|
function VideoThumbnail(_props) {
|
|
1148
1152
|
return null;
|
|
1149
1153
|
}
|
|
@@ -1168,6 +1172,7 @@ function Video({
|
|
|
1168
1172
|
}) {
|
|
1169
1173
|
const parsed = useMemo(() => parseVideoChildren(children), [children]);
|
|
1170
1174
|
const [captions, setCaptions] = useState([]);
|
|
1175
|
+
const [chapters, setChapters] = useState([]);
|
|
1171
1176
|
const [poster, setPoster] = useState(void 0);
|
|
1172
1177
|
const captionsSourceRef = useRef("");
|
|
1173
1178
|
useEffect(() => {
|
|
@@ -1202,6 +1207,25 @@ function Video({
|
|
|
1202
1207
|
cancelled = true;
|
|
1203
1208
|
};
|
|
1204
1209
|
}, [parsed.captionsSrc, parsed.captionsData]);
|
|
1210
|
+
useEffect(() => {
|
|
1211
|
+
if (parsed.chaptersData) {
|
|
1212
|
+
setChapters(parsed.chaptersData);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (!parsed.chaptersSrc) {
|
|
1216
|
+
setChapters([]);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
let cancelled = false;
|
|
1220
|
+
fetch(parsed.chaptersSrc, { cache: "no-store" }).then((r) => r.json()).then((data) => {
|
|
1221
|
+
if (!cancelled && Array.isArray(data)) setChapters(data);
|
|
1222
|
+
}).catch(() => {
|
|
1223
|
+
if (!cancelled) setChapters([]);
|
|
1224
|
+
});
|
|
1225
|
+
return () => {
|
|
1226
|
+
cancelled = true;
|
|
1227
|
+
};
|
|
1228
|
+
}, [parsed.chaptersSrc, parsed.chaptersData]);
|
|
1205
1229
|
useEffect(() => {
|
|
1206
1230
|
if (!parsed.thumbnailSrc) {
|
|
1207
1231
|
setPoster(void 0);
|
|
@@ -2608,6 +2632,14 @@ function Video({
|
|
|
2608
2632
|
}
|
|
2609
2633
|
}
|
|
2610
2634
|
),
|
|
2635
|
+
chapters.length > 0 && duration > 0 && chapters.map((ch, i) => /* @__PURE__ */ jsx(
|
|
2636
|
+
"div",
|
|
2637
|
+
{
|
|
2638
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 w-0.5 rounded-full bg-white/50",
|
|
2639
|
+
style: { left: `${ch.startTime / duration * 100}%`, height: isDragging ? "7px" : isHoveringProgress ? "5px" : "3px", transition: "height 0.15s ease" }
|
|
2640
|
+
},
|
|
2641
|
+
i
|
|
2642
|
+
)),
|
|
2611
2643
|
preview && (() => {
|
|
2612
2644
|
const frameW = preview.cue.w ?? 160;
|
|
2613
2645
|
const frameH = preview.cue.h ?? 90;
|
|
@@ -2700,7 +2732,12 @@ function Video({
|
|
|
2700
2732
|
formatTime(currentTime),
|
|
2701
2733
|
/* @__PURE__ */ jsx("span", { className: "text-white/30", children: "/" }),
|
|
2702
2734
|
/* @__PURE__ */ jsx("span", { className: "text-white/45", children: formatTime(duration) })
|
|
2703
|
-
] })
|
|
2735
|
+
] }),
|
|
2736
|
+
(() => {
|
|
2737
|
+
if (chapters.length === 0) return null;
|
|
2738
|
+
const ch = [...chapters].reverse().find((c) => currentTime >= c.startTime);
|
|
2739
|
+
return ch ? /* @__PURE__ */ jsx("span", { className: "hidden max-w-40 truncate text-[11px] text-white/50 @sm:block", children: ch.title }) : null;
|
|
2740
|
+
})()
|
|
2704
2741
|
] }),
|
|
2705
2742
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 @sm:gap-1", children: [
|
|
2706
2743
|
/* @__PURE__ */ jsx(
|
|
@@ -2916,6 +2953,14 @@ function parseVideoChildren(children) {
|
|
|
2916
2953
|
parsed.captionsSrc = element.props.src;
|
|
2917
2954
|
}
|
|
2918
2955
|
}
|
|
2956
|
+
if (child.type === Chapters || name === "SiloChapters") {
|
|
2957
|
+
const element = child;
|
|
2958
|
+
if (element.props.data) {
|
|
2959
|
+
parsed.chaptersData = element.props.data;
|
|
2960
|
+
} else if (element.props.src) {
|
|
2961
|
+
parsed.chaptersSrc = element.props.src;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2919
2964
|
if (child.type === VideoThumbnail || name === "SiloVideoThumbnail") {
|
|
2920
2965
|
const element = child;
|
|
2921
2966
|
parsed.thumbnailSrc = element.props.src;
|
|
@@ -2956,7 +3001,13 @@ function inferSourceType(source) {
|
|
|
2956
3001
|
return "file";
|
|
2957
3002
|
}
|
|
2958
3003
|
function findStoryboardCue(cues, time) {
|
|
2959
|
-
|
|
3004
|
+
if (cues.length === 0) return null;
|
|
3005
|
+
let best = null;
|
|
3006
|
+
for (const cue of cues) {
|
|
3007
|
+
if (cue.start <= time) best = cue;
|
|
3008
|
+
else break;
|
|
3009
|
+
}
|
|
3010
|
+
return best;
|
|
2960
3011
|
}
|
|
2961
3012
|
function parseStoryboardVtt(text, baseUrl) {
|
|
2962
3013
|
const lines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
@@ -3205,9 +3256,7 @@ var STATUS_LABEL = {
|
|
|
3205
3256
|
CREATED: "Created",
|
|
3206
3257
|
UPLOADING: "Uploading",
|
|
3207
3258
|
INGESTING: "Ingesting",
|
|
3208
|
-
QUEUED: "Queued",
|
|
3209
3259
|
PROCESSING: "Processing",
|
|
3210
|
-
SYNCING: "Syncing",
|
|
3211
3260
|
READY: "Ready",
|
|
3212
3261
|
FAILED: "Failed",
|
|
3213
3262
|
CANCELLED: "Cancelled"
|
|
@@ -3221,7 +3270,7 @@ function statusColor(status) {
|
|
|
3221
3270
|
return STATUS_COLOR[status] ?? "#6366f1";
|
|
3222
3271
|
}
|
|
3223
3272
|
function isProcessing(status) {
|
|
3224
|
-
return ["
|
|
3273
|
+
return ["CREATED", "UPLOADING", "INGESTING", "PROCESSING"].includes(status);
|
|
3225
3274
|
}
|
|
3226
3275
|
function FileCard({
|
|
3227
3276
|
fileId,
|
|
@@ -3339,15 +3388,13 @@ var STATUS_LABEL2 = {
|
|
|
3339
3388
|
CREATED: "Created",
|
|
3340
3389
|
UPLOADING: "Uploading",
|
|
3341
3390
|
INGESTING: "Ingesting",
|
|
3342
|
-
QUEUED: "Queued",
|
|
3343
3391
|
PROCESSING: "Processing",
|
|
3344
|
-
SYNCING: "Syncing",
|
|
3345
3392
|
READY: "Ready",
|
|
3346
3393
|
FAILED: "Failed",
|
|
3347
3394
|
CANCELLED: "Cancelled"
|
|
3348
3395
|
};
|
|
3349
3396
|
function isProcessing2(status) {
|
|
3350
|
-
return ["
|
|
3397
|
+
return ["CREATED", "UPLOADING", "INGESTING", "PROCESSING"].includes(status);
|
|
3351
3398
|
}
|
|
3352
3399
|
function formatDate(iso) {
|
|
3353
3400
|
return new Date(iso).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
@@ -3478,6 +3525,6 @@ function Badge({ children, muted }) {
|
|
|
3478
3525
|
);
|
|
3479
3526
|
}
|
|
3480
3527
|
|
|
3481
|
-
export { Avatar, Background, Captions, DropZone, FileCard, FileIcon, FilePreview, FileUploader, ImageOptions, ImageUploader, MediaUploader, ProgressBar, Source, Storyboard, StoryboardFrame, Thumbnail, Video, VideoOptions, VideoPlayer, VideoThumbnail, VideoUploader, defaultTheme, resolveTheme };
|
|
3528
|
+
export { Avatar, Background, Captions, Chapters, DropZone, FileCard, FileIcon, FilePreview, FileUploader, ImageOptions, ImageUploader, MediaUploader, ProgressBar, Source, Storyboard, StoryboardFrame, Thumbnail, Video, VideoOptions, VideoPlayer, VideoThumbnail, VideoUploader, defaultTheme, resolveTheme };
|
|
3482
3529
|
//# sourceMappingURL=index.js.map
|
|
3483
3530
|
//# sourceMappingURL=index.js.map
|