@geekapps/silo-elements-nextjs 0.3.2 → 0.3.3

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.
@@ -391,7 +391,7 @@ function ImageUploader({
391
391
  ] })
392
392
  ] });
393
393
  }
394
- var CODECS = [
394
+ var VIDEO_CODECS = [
395
395
  {
396
396
  value: "h264",
397
397
  label: "H.264",
@@ -400,15 +400,46 @@ var CODECS = [
400
400
  {
401
401
  value: "h265",
402
402
  label: "H.265",
403
- description: "50% menor que H.264 com a mesma qualidade. Requer player moderno (Chrome, Safari, Firefox)."
403
+ description: "50% menor que H.264 com a mesma qualidade. Requer player moderno."
404
404
  },
405
405
  {
406
406
  value: "av1",
407
407
  label: "AV1",
408
- description: "M\xE1xima efici\xEAncia \u2014 at\xE9 50% menor que H.265. Suportado no Chrome, Firefox e Safari 17+.",
409
- warning: "AV1 n\xE3o \xE9 suportado em iPhones mais antigos (iOS < 16) e Smart TVs antigas."
408
+ description: "M\xE1xima efici\xEAncia \u2014 at\xE9 50% menor que H.265. Chrome 70+, Firefox 67+, Safari 17+.",
409
+ warning: "N\xE3o suportado em iPhones antigos (iOS < 16) e Smart TVs antigas."
410
410
  }
411
411
  ];
412
+ var AUDIO_SIMPLE = [
413
+ {
414
+ value: "passthrough",
415
+ label: "Preservar original",
416
+ badge: "Recomendado",
417
+ description: "Copia o \xE1udio sem reencodar quando compat\xEDvel com HLS (AAC, AC3, E-AC3). Converte para AAC est\xE9reo como fallback."
418
+ },
419
+ {
420
+ value: "aac",
421
+ label: "AAC",
422
+ description: "Compatibilidade m\xE1xima. Funciona em todos os players e dispositivos."
423
+ },
424
+ {
425
+ value: "opus",
426
+ label: "Opus",
427
+ description: "Melhor efici\xEAncia que AAC. Suportado em Chrome, Firefox e Android. N\xE3o suportado em Safari/iOS."
428
+ }
429
+ ];
430
+ var AUDIO_ADVANCED_CODEC = [
431
+ { value: "passthrough", label: "Original", description: "Passthrough quando HLS-compat\xEDvel, AAC como fallback." },
432
+ { value: "aac", label: "AAC", description: "Compatibilidade m\xE1xima." },
433
+ { value: "opus", label: "Opus", description: "Melhor efici\xEAncia que AAC. Chrome/Firefox/Android." },
434
+ { value: "ac3", label: "AC3", description: "Dolby Digital. Compat\xEDvel com HLS e home theaters." },
435
+ { value: "eac3", label: "E-AC3", description: "Dolby Digital Plus. Suporta Atmos. Netflix, Disney+, Apple TV+." }
436
+ ];
437
+ var AUDIO_CHANNELS = [
438
+ { value: "original", label: "Original", description: "Mant\xE9m os canais do arquivo fonte." },
439
+ { value: "stereo", label: "Est\xE9reo", description: "2.0 \u2014 compat\xEDvel com todos os dispositivos." },
440
+ { value: "5.1", label: "5.1", description: "Surround 5.1." },
441
+ { value: "7.1", label: "7.1", description: "Surround 7.1." }
442
+ ];
412
443
  var RESOLUTIONS = ["144", "240", "360", "480", "720", "1080", "1440", "2160"];
413
444
  var RESOLUTION_LABELS = {
414
445
  "144": "144p",
@@ -421,20 +452,40 @@ var RESOLUTION_LABELS = {
421
452
  "2160": "4K"
422
453
  };
423
454
  function optBtnStyle(active) {
424
- return active ? { border: "1px solid #6366f1", background: "#6366f1", color: "#fff", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer", minWidth: 36 } : { border: "1px solid rgba(255,255,255,0.2)", background: "rgba(255,255,255,0.06)", color: "rgba(255,255,255,0.8)", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer", minWidth: 36 };
455
+ return active ? { border: "1px solid #6366f1", background: "#6366f1", color: "#fff", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer" } : { border: "1px solid rgba(255,255,255,0.2)", background: "rgba(255,255,255,0.06)", color: "rgba(255,255,255,0.8)", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer" };
456
+ }
457
+ function SectionLabel({ children }) {
458
+ return /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6, color: "rgba(255,255,255,0.35)" }, children });
459
+ }
460
+ function Hint({ children }) {
461
+ return /* @__PURE__ */ jsx("p", { style: { marginTop: 5, fontSize: 11, color: "rgba(255,255,255,0.4)", lineHeight: 1.5 }, children });
462
+ }
463
+ function Warning({ children }) {
464
+ return /* @__PURE__ */ jsx("div", { style: { marginTop: 5, display: "flex", gap: 5, background: "rgba(251,191,36,0.08)", border: "1px solid rgba(251,191,36,0.2)", borderRadius: 6, padding: "5px 8px" }, children: /* @__PURE__ */ jsxs("span", { style: { fontSize: 11, color: "#fbbf24", lineHeight: 1.5 }, children: [
465
+ "\u26A0 ",
466
+ children
467
+ ] }) });
425
468
  }
426
- function Toggle({ checked, onToggle, label }) {
427
- return /* @__PURE__ */ jsxs("div", { style: { display: "inline-flex", alignItems: "center", gap: 8, cursor: "pointer", userSelect: "none" }, onClick: onToggle, children: [
428
- /* @__PURE__ */ jsx("span", { style: { position: "relative", display: "inline-block", width: 32, height: 18, borderRadius: 9, flexShrink: 0, cursor: "pointer", background: checked ? "#6366f1" : "rgba(255,255,255,0.15)", transition: "background 150ms" }, children: /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 2, left: checked ? 16 : 2, width: 14, height: 14, borderRadius: "50%", background: "#fff", boxShadow: "0 1px 3px rgba(0,0,0,.3)", transition: "left 150ms" } }) }),
429
- /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 500, color: "rgba(255,255,255,0.85)" }, children: label })
469
+ function Toggle({ checked, onToggle, label, hint }) {
470
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: 8, cursor: "pointer", userSelect: "none" }, onClick: onToggle, children: [
471
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", display: "inline-block", width: 32, height: 18, borderRadius: 9, flexShrink: 0, marginTop: 1, background: checked ? "#6366f1" : "rgba(255,255,255,0.15)", transition: "background 150ms" }, children: /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 2, left: checked ? 16 : 2, width: 14, height: 14, borderRadius: "50%", background: "#fff", boxShadow: "0 1px 3px rgba(0,0,0,.3)", transition: "left 150ms" } }) }),
472
+ /* @__PURE__ */ jsxs("div", { children: [
473
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 500, color: "rgba(255,255,255,0.85)" }, children: label }),
474
+ hint && /* @__PURE__ */ jsx("p", { style: { fontSize: 11, color: "rgba(255,255,255,0.4)", marginTop: 1, lineHeight: 1.4 }, children: hint })
475
+ ] })
430
476
  ] });
