UNPKG

@yandex/ymaps3-types

Version:

Types for ymaps3 maps library

60 lines (59 loc) 2.32 kB
import type { YMapFeature, YMapHotspot, YMapMarker } from "../../../imperative"; import type { CustomVuefyFn, CustomVuefyOptions } from "../../../modules/vuefy"; import type { CustomReactify } from "../../../reactify/reactify"; import type TReact from "react"; import { optionsKeyVuefy, overrideKeyReactify, overrideKeyVuefy } from "../../../imperative/wrappers"; type YMapHintProps = { hint: (object: YMapFeature | YMapMarker | YMapHotspot | undefined) => unknown; }; declare const YMapHintContext: import("../../../imperative/YMapEnities").YMapContext<unknown>; /** * Display hint on map elements. * * @example * ```javascript * const {YMapHint, YMapHintContext} = await ymaps3.import('@yandex/ymaps3-hint@0.0.1'); * map.addChild(defaultFeatures = new YMapDefaultFeaturesLayer()); * map.addChild(hint = YMapHint({ * layers: [defaultFeatures.layer], * hint: object => object?.properties?.hint * })); * * const {YMapDefaultMarker} = await ymaps3.import('@yandex/ymaps3-markers@0.0.1'); * map.addChild(new YMapDefaultMarker({coordinates: [37, 55], properties: {hint: 'Hello world!'}})); * * hint.addChild(new class MyHint extends ymaps3.YMapEntity { * _onAttach() { * this._element = document.createElement('div'); * this._element.className = 'my-hint'; * * this._detachDom = ymaps3.useDomContext(this, this._element); * this._watchContext(YMapHintContext, () => { * this._element.textContent = this._consumeContext(YMapHintContext)?.hint; * }, {immediate: true}); * } * * _onDetach() { * this._detachDom(); * this._detachDom = undefined; * } * }); * ``` */ declare class YMapHint extends ymaps3.YMapGroupEntity<YMapHintProps> { static [overrideKeyReactify]: CustomReactify<YMapHint, TReact.FC<YMapHintProps>>; static [overrideKeyVuefy]: CustomVuefyFn<YMapHint>; static [optionsKeyVuefy]: CustomVuefyOptions<YMapHint>; private _detachDom?; private _element; private _hintElement; constructor(props: YMapHintProps); protected _positionHintElement(screenCoordinates: [ number, number ]): void; protected _toggleHint(add: boolean): void; protected _onAttach(): void; protected _onDetach(): void; } export { YMapHint, YMapHintContext };