@dartcom/ui-kit 10.2.21 → 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;;;;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":"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,9 +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();
43438
+ leafletLayer.on('load', () => {
43426
43439
  leafletLayer.setSelectionEvents({
43427
43440
  click: ({ feature, leaflet_event }) => {
43428
43441
  if (feature) {
@@ -43451,7 +43464,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43451
43464
  setLayer(leafletLayer);
43452
43465
  }
43453
43466
  });
43454
- }, [eventHandlers]);
43467
+ }, [eventHandlers, mapContainer]);
43455
43468
  const checkConfig = React__namespace.useCallback((callback) => {
43456
43469
  if (config) {
43457
43470
  callback(config);
@@ -43661,19 +43674,6 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43661
43674
  };
43662
43675
  };
43663
43676
 
43664
- const LeafletContext = React.createContext(null);
43665
- function useLeafletContext() {
43666
- const context = React.use(LeafletContext);
43667
- if (context == null) {
43668
- throw new Error('No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>');
43669
- }
43670
- return context;
43671
- }
43672
-
43673
- function useMap() {
43674
- return useLeafletContext().map;
43675
- }
43676
-
43677
43677
  const LeafletLayer = ({ layers }) => {
43678
43678
  const { layer } = useGetLeafletLayer({
43679
43679
  defaultLayers: layers,