431
477
  }
432
478
  function VideoOptions({ value, onChange, style }) {
479
+ const [advanced, setAdvanced] = useState(false);
433
480
  const codec = value.codec ?? "h264";
434
481
  const transcoding = value.transcoding ?? "auto";
435
482
  const isAuto = transcoding === "auto";
436
483
  const selectedRes = isAuto ? [] : transcoding;
437
- const selectedCodec = CODECS.find((c) => c.value === codec) ?? CODECS[0];
484
+ const audioCodec = value.audioCodec ?? "passthrough";
485
+ const audioChannels = value.audioChannels ?? "original";
486
+ const preserveAtmos = value.preserveAtmos ?? true;
487
+ const hdrMode = value.hdr ?? "preserve";
488
+ const selectedVideoCodec = VIDEO_CODECS.find((c) => c.value === codec);
438
489
  function toggleRes(r) {
439
490
  if (isAuto) {
440
491
  onChange({ ...value, transcoding: [r] });
@@ -443,13 +494,12 @@ function VideoOptions({ value, onChange, style }) {
443
494
  const next = selectedRes.includes(r) ? selectedRes.filter((x) => x !== r) : [...selectedRes, r];
444
495
  onChange({ ...value, transcoding: next.length === 0 ? "auto" : next });
445
496
  }
446
- function toggleFeature(key) {
447
- onChange({ ...value, [key]: !value[key] });
448
- }
449
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", style, children: [
497
+ const showAtmosOption = audioCodec === "eac3" || audioCodec === "passthrough";
498
+ const showAtmosWarning = audioCodec === "aac" || audioCodec === "opus" || audioCodec === "ac3";
499
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", style, children: [
450
500
  /* @__PURE__ */ jsxs("div", { children: [
451
- /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6, color: "rgba(255,255,255,0.4)" }, children: "Codec de v\xEDdeo" }),
452
- /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: CODECS.map((c) => /* @__PURE__ */ jsx(
501
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Codec de v\xEDdeo" }),
502
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: VIDEO_CODECS.map((c) => /* @__PURE__ */ jsx(
453
503
  "button",
454
504
  {
455
505
  type: "button",
@@ -459,38 +509,117 @@ function VideoOptions({ value, onChange, style }) {
459
509
  },
460
510
  c.value
461
511
  )) }),
462
- /* @__PURE__ */ jsx("div", { style: { marginTop: 6, fontSize: 11, color: "rgba(255,255,255,0.45)", lineHeight: 1.5 }, children: selectedCodec.description }),
463
- selectedCodec.warning && /* @__PURE__ */ jsx("div", { style: { marginTop: 5, display: "flex", alignItems: "flex-start", gap: 5, background: "rgba(251,191,36,0.08)", border: "1px solid rgba(251,191,36,0.2)", borderRadius: 6, padding: "5px 8px" }, children: /* @__PURE__ */ jsxs("span", { style: { fontSize: 11, color: "#fbbf24", lineHeight: 1.5 }, children: [
464
- "\u26A0 ",
465
- selectedCodec.warning
466
- ] }) })
512
+ selectedVideoCodec && /* @__PURE__ */ jsx(Hint, { children: selectedVideoCodec.description }),
513
+ selectedVideoCodec?.warning && /* @__PURE__ */ jsx(Warning, { children: selectedVideoCodec.warning })
467
514
  ] }),
468
515
  /* @__PURE__ */ jsxs("div", { children: [
469
- /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6, color: "rgba(255,255,255,0.4)" }, children: "Resolu\xE7\xF5es" }),
516
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Resolu\xE7\xF5es" }),
470
517
  /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
471
518
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, transcoding: "auto" }), style: optBtnStyle(isAuto), children: "Auto" }),
472
- RESOLUTIONS.map((r) => /* @__PURE__ */ jsx(
519
+ RESOLUTIONS.map((r) => /* @__PURE__ */ jsx("button", { type: "button", onClick: () => toggleRes(r), style: optBtnStyle(!isAuto && selectedRes.includes(r)), children: RESOLUTION_LABELS[r] }, r))
520
+ ] }),
521
+ isAuto && /* @__PURE__ */ jsx(Hint, { children: "Gera todas as resolu\xE7\xF5es at\xE9 a resolu\xE7\xE3o original do v\xEDdeo." })
522
+ ] }),
523
+ !advanced && /* @__PURE__ */ jsxs(Fragment, { children: [
524
+ /* @__PURE__ */ jsxs("div", { children: [
525
+ /* @__PURE__ */ jsx(SectionLabel, { children: "\xC1udio" }),
526
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: AUDIO_SIMPLE.map((a) => /* @__PURE__ */ jsxs(
527
+ "button",
528
+ {
529
+ type: "button",
530
+ onClick: () => onChange({ ...value, audioCodec: a.value }),
531
+ style: optBtnStyle(audioCodec === a.value),
532
+ children: [
533
+ a.label,
534
+ "badge" in a && a.badge ? /* @__PURE__ */ jsx("span", { style: { marginLeft: 5, fontSize: 9, fontWeight: 700, background: "rgba(255,255,255,0.15)", borderRadius: 4, padding: "1px 4px", verticalAlign: "middle" }, children: a.badge }) : null
535
+ ]
536
+ },
537
+ a.value
538
+ )) }),
539
+ /* @__PURE__ */ jsx(Hint, { children: AUDIO_SIMPLE.find((a) => a.value === audioCodec)?.description })
540
+ ] }),
541
+ /* @__PURE__ */ jsxs("div", { children: [
542
+ /* @__PURE__ */ jsx(SectionLabel, { children: "HDR" }),
543
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(
544
+ Toggle,
545
+ {
546
+ checked: hdrMode === "preserve",
547
+ onToggle: () => onChange({ ...value, hdr: hdrMode === "preserve" ? "sdr" : "preserve" }),
548
+ label: "Preservar HDR",
549
+ hint: "Mant\xE9m HDR10, HDR10+, HLG e Dolby Vision quando o codec de sa\xEDda suporta (H.265 e AV1). Ignorado para H.264."
550
+ }
551
+ ) })
552
+ ] })
553
+ ] }),
554
+ advanced && /* @__PURE__ */ jsxs(Fragment, { children: [
555
+ /* @__PURE__ */ jsxs("div", { children: [
556
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Codec de \xE1udio" }),
557
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: AUDIO_ADVANCED_CODEC.map((a) => /* @__PURE__ */ jsx(
558
+ "button",
559
+ {
560
+ type: "button",
561
+ onClick: () => onChange({ ...value, audioCodec: a.value }),
562
+ style: optBtnStyle(audioCodec === a.value),
563
+ children: a.label
564
+ },
565
+ a.value
566
+ )) }),
567
+ /* @__PURE__ */ jsx(Hint, { children: AUDIO_ADVANCED_CODEC.find((a) => a.value === audioCodec)?.description }),
568
+ showAtmosWarning && /* @__PURE__ */ jsx(Warning, { children: "Este codec n\xE3o preserva Dolby Atmos. Use E-AC3 ou Original para manter Atmos." })
569
+ ] }),
570
+ /* @__PURE__ */ jsxs("div", { children: [
571
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Canais" }),
572
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: AUDIO_CHANNELS.map((c) => /* @__PURE__ */ jsx(
473
573
  "button",
474
574
  {
475
575
  type: "button",
476
- onClick: () => toggleRes(r),
477
- style: optBtnStyle(!isAuto && selectedRes.includes(r)),
478
- children: RESOLUTION_LABELS[r]
576
+ onClick: () => onChange({ ...value, audioChannels: c.value }),
577
+ style: optBtnStyle(audioChannels === c.value),
578
+ children: c.label
479
579
  },
480
- r
481
- ))
580
+ c.value
581
+ )) }),
582
+ /* @__PURE__ */ jsx(Hint, { children: AUDIO_CHANNELS.find((c) => c.value === audioChannels)?.description })
482
583
  ] }),
