@evergis/react 3.1.107 → 3.1.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  import { CSSProperties, FC, ReactNode } from 'react';
2
- import { Projection } from 'mapbox-gl';
3
2
  import { i18n } from 'i18next';
4
3
  import { AttributeDefinitionDc, AttributeFormatDefinitionDc, AttributeType, EqlRequestDc, FeatureDc, GeometryType, PagedFeaturesListDc, PositionDc, RemoteTaskStatus, StringSubType } from '@evergis/api';
5
4
  import { PieChartData, BarChartMarker } from '@evergis/charts';
@@ -142,7 +141,7 @@ export interface ConfigOptions {
142
141
  align?: "left" | "center" | "right";
143
142
  pitch?: number;
144
143
  bearing?: number;
145
- projection?: Projection["name"];
144
+ projection?: string;
146
145
  baseMapName?: string;
147
146
  baseMapSettings?: Record<string, BaseMapSettings>;
148
147
  expandedLayers?: boolean;
@@ -1,5 +1,5 @@
1
- import { CirclePaint, FillPaint, FillExtrusionPaint, LinePaint } from 'mapbox-gl';
2
- export declare const DEFAULT_CIRCLE_PAINT: CirclePaint;
3
- export declare const DEFAULT_FILL_PAINT: FillPaint;
4
- export declare const DEFAULT_FILL_EXTRUSION_PAINT: FillExtrusionPaint;
5
- export declare const DEFAULT_LINE_PAINT: LinePaint;
1
+ import { CircleLayerSpecification, FillExtrusionLayerSpecification, FillLayerSpecification, LineLayerSpecification } from 'maplibre-gl';
2
+ export declare const DEFAULT_CIRCLE_PAINT: CircleLayerSpecification["paint"];
3
+ export declare const DEFAULT_FILL_PAINT: FillLayerSpecification["paint"];
4
+ export declare const DEFAULT_FILL_EXTRUSION_PAINT: FillExtrusionLayerSpecification["paint"];
5
+ export declare const DEFAULT_LINE_PAINT: LineLayerSpecification["paint"];
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
- import { MapProps as MapGLProps } from 'react-map-gl/mapbox';
2
+ import { MapProps as MapGLProps } from 'react-map-gl/maplibre';
3
3
  export interface MapProps extends MapGLProps {
4
4
  zIndex?: CSSProperties["zIndex"];
5
5
  lowerSiblings?: ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, MutableRefObject, PropsWithChildren, SetStateAction } from 'react';
2
- import { Map as MapboxGLMap } from 'mapbox-gl';
2
+ import { Map as MaplibreGLMap } from 'maplibre-gl';
3
3
  import { default as MapboxDraw } from '@mapbox/mapbox-gl-draw';
4
4
  export declare enum BaseMapTheme {
5
5
  Light = "light",
@@ -16,7 +16,7 @@ export interface BaseMapItem {
16
16
  color?: string;
17
17
  }
18
18
  export interface MapContextProps {
19
- map?: MutableRefObject<MapboxGLMap>;
19
+ map?: MutableRefObject<MaplibreGLMap>;
20
20
  draw?: MutableRefObject<Omit<MapboxDraw, "getDefaultPosition">>;
21
21
  loaded?: boolean;
22
22
  setLoaded?: Dispatch<SetStateAction<boolean>>;
@@ -1,2 +1,2 @@
1
- import { ExpressionSpecification } from 'mapbox-gl';
1
+ import { ExpressionSpecification } from 'maplibre-gl';
2
2
  export declare const findAttributeInExpression: (expression: ExpressionSpecification) => string[];
@@ -1,2 +1,2 @@
1
- import { AnyPaint } from 'mapbox-gl';
2
- export declare const getActualExtrusionHeight: (paint: AnyPaint) => any;
1
+ import { CircleLayerSpecification, LineLayerSpecification, FillLayerSpecification, FillExtrusionLayerSpecification, HeatmapLayerSpecification, SymbolLayerSpecification } from 'maplibre-gl';
2
+ export declare const getActualExtrusionHeight: (paint: CircleLayerSpecification["paint"] | LineLayerSpecification["paint"] | FillLayerSpecification["paint"] | FillExtrusionLayerSpecification["paint"] | HeatmapLayerSpecification["paint"] | SymbolLayerSpecification["paint"]) => any;
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var jspdf = require('jspdf');
18
18
  var html2canvas = require('html2canvas');
19
19
  var MapboxDraw = require('@mapbox/mapbox-gl-draw');
20
20
  var turf = require('@turf/turf');
21
- var MapGL = require('react-map-gl/mapbox');
21
+ var MapGL = require('react-map-gl/maplibre');
22
22
  require('@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css');
23
23
  require('mapbox-gl/dist/mapbox-gl.css');
24
24
  var react = require('swiper/react');
@@ -4898,12 +4898,10 @@ const useMapImages = ({ images }) => {
4898
4898
  if (isSvgUrl(config.url)) {
4899
4899
  // SVG: растеризуем через canvas
4900
4900
  try {
4901
- const { data, width, height } = await loadSvgAsImage(config.url, size, pixelRatio);
4901
+ const { data } = await loadSvgAsImage(config.url, size, pixelRatio);
4902
4902
  map.current.addImage(config.name, data, {
4903
4903
  sdf,
4904
4904
  pixelRatio,
4905
- width,
4906
- height,
4907
4905
  });
4908
4906
  loadedImagesRef.current.add(config.name);
4909
4907
  }
@@ -4916,12 +4914,7 @@ const useMapImages = ({ images }) => {
4916
4914
  else {
4917
4915
  // PNG/другие форматы: используем стандартную загрузку Mapbox
4918
4916
  return new Promise((resolve, reject) => {
4919
- map.current.loadImage(config.url, (error, image) => {
4920
- if (error) {
4921
- setErrors(prev => ({ ...prev, [config.name]: error.message }));
4922
- reject(error);
4923
- return;
4924
- }
4917
+ map.current.loadImage(config.url).then((image) => {
4925
4918
  if (image) {
4926
4919
  map.current.addImage(config.name, image, {
4927
4920
  sdf,
@@ -4930,6 +4923,9 @@ const useMapImages = ({ images }) => {
4930
4923
  loadedImagesRef.current.add(config.name);
4931
4924
  resolve();
4932
4925
  }
4926
+ }).catch(error => {
4927
+ setErrors(prev => ({ ...prev, [config.name]: error.message }));
4928
+ reject(error);
4933
4929
  });
4934
4930
  });
4935
4931
  }
@@ -11468,7 +11464,7 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
11468
11464
  return null;
11469
11465
  }).filter((config) => config !== null);
11470
11466
  }, [clientStyle]);
11471
- const { loaded: iconsLoaded } = useMapImages({ images: iconConfigs });
11467
+ useMapImages({ images: iconConfigs });
11472
11468
  const renderLayerByGeometryType = React.useCallback(() => {
11473
11469
  const visibility = visible ? "visible" : "none";
11474
11470
  switch (geometryType) {
@@ -11621,7 +11617,7 @@ const MapWrapper = styled.div `
11621
11617
 
11622
11618
  const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...rest }) => {
11623
11619
  const { map, setLoaded } = useMapContext();
11624
- return (jsxRuntime.jsxs(MapWrapper, { "$zIndex": zIndex, children: [lowerSiblings, jsxRuntime.jsx(MapGL, { ...rest, renderWorldCopies: true, antialias: true, doubleClickZoom: false, cursor: "default", onLoad: e => {
11620
+ return (jsxRuntime.jsxs(MapWrapper, { "$zIndex": zIndex, children: [lowerSiblings, jsxRuntime.jsx(MapGL, { ...rest, renderWorldCopies: true, doubleClickZoom: false, cursor: "default", onLoad: e => {
11625
11621
  map.current = e.target;
11626
11622
  map.current.on("error", onError);
11627
11623
  setLoaded(true);