@kolkrabbi/kol-component 0.20.1 → 0.21.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -216,10 +216,36 @@ function useCopy() {
|
|
|
216
216
|
return [copied, copy]
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/* A video paints nothing until a frame decodes, so its resting state is a blank
|
|
220
|
+
* box — no name, no type marker. This gives it the <img alt> equivalent: a play
|
|
221
|
+
* glyph and the filename behind the video, revealed only while it has nothing
|
|
222
|
+
* to show. `onLoadedData` is the earliest event that guarantees a frame.
|
|
223
|
+
*
|
|
224
|
+
* The loading strategy is deliberately unchanged (lobby/MediaLibraryVideoFallback:
|
|
225
|
+
* both candidate strategies failed the same way headless, so that measurement
|
|
226
|
+
* discriminates nothing). This layer needs no decoder to be correct. */
|
|
219
227
|
function Thumb({ row, mediaUrl }) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
const [painted, setPainted] = useState(false)
|
|
229
|
+
|
|
230
|
+
if (!isVideo(row.contentType)) {
|
|
231
|
+
return <img src={mediaUrl(row.key)} alt="" loading="lazy" className="w-full h-full object-cover" />
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<div className="kol-media-thumb">
|
|
236
|
+
<span className="kol-media-thumb-fallback" data-painted={painted}>
|
|
237
|
+
<Icon name="play" size={20} />
|
|
238
|
+
<span className="kol-mono-12">{fileName(row.key)}</span>
|
|
239
|
+
</span>
|
|
240
|
+
<video
|
|
241
|
+
src={posterSrc(mediaUrl(row.key))}
|
|
242
|
+
muted
|
|
243
|
+
preload="metadata"
|
|
244
|
+
onLoadedData={() => setPainted(true)}
|
|
245
|
+
className="relative w-full h-full object-cover"
|
|
246
|
+
/>
|
|
247
|
+
</div>
|
|
248
|
+
)
|
|
223
249
|
}
|
|
224
250
|
|
|
225
251
|
/* Folders, then the tiles or rows. Shared by both views — the modal shell and
|