483
- isAuto && /* @__PURE__ */ jsx("div", { style: { marginTop: 6, fontSize: 11, color: "rgba(255,255,255,0.35)", lineHeight: 1.5 }, children: "Modo autom\xE1tico: gera todas as resolu\xE7\xF5es at\xE9 a resolu\xE7\xE3o original do v\xEDdeo." })
584
+ showAtmosOption && /* @__PURE__ */ jsxs("div", { children: [
585
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Atmos" }),
586
+ /* @__PURE__ */ jsx(
587
+ Toggle,
588
+ {
589
+ checked: preserveAtmos,
590
+ onToggle: () => onChange({ ...value, preserveAtmos: !preserveAtmos }),
591
+ label: "Preservar Dolby Atmos quando dispon\xEDvel",
592
+ hint: "Mant\xE9m os metadados Atmos no E-AC3 de sa\xEDda. Efetivo somente com codec E-AC3 ou Original."
593
+ }
594
+ )
595
+ ] }),
596
+ /* @__PURE__ */ jsxs("div", { children: [
597
+ /* @__PURE__ */ jsx(SectionLabel, { children: "HDR" }),
598
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
599
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, hdr: "preserve" }), style: optBtnStyle(hdrMode === "preserve"), children: "Preservar HDR" }),
600
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, hdr: "sdr" }), style: optBtnStyle(hdrMode === "sdr"), children: "Converter para SDR" })
601
+ ] }),
602
+ /* @__PURE__ */ jsx(Hint, { children: hdrMode === "preserve" ? "HDR10, HDR10+, HLG e Dolby Vision s\xE3o preservados com H.265 e AV1. H.264 ignora HDR." : "Tonemapping para SDR \u2014 compat\xEDvel com todos os displays." })
603
+ ] })
484
604
  ] }),
