@kiva/kv-components 8.6.0 → 8.6.2-next.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.
package/dist/vue/KvMap.vue.d.ts
CHANGED
|
@@ -83,7 +83,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
83
83
|
mapLibreReady: boolean;
|
|
84
84
|
mapLoaded: boolean;
|
|
85
85
|
zoomActive: boolean;
|
|
86
|
-
countriesBorders:
|
|
86
|
+
countriesBorders: any;
|
|
87
|
+
countriesBordersPromise: any;
|
|
87
88
|
}, {
|
|
88
89
|
mapDimensions(): {
|
|
89
90
|
height: string;
|
|
@@ -104,7 +105,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
104
105
|
destroyWrapperObserver(): void;
|
|
105
106
|
checkWebGL(): boolean;
|
|
106
107
|
initializeMap(): void;
|
|
107
|
-
initializeLeaflet(): void
|
|
108
|
+
initializeLeaflet(): Promise<void>;
|
|
108
109
|
initializeMapLibre(): void;
|
|
109
110
|
animateMap(): void;
|
|
110
111
|
checkIntersectionObserverSupport(): boolean;
|
|
@@ -117,6 +118,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
117
118
|
loaded: boolean;
|
|
118
119
|
}>;
|
|
119
120
|
getCountriesData(): any;
|
|
121
|
+
ensureCountriesBordersLoaded(): any;
|
|
120
122
|
countryStyle(feature: any): {
|
|
121
123
|
color: any;
|
|
122
124
|
fillColor: string;
|
package/dist/vue/KvMap2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { computeMapCenter as l, computeMapZoom as h, generateMapMarkers as c, animationCoordinator as
|
|
3
|
-
const
|
|
1
|
+
import r from "@kiva/kv-tokens";
|
|
2
|
+
import { computeMapCenter as l, computeMapZoom as h, generateMapMarkers as c, animationCoordinator as u, getCountryColor as n } from "../utils/mapUtils.js";
|
|
3
|
+
const p = {
|
|
4
4
|
name: "KvMap",
|
|
5
5
|
props: {
|
|
6
6
|
/**
|
|
@@ -173,13 +173,14 @@ const f = {
|
|
|
173
173
|
mapLibreReady: !1,
|
|
174
174
|
mapLoaded: !1,
|
|
175
175
|
zoomActive: !1,
|
|
176
|
-
countriesBorders:
|
|
176
|
+
countriesBorders: null,
|
|
177
|
+
countriesBordersPromise: null
|
|
177
178
|
};
|
|
178
179
|
},
|
|
179
180
|
computed: {
|
|
180
181
|
mapDimensions() {
|
|
181
|
-
var
|
|
182
|
-
const e = (
|
|
182
|
+
var s;
|
|
183
|
+
const e = (s = this.$el) == null ? void 0 : s.getBoundingClientRect(), t = e ? `${e.width / this.aspectRatio}px` : "300px", i = e ? `${e.width}px` : "100%";
|
|
183
184
|
return {
|
|
184
185
|
height: this.height ? `${this.height}px` : t,
|
|
185
186
|
width: this.width ? `${this.width}px` : i,
|
|
@@ -226,8 +227,8 @@ const f = {
|
|
|
226
227
|
t === null && this.effectiveLat !== null && !this.mapLibreReady && !this.leafletReady && this.initializeMap();
|
|
227
228
|
},
|
|
228
229
|
countriesData: {
|
|
229
|
-
handler() {
|
|
230
|
-
this.optimizeInitialMapZoom && !this.mapLibreReady && !this.leafletReady && this.initializeMap();
|
|
230
|
+
handler(e) {
|
|
231
|
+
e != null && e.length && this.ensureCountriesBordersLoaded(), this.optimizeInitialMapZoom && !this.mapLibreReady && !this.leafletReady && this.initializeMap();
|
|
231
232
|
},
|
|
232
233
|
deep: !0
|
|
233
234
|
},
|
|
@@ -235,22 +236,23 @@ const f = {
|
|
|
235
236
|
this.mapInstance && (this.mapInstance.remove(), this.initializeLeaflet());
|
|
236
237
|
}
|
|
237
238
|
},
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
mounted() {
|
|
240
|
+
var e;
|
|
241
|
+
(e = this.countriesData) != null && e.length && this.ensureCountriesBordersLoaded(), !this.mapLibreReady && !this.leafletReady && this.initializeMap();
|
|
240
242
|
},
|
|
241
243
|
beforeDestroy() {
|
|
242
244
|
this.mapInstance && (!this.hasWebGL && !this.leafletReady && this.mapInstance.off(), this.mapInstance.remove()), this.destroyWrapperObserver();
|
|
243
245
|
},
|
|
244
246
|
methods: {
|
|
245
247
|
activateZoom(e = !1) {
|
|
246
|
-
const { mapInstance: t, hasWebGL: i, mapLibreReady:
|
|
247
|
-
if (!e &&
|
|
248
|
+
const { mapInstance: t, hasWebGL: i, mapLibreReady: s } = this, a = t.getZoom();
|
|
249
|
+
if (!e && a === this.effectiveZoomLevel || e && a === this.initialZoom) return !1;
|
|
248
250
|
this.zoomActive = !0;
|
|
249
|
-
const
|
|
250
|
-
i &&
|
|
251
|
+
const o = window.setTimeout(() => {
|
|
252
|
+
i && s ? t.zoomTo(
|
|
251
253
|
e ? this.initialZoom : this.effectiveZoomLevel,
|
|
252
254
|
{ duration: 1200 }
|
|
253
|
-
) : t.setZoom(e ? this.initialZoom : this.effectiveZoomLevel), clearTimeout(
|
|
255
|
+
) : t.setZoom(e ? this.initialZoom : this.effectiveZoomLevel), clearTimeout(o), this.zoomActive = !1;
|
|
254
256
|
}, this.autoZoomDelay);
|
|
255
257
|
},
|
|
256
258
|
createWrapperObserver() {
|
|
@@ -259,8 +261,8 @@ const f = {
|
|
|
259
261
|
targets: [(e = this.$refs) == null ? void 0 : e[this.refString]],
|
|
260
262
|
callback: (t) => {
|
|
261
263
|
t.forEach((i) => {
|
|
262
|
-
var
|
|
263
|
-
i.target === ((
|
|
264
|
+
var s, a;
|
|
265
|
+
i.target === ((s = this.$refs) == null ? void 0 : s[this.refString]) && !this.zoomActive && i.intersectionRatio > 0 && (this.initialZoom !== null && this.activateZoom(), (a = this.advancedAnimation) != null && a.borrowerPoints && this.animateMap());
|
|
264
266
|
});
|
|
265
267
|
}
|
|
266
268
|
});
|
|
@@ -281,7 +283,7 @@ const f = {
|
|
|
281
283
|
i.loaded && !this.mapLoaded && this.effectiveLat != null && this.effectiveLong != null && (this.initializeLeaflet(), this.leafletReady = !0);
|
|
282
284
|
})), document.head.appendChild(e), document.head.appendChild(t);
|
|
283
285
|
},
|
|
284
|
-
initializeLeaflet() {
|
|
286
|
+
async initializeLeaflet() {
|
|
285
287
|
this.mapInstance = L.map(`kv-map-holder-${this.mapId}`, {
|
|
286
288
|
center: [this.effectiveLat, this.effectiveLong],
|
|
287
289
|
zoom: this.initialZoom || this.effectiveZoomLevel,
|
|
@@ -290,7 +292,8 @@ const f = {
|
|
|
290
292
|
zoomControl: this.showZoomControl,
|
|
291
293
|
scrollWheelZoom: !1,
|
|
292
294
|
doubleClickZoom: !1,
|
|
293
|
-
attributionControl: !1
|
|
295
|
+
attributionControl: !1,
|
|
296
|
+
worldCopyJump: !0
|
|
294
297
|
});
|
|
295
298
|
let e = "https://api.maptiler.com/maps/landscape/{z}/{x}/{y}.png?key=n1Mz5ziX3k6JfdjFe7mx";
|
|
296
299
|
this.showLabels && (e = "https://api.maptiler.com/maps/bright/{z}/{x}/{y}.png?key=n1Mz5ziX3k6JfdjFe7mx"), L.tileLayer(e, {
|
|
@@ -298,7 +301,7 @@ const f = {
|
|
|
298
301
|
zoomOffset: -1,
|
|
299
302
|
minZoom: 1,
|
|
300
303
|
crossOrigin: !0
|
|
301
|
-
}).addTo(this.mapInstance), this.countriesData.length > 0 && (L.geoJson(
|
|
304
|
+
}).addTo(this.mapInstance), this.countriesData.length > 0 && (await this.ensureCountriesBordersLoaded(), this.countriesBorders && (L.geoJson(
|
|
302
305
|
this.getCountriesData(),
|
|
303
306
|
{
|
|
304
307
|
style: this.countryStyle,
|
|
@@ -307,17 +310,17 @@ const f = {
|
|
|
307
310
|
).addTo(this.mapInstance), this.countriesData.forEach((t) => {
|
|
308
311
|
if (t.numLoansFundraising > 0 && this.showFundraisingLoans) {
|
|
309
312
|
const i = L.circle([t.lat, t.long], {
|
|
310
|
-
color:
|
|
313
|
+
color: r.colors.black,
|
|
311
314
|
weight: 1,
|
|
312
|
-
fillColor:
|
|
315
|
+
fillColor: r.colors.brand[900],
|
|
313
316
|
fillOpacity: 1,
|
|
314
317
|
radius: 13e4
|
|
315
|
-
}).addTo(this.mapInstance),
|
|
316
|
-
i.bindTooltip(
|
|
318
|
+
}).addTo(this.mapInstance), s = `Click to see ${t.numLoansFundraising} fundraising loans in ${t.label}`;
|
|
319
|
+
i.bindTooltip(s), i.on("click", () => {
|
|
317
320
|
this.circleMapClicked(t.isoCode);
|
|
318
321
|
});
|
|
319
322
|
}
|
|
320
|
-
})), this.mapLoaded = !0, this.initialZoom !== null && this.createWrapperObserver();
|
|
323
|
+
}))), this.mapLoaded = !0, this.initialZoom !== null && this.createWrapperObserver();
|
|
321
324
|
},
|
|
322
325
|
initializeMapLibre() {
|
|
323
326
|
let e = "https://api.maptiler.com/maps/landscape/style.json?key=n1Mz5ziX3k6JfdjFe7mx";
|
|
@@ -340,7 +343,7 @@ const f = {
|
|
|
340
343
|
this.mapInstance.style.stylesheet.layers.forEach((e) => {
|
|
341
344
|
e.type === "symbol" && this.mapInstance.removeLayer(e.id);
|
|
342
345
|
}), c(this.mapInstance, this.advancedAnimation.borrowerPoints), setTimeout(() => {
|
|
343
|
-
|
|
346
|
+
u(this.mapInstance, this.advancedAnimation.borrowerPoints).then(() => {
|
|
344
347
|
this.mapInstance.dragPan.enable(), this.mapInstance.scrollZoom.enable(), this.mapInstance.scrollZoom.enable(), this.mapInstance.easeTo({
|
|
345
348
|
center: [this.effectiveLong, this.effectiveLat],
|
|
346
349
|
zoom: this.initialZoom || this.effectiveZoomLevel
|
|
@@ -357,42 +360,50 @@ const f = {
|
|
|
357
360
|
targets: i
|
|
358
361
|
} = {}) {
|
|
359
362
|
if (this.checkIntersectionObserverSupport()) {
|
|
360
|
-
const
|
|
361
|
-
return i.forEach((
|
|
363
|
+
const s = new IntersectionObserver(e, t);
|
|
364
|
+
return i.forEach((a) => s.observe(a)), s;
|
|
362
365
|
}
|
|
363
366
|
},
|
|
364
367
|
testDelayedGlobalLibrary(e, t = 3e3) {
|
|
365
|
-
return new Promise((i,
|
|
366
|
-
typeof window > "u" &&
|
|
367
|
-
let
|
|
368
|
-
const
|
|
369
|
-
typeof window[e] < "u" && (clearInterval(
|
|
368
|
+
return new Promise((i, s) => {
|
|
369
|
+
typeof window > "u" && s(new Error("window object not available"));
|
|
370
|
+
let a;
|
|
371
|
+
const o = window.setInterval(() => {
|
|
372
|
+
typeof window[e] < "u" && (clearInterval(o), clearTimeout(a), i({ loaded: !0 }));
|
|
370
373
|
}, 100);
|
|
371
|
-
|
|
372
|
-
clearInterval(
|
|
374
|
+
a = window.setTimeout(() => {
|
|
375
|
+
clearInterval(o), clearTimeout(a), i({ loaded: !1 });
|
|
373
376
|
}, t);
|
|
374
377
|
});
|
|
375
378
|
},
|
|
376
379
|
getCountriesData() {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
if (!this.countriesBorders)
|
|
381
|
+
return { type: "FeatureCollection", features: [] };
|
|
382
|
+
const e = this.countriesBorders, t = e.features ?? [];
|
|
383
|
+
return t.forEach((i, s) => {
|
|
384
|
+
const a = this.countriesData.find((o) => o.isoCode === i.properties.iso_a2);
|
|
385
|
+
a && (t[s].lenderLoans = a.value, t[s].numLoansFundraising = a.numLoansFundraising);
|
|
386
|
+
}), e;
|
|
387
|
+
},
|
|
388
|
+
ensureCountriesBordersLoaded() {
|
|
389
|
+
return this.countriesBorders ? Promise.resolve(this.countriesBorders) : (this.countriesBordersPromise || (this.countriesBordersPromise = import("../data/ne_110m_admin_0_countries.json.js").then((e) => {
|
|
390
|
+
const t = e.default ?? e;
|
|
391
|
+
return JSON.parse(JSON.stringify(t));
|
|
392
|
+
}).then((e) => (this.countriesBorders = e, this.countriesBorders)).catch(() => (this.countriesBordersPromise = null, null))), this.countriesBordersPromise);
|
|
382
393
|
},
|
|
383
394
|
countryStyle(e) {
|
|
384
395
|
return {
|
|
385
|
-
color:
|
|
396
|
+
color: r.colors.white,
|
|
386
397
|
// eslint-disable-next-line max-len
|
|
387
|
-
fillColor:
|
|
398
|
+
fillColor: n(e.lenderLoans, this.countriesData, r, this.defaultBaseColor),
|
|
388
399
|
weight: 1,
|
|
389
400
|
fillOpacity: 1
|
|
390
401
|
};
|
|
391
402
|
},
|
|
392
403
|
onEachCountryFeature(e, t) {
|
|
393
404
|
if (!this.showTooltips) return;
|
|
394
|
-
const i = e.lenderLoans ? `${e.lenderLoans} loan${e.lenderLoans > 1 ? "s" : ""}` : "0 loans",
|
|
395
|
-
t.bindTooltip(
|
|
405
|
+
const i = e.lenderLoans ? `${e.lenderLoans} loan${e.lenderLoans > 1 ? "s" : ""}` : "0 loans", s = `${e.properties.name} <br/> ${i}`;
|
|
406
|
+
t.bindTooltip(s, {
|
|
396
407
|
sticky: !0
|
|
397
408
|
}), t.on({
|
|
398
409
|
mouseover: this.highlightFeature,
|
|
@@ -401,14 +412,14 @@ const f = {
|
|
|
401
412
|
},
|
|
402
413
|
highlightFeature(e) {
|
|
403
414
|
e.target.setStyle({
|
|
404
|
-
fillColor:
|
|
415
|
+
fillColor: r.colors.gray[500]
|
|
405
416
|
});
|
|
406
417
|
},
|
|
407
418
|
resetHighlight(e) {
|
|
408
419
|
const t = e.target, { feature: i } = t;
|
|
409
420
|
t.setStyle({
|
|
410
421
|
// eslint-disable-next-line max-len
|
|
411
|
-
fillColor:
|
|
422
|
+
fillColor: n(i.lenderLoans, this.countriesData, r, this.defaultBaseColor)
|
|
412
423
|
});
|
|
413
424
|
},
|
|
414
425
|
circleMapClicked(e) {
|
|
@@ -417,5 +428,5 @@ const f = {
|
|
|
417
428
|
}
|
|
418
429
|
};
|
|
419
430
|
export {
|
|
420
|
-
|
|
431
|
+
p as default
|
|
421
432
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.menu-heading[data-v-3e49579c]{font-weight:300;font-size:1rem;letter-spacing:0em;line-height:1.
|
|
1
|
+
.menu-heading[data-v-3e49579c]{font-weight:300;font-size:1rem;letter-spacing:0em;line-height:1.4}@media (min-width: 64rem){.menu-heading[data-v-3e49579c]{font-size:1rem;letter-spacing:0em}}.menu-heading[data-v-3e49579c]{font-weight:400}.region-list[data-v-3e49579c],.search-list[data-v-3e49579c]{-moz-column-fill:auto;column-fill:auto;-moz-columns:3;columns:3;gap:2rem}.mega-menu-link[data-v-3e49579c]{display:inline-block;padding-top:.5rem;padding-bottom:.5rem;--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1));text-decoration-line:none}.mega-menu-link[data-v-3e49579c]:hover{--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1));text-decoration-line:underline}.link-item[data-v-3e49579c]{width:11rem;text-decoration-line:none}.link-item[data-v-3e49579c]:hover{--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1));text-decoration-line:underline}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "8.6.0",
|
|
3
|
+
"version": "8.6.2-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@babel/preset-env": "^7.24.8",
|
|
35
35
|
"@babel/preset-react": "^7.24.7",
|
|
36
36
|
"@babel/preset-typescript": "^7.24.7",
|
|
37
|
-
"@kiva/kv-tokens": "^3.7.
|
|
37
|
+
"@kiva/kv-tokens": "^3.7.3-next.0",
|
|
38
38
|
"@kiva/vite-plugin-vue-lib-css": "^2.0.0",
|
|
39
39
|
"@laynezh/vite-plugin-lib-assets": "^0.6.1",
|
|
40
40
|
"@mdi/js": "^7.4.47",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"embla-carousel-fade",
|
|
126
126
|
"popper.js"
|
|
127
127
|
],
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "b20da6549c86bce57f12ac7a951a74f745a9399c"
|
|
129
129
|
}
|