@nuralogix.ai/anura-web-core-sdk
Version:
Anura Web Core SDK
199 lines (185 loc) • 5.1 kB
TypeScript
/**
* The objectFit sets how the content of an element should be resized to fit its container.
*
* `contain`:
*
* The content is scaled to maintain its aspect ratio while fitting within the element's
* content box. The entire object is made to fill the box, while preserving its aspect ratio,
* so the object will be "letterboxed" or "pillarboxed" if its aspect ratio does not match the
* aspect ratio of the box.
*
* `cover`:
*
* The content is sized to maintain its aspect ratio while filling the element's entire
* content box. If the object's aspect ratio does not match the aspect ratio of its box, then
* the object will be clipped to fit.
*
* `none`:
*
* The content is not resized.
* @enum
*/
declare const objectFit: {
readonly CONTAIN: "contain";
readonly COVER: "cover";
readonly NONE: "none";
};
type ObjectFit = typeof objectFit[keyof typeof objectFit];
interface VideoElementSize {
width: number;
height: number;
offsetX: number;
offsetY: number;
}
interface Centroids {
[id: string]: {x: number, y: number };
}
interface MeshAnnotation {
x: number;
y: number;
z: number | undefined;
}
interface Annotations {
silhouette: MeshAnnotation[],
centroids: Centroids;
}
interface PosePoints {
[x: string]: {
point: number[],
valid: boolean;
estimated: boolean;
quality: number;
}
}
interface DfxRect {
x: number;
y: number;
width: number;
height: number;
}
interface DfxFace {
detected: boolean;
id: string;
poseValid: boolean;
posePoints: PosePoints,
faceRect: DfxRect;
}
declare const pointGroup: {
readonly METADATA: "metadata";
readonly PHYSICAL: "physical";
readonly GENERAL_RISKS: "generalRisks";
readonly VITALS: "vitals";
readonly PHYSIOLOGICAL: "physiological";
readonly METABOLIC_RISKS: "metabolicRisks";
readonly BLOOD_BIOMARKERS: "bloodBiomarkers";
readonly OVERALL: "overall";
readonly MENTAL: "mental";
readonly SURVEYS: "surveys";
};
type PointGroupType = typeof pointGroup[keyof typeof pointGroup];
type BandColors = ('YELLOW' | 'LIGHT_GREEN' | 'GREEN' | 'LIGHT_RED' | 'RED')[];
interface IMeta {
availableAfterSec: number;
range: {
min: number;
max: number;
};
requirements: {
profileInfo: boolean;
medicalHistory: boolean;
};
group: PointGroupType;
ranges: {
[x: string]: number[][][];
};
dialBandColors: {
[x: string]: BandColors;
};
}
interface DialSection {
groupSize: number;
bandColor: 'YELLOW' | 'LIGHT_GREEN' | 'GREEN' | 'LIGHT_RED' | 'RED';
range: number[];
}
interface Point {
channel: string;
notes: string[];
value: string;
dial: {
sections: DialSection[];
group: number;
subGroup: number;
};
meta: IMeta;
info: {
name: string;
unit: string;
};
}
interface Points {
[x: string]: Point;
}
interface Drawables {
face: DfxFace;
annotations: Annotations;
starRating: number;
percentCompleted: number;
}
interface IMask {
version: string;
objectFit: ObjectFit;
getSvg(): SVGSVGElement;
resize(resizeInfo: IMaskResize): void;
draw({ face, annotations, starRating, percentCompleted }: Drawables): void;
setMaskVisibility(isVisible: boolean): void;
}
interface IMediaElementSize {
width: number;
height: number;
x: number;
y: number;
}
interface IFrameInfo {
mediaStreamWidth: number;
mediaStreamHeight: number;
faceTrackerWidth: number;
faceTrackerHeight: number;
}
interface IMaskResize {
mediaElementSize: IMediaElementSize;
videoElementSize: VideoElementSize;
frameInfo: IFrameInfo;
isPortrait: boolean;
aspectRatio: number;
}
interface IAnuraMask extends IMask {
setIntermediateResults(points: Points): void;
resize(resizeInfo: IMaskResize, settings?: Partial<AnuraMaskSettings>): void;
}
interface AnuraMaskSettings {
starFillColor: string;
starBorderColor: string;
pulseRateColor: string;
pulseRateLabelColor: string;
backgroundColor: string;
countDownLabelColor: string;
faceNotCenteredColor: string;
/** must be > 0 and <= 1 */
diameter: number;
/** must be > 0 and <= 1 */
bottomMargin: number;
/** must be > 0 and <= 1. */
topMargin: number;
}
declare class AnuraMask implements IAnuraMask {
#private;
version: string;
objectFit: ObjectFit;
constructor(settings?: Partial<AnuraMaskSettings>);
getSvg(): SVGSVGElement;
resize(resizeInfo: IMaskResize, settings?: Partial<AnuraMaskSettings>): void;
draw({ face, annotations, starRating, percentCompleted }: Drawables): void;
setMaskVisibility(isVisible: boolean): void;
setIntermediateResults(points: Points): void;
}
export { AnuraMask, type AnuraMaskSettings, type IAnuraMask, type IFrameInfo, type IMaskResize, type IMediaElementSize, type ObjectFit, type VideoElementSize, objectFit };