485
605
  /* @__PURE__ */ jsxs("div", { children: [
486
- /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 8, color: "var(--silo-text-muted)" }, children: "Recursos" }),
487
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
488
- /* @__PURE__ */ jsx(Toggle, { checked: value.thumbnails ?? true, onToggle: () => toggleFeature("thumbnails"), label: "Gerar thumbnails" }),
489
- /* @__PURE__ */ jsx(Toggle, { checked: value.storyboard ?? false, onToggle: () => toggleFeature("storyboard"), label: "Gerar storyboard" }),
490
- /* @__PURE__ */ jsx(Toggle, { checked: value.autoCaptions ?? false, onToggle: () => toggleFeature("autoCaptions"), label: "Legendas autom\xE1ticas (IA)" }),
491
- /* @__PURE__ */ jsx(Toggle, { checked: value.separateAudio ?? false, onToggle: () => toggleFeature("separateAudio"), label: "Separar faixa de \xE1udio" })
606
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Recursos" }),
607
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5", children: [
608
+ /* @__PURE__ */ jsx(Toggle, { checked: value.thumbnails ?? true, onToggle: () => onChange({ ...value, thumbnails: !(value.thumbnails ?? true) }), label: "Gerar thumbnails" }),
609
+ /* @__PURE__ */ jsx(Toggle, { checked: value.storyboard ?? false, onToggle: () => onChange({ ...value, storyboard: !value.storyboard }), label: "Gerar storyboard" }),
610
+ /* @__PURE__ */ jsx(Toggle, { checked: value.autoCaptions ?? false, onToggle: () => onChange({ ...value, autoCaptions: !value.autoCaptions }), label: "Legendas autom\xE1ticas (IA)" }),
611
+ /* @__PURE__ */ jsx(Toggle, { checked: value.separateAudio ?? false, onToggle: () => onChange({ ...value, separateAudio: !value.separateAudio }), label: "Separar faixa de \xE1udio" })
492
612
  ] })
493
- ] })
613
+ ] }),
614
+ /* @__PURE__ */ jsx(
615
+ "button",
616
+ {
617
+ type: "button",
618
+ onClick: () => setAdvanced((v) => !v),
619
+ style: { alignSelf: "flex-start", fontSize: 11, color: "rgba(255,255,255,0.35)", background: "none", border: "none", cursor: "pointer", padding: 0, textDecoration: "underline", textUnderlineOffset: 3 },
620
+ children: advanced ? "\u2190 Modo simples" : "Op\xE7\xF5es avan\xE7adas \u2192"
621
+ }
622
+ )
494
623
  ] });
495
624
  }
496
625
  var DEFAULT_VIDEO_OPTS = {