Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@yandex/ymaps3-types

Package Overview
Dependencies
Maintainers
0
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yandex/ymaps3-types - npm Package Compare versions

Comparing version 0.0.28 to 0.0.29

imperative/projections/index.d.ts

8

common/types/data-source-description.d.ts

@@ -125,2 +125,6 @@ import type { WorldCoordinates } from "./coordinates";

richModelRequestWithCredentials?: boolean;
indoorPlanRequestWithCredentials?: boolean;
styleRequestWithCredentials?: boolean;
fontListRequestWithCredentials?: boolean;
fontObjectRequestWithCredentials?: boolean;
tileRequestHeaders?: Record<string, string>;

@@ -131,2 +135,6 @@ iconRequestHeaders?: Record<string, string>;

richModelRequestHeaders?: Record<string, string>;
indoorPlanRequestHeaders?: Record<string, string>;
styleRequestHeaders?: Record<string, string>;
fontListRequestHeaders?: Record<string, string>;
fontObjectRequestHeaders?: Record<string, string>;
priority: VectorDataSourcePriority;

@@ -133,0 +141,0 @@ collisionPriority?: VectorObjectsCollisionPriority;

@@ -0,1 +1,4 @@

/**
* All possible apikeys for http-services.
*/
interface Apikeys {

@@ -6,7 +9,29 @@ suggest?: string;

}
/**
* Configuration object for whole API.
* For example, it can be used to set experiments or apikeys.
* ```js
* ymaps3.getDefaultConfig().setApikeys({search: "YOUR_SEARCH_API_KEY"})`.
* ```
*/
export declare class Config {
readonly description: string;
/**
* Set experiments for map.
*/
setExperiments(experiments: Record<string, boolean>): void;
/**
* Set apikeys for http-services.
* ```js
* ymaps3.getDefaultConfig().setApikeys({search: "YOUR_SEARCH_API_KEY"})`.
* ```
*/
setApikeys(apikeys: Apikeys): void;
}
/**
* Returns default config object.
* ```js
* ymaps3.getDefaultConfig().setApikeys({suggest: "YOUR_SUGGEST_API_KEY"})`.
* ```
*/
export declare function getDefaultConfig(): Config;

4

imperative/DomContext.d.ts

@@ -21,4 +21,4 @@ import { Context, GenericComplexEntity, GenericEntity } from "./Entities";

* @param entity - Entity to provide the DomContext
* @param element - Dom element that is passed to DomContext
* @param container - Inner DOM element that is passed to the DOMContext
* @param element - DOM element to attach
* @param container - DOM element to provide to descendants in new DomContext
* @returns Function that detaches the DOM element and DomContext from the entity

@@ -25,0 +25,0 @@ */

@@ -1,2 +0,2 @@

import * as projections_ from "./utils/projections";
import * as projections_ from "./projections";
export { YMap, YMapProps, YMapCenterLocation, YMapZoomLocation, YMapBoundsLocation, YMapCenterZoomLocation, YMapLocationRequest, YMapCameraRequest } from "./YMap";

@@ -3,0 +3,0 @@ export { YMapThemeContext, ThemeContext, YMapTheme } from "./ThemeContext";

import { Context } from "./Entities";
/**
* Sets map theme
* Map theme. Affects the colors of the map controls and background.
* ```typescript
* const map = new ymaps3.YMap({
* location: {center: [55.751574, 37.573856], zoom: 9},
* theme: 'dark'
* });
* ```
*/

@@ -5,0 +11,0 @@ export type YMapTheme = "light" | "dark";

@@ -7,2 +7,9 @@ import { Context } from "./Entities";

};
/**
* Selects one of predefined map style modes optimized for particular use case. The following values are supported:
* * `map` - basic map
* * `driving` - automobile navigation map
* * `transit` - public transport map
* * `admin` - administrative map
*/
export declare const TypeContext: Context<YMapTypeContext>;

@@ -9,3 +9,8 @@ import type { BehaviorType, LngLat, MapMode, Margin, PixelCoordinates, Projection, ReadonlyLngLat, LngLatBounds, ZoomRange, ZoomRounding, WorldOptions, ZoomStrategy, EasingFunctionDescription, TiltRange } from "../../common/types";

/**
* Sets map center.
* Sets map center. In this case, the zoom of the map remains unchanged.
* ```javascript
* map.update({
* location: {center: [-0.118092, 51.509865]}
* });
* ```
*/

