@dartcom/ui-kit 10.1.10 → 10.1.11

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.
@@ -6,14 +6,14 @@ export declare const useGetLeafletLayer: ({ eventHandlers, }: {
6
6
  layer: Nullable<TangramLeafletLayer>;
7
7
  scene: import("..").TangramScene | null;
8
8
  config: Nullable<TangramEventConfig>;
9
- addSource: (sourceConfig: TangramSourceConfig) => string[] | undefined;
9
+ addSource: (sourceName: TangramSourceNames) => void;
10
10
  getSource: (sourceName: TangramSourceConfig["name"]) => {
11
11
  tile_size: number;
12
12
  type: string;
13
13
  url: string;
14
14
  } | undefined;
15
- updateSource: (sourceName: TangramSourceConfig["name"], newUrl: TangramSourceConfig["url"]) => string[] | undefined;
16
- reloadSource: (sourceName: TangramSourceNames) => string[] | undefined;
15
+ updateSource: (sourceName: TangramSourceConfig["name"], newUrl: TangramSourceConfig["url"]) => void;
16
+ reloadSource: (sourceName: TangramSourceNames) => void;
17
17
  addLayer: (layer: TangramCustomLayer) => string[] | undefined;
18
18
  removeLayer: (layer: TangramCustomLayer) => string[] | undefined;
19
19
  addStyle: ({ name, style }: {
@@ -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,SAAS,CAAC;AAKnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,kBAAkB,GAAI,oBAEhC;IACD,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC1C;;;;8BAmEkB,mBAAmB;4BA4BrB,mBAAmB,CAAC,MAAM,CAAC;;;;;+BAe1B,mBAAmB,CAAC,MAAM,CAAC,UAC/B,mBAAmB,CAAC,KAAK,CAAC;+BA+BvB,kBAAkB;sBASvB,kBAAkB;yBAyDlB,kBAAkB;gCA+BR;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;gCAyBzC,kBAAkB;gDAkBL;QAAE,KAAK,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;;;;CA0IvE,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,SAAS,CAAC;AAKnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,kBAAkB,GAAI,oBAEhC;IACD,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC1C;;;;4BAmEgB,kBAAkB;4BAsDlB,mBAAmB,CAAC,MAAM,CAAC;;;;;+BAiB1B,mBAAmB,CAAC,MAAM,CAAC,UAC/B,mBAAmB,CAAC,KAAK,CAAC;+BAyBvB,kBAAkB;sBASvB,kBAAkB;yBAyDlB,kBAAkB;gCA+BR;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;gCAyBzC,kBAAkB;gDAkBL;QAAE,KAAK,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;;;;CAiIvE,CAAC"}
package/dist/index.cjs CHANGED
@@ -30347,7 +30347,7 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
30347
30347
  }
30348
30348
  });
30349
30349
  }, [eventHandlers]);
30350
- const addSource = React__namespace.useCallback((sourceConfig) => {
30350
+ const addSource = React__namespace.useCallback((sourceName) => {
30351
30351
  if (!scene) {
30352
30352
  loggerService.warn({
30353
30353
  message: 'Scene не инициализирована',
@@ -30360,10 +30360,29 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
30360
30360
  });
30361
30361
  return;
30362
30362
  }
30363
- const { name } = sourceConfig;
30364
- config.sources[name] = structuredClone(sourceConfig);
30363
+ const url = sourceUrl[sourceName];
30364
+ config.sources[sourceName] = {
30365
+ tile_size,
30366
+ url,
30367
+ type: 'MVT',
30368
+ };
30369
+ scene.updateConfig({ rebuild: true });
30370
+ }, [scene, config]);
30371
+ const deleteSource = React__namespace.useCallback((sourceName) => {
30372
+ if (!scene) {
30373
+ loggerService.warn({
30374
+ message: 'Scene не инициализирована',
30375
+ });
30376
+ return;
30377
+ }
30378
+ if (!config) {
30379
+ loggerService.warn({
30380
+ message: 'Config не инициализирована',
30381
+ });
30382
+ return;
30383
+ }
30384
+ delete config.sources[sourceName];
30365
30385
  scene.updateConfig({ rebuild: true });
30366
- return getSources();
30367
30386
  }, [scene, config]);
30368
30387
  const getSource = React__namespace.useCallback((sourceName) => {
30369
30388
  if (!config) {
@@ -30372,7 +30391,8 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
30372
30391
  });
30373
30392
  return;
30374
30393
  }
30375
- return structuredClone(config.sources[sourceName]);
30394
+ const source = structuredClone(config.sources[sourceName]);
30395
+ return source;
30376
30396
  }, [config]);
30377
30397
  const updateSource = React__namespace.useCallback((sourceName, newUrl) => {
30378
30398
  if (!scene) {
@@ -30387,15 +30407,12 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
30387
30407
  });
30388
30408
  return;
30389
30409
  }
30390
- config.sources[sourceName].url = '';
30391
- scene.updateConfig();
30392
30410
  config.sources[sourceName].url = newUrl;
30393
30411
  scene.updateConfig({ rebuild: true });
30394
- return getSources();
30395
30412
  }, [config, scene]);
30396
30413
  const reloadSource = React__namespace.useCallback((sourceName) => {
30397
- const url = sourceUrl[sourceName];
30398
- return updateSource(sourceName, url);
30414
+ deleteSource(sourceName);
30415
+ addSource(sourceName);
30399
30416
  }, [updateSource]);
30400
30417
  const addLayer = React__namespace.useCallback((layer) => {
30401
30418
  if (!scene) {
@@ -30566,15 +30583,7 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
30566
30583
  },
30567
30584
  },
30568
30585
  });
30569
- Object.values(exports.TangramSourceNames).forEach((name) => {
30570
- const url = sourceUrl[name];
30571
- addSource({
30572
- tile_size,
30573
- name,
30574
- url,
30575
- type: 'MVT',
30576
- });
30577
- });
30586
+ Object.values(exports.TangramSourceNames).forEach(addSource);
30578
30587
  }, [addStyle, addSource]);
30579
30588
  return {
30580
30589
  layer,