vue-yandex-maps
Version:
Yandex Maps 3.0 components library for VueJS.
202 lines (201 loc) • 9.49 kB
TypeScript
import { Ref } from 'vue';
import { OverloadParameters } from './types/overload-extract.ts';
import { Apikeys } from '@yandex/ymaps3-types/imperative/config';
import { YMapEntity } from '@yandex/ymaps3-types';
export interface IYandexMapTrafficLayerProps {
visible: boolean;
[key: string]: any;
}
export declare class IYandexMapTrafficLayer extends YMapEntity<IYandexMapTrafficLayerProps> {
}
export interface IYandexMapTrafficEventsLayerProps extends IYandexMapTrafficLayerProps {
}
export declare class IYandexMapTrafficEventsLayer extends YMapEntity<IYandexMapTrafficEventsLayerProps> {
}
export declare namespace VueYandexMaps {
const settings: Ref<VueYandexMaps.PluginSettings>;
/**
* @description True when `createYmapsOptions` was called and settings were set
* @note Useful if there's a change your map may be initialized earlier than you will set settings
*/
const isReadyToInit: import("vue").ComputedRef<boolean>;
const ymaps: () => typeof import("@yandex/ymaps3-types");
const script: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
class YandexMapException extends Error {
constructor(message: string);
}
type LoadStatus = 'pending' | 'loading' | 'loaded' | 'error';
const loadStatus: Ref<LoadStatus, LoadStatus>;
const isLoaded: import("vue").ComputedRef<boolean>;
const loadError: Ref<string | Error | {
readonly bubbles: boolean;
cancelBubble: boolean;
readonly cancelable: boolean;
readonly composed: boolean;
readonly currentTarget: {
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (event: Event) => boolean;
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
} | null;
readonly defaultPrevented: boolean;
readonly eventPhase: number;
readonly isTrusted: boolean;
returnValue: boolean;
readonly srcElement: {
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (event: Event) => boolean;
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
} | null;
readonly target: {
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (event: Event) => boolean;
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
} | null;
readonly timeStamp: DOMHighResTimeStamp;
readonly type: string;
composedPath: () => EventTarget[];
initEvent: (type: string, bubbles?: boolean, cancelable?: boolean) => void;
preventDefault: () => void;
stopImmediatePropagation: () => void;
stopPropagation: () => void;
readonly NONE: 0;
readonly CAPTURING_PHASE: 1;
readonly AT_TARGET: 2;
readonly BUBBLING_PHASE: 3;
} | null, string | Error | {
readonly bubbles: boolean;
cancelBubble: boolean;
readonly cancelable: boolean;
readonly composed: boolean;
readonly currentTarget: {
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (event: Event) => boolean;
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
} | null;
readonly defaultPrevented: boolean;
readonly eventPhase: number;
readonly isTrusted: boolean;
returnValue: boolean;
readonly srcElement: {
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (event: Event) => boolean;
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
} | null;
readonly target: {
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (event: Event) => boolean;
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
} | null;
readonly timeStamp: DOMHighResTimeStamp;
readonly type: string;
composedPath: () => EventTarget[];
initEvent: (type: string, bubbles?: boolean, cancelable?: boolean) => void;
preventDefault: () => void;
stopImmediatePropagation: () => void;
stopPropagation: () => void;
readonly NONE: 0;
readonly CAPTURING_PHASE: 1;
readonly AT_TARGET: 2;
readonly BUBBLING_PHASE: 3;
} | null>;
interface LayersExtra {
YMapTrafficLayer: typeof IYandexMapTrafficLayer;
YMapTrafficEventsLayer: typeof IYandexMapTrafficEventsLayer;
}
/**
* @description type-safe import for layers-extra module
* @internal
*/
function importLayersExtra(): Promise<VueYandexMaps.LayersExtra>;
interface PluginSettings {
/**
* @see https://yandex.ru/dev/maps/jsapi/doc/3.0/dg/concepts/load.html#parms
* @see https://yandex.com/dev/maps/jsapi/doc/3.0/dg/concepts/load.html#parms
*/
apikey: string;
/**
* @description Allows to set apikeys for Yandex Services.
*
* @note You should only set those on first setup. Will have no effect afterward.
* @example router for `ymaps3.route` and `suggest` for `ymaps3.suggest`
*/
servicesApikeys?: Apikeys | null;
/**
* @see https://yandex.ru/dev/maps/jsapi/doc/3.0/dg/concepts/load.html#parms
* @see https://yandex.com/dev/maps/jsapi/doc/3.0/dg/concepts/load.html#parms
* @default ru_RU
*/
lang?: string;
/**
* @default v3
*/
version?: string;
/**
* @see https://yandex.ru/dev/maps/jsapi/doc/3.0/dg/concepts/general.html#strict-mode
* @see https://yandex.com/dev/maps/jsapi/doc/3.0/dg/concepts/general.html#strict-mode
* @default false
*/
strictMode?: boolean;
cdnLibraryLoading?: {
/**
* @default true
*/
enabled?: boolean;
/**
* @default https://cdn.jsdelivr.net/npm/{package}
*/
url?: string;
/**
* @description Libraries to add to CDN loading list
*/
extendLibraries?: string[];
};
/**
* @default https://api-maps.yandex.ru
*/
domain?: string;
/**
* @description You can choose where to initialize Yandex Maps library
*
* - onPluginInit will load maps on `vue-yandex-maps` plugin init (Client Side only)
* - onComponentMount will load maps as soon as you load component (lazy option, default)
* - never will require you to call initYmaps by yourself
*
* @default onComponentMount
*/
initializeOn?: 'onPluginInit' | 'onComponentMount' | 'never';
/**
* @description You can preload modules in initYmaps, note you will still have to import them later to use
* @see https://yandex.ru/dev/maps/jsapi/doc/3.0/ref/modules/index.html
* @see https://yandex.com/dev/maps/jsapi/doc/3.0/ref/modules/index.html
*/
importModules?: OverloadParameters<typeof ymaps3['import']>[0][];
/**
* @description Amount of time in milliseconds library will wait for Yandex script full load.
*
* Set this to false, to disable this behavior and make library wait forever.
* @default true (5000)
*/
mapsScriptWaitDuration?: number | boolean;
/**
* @description Amount of time in milliseconds library will wait for all components render after Yandex script was loaded.
*
* Set this to false, to disable this behavior and make library wait forever.
* @note If you disable this behavior completely, any fatal error inside components will not lead to exception and library will never load.
* @default true (5000)
*/
mapsRenderWaitDuration?: number | boolean;
/**
* @description Sets script tag attributes
* @default async defer referrerpolicy=strict-origin-when-cross-origin type=text/javascript
* @note src will be ignored
*/
scriptAttributes?: Record<Lowercase<string>, string | false>;
}
/**
* @description Strict-typed version of PluginSettings with all keys required
*/
type DefProductSettings = {
[T in keyof PluginSettings]-?: PluginSettings[T];
};
}