@@ -16,3 +21,8 @@ export type YMapCenterLocation = {

/**
* Sets map zoom.
* Sets map zoom. In this case, the center of the map remains unchanged.
* ```javascript
* map.update({
* location: {zoom: 10}
* });
* ```
*/

@@ -23,3 +33,10 @@ export type YMapZoomLocation = {

/**
* Sets map bounds.
* Calculate the center and zoom by specifying the coordinates of the top left and bottom right corners of the map.
* In this case, the center of the map will be in the center of the rectangle described at the given coordinates.
* If the map have an aspect ratio different from this rectangle, the rectangle will be inscribed in height and the map will be centered in width.
* ```javascript
* map.update({
* location: {bounds: [[-0.118092, 51.509865], [-0.118092, 51.509865]]}
* });
* ```
*/

@@ -31,6 +48,11 @@ export type YMapBoundsLocation = {

* Sets map center and zoom. Combination of YMapCenterLocation and YMapZoomLocation
* ```javascript
* map.update({
* location: {center: [-0.118092, 51.509865], zoom: 10}
* });
* ```
*/
export type YMapCenterZoomLocation = YMapCenterLocation & YMapZoomLocation;
/**
* Sets map center and zoom or bounds. Combination of @mixes YMapZoomLocation and YMapBoundsLocation
* Union type for describing the position of the map through the center and zoom or through the bounds of the map
*/

@@ -48,3 +70,23 @@ export type YMapLocation = YMapCenterZoomLocation & Partial<YMapBoundsLocation>;

/**
* Describes how to change current map location. Change can be instantenious or animated if duration property is set.
* Describes how to change current map location. Change can be instantaneous or animated if duration property is set.
* ```javascript
* map.update({
* location: {
* center: [-0.118092, 51.509865], // Center of the map
* zoom: 10, // Zoom level
* duration: 200, // Animation of moving map will take 200 milliseconds
* easing: 'ease-in-out' // Animation easing function
* }
* });
* ```
* or just change center of the map
* ```javascript
* map.update({
* location: {
* center: [-0.118092, 51.509865], // Center of the map
* duration: 200, // Animation of moving map will take 200 milliseconds
* easing: 'linear' // Animation easing function
* }
* })';
* ```
*/

@@ -57,2 +99,13 @@ export type YMapLocationRequest = (YMapBoundsLocation | YMapCenterLocation | YMapZoomLocation | YMapCenterZoomLocation) & {

};
/**
* Describes how to change current camera position. Change can be instantaneous or animated if duration property is set.
* ```javascript
* map.update({camera: {
* tilt: 45 * (Math.PI / 180), // 45 degrees
* azimuth: 30 * (Math.PI / 180) // 30 degrees
* duration: 200, // Animation of moving camera will take 200 milliseconds
* easing: 'ease-in-out'
* }});
* ```
*/
export type YMapCameraRequest = YMapCamera & {

@@ -65,3 +118,20 @@ /** Animation duration */

/**
* YMap props
* Map settings. Allow to set map mode, behaviors, margin, zoom rounding, zoom range, restrict map area, theme and other settings.
* ```javascript
* const map = new YMap(document.getElementById('map-root'), {
* className: 'custom-map',
* location: {center: [-0.118092, 51.509865], zoom: 10},
* camera: {tilt: 45 * (Math.PI / 180), azimuth: 30 * (Math.PI / 180)}
* mode: 'raster',
* behaviors: ['drag', 'scrollZoom', 'dblClick', 'mouseRotate', 'mouseTilt'],
* margin: [0, 100, 0, 0],
* theme: 'light'
* });
* ```
* But required only `location` prop.
* ```javascript
* const map = new YMap(document.getElementById('map-root'), {
* location: {center: [-0.118092, 51.509865], zoom: 10}
* });
* ```
*/

@@ -141,3 +211,3 @@ export type YMapProps = {

* document.getElementById('map-root'),
* {location: {center: [37.622504, 55.753215], zoom: 10}}
* {location: {center: [-0.118092, 51.509865], zoom: 10}}
* );

@@ -144,0 +214,0 @@ * // add default Yandex scheme layer

import { YMapGroupEntity } from "../YMapEnities";
/**
* YMapCollection is a collection of YMapEntity objects.
* Allow adding or removing [[YMapEntity]] objects.
* ```typescript
* const collection = new YMapCollection({});
* const markerElement = document.createElement('div');
* markerElement.className = 'marker';
*
* for (let i = 0; i < 10_000; i++) {
* collection.addChild(new YMapMarker({
* coordinates: [Math.random() * 180, Math.random() * 180]
* }, markerElement.cloneNode(true)));
* }
*
* map.addChild(collection); // Add collection to the map
* map.removeChild(collection); // Remove all markers from the map
* ```
*/
export declare class YMapCollection extends YMapGroupEntity<{}> {
}

@@ -20,2 +20,16 @@ import type TReact from "react";

type ComputedYMapContainerProps<TContext> = YMapContainerProps<TContext> & YMapContainerPropsImpl<TContext>;
/**
* Allow adding or removing [[YMapEntity]] objects or usual DOM elements inside the YMap.
* ```tsx
* const container = <YMapContainer>
* <YMapMarker coordinates={[55.76, 37.64]}><div className="point"></div></YMapMarker>
* <div>Some text</div>
* </YMapContainer>;
*
* ReactDOM.render(<YMap>{container}</YMap, document.getElementById('root'));
* ```
* In this example, the `container` variable contains a `YMapContainer` object with two children: `YMapMarker` and `div`.
* - `YMapMarker` is a YMapEntity
* - `div` is a usual DOM element
*/
declare class YMapContainer extends YMapGroupEntity<ComputedYMapContainerProps<unknown>, DefaultProps> {

@@ -22,0 +36,0 @@ static defaultProps: {

@@ -14,9 +14,34 @@ import { YMapGroupEntity } from "../YMapEnities";

* Context provider for YMap, allowing to inject a context and its value.
* @example
*
* ```javascript
* const mapContextProvider = new YMapContextProvider({context: SomeMapContext, value: {your: 'value'}});
* mapContextProvider.addChild(new YMapDefaultSchemeLayer({}));
* map.addChild(mapContextProvider);
* ```
* `YMapDefaultSchemeLayer` will receive the context `SomeMapContext` with the value `{ your: 'value' }`
* And define context consumer:
* ```ts
* class SomeContextConsumer extends ymaps3.YMapEntity<{}> {
* constructor() {
* super({});
* }
*
* _onAttach() {
* const value = this._consumeContext(SomeMapContext);
* console.log(value); // {your: 'value'}
* }
* }
* ```
* When adding nested containers, the context will be available in them:
* ```ts
* mapContextProvider.addChild(new SomeContextConsumer());
* ```
* But the most important thing is that the context can be passed at any nesting level:
* ```tsx
* <YMapContextProvider context={SomeMapContext} value={{your: 'value'}}>
* <YMapContainer>
* <YMapContainer>
* <SomeContextConsumer />
* <YMapContainer>
* </YMapContainer>
* </YMapContextProvider>
* ```
*/

@@ -23,0 +48,0 @@ export declare class YMapContextProvider<T> extends YMapGroupEntity<YMapContextProviderProps<T>> {

import { YMapComplexEntity, YMapGroupEntity } from "../YMapEnities";
import { overrideKeyReactify } from "../wrappers";
/**
* YMapControlButton props
* Properties for [[YMapControlCommonButton]]
* ```typescript
* const button = new YMapControlCommonButton({
* text: 'Click me!',
* disabled: false,
* color: 'black',
* background: 'white',
* onClick: () => {
* console.log('Button clicked');
* }
* });
* ```
*/

@@ -23,3 +34,15 @@ export type YMapControlCommonButtonProps = {

/**
* Default control button.
* Default control button. Can be used as a base for custom controls.
* ```javascript
* const map = new ymaps3.YMap(document.getElementById('map-root'), {...});
* const controls = new ymaps3.YMapControls({position: 'bottom right'});
* const button = new ymaps3.YMapControlCommonButton({
* text: 'Click me!',
* onClick: () => {
* console.log('Button clicked');
* }
* });
* controls.addChild(button);
* ```
* More about controls: [Yandex Maps API controls](https://yandex.com/dev/jsapi30/doc/en/dg/concepts/controls/)
*/

@@ -26,0 +49,0 @@ export declare class YMapControlCommonButton extends YMapGroupEntity<YMapControlCommonButtonProps> {

import { YMapGroupEntity } from "../YMapEnities";
/**
* Copyrights position on the map container. By default, 'bottom right'.
* For example, 'top left' or 'bottom right'
* ```javascript
* const map = new ymaps3.YMap(document.getElementById('map-root'), {
* copyrightsPosition: 'top left'
* });
* ```
*/
type YMapCopyrightsPosition = "top left" | "top right" | "bottom left" | "bottom right";

@@ -23,5 +32,5 @@ type YMapCopyrightsProps = {

}>;
private _boxElement;
private _containerElement;
private _copyrightsTextElement;
private _linkElement;
private _agreementLinkElement;
private _logoElement;

@@ -31,9 +40,3 @@ private _copyrightsContainer;

private _scaleControl;
private _mapWidth;
private _copyrights;
private _fixedCopyrights;
private _userAgreementText;
private _userAgreementState;
private _unwatchMapContext?;
private _unwatchThemeContext?;
private _detachDom?;

@@ -45,13 +48,9 @@ constructor(props?: YMapCopyrightsProps);

private _createDom;
private _syncDom;
private _syncMapWidth;
private _render;
private _syncTheme;
private _setUserAgreementText;
private _setUserAgreementState;
private _setCopyrights;
private _setFixedCopyrights;
private _copyrightsChangeHandler;
private _adjustText;
private _applyCopyrights;
private _computeMaxWidth;
private _rearrange;
private _toggleScaleControl;
}
export { YMapCopyrights, YMapCopyrightsPosition, YMapCopyrightsProps };
import type { VectorCustomization } from "../../common/types";
import { YMapLayerProps } from "../YMapLayer";
import { YMapComplexEntity } from "../YMapEnities";
/**
* Types of underlay layers available in the default scheme.
* Each layer is displayed on the map according to its zIndex.
* By default, layers are displayed in the following order:
* 1. ground
* 2. buildings
* 3. icons
* 4. labels
* @see https://yandex.ru/dev/jsapi30/doc/en/dg/concepts/general#source-prepared
*/
type YMapDefaultSchemeLayerType = "ground" | "buildings" | "icons" | "labels";

@@ -68,4 +78,2 @@ /**

transit: string;
"future-map": string;
"legacy-map": string;
};

@@ -72,0 +80,0 @@ /**

@@ -94,2 +94,49 @@ import type { YMap } from "./YMap";

}
export { YMapEntity, YMapComplexEntity, YMapGroupEntity, Context as YMapContext };
/**
* Context for YMap. It allows you to provide a value to the context and use it in the children of the context provider.
* ```ts
* const YMapSomeContext = new ymaps3.YMapContext('YMapSomeContext');
* class SomeValueProvider extends ymaps3.YMapGroupEntity<{}> {
* constructor() {
* super({});
* this._provideContext(YMapSomeContext, {your: 'value'}); // Special method to provide context value
* }
* }
* ```
* And some child entity can use this context:
* ```ts
* class SomeContextConsumer extends ymaps3.YMapEntity<{}> {
* constructor() {
* super({});
* }
*
* _onAttach() {
* const value = this._consumeContext(YMapSomeContext); // Special method to get context value
* console.log(value); // {your: 'value'}
* }
* }
* ```
* In any level of nesting:
* ```tsx
* <SomeValueProvider>
* <YMapContainer>
* <YMapContainer>
* <SomeContextConsumer />
* </YMapContainer>
* </YMapContainer>
* </SomeEntity>
* ```
* You can set the context value using [[YMapContextProvider]]:
* ```tsx
* <YMapContextProvider context={YMapSomeContext} value={{your: 'value'}}>
* <YMapContainer>
* <YMapContainer>
* <SomeContextConsumer />
* </YMapContainer>
* </YMapContainer>
* </SomeEntity>
* ```
*/
declare class YMapContext<T> extends Context<T> {
}
export { YMapEntity, YMapComplexEntity, YMapGroupEntity, YMapContext };

@@ -26,5 +26,6 @@ import type { DrawingStyle, GenericGeometry, LngLat, HideOutsideRule } from "../../common/types";

/**
* The feature component on the map.
* Component for creating a geo object on the map.
* Supports drag-and-drop functionality, drawing styles, and event handling.
* Supported geometries: `Point`, `LineString`, `MultiLineString`, `Polygon` and `MultiPolygon`.
*
* @example
* ```javascript

@@ -47,2 +48,15 @@ * const feature = new YMapFeature({

* ```
* You can add Point geometry with HTMLElement:
* ```javascript
* const feature = new YMapFeature({
* geometry: {
* type: 'Point',
* coordinates: [37.40108963847453, 55.70173382087952]
* },
* style: {
* element: document.createElement('div')
* }
* });
* ```
* But better to use [[YMapMarker]] for this.
*/

@@ -49,0 +63,0 @@ declare class YMapFeature extends YMapEntity<YMapFeatureProps, DefaultProps> {

@@ -53,2 +53,17 @@ import type { LineStringGeometry, Margin, MultiLineStringGeometry, MultiPolygonGeometry, PointGeometry, PolygonGeometry, LngLat } from "../../common/types";

export type Geometry = PolygonGeometry | MultiPolygonGeometry | LineStringGeometry | MultiLineStringGeometry | PointGeometry;
/**
* Feature drag event handler.
* ```typescript
* function onDragEvent(type, coordinates) => {
* console.log('Event:', type, coordinates);
* };
* const feature = new YMapFeature({
* geometry: {...},
* draggable: true,
* onDragStart: onDragEvent.bind(null, 'dragStart'),
* onDragMove: onDragEvent.bind(null, 'dragMove'),
* onDragEnd: onDragEvent.bind(null, 'dragEnd'),
* });
* ```
*/
export type YMapFeatureEventHandler = (coordinates: Geometry['coordinates']) => void | false;
import type { GenericGeometry, LngLat } from "../../common/types";
/**
* Some active area on the map that can be clicked.
* This is not a real YMapEntity, it cannot be added to the map.
* But you can check it by `instance of` in YMapListener handlers
* For example, in [custom layers](https://yandex.ru/dev/jsapi30/doc/en/dg/concepts/custom-layers) you can pass an object of this type in the `findObjectInPosition` method
* Or just listen to the `onEventName` event and check the object:
* ```javascript
* const map = new ymaps3.YMap(document.getElementById('map-root'), {...});
* map.addChild(new ymaps3.YMapListener({
* layer: 'any',
* onClick: (object) => {
* if (object instanceof ymaps3.YMapHotspot) {
* console.log('Hotspot clicked', object);
* }
* }
* }))
* ```
*/

@@ -6,0 +20,0 @@ declare class YMapHotspot {

import { YMapContainer, YMapContainerProps, YMapContainerPropsImpl } from "../YMapContainer";
/** @deprecated Use YMapContainerPropsImpl instead */
/**
* @deprecated Use {@link YMapContainerPropsImpl} instead
* @private
*/
type YMapReactContainerPropsImpl<TContext> = YMapContainerPropsImpl<TContext>;
/** @deprecated Use YMapContainerProps instead */
/**
* @deprecated Use {@link YMapContainerProps} instead
* @private
*/
type YMapReactContainerProps<TContext> = YMapContainerProps<TContext>;
/** @deprecated Use YMapContainer instead */
/**
* @deprecated Use {@link YMapContainer} instead
* @private
*/
declare class YMapReactContainer extends YMapContainer {
}
export { YMapReactContainer, YMapReactContainerPropsImpl, YMapReactContainerProps };
import { YMapComplexEntity } from "../YMapEnities";
/**
* Types of measurement units that scale control can display.
*/
export type UnitType = "imperial" | "metric" | "nautical";
/**
* Properties for [[YMapScaleControl]]
*/
type YMapScaleControlProps = {

@@ -14,2 +20,18 @@ /** Maximum width of scale line in pixels */

type DefaultProps = typeof defaultProps;
/**
* A control that shows the map scale in different units of measurement.
* @example Add scale control to the lower left part of the map:
* ```js
* const scaleControl = new YMapScaleControl({});
* const controls = new YMapControls({position: 'bottom left'}, [scaleControl]);
* map.addChild(controls)
* ```
* Alternatively, you can show the integrated scale control on the map by `showScaleInCopyrights` props:
* ```js
* const map = new YMap(document.getElementById('map-root'), {
* showScaleInCopyrights: true,
* location: {center: [37.622504, 55.753215], zoom: 10}
* });
* ```
*/
declare class YMapScaleControl extends YMapComplexEntity<YMapScaleControlProps, DefaultProps> {

@@ -16,0 +38,0 @@ static defaultProps: Readonly<{

@@ -1,2 +0,2 @@

import type { RasterTileDataSourceDescription, VectorTileDataSourceDescription, ZoomRange } from "../../common/types";
import type { RasterTileDataSourceDescription, ZoomRange } from "../../common/types";
import { YMapEntity } from "../YMapEnities";

@@ -6,3 +6,3 @@ /**

*/
type YMapTileDataSourceProps = {
interface YMapTileDataSourceProps {
/** Data source id */

@@ -22,3 +22,3 @@ id: string;

copyrights?: string[];
};
}
/**

@@ -25,0 +25,0 @@ * Create map tile data source.

{
"name": "@yandex/ymaps3-types",
"version": "0.0.28",
"version": "0.0.29",
"description": "Types for ymaps3 maps library",

@@ -5,0 +5,0 @@ "main": "",

@@ -9,3 +9,3 @@ import type { YMapFeature, YMapHotspot, YMapMarker } from "../../../imperative";

};
declare const YMapHintContext: import("../../../imperative/Entities").Context<unknown>;
declare const YMapHintContext: import("../../../imperative/YMapEnities").YMapContext<unknown>;
/**

@@ -12,0 +12,0 @@ * Display hint on map elements.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc