initial commit
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import { t, Static } from "elysia";
|
||||
|
||||
export const CaptionTextStyle = t.Object({
|
||||
font_family: t.String({ default: "Lobster" }),
|
||||
font_size: t.Number({ default: 40 }),
|
||||
font_weight: t.Number({ default: 400 }),
|
||||
text_color: t.String({ default: "#FFFFFF" }),
|
||||
highlight_color: t.String({ default: "#FFCC00" }),
|
||||
text_shadow: t.Union([t.String(), t.Null()], {
|
||||
default: "2px 2px 4px rgba(0,0,0,0.5)",
|
||||
}),
|
||||
text_stroke_width: t.Number({ default: 0 }),
|
||||
text_stroke_color: t.String({ default: "#000000" }),
|
||||
});
|
||||
|
||||
export const CaptionLayoutStyle = t.Object({
|
||||
vertical_position: t.Union(
|
||||
[t.Literal("top"), t.Literal("center"), t.Literal("bottom")],
|
||||
{ default: "bottom" },
|
||||
),
|
||||
horizontal_alignment: t.Union(
|
||||
[t.Literal("left"), t.Literal("center"), t.Literal("right")],
|
||||
{ default: "center" },
|
||||
),
|
||||
padding_px: t.Number({ default: 20 }),
|
||||
max_width_pct: t.Number({ default: 90 }),
|
||||
lines_per_screen: t.Number({ default: 2 }),
|
||||
});
|
||||
|
||||
export const CaptionAnimationStyle = t.Object({
|
||||
highlight_style: t.Union(
|
||||
[
|
||||
t.Literal("color"),
|
||||
t.Literal("scale"),
|
||||
t.Literal("underline"),
|
||||
t.Literal("color_scale"),
|
||||
],
|
||||
{ default: "color" },
|
||||
),
|
||||
highlight_scale: t.Number({ default: 1.1 }),
|
||||
segment_transition: t.Union(
|
||||
[t.Literal("fade"), t.Literal("slide"), t.Literal("none")],
|
||||
{ default: "fade" },
|
||||
),
|
||||
fade_duration_frames: t.Number({ default: 3 }),
|
||||
animation_speed: t.Number({ default: 1.0 }),
|
||||
});
|
||||
|
||||
export const CaptionBackgroundStyle = t.Object({
|
||||
bg_color: t.String({ default: "rgba(0,0,0,0.6)" }),
|
||||
bg_blur_px: t.Number({ default: 0 }),
|
||||
bg_glow_color: t.Union([t.String(), t.Null()], { default: null }),
|
||||
bg_border_radius_px: t.Number({ default: 15 }),
|
||||
bg_padding_px: t.Number({ default: 20 }),
|
||||
});
|
||||
|
||||
export const CaptionStyleSchema = t.Object({
|
||||
text: CaptionTextStyle,
|
||||
layout: CaptionLayoutStyle,
|
||||
animation: CaptionAnimationStyle,
|
||||
background: CaptionBackgroundStyle,
|
||||
});
|
||||
|
||||
export type CaptionTextStyleType = Static<typeof CaptionTextStyle>;
|
||||
export type CaptionLayoutStyleType = Static<typeof CaptionLayoutStyle>;
|
||||
export type CaptionAnimationStyleType = Static<typeof CaptionAnimationStyle>;
|
||||
export type CaptionBackgroundStyleType = Static<typeof CaptionBackgroundStyle>;
|
||||
export type CaptionStyleConfigType = Static<typeof CaptionStyleSchema>;
|
||||
@@ -0,0 +1,49 @@
|
||||
import { t, Static } from "elysia";
|
||||
|
||||
// 1. Leaf Nodes (Building blocks)
|
||||
export const Tag = t.Object({
|
||||
name: t.String(),
|
||||
});
|
||||
|
||||
export const TimeRange = t.Object({
|
||||
start: t.Number(),
|
||||
end: t.Number(),
|
||||
});
|
||||
|
||||
// 2. Word Node
|
||||
export const WordNode = t.Object({
|
||||
text: t.String(),
|
||||
semantic_tags: t.Array(Tag),
|
||||
structure_tags: t.Array(Tag),
|
||||
time: TimeRange,
|
||||
});
|
||||
|
||||
// 3. Line Node (Contains Words)
|
||||
export const LineNode = t.Object({
|
||||
text: t.String(),
|
||||
semantic_tags: t.Array(Tag),
|
||||
structure_tags: t.Array(Tag),
|
||||
time: TimeRange,
|
||||
words: t.Array(WordNode),
|
||||
});
|
||||
|
||||
// 4. Segment Node (Contains Lines)
|
||||
export const SegmentNode = t.Object({
|
||||
text: t.String(),
|
||||
semantic_tags: t.Array(Tag),
|
||||
structure_tags: t.Array(Tag),
|
||||
time: TimeRange,
|
||||
lines: t.Array(LineNode),
|
||||
});
|
||||
|
||||
// 5. Root Document
|
||||
export const Document = t.Object({
|
||||
segments: t.Array(SegmentNode),
|
||||
});
|
||||
|
||||
export type TagInterface = Static<typeof Tag>;
|
||||
export type TimeRangeInterface = Static<typeof TimeRange>;
|
||||
export type WordNodeInterface = Static<typeof WordNode>;
|
||||
export type LineNodeInterface = Static<typeof LineNode>;
|
||||
export type SegmentNodeInterface = Static<typeof SegmentNode>;
|
||||
export type DocumentInterface = Static<typeof Document>;
|
||||
Reference in New Issue
Block a user