@dartcom/ui-kit 10.2.23 → 10.2.25

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":"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"}
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;;;;4BA0GT,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,19 +39184,6 @@ 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
-
39200
39187
  /* eslint-disable no-console */
39201
39188
  class LoggerService {
39202
39189
  constructor() { }
@@ -43413,8 +43400,6 @@ const getLayerModalsNames = (layer) => {
43413
43400
  const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43414
43401
  const [layer, setLayer] = React__namespace.useState(null);
43415
43402
  const [config, setConfig] = React__namespace.useState(null);
43416
- const map = useMap();
43417
- const mapContainer = map.getContainer();
43418
43403
  const scene = React__namespace.useMemo(() => {
43419
43404
  if (layer === null)
43420
43405
  return null;
@@ -43426,8 +43411,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43426
43411
  if (window.Tangram) {
43427
43412
  const leafletLayer = window.Tangram.leafletLayer({
43428
43413
  scene: data,
43429
- modifyScrollWheel: true,
43430
- modifyZoomBehavior: false,
43414
+ modifyScrollWheel: false,
43431
43415
  });
43432
43416
  const { scene } = leafletLayer;
43433
43417
  scene.subscribe({
@@ -43435,7 +43419,8 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43435
43419
  setConfig(config);
43436
43420
  },
43437
43421
  });
43438
- leafletLayer.on('load', () => {
43422
+ leafletLayer.on('load', ({ sourceTarget }) => {
43423
+ const map = sourceTarget._map;
43439
43424
  leafletLayer.setSelectionEvents({
43440
43425
  click: ({ feature, leaflet_event }) => {
43441
43426
  if (feature) {
@@ -43447,9 +43432,10 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43447
43432
  }
43448
43433
  },
43449
43434
  hover: ({ feature, leaflet_event }) => {
43435
+ const mapContainer = map.getContainer();
43450
43436
  if (feature) {
43451
- mapContainer.style.cursor = 'pointer';
43452
43437
  const { source_layer, properties } = feature;
43438
+ mapContainer.style.cursor = 'pointer';
43453
43439
  eventHandlers?.[source_layer]?.hover?.({
43454
43440
  leaflet_event,
43455
43441
  properties,
@@ -43464,7 +43450,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43464
43450
  setLayer(leafletLayer);
43465
43451
  }
43466
43452
  });
43467
- }, [eventHandlers, mapContainer]);
43453
+ }, [eventHandlers]);
43468
43454
  const checkConfig = React__namespace.useCallback((callback) => {
43469
43455
  if (config) {
43470
43456
  callback(config);
@@ -43674,11 +43660,24 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43674
43660
  };
43675
43661
  };
43676
43662
 
43663
+ const LeafletContext = React.createContext(null);
43664
+ function useLeafletContext() {
43665
+ const context = React.use(LeafletContext);
43666
+ if (context == null) {
43667
+ throw new Error('No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>');
43668
+ }
43669
+ return context;
43670
+ }
43671
+
43672
+ function useMap() {
43673
+ return useLeafletContext().map;
43674
+ }
43675
+
43677
43676
  const LeafletLayer = ({ layers }) => {
43677
+ const map = useMap();
43678
43678
  const { layer } = useGetLeafletLayer({
43679
43679
  defaultLayers: layers,
43680
43680
  });
43681
- const map = useMap();
43682
43681
  React__namespace.useEffect(() => {
43683
43682
  if (layer) {
43684
43683
  map.addLayer(layer);