@kolkrabbi/kol-component 0.253.0 → 0.255.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.253.0",
3
+ "version": "0.255.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,8 +22,25 @@ import Hls from 'hls.js'
22
22
  * @param {boolean} active plays only while true (default true) — an
23
23
  * off-stage carousel slide pauses instead of autoplaying beside the
24
24
  * active one (FeaturedCarouselFullWidth, 2026-08-26)
25
+ * @param {Object} hlsConfig hls.js config spread over `HLS_DEFAULTS`; read when `src` attaches
26
+ * (a changed object alone does not reload the stream)
25
27
  */
26
- export default function BackgroundVideo({ src, poster, className, onEnded, active = true, ...props }) {
28
+ /* START WHERE THE PLAYER CAN SHOW IT (BackgroundVideoStartsAtLowestRendition, kol-website
29
+ * 2026-10-13 — user: *"why is this video so low res? … its super long lag till you get good res?"*).
30
+ * A bare `new Hls()` starts at the manifest's FIRST rendition (360p on every bucket master) on a
31
+ * 500 kbps guess and only climbs after measured fragments, so a 640px card played upscaled 360p
32
+ * until ABR caught up. Auto start level, a broadband guess until measured, and never above the
33
+ * element's own size. The ticket's three keys plus `testBandwidth: false`. */
34
+ export const HLS_DEFAULTS = {
35
+ startLevel: -1,
36
+ /* without this, an auto start still loads its FIRST fragment at the lowest rendition to measure
37
+ * bandwidth — measured 2026-10-13: 360 → 720 with it on, 720 from the first fragment with it off */
38
+ testBandwidth: false,
39
+ abrEwmaDefaultEstimate: 8_000_000,
40
+ capLevelToPlayerSize: true,
41
+ }
42
+
43
+ export default function BackgroundVideo({ src, poster, className, onEnded, active = true, hlsConfig, ...props }) {
27
44
  const videoRef = useRef(null)
28
45
 
29
46
  useEffect(() => {
@@ -38,7 +55,7 @@ export default function BackgroundVideo({ src, poster, className, onEnded, activ
38
55
  if (!video || !src) return
39
56
 
40
57
  if (Hls.isSupported()) {
41
- const hls = new Hls()
58
+ const hls = new Hls({ ...HLS_DEFAULTS, ...hlsConfig })
42
59
  hls.loadSource(src)
43
60
  hls.attachMedia(video)
44
61
  return () => hls.destroy()
@@ -46,7 +63,7 @@ export default function BackgroundVideo({ src, poster, className, onEnded, activ
46
63
  // Safari native HLS support
47
64
  video.src = src
48
65
  }
49
- }, [src])
66
+ }, [src]) // eslint-disable-line react-hooks/exhaustive-deps -- hlsConfig is read at attach
50
67
 
51
68
  return (
52
69
  <video
@@ -95,6 +95,17 @@ export default function SelectionOverlay({
95
95
  /* half the rotated box's axis-aligned height — the label hangs below that, centred */
96
96
  const rad = (rot * Math.PI) / 180
97
97
  const halfBoundsH = (Math.abs(w * Math.sin(rad)) + Math.abs(h * Math.cos(rad))) / 2
98
+ /* …and clear the rotate handle when the box points down (SelectionOverlayLabelClearsRotateHandle,
99
+ * kol-fxr 2026-10-13: at 180° the handle sat on the label's ×). The handle's centre, from the box
100
+ * centre, after the chrome's rotation; if it falls in the label's column below the box, the label
101
+ * hangs under the handle instead. Label width estimated from its text — mono, 12px. */
102
+ const labelText = showLabel ? labelFormatter(box) : ''
103
+ const handleDy = -(h / 2) - ROTATE_OFFSET / zoom + size / 2
104
+ const handleX = -handleDy * Math.sin(rad)
105
+ const handleY = handleDy * Math.cos(rad)
106
+ const labelHalfW = (labelText.length * 7.5 + 12) / 2 / zoom
107
+ const clearsHandle = rotate && handleY > 0 && Math.abs(handleX) < labelHalfW + size / 2
108
+ const labelBelow = Math.max(halfBoundsH, clearsHandle ? handleY + size / 2 : 0)
98
109
 
99
110
  return (
100
111
  <>
@@ -162,7 +173,7 @@ export default function SelectionOverlay({
162
173
  style={{
163
174
  position: 'absolute',
164
175
  left: x + w / 2,
165
- top: y + h / 2 + halfBoundsH + 6 / zoom,
176
+ top: y + h / 2 + labelBelow + 6 / zoom,
166
177
  /* counter-scale, not just a smaller font: padding, radius and
167
178
  * tracking have to stay screen-constant too */
168
179
  transform: `translateX(-50%) scale(${1 / zoom})`,
@@ -179,7 +190,7 @@ export default function SelectionOverlay({
179
190
  zIndex: 100,
180
191
  }}
181
192
  >
182
- {labelFormatter(box)}
193
+ {labelText}
183
194
  </span>
184
195
  )}
185
196
  </>