@livo-tv/blocks 1.18.0 → 1.19.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/dist/index.cjs CHANGED
@@ -4293,6 +4293,7 @@ var DEFAULT_LABELS3 = {
4293
4293
  cast: "Cast",
4294
4294
  settings: "Settings",
4295
4295
  more: "More",
4296
+ back: "Back",
4296
4297
  quality: "Quality",
4297
4298
  auto: "Auto",
4298
4299
  speed: "Speed",
@@ -4421,6 +4422,9 @@ function VideoPlayer({
4421
4422
  const [controlsVisible, setControlsVisible] = React9__namespace.useState(true);
4422
4423
  const [playbackRate, setPlaybackRate] = React9__namespace.useState(1);
4423
4424
  const [openMenu, setOpenMenu] = React9__namespace.useState(null);
4425
+ const [morePane, setMorePane] = React9__namespace.useState(
4426
+ "root"
4427
+ );
4424
4428
  const [compactChrome, setCompactChrome] = React9__namespace.useState(false);
4425
4429
  const [captionLocale, setCaptionLocale] = React9__namespace.useState(defaultCaptionLocale ?? "off");
4426
4430
  const [captionCues, setCaptionCues] = React9__namespace.useState([]);
@@ -4448,6 +4452,9 @@ function VideoPlayer({
4448
4452
  observer.observe(el);
4449
4453
  return () => observer.disconnect();
4450
4454
  }, [active]);
4455
+ React9__namespace.useEffect(() => {
4456
+ if (openMenu !== "more") setMorePane("root");
4457
+ }, [openMenu]);
4451
4458
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
4452
4459
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
4453
4460
  React9__namespace.useEffect(() => {
@@ -5096,55 +5103,87 @@ function VideoPlayer({
5096
5103
  className: cn("size-5", pipActive && "text-primary")
5097
5104
  }
5098
5105
  ) }),
5099
- compactChrome && /* @__PURE__ */ jsxRuntime.jsxs(
5106
+ compactChrome && /* @__PURE__ */ jsxRuntime.jsx(
5100
5107
  MenuControl,
5101
5108
  {
5102
5109
  label: t.more,
5103
5110
  open: openMenu === "more",
5104
5111
  onOpenChange: (o) => setOpenMenu(o ? "more" : null),
5105
5112
  trigger: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EllipsisVertical, { className: "size-5" }),
5106
- children: [
5107
- mode === "vod" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5108
- /* @__PURE__ */ jsxRuntime.jsx(MenuSection, { children: t.speed }),
5109
- PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxRuntime.jsxs(
5110
- MenuItem,
5111
- {
5112
- selected: rate === playbackRate,
5113
- onSelect: () => changeRate(rate),
5114
- children: [
5115
- rate,
5116
- "\xD7"
5117
- ]
5118
- },
5119
- rate
5120
- ))
5121
- ] }),
5122
- showQuality && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5123
- /* @__PURE__ */ jsxRuntime.jsx(MenuSection, { children: t.quality }),
5124
- /* @__PURE__ */ jsxRuntime.jsx(
5125
- MenuItem,
5126
- {
5127
- selected: activeLevel < 0,
5128
- onSelect: () => chooseLevel(-1),
5129
- children: t.auto
5130
- }
5131
- ),
5132
- qualities.map((q) => /* @__PURE__ */ jsxRuntime.jsxs(
5133
- MenuItem,
5134
- {
5135
- selected: activeLevel === q.index,
5136
- onSelect: () => chooseLevel(q.index),
5137
- children: [
5138
- q.height,
5139
- "p"
5140
- ]
5141
- },
5142
- q.index
5143
- ))
5144
- ] }),
5113
+ children: morePane === "speed" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5114
+ /* @__PURE__ */ jsxRuntime.jsx(
5115
+ MenuBack,
5116
+ {
5117
+ label: t.back,
5118
+ title: t.speed,
5119
+ onSelect: () => setMorePane("root")
5120
+ }
5121
+ ),
5122
+ PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxRuntime.jsxs(
5123
+ MenuItem,
5124
+ {
5125
+ selected: rate === playbackRate,
5126
+ onSelect: () => changeRate(rate),
5127
+ children: [
5128
+ rate,
5129
+ "\xD7"
5130
+ ]
5131
+ },
5132
+ rate
5133
+ ))
5134
+ ] }) : morePane === "quality" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5135
+ /* @__PURE__ */ jsxRuntime.jsx(
5136
+ MenuBack,
5137
+ {
5138
+ label: t.back,
5139
+ title: t.quality,
5140
+ onSelect: () => setMorePane("root")
5141
+ }
5142
+ ),
5143
+ /* @__PURE__ */ jsxRuntime.jsx(
5144
+ MenuItem,
5145
+ {
5146
+ selected: activeLevel < 0,
5147
+ onSelect: () => chooseLevel(-1),
5148
+ children: t.auto
5149
+ }
5150
+ ),
5151
+ qualities.map((q) => /* @__PURE__ */ jsxRuntime.jsxs(
5152
+ MenuItem,
5153
+ {
5154
+ selected: activeLevel === q.index,
5155
+ onSelect: () => chooseLevel(q.index),
5156
+ children: [
5157
+ q.height,
5158
+ "p"
5159
+ ]
5160
+ },
5161
+ q.index
5162
+ ))
5163
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5164
+ mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
5165
+ MenuNavRow,
5166
+ {
5167
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Gauge, { className: "size-4" }),
5168
+ label: t.speed,
5169
+ value: `${playbackRate}\xD7`,
5170
+ onSelect: () => setMorePane("speed")
5171
+ }
5172
+ ),
5173
+ showQuality && /* @__PURE__ */ jsxRuntime.jsx(
5174
+ MenuNavRow,
5175
+ {
5176
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" }),
5177
+ label: t.quality,
5178
+ value: currentLevelLabel,
5179
+ onSelect: () => setMorePane("quality")
5180
+ }
5181
+ ),
5182
+ (mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-white/15" }),
5145
5183
  /* @__PURE__ */ jsxRuntime.jsx(
5146
5184
  MenuAction,
5147
5185
  {
5186
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cast, { className: "size-4" }),
5148
5187
  onSelect: () => {
5149
5188
  setOpenMenu(null);
5150
5189
  void castHlsUrl(src).catch(() => void 0);
@@ -5155,6 +5194,8 @@ function VideoPlayer({
5155
5194
  pipSupported && /* @__PURE__ */ jsxRuntime.jsx(
5156
5195
  MenuAction,
5157
5196
  {
5197
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PictureInPicture2, { className: "size-4" }),
5198
+ active: pipActive,
5158
5199
  onSelect: () => {
5159
5200
  setOpenMenu(null);
5160
5201
  togglePip();
@@ -5162,7 +5203,7 @@ function VideoPlayer({
5162
5203
  children: t.pictureInPicture
5163
5204
  }
5164
5205
  )
5165
- ]
5206
+ ] })
5166
5207
  }
5167
5208
  ),
5168
5209
  fullscreenSupported && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5228,15 +5269,12 @@ function MenuControl({
5228
5269
  "div",
5229
5270
  {
5230
5271
  role: "menu",
5231
- className: "absolute right-0 bottom-full z-10 mb-2 min-w-24 rounded-md bg-black/90 p-1 text-sm shadow-lg backdrop-blur-sm",
5272
+ className: "absolute right-0 bottom-full z-10 mb-2 min-w-52 rounded-md bg-black/90 p-1 text-sm shadow-lg backdrop-blur-sm",
5232
5273
  children
5233
5274
  }
5234
5275
  )
5235
5276
  ] });
