poe-svelte-ui-lib 1.58.0 → 1.59.0

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.
@@ -99,3 +99,7 @@ Telemetry_SendObject(g_telemetry_stream, g_mcfg.DevSN, "Data", dev, sizeof(dev)
99
99
  ### Подсказки
100
100
 
101
101
  Кнопка «?» в правом краю шапки включает и выключает подсказки этого виджета (по умолчанию выключены); выбор общий для всех `WidgetMap` в браузере (`hintsSetting("WidgetMap")`, `hints.ts`). Подсказка всплывает при наведении на поле, смысл которого не очевиден, — что это за значение и на что влияет.
102
+
103
+ ### Подпись источников карты
104
+
105
+ Условия CARTO и OpenStreetMap требуют указывать источник подложки, поэтому подпись не убирается: она компактная — кнопка «i» в углу карты, свёрнутая при открытии (`attributionControl: { compact: true }`, сворачивание один раз после появления подписи в `mapWrapper/MapLibre.svelte`); полный текст раскрывается по нажатию.
@@ -30,19 +30,37 @@
30
30
 
31
31
  const mapCtx = prepareMapContext()
32
32
 
33
- // Инициализация карты
34
- $effect(() => {
35
- if (!window.maplibregl || map || !container) return
33
+ /* Подпись источников карты (CARTO, OpenStreetMap) обязательна по их условиям — оставляем её компактной кнопкой «i», свёрнутой при открытии */
34
+ /* Подпись появляется, когда загрузятся стиль и источники, — сворачиваем один раз, дальше её открывает и закрывает оператор */
35
+ const collapseAttribution = (target: maplibregl.Map) => {
36
+ const tryCollapse = () => {
37
+ const attrib = container?.querySelector(".maplibregl-ctrl-attrib.maplibregl-compact")
38
+ if (!attrib) return
39
+ attrib.classList.remove("maplibregl-compact-show")
40
+ attrib.removeAttribute("open")
41
+ target.off("styledata", tryCollapse)
42
+ target.off("sourcedata", tryCollapse)
43
+ }
44
+ target.on("styledata", tryCollapse)
45
+ target.on("sourcedata", tryCollapse)
46
+ }
36
47
 
48
+ const createMap = () => {
49
+ if (!window.maplibregl || map || !container) return
37
50
  map = new window.maplibregl.Map({
38
51
  container,
39
52
  style,
40
53
  zoom,
41
54
  center,
42
55
  maxPitch,
56
+ attributionControl: { compact: true },
43
57
  })
58
+ collapseAttribution(map)
44
59
  mapCtx.map = map
45
- })
60
+ }
61
+
62
+ // Инициализация карты
63
+ $effect(createMap)
46
64
 
47
65
  $effect(() => {
48
66
  if (map && style) {
@@ -61,16 +79,7 @@
61
79
  hasConnection = await loadMapLibre()
62
80
  isLoading = false
63
81
 
64
- if (!window.maplibregl || map || !container) return
65
-
66
- map = new window.maplibregl.Map({
67
- container,
68
- style,
69
- zoom,
70
- center,
71
- maxPitch,
72
- })
73
- mapCtx.map = map
82
+ createMap()
74
83
  })
75
84
  </script>
76
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.58.0",
3
+ "version": "1.59.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Oleg-Perevyshin/ElementsUI.git"