import type { LiteralUnion } from 'type-fest'; import type { StyleObject, VpUnit, VpValue } from 'noodl-types'; import type NuiViewport from '../Viewport'; import * as t from '../types'; export declare const xKeys: readonly ["width", "left"]; export declare const yKeys: readonly ["height", "top", "marginTop"]; export declare const posKeys: readonly ["width", "left", "height", "top", "marginTop"]; export declare const vpHeightKeys: readonly ["height", "top", "marginTop", "borderRadius", "fontSize", "padding", "paddingTop", "paddingBottom", "marginBottom"]; export declare const vpWidthKeys: readonly ["width", "left", "marginLeft", "marginRight", "paddingLeft", "paddingRight"]; export declare const textAlignStrings: readonly ["left", "center", "right", "centerX", "centerY"]; export declare function getPositionProps(styleObj: StyleObject | undefined, key: string, // 'marginTop' | 'top' | 'height' | 'width' | 'left' | 'fontSize' viewportSize: number): { [x: string]: string; } | undefined; /** * Takes a value and a full viewport size and returns a computed value in px * @param { string | number } value - width / height value * @param { number } viewportSize */ export declare function getSize(value: string | number, viewportSize: number): string | number; /** * Returns a ratio (in pixels) computed from a total given viewport size * @param { number } viewportSize - Size (in pixels) in the viewport (represents width or height) * @param { string | number } size - Size (raw decimal value from NOODL response) most likely in decimals. Strings are converted to numbers to evaluate the value. Numbers that aren't decimals are used as a fraction of the viewport size. */ export declare function getViewportRatio(viewportSize: number, size: string | number): number; /** * Returns viewport.width or viewport.height, or null is viewport is invalid * @param viewport * @param value * @returns */ export declare function getViewportBound(viewport: t.ViewportObject | NuiViewport | null | undefined, value: LiteralUnion[0], string>): number | null; export declare function getVpKey(value: VpValue | (typeof vpHeightKeys[number] | typeof vpWidthKeys[number] | typeof textAlignStrings[number])): "height" | "width"; /** * If this returns true, the value is something like "0.2", "0.4", etc. * Whole numbers like "1" or "5" will return false, which is not what we want for positioning values like "marginTop" or "top" since we assume "1" means full screen, etc. */ export declare function isNoodlUnit(value: unknown): value is string; export declare function toFixed(value: number, fixNum?: number): string | number; export declare function toFixedNum(value: string | number, fixNum?: number): string | number; export declare function isVwVh(value: unknown): value is `${string}${'vw' | 'vh'}`; export declare function isVw(v: unknown): v is `${string}vw`; export declare function isVh(v: unknown): v is `${string}vh`; export declare function isKeyRelatedToWidthOrHeight(key: string): boolean; export declare function isKeyRelatedToHeight(key: string): boolean; export declare function isKeyRelatedToWidth(key: string): boolean; export declare function isValidViewport(value: unknown): value is NuiViewport | t.ViewportObject; /** * https://tc39.es/ecma262/#sec-tonumber */ export declare function toNum(value: unknown, fixedNum?: number): number; /** * @param { number | null } vpSize * @param { string | number } value * @param { VpUnit } unit * @returns { string } */ export declare function toVwVh(vpSize: number | null, value: string | number, unit: VpUnit): string | number; /** * Convers the value into the vw/vh format * @param { number } vpSize * @param { string | number } px * @returns { number } */ export declare function toVp(unit: VpUnit, vpSize: number, px: string | number): VpValue; export declare const pxToVw: (vpSize: number, px: string | number) => `${string}vw`; export declare const pxToVh: (vpSize: number, px: string | number) => `${string}vh`;