@klikeai/cut-preview 1.0.1 → 1.0.2

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.d.ts CHANGED
@@ -61,6 +61,11 @@ interface CaptionStyle {
61
61
  template?: CaptionTemplate;
62
62
  /** Âncora vertical do bloco (sempre dentro das safe zones). */
63
63
  position?: 'bottom' | 'center' | 'top';
64
+ /** Fundo do bloco (hex #RRGGBB) — vale p/ QUALQUER template; '' = sem
65
+ * fundo (o template pill mantém o fundo escuro default). */
66
+ backgroundColor?: string;
67
+ /** Opacidade do fundo 0-1 (default 0.72; usada com backgroundColor). */
68
+ backgroundOpacity?: number;
64
69
  }
65
70
  interface CaptionsProps {
66
71
  enabled: boolean;
package/dist/index.js CHANGED
@@ -21,7 +21,9 @@ var DEFAULT_CAPTION_STYLE = {
21
21
  activeScale: 1.15,
22
22
  animateIn: true,
23
23
  template: "classic",
24
- position: "bottom"
24
+ position: "bottom",
25
+ backgroundColor: "",
26
+ backgroundOpacity: 0.72
25
27
  };
26
28
  var DEFAULT_CAPTION_DISPLAY_MODE = "highlight";
27
29
  var DEFAULT_CAPTION_COMBINE_MS = 1200;
@@ -291,6 +293,13 @@ var gradeFilter = (preset, intensity) => {
291
293
  if (t.hueDeg !== void 0) parts.push(`hue-rotate(${lerp(0, t.hueDeg)}deg)`);
292
294
  return parts.length ? parts.join(" ") : "none";
293
295
  };
296
+ var hexToRgba = (hex, alpha = 1) => {
297
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
298
+ if (!m) return hex;
299
+ const n = parseInt(m[1], 16);
300
+ const a = Math.max(0, Math.min(alpha, 1));
301
+ return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${a})`;
302
+ };
294
303
  var textOutline = (color, px = 3) => {
295
304
  const o = [];
296
305
  for (let dx = -px; dx <= px; dx++) {
@@ -592,12 +601,16 @@ var Page = ({ page, style, displayMode, safeZones }) => {
592
601
  lineHeight: 1.25,
593
602
  opacity: enter,
594
603
  transform: `scale(${interpolate3(enter, [0, 1], [0.92, 1])})`,
595
- // Template pill: bloco da página sobre fundo arredondado translúcido.
596
- ...template === "pill" ? {
597
- backgroundColor: "rgba(12, 12, 14, 0.72)",
598
- borderRadius: 22 * ui,
599
- padding: "0.35em 0.6em"
600
- } : {}
604
+ // Fundo do bloco: override explícito (backgroundColor+opacity) vale
605
+ // p/ QUALQUER template; sem override, só o pill tem o fundo default.
606
+ ...(() => {
607
+ const blockBg = style.backgroundColor ? hexToRgba(style.backgroundColor, style.backgroundOpacity) : template === "pill" ? "rgba(12, 12, 14, 0.72)" : void 0;
608
+ return blockBg ? {
609
+ backgroundColor: blockBg,
610
+ borderRadius: 22 * ui,
611
+ padding: "0.35em 0.6em"
612
+ } : {};
613
+ })()
601
614
  },
602
615
  children: page.tokens.map((t, i) => renderToken(t.text, t.fromMs, t.toMs, i))
603
616
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klikeai/cut-preview",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "SmartStudioComposition + calculateMetadata do Klike Cut para o preview ao vivo (Remotion Player).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",