@dartcom/ui-kit 10.2.22 → 10.2.23

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 +1 @@
1
- {"version":3,"file":"useGetLeafletLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/lib/hooks/useGetLeafletLayer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMvC,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAKlB,KAAK,uBAAuB,GAAG;IAC7B,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,mCAGhC,uBAAuB;;;;4BA2HT,kBAAkB;4BA0BlB,mBAAmB,CAAC,MAAM,CAAC;+BAa1B,mBAAmB,CAAC,MAAM,CAAC,UAC/B,mBAAmB,CAAC,KAAK,CAAC;+BAWvB,kBAAkB;sBASvB,kBAAkB;yBAyClB,kBAAkB;gCAaR;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;gCAWzC,kBAAkB;gDAgBL;QAAE,KAAK,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;;;;CA2HvE,CAAC"}
1
+ {"version":3,"file":"useGetLeafletLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/lib/hooks/useGetLeafletLayer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMvC,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAGlB,KAAK,uBAAuB,GAAG;IAC7B,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,mCAGhC,uBAAuB;;;;4BA2GT,kBAAkB;4BA0BlB,mBAAmB,CAAC,MAAM,CAAC;+BAa1B,mBAAmB,CAAC,MAAM,CAAC,UAC/B,mBAAmB,CAAC,KAAK,CAAC;+BAWvB,kBAAkB;sBASvB,kBAAkB;yBAyClB,kBAAkB;gCAaR;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;gCAWzC,kBAAkB;gDAgBL;QAAE,KAAK,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;;;;CA2HvE,CAAC"}
package/dist/index.cjs CHANGED
@@ -39184,6 +39184,19 @@ exports.TangramSourceNames = void 0;
39184
39184
  TangramSourceNames["MSK"] = "msk";
39185
39185
  })(exports.TangramSourceNames || (exports.TangramSourceNames = {}));
39186
39186
 
39187
+ const LeafletContext = React.createContext(null);
39188
+ function useLeafletContext() {
39189
+ const context = React.use(LeafletContext);
39190
+ if (context == null) {
39191
+ throw new Error('No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>');
39192
+ }
39193
+ return context;
39194
+ }
39195
+
39196
+ function useMap() {
39197
+ return useLeafletContext().map;
39198
+ }
39199
+
39187
39200
  /* eslint-disable no-console */
39188
39201
  class LoggerService {
39189
39202
  constructor() { }
@@ -43400,6 +43413,8 @@ const getLayerModalsNames = (layer) => {
43400
43413
  const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43401
43414
  const [layer, setLayer] = React__namespace.useState(null);
43402
43415
  const [config, setConfig] = React__namespace.useState(null);
43416
+ const map = useMap();
43417
+ const mapContainer = map.getContainer();
43403
43418
  const scene = React__namespace.useMemo(() => {
43404
43419
  if (layer === null)
43405
43420
  return null;
@@ -43420,24 +43435,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43420
43435
  setConfig(config);
43421
43436
  },
43422
43437
  });
43423
- leafletLayer.on('load', ({ sourceTarget }) => {
43424
- const map = sourceTarget._map;
43425
- const mapContainer = map.getContainer();
43426
- const origPerformZoom = map.scrollWheelZoom._performZoom;
43427
- map.scrollWheelZoom._performZoom = function (event) {
43428
- try {
43429
- origPerformZoom.call(event);
43430
- }
43431
- catch (err) {
43432
- if (err.message.includes('lat')) {
43433
- const delta = event.originalEvent.deltaY > 0 ? -0.1 : 0.1;
43434
- map.setZoom(map.getZoom() + delta, { animate: true });
43435
- }
43436
- else {
43437
- throw err;
43438
- }
43439
- }
43440
- };
43438
+ leafletLayer.on('load', () => {
43441
43439
  leafletLayer.setSelectionEvents({
43442
43440
  click: ({ feature, leaflet_event }) => {
43443
43441
  if (feature) {
@@ -43466,7 +43464,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43466
43464
  setLayer(leafletLayer);
43467
43465
  }
43468
43466
  });
43469
- }, [eventHandlers]);
43467
+ }, [eventHandlers, mapContainer]);
43470
43468
  const checkConfig = React__namespace.useCallback((callback) => {
43471
43469
  if (config) {
43472
43470
  callback(config);
@@ -43676,19 +43674,6 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43676
43674
  };
43677
43675
  };
43678
43676
 
43679
- const LeafletContext = React.createContext(null);
43680
- function useLeafletContext() {
43681
- const context = React.use(LeafletContext);
43682
- if (context == null) {
43683
- throw new Error('No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>');
43684
- }
43685
- return context;
43686
- }
43687
-
43688
- function useMap() {
43689
- return useLeafletContext().map;
43690
- }
43691
-
43692
43677
  const LeafletLayer = ({ layers }) => {
43693
43678
  const { layer } = useGetLeafletLayer({
43694
43679
  defaultLayers: layers,