@dartcom/ui-kit 10.2.23 → 10.2.24

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":"leaflet.d.ts","sourceRoot":"","sources":["../../../../src/components/layers/leaflet/leaflet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAsB,MAAM,OAAO,CAAC;AAE/D,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAc7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"leaflet.d.ts","sourceRoot":"","sources":["../../../../src/components/layers/leaflet/leaflet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAsB,MAAM,OAAO,CAAC;AAE/D,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgB7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { Nullable } from '../../../../../lib/types';
2
2
  import { SourceLayerEventHandlers, TangramCustomLayer, TangramEventConfig, TangramLeafletLayer, TangramScene, TangramSourceConfig, TangramSourceNames } from '../types';
3
3
  type UseGetLeafletLayerProps = {
4
+ map: L.Map;
4
5
  eventHandlers?: SourceLayerEventHandlers;
5
6
  defaultLayers?: TangramCustomLayer[];
6
7
  };
7
- export declare const useGetLeafletLayer: ({ eventHandlers, defaultLayers, }: UseGetLeafletLayerProps) => {
8
+ export declare const useGetLeafletLayer: ({ map, eventHandlers, defaultLayers, }: UseGetLeafletLayerProps) => {
8
9
  layer: Nullable<TangramLeafletLayer>;
9
10
  scene: TangramScene | null;
10
11
  config: Nullable<TangramEventConfig>;
@@ -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;AAGlB,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;IAEX,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,wCAKhC,uBAAuB;;;;4BAyGT,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() { }
@@ -43410,11 +43397,9 @@ const getLayerModalsNames = (layer) => {
43410
43397
  return layerModalsNames;
43411
43398
  };
43412
43399
 
43413
- const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43400
+ const useGetLeafletLayer = ({ map, 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;
@@ -43447,6 +43432,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43447
43432
  }
43448
43433
  },
43449
43434
  hover: ({ feature, leaflet_event }) => {
43435
+ const mapContainer = map.getContainer();
43450
43436
  if (feature) {
43451
43437
  mapContainer.style.cursor = 'pointer';
43452
43438
  const { source_layer, properties } = feature;
@@ -43464,7 +43450,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43464
43450
  setLayer(leafletLayer);
43465
43451
  }
43466
43452
  });
43467
- }, [eventHandlers, mapContainer]);
43453
+ }, [eventHandlers, map]);
43468
43454
  const checkConfig = React__namespace.useCallback((callback) => {
43469
43455
  if (config) {
43470
43456
  callback(config);
@@ -43674,11 +43660,25 @@ 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
+ map,
43679
43680
  defaultLayers: layers,
43680
43681
  });
43681
- const map = useMap();
43682
43682
  React__namespace.useEffect(() => {
43683
43683
  if (layer) {
43684
43684
  map.addLayer(layer);