/* eslint-disable no-var,camelcase */
/*!
* V4Fire Client Core
* https://github.com/V4Fire/Client
*
* Released under the MIT license
* https://github.com/V4Fire/Client/blob/master/LICENSE
*/
///
///
///
declare const MODULE: string;
declare const CSP_NONCE_STORE: string;
declare const LANG_PACKS: string;
declare var PATH: Dictionary>;
declare var PUBLIC_PATH: CanUndef;
declare const COMPONENTS: Dictionary<{parent: string; dependencies: string[]}>;
declare const TPLS: Dictionary>;
declare const DS: CanUndef;
declare const BLOCK_NAMES: CanUndef;
declare const BUILD_MODE: CanUndef;
declare const DS_COMPONENTS_MODS: CanUndef<{
[name: string]: Nullable>;
}>;
interface RenderOptions {
/** @default `'rootSelector'` */
selectorToInject?: string;
/** @default `'#root-component'` */
rootSelector?: string;
}
interface HTMLImageElement {
readonly init: Promise;
onInit(onSuccess: () => void, onFail?: (err?: Error) => void): void;
}
/**
* Default app theme to use
* @see config/default.js
*/
declare const THEME: CanUndef;
/**
* Attribute name to set a value of the theme to the root element
* @see config/default.js
*/
declare const THEME_ATTRIBUTE: CanUndef;
/**
* Array of available themes in the runtime
* @see config/default.js
*/
declare const AVAILABLE_THEMES: CanUndef;
declare const DETECT_USER_PREFERENCES: CanUndef<
Dictionary;
}>>
>;
interface Event {
delegateTarget?: Element;
}
interface BoxSize {
readonly blockSize: number;
readonly inlineSize: number;
}
interface ResizeObserverObserveOptions {
box: 'content-box' | 'border-box';
}
declare let ModuleDependencies: {
cache: Dictionary;
event: {on: Function; once: Function; off: Function};
add(moduleName: string, dependencies: string[]): void;
get(module: string): Promise;
};
interface ElementPosition {
top: number;
left: number;
}
interface Element {
getPosition(): ElementPosition;
getIndex(): number | null;
}
interface Node {
getOffset(parent?: Element | string): ElementPosition;
}
interface IntersectionObserverInit {
delay?: number;
trackVisibility?: boolean;
}
interface IntersectionObserver {
delay?: number;
trackVisibility?: boolean;
}
interface Document {
fonts: {
ready: Promise;
};
}
interface RenderContentFn {
(props: Dictionary): string;
}
interface RenderParams {
/**
* Component attrs
*/
attrs?: A;
/** @see [[RenderContent]] */
content?: Dictionary;
}
/**
* Content to render into an element
*
* @example
*
* ```typescript
* globalThis.renderComponents('b-button', {
* attrs: {
* testProp: 1
* },
*
* content: {
* default: {
* tag: 'b-button',
* content: {
* default: 'Test'
* }
* }
* }
* });
* ```
*
* This schema is the equivalent of such a template:
*
* ```ss
* < b-button :testProp = 1
* < b-button
* Test
* ```
*/
interface RenderContent {
/**
* Component name or tagName
*/
tag: string;
/**
* Component attrs
*/
attrs: Dictionary;
/** @see [[RenderContent]] */
content?: Dictionary;
}
// eslint-disable-next-line no-var,vars-on-top
declare var
/**
* Renders the specified components
*
* @param componentName
* @param scheme
* @param [opts]
*/
renderComponents: (componentName: string, scheme: RenderParams[] | string, opts?: RenderOptions) => void,
/**
* Removes all components created via `globalThis.renderComponents`
*/
removeCreatedComponents: () => void,
/**
* Requires a module by the specified path
*/
importModule: (path: string) => any,
/**
* Jest mock API for test environment.
*/
jestMock: {
/**
* Wrapper for jest `spyOn` function.
* @see https://jestjs.io/docs/mock-functions
*/
spy: import('jest-mock').ModuleMocker['spyOn'];
/**
* Wrapper for jest `fn` function.
* @see https://jestjs.io/docs/mock-functions
*/
mock: import('jest-mock').ModuleMocker['fn'];
};
type RenderComponentsScheme = RenderComponentsVnodeParams[] | string;
interface RenderComponentsVnodeDescriptor extends RenderComponentsVnodeParams {
/**
* A simple tag name or component name
*/
type: string;
}
interface RenderComponentsVnodeParams {
/**
* A dictionary with attributes to pass to the created VNode
*/
attrs?: A;
/**
* An array of children VNode descriptors or dictionary with slot functions
*/
children?: VNodeChildren;
}
type VNodeChild = string | RenderComponentsVnodeDescriptor;
type VNodeChildren =
VNodeChild[] |
Dictionary | ((...args: any[]) => CanArray)>;
/**
* The results returned by a mock or spy function from `jestMock`.
*/
interface JestMockResult {
type: 'throw' | 'return';
value: VAL;
}
interface TouchGesturesCreateOptions {
/**
* Element to dispatch an event
*/
dispatchEl: Element | string;
/**
* Element that will be provided as a target in the dispatched event
*/
targetEl: Element | string;
/**
* Delay between steps
* @default `5`
*/
pause?: number;
}
interface TouchGesturePoint extends Partial {
x: number;
y: number;
}