@interactify-live/player-react-native
Version:
React Native library for Interactify player with media display, widgets, and MQTT integration
187 lines (186 loc) • 4.57 kB
TypeScript
import { ViewStyle, TextStyle } from "react-native";
export declare const Alignment: {
LEFT: "left";
CENTER: "center";
RIGHT: "right";
JUSTIFY: "justify";
};
export declare const FontWeight: {
NORMAL: "normal";
BOLD: "bold";
BOLDER: "bolder";
LIGHTER: "lighter";
100: "100";
200: "200";
300: "300";
400: "400";
500: "500";
600: "600";
700: "700";
800: "800";
900: "900";
};
export declare const FontStyle: {
NORMAL: "normal";
ITALIC: "italic";
OBLIQUE: "oblique";
};
export declare const ShapeType: {
RECTANGLE: "rectangle";
CIRCLE: "circle";
ELLIPSE: "ellipse";
TRIANGLE: "triangle";
};
export type AlignmentType = (typeof Alignment)[keyof typeof Alignment];
export type FontWeightType = (typeof FontWeight)[keyof typeof FontWeight];
export type FontStyleType = (typeof FontStyle)[keyof typeof FontStyle];
export type ShapeTypeType = (typeof ShapeType)[keyof typeof ShapeType];
export interface WidgetOptions {
id?: string;
x?: number;
y?: number;
width?: number;
height?: number;
visible?: boolean;
zIndex?: number;
opacity?: number;
rotation?: number;
scale?: {
x: number;
y: number;
};
isDraggable?: boolean;
animation?: string | null;
duration?: number;
easing?: string;
onPress?: () => void;
onPressIn?: () => void;
onPressOut?: () => void;
onLongPress?: () => void;
onDragStart?: () => void;
onDragMove?: () => void;
onDragEnd?: (position: {
x: number;
y: number;
}) => void;
}
export interface TextWidgetOptions extends WidgetOptions {
text?: string;
fontSize?: number;
fontFamily?: string;
fontWeight?: FontWeightType;
fontStyle?: FontStyleType;
color?: string;
backgroundColor?: string;
textAlign?: AlignmentType;
lineHeight?: number;
letterSpacing?: number;
borderWidth?: number;
borderColor?: string;
borderRadius?: number;
maxWidth?: number | null;
maxHeight?: number | null;
overflow?: "visible" | "hidden" | "scroll";
autoSize?: boolean;
minFontSize?: number;
maxFontSize?: number;
textShadowColor?: string;
textShadowOffset?: {
width: number;
height: number;
};
textShadowRadius?: number;
padding?: number;
paddingHorizontal?: number;
paddingVertical?: number;
}
export interface WidgetManagerOptions {
enableDrag?: boolean;
enableResize?: boolean;
enableRotation?: boolean;
}
export interface WidgetConfig {
id: string;
type: string;
x: number;
y: number;
width: number;
height: number;
visible: boolean;
zIndex: number;
opacity: number;
rotation: number;
scale: {
x: number;
y: number;
};
[key: string]: any;
}
export interface ManagerConfig {
widgets: WidgetConfig[];
options: WidgetManagerOptions;
}
export interface AnimationProperties {
opacity?: number;
rotation?: number;
scale?: {
x: number;
y: number;
};
x?: number;
y?: number;
width?: number;
height?: number;
[key: string]: any;
}
export interface InteractionItem {
interaction: string;
payload: any;
geometric: {
x: number;
y: number;
width: number;
height: number;
};
}
export interface InteractionRendererOptions {
onInteractionPress?: (interaction: InteractionItem) => void;
onInteractionDragEnd?: (interactionIndex: number, geometric: {
x: number;
y: number;
width: number;
height: number;
}) => void;
isDraggable?: boolean;
}
export interface WidgetStyle extends Omit<ViewStyle, "transform"> {
position: "absolute";
left: number;
top: number;
width: number;
height: number;
opacity: number;
transform: Array<{
rotate?: string;
scale?: number;
scaleX?: number;
scaleY?: number;
}>;
zIndex: number;
}
export interface TextWidgetStyle extends Omit<TextStyle, "fontStyle" | "fontWeight"> {
fontSize: number;
fontFamily?: string;
fontWeight?: "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | "normal" | "bold" | "lighter" | "bolder";
fontStyle?: "normal" | "italic";
color: string;
textAlign: AlignmentType;
lineHeight?: number;
letterSpacing?: number;
textShadowColor?: string;
textShadowOffset?: {
width: number;
height: number;
};
textShadowRadius?: number;
}