5236
5277
  }
5237
- function MenuSection({ children }) {
5238
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pt-1.5 pb-0.5 text-[10px] font-semibold tracking-wide text-white/50 uppercase", children });
5239
- }
5240
5278
  function MenuItem({
5241
5279
  selected,
5242
5280
  onSelect,
@@ -5249,7 +5287,7 @@ function MenuItem({
5249
5287
  role: "menuitemradio",
5250
5288
  "aria-checked": selected,
5251
5289
  onClick: onSelect,
5252
- className: "flex w-full items-center justify-between gap-3 rounded px-2 py-1.5 text-left text-white/90 hover:bg-white/15",
5290
+ className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5253
5291
  children: [
5254
5292
  children,
5255
5293
  selected && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4" })
@@ -5257,18 +5295,69 @@ function MenuItem({
5257
5295
  }
5258
5296
  );
5259
5297
  }
5298
+ function MenuNavRow({
5299
+ icon,
5300
+ label,
5301
+ value,
5302
+ onSelect
5303
+ }) {
5304
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5305
+ "button",
5306
+ {
5307
+ type: "button",
5308
+ role: "menuitem",
5309
+ "aria-label": `${label}, ${value}`,
5310
+ onClick: onSelect,
5311
+ className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5312
+ children: [
5313
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/70", children: icon }),
5314
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: label }),
5315
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/50", children: value }),
5316
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-4 text-white/50" })
5317
+ ]
5318
+ }
5319
+ );
5320
+ }
5321
+ function MenuBack({
5322
+ label,
5323
+ title,
5324
+ onSelect
5325
+ }) {
5326
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5327
+ "button",
5328
+ {
5329
+ type: "button",
5330
+ role: "menuitem",
5331
+ "aria-label": label,
5332
+ onClick: onSelect,
5333
+ className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5334
+ children: [
5335
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" }),
5336
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: title })
5337
+ ]
5338
+ }
5339
+ );
5340
+ }
5260
5341
  function MenuAction({
5261
5342
  onSelect,
5343
+ icon,
5344
+ active,
5262
5345
  children
5263
5346
  }) {
5264
- return /* @__PURE__ */ jsxRuntime.jsx(
5347
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5265
5348
  "button",
5266
5349
  {
5267
5350
  type: "button",
5268
5351
  role: "menuitem",
5269
5352
  onClick: onSelect,
5270
- className: "flex w-full items-center rounded px-2 py-1.5 text-left text-white/90 hover:bg-white/15",
5271
- children
5353
+ className: cn(
5354
+ "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5355
+ active && "text-primary"
5356
+ ),
5357
+ children: [
5358
+ icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-white/70", active && "text-primary"), children: icon }) : null,
5359
+ children
5360
+ ]
5272
5361
  }
5273
5362
  );
5274
5363
  }