@kiva/kv-components 8.13.1 → 8.13.3
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.
|
@@ -3,6 +3,10 @@ export interface Centroid {
|
|
|
3
3
|
cy: number;
|
|
4
4
|
xMax: number;
|
|
5
5
|
yMax: number;
|
|
6
|
+
popupCx?: number;
|
|
7
|
+
popupCy?: number;
|
|
8
|
+
popupXMax?: number;
|
|
9
|
+
popupYMax?: number;
|
|
6
10
|
}
|
|
7
11
|
declare const simpleMapCentroids: Record<string, Centroid>;
|
|
8
12
|
export default simpleMapCentroids;
|
|
@@ -39,7 +39,12 @@ const x = {
|
|
|
39
39
|
cx: 1116.78,
|
|
40
40
|
cy: 451.16,
|
|
41
41
|
xMax: 1190.78,
|
|
42
|
-
yMax: 521.76
|
|
42
|
+
yMax: 521.76,
|
|
43
|
+
// Main continent — tighter than full bbox with remote islands
|
|
44
|
+
popupCx: 1120,
|
|
45
|
+
popupCy: 450,
|
|
46
|
+
popupXMax: 1170,
|
|
47
|
+
popupYMax: 500
|
|
43
48
|
},
|
|
44
49
|
AT: {
|
|
45
50
|
cx: 682.12,
|
|
@@ -147,7 +152,12 @@ const x = {
|
|
|
147
152
|
cx: 361.59,
|
|
148
153
|
cy: 78.04,
|
|
149
154
|
xMax: 502.28,
|
|
150
|
-
yMax: 154.65
|
|
155
|
+
yMax: 154.65,
|
|
156
|
+
// Southern populated mainland — excludes Arctic archipelago
|
|
157
|
+
popupCx: 330,
|
|
158
|
+
popupCy: 105,
|
|
159
|
+
popupXMax: 420,
|
|
160
|
+
popupYMax: 140
|
|
151
161
|
},
|
|
152
162
|
CH: {
|
|
153
163
|
cx: 665.97,
|
|
@@ -159,7 +169,12 @@ const x = {
|
|
|
159
169
|
cx: 406.26,
|
|
160
170
|
cy: 490.74,
|
|
161
171
|
xMax: 431.06,
|
|
162
|
-
yMax: 571.28
|
|
172
|
+
yMax: 571.28,
|
|
173
|
+
// Central Chile (Santiago region) — avoids extreme N-S elongation
|
|
174
|
+
popupCx: 410,
|
|
175
|
+
popupCy: 475,
|
|
176
|
+
popupXMax: 425,
|
|
177
|
+
popupYMax: 500
|
|
163
178
|
},
|
|
164
179
|
CN: {
|
|
165
180
|
cx: 986.5,
|
|
@@ -387,13 +402,23 @@ const x = {
|
|
|
387
402
|
cx: 1077.13,
|
|
388
403
|
cy: 345.31,
|
|
389
404
|
xMax: 1162.16,
|
|
390
|
-
yMax: 379.27
|
|
405
|
+
yMax: 379.27,
|
|
406
|
+
// Java/Bali region — most populated; avoids geometric center in open sea
|
|
407
|
+
popupCx: 1065,
|
|
408
|
+
popupCy: 360,
|
|
409
|
+
popupXMax: 1095,
|
|
410
|
+
popupYMax: 378
|
|
391
411
|
},
|
|
392
412
|
IN: {
|
|
393
413
|
cx: 937.01,
|
|
394
414
|
cy: 241.69,
|
|
395
415
|
xMax: 988.21,
|
|
396
|
-
yMax: 300.71
|
|
416
|
+
yMax: 300.71,
|
|
417
|
+
// Indian peninsula — excludes Andaman/Nicobar and Lakshadweep
|
|
418
|
+
popupCx: 942,
|
|
419
|
+
popupCy: 240,
|
|
420
|
+
popupXMax: 975,
|
|
421
|
+
popupYMax: 280
|
|
397
422
|
},
|
|
398
423
|
IE: {
|
|
399
424
|
cx: 613.51,
|
|
@@ -615,7 +640,12 @@ const x = {
|
|
|
615
640
|
cx: 1045.2,
|
|
616
641
|
cy: 318.33,
|
|
617
642
|
xMax: 1080.71,
|
|
618
|
-
yMax: 331.5
|
|
643
|
+
yMax: 331.5,
|
|
644
|
+
// Peninsular Malaysia — avoids centroid falling in sea between halves
|
|
645
|
+
popupCx: 1018,
|
|
646
|
+
popupCy: 318,
|
|
647
|
+
popupXMax: 1027,
|
|
648
|
+
popupYMax: 330
|
|
619
649
|
},
|
|
620
650
|
NA: {
|
|
621
651
|
cx: 706.27,
|
|
@@ -651,7 +681,12 @@ const x = {
|
|
|
651
681
|
cx: 687.84,
|
|
652
682
|
cy: 48.37,
|
|
653
683
|
xMax: 722.29,
|
|
654
|
-
yMax: 88.49
|
|
684
|
+
yMax: 88.49,
|
|
685
|
+
// Southern mainland — excludes Svalbard/Arctic pulling centroid far north
|
|
686
|
+
popupCx: 680,
|
|
687
|
+
popupCy: 75,
|
|
688
|
+
popupXMax: 700,
|
|
689
|
+
popupYMax: 89
|
|
655
690
|
},
|
|
656
691
|
NP: {
|
|
657
692
|
cx: 940.71,
|
|
@@ -663,7 +698,12 @@ const x = {
|
|
|
663
698
|
cx: 1222.95,
|
|
664
699
|
cy: 508.39,
|
|
665
700
|
xMax: 1256.51,
|
|
666
|
-
yMax: 534.29
|
|
701
|
+
yMax: 534.29,
|
|
702
|
+
// North + South Island — excludes distant Chatham Islands inflating west
|
|
703
|
+
popupCx: 1242,
|
|
704
|
+
popupCy: 510,
|
|
705
|
+
popupXMax: 1257,
|
|
706
|
+
popupYMax: 535
|
|
667
707
|
},
|
|
668
708
|
OM: {
|
|
669
709
|
cx: 842.43,
|
|
@@ -747,7 +787,12 @@ const x = {
|
|
|
747
787
|
cx: 929.32,
|
|
748
788
|
cy: 82.39,
|
|
749
789
|
xMax: 1158.54,
|
|
750
|
-
yMax: 158.22
|
|
790
|
+
yMax: 158.22,
|
|
791
|
+
// Central Russia — avoids extreme east-west spread
|
|
792
|
+
popupCx: 900,
|
|
793
|
+
popupCy: 95,
|
|
794
|
+
popupXMax: 1e3,
|
|
795
|
+
popupYMax: 135
|
|
751
796
|
},
|
|
752
797
|
RW: {
|
|
753
798
|
cx: 749.91,
|
|
@@ -921,7 +966,12 @@ const x = {
|
|
|
921
966
|
cx: 237.09,
|
|
922
967
|
cy: 146.09,
|
|
923
968
|
xMax: 416.07,
|
|
924
|
-
yMax: 253.75
|
|
969
|
+
yMax: 253.75,
|
|
970
|
+
// Continental US mainland — excludes Alaska/Hawaii bbox inflation
|
|
971
|
+
popupCx: 275,
|
|
972
|
+
popupCy: 175,
|
|
973
|
+
popupXMax: 340,
|
|
974
|
+
popupYMax: 210
|
|
925
975
|
},
|
|
926
976
|
UZ: {
|
|
927
977
|
cx: 856.34,
|
package/dist/vue/KvSimpleMap.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.kv-simple-map__pan-layer[data-v-
|
|
1
|
+
.kv-simple-map__pan-layer[data-v-0abc47d3]{transform-origin:0 0}.kv-simple-map__control-btn[data-v-0abc47d3]{display:flex;height:2rem;width:2rem;cursor:pointer;align-items:center;justify-content:center;border-radius:.25rem;border-width:.0625rem;--tw-border-opacity: 1;border-color:rgba(var(--border-tertiary),var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow: 0 1px 4px 0 rgb(0 0 0 / .08);--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.kv-simple-map__control-btn[data-v-0abc47d3]:disabled{cursor:default;opacity:.3}.kv-simple-map__control-btn[data-v-0abc47d3]:hover:not(:disabled){--tw-bg-opacity: 1;background-color:rgba(var(--bg-secondary),var(--tw-bg-opacity, 1))}.kv-simple-map__play-btn[data-v-0abc47d3]{border-radius:500rem}.kv-simple-map__default-popup[data-v-0abc47d3]{white-space:nowrap;border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:.5rem 1.5rem;text-align:center;--tw-shadow: 0 1px 4px 0 rgb(0 0 0 / .08);--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);min-width:80px}.kv-simple-map__popup[data-v-0abc47d3]{height:0;width:0}.kv-simple-map__popup-content[data-v-0abc47d3]{position:absolute;white-space:nowrap}.kv-simple-map__popup--top>.kv-simple-map__popup-content[data-v-0abc47d3]{bottom:var(--kv-simple-map-popup-offset, 4px);left:0;transform:translate(-50%)}.kv-simple-map__popup--bottom>.kv-simple-map__popup-content[data-v-0abc47d3]{top:var(--kv-simple-map-popup-offset, 4px);left:0;transform:translate(-50%)}.kv-simple-map__popup--bottom-right>.kv-simple-map__popup-content[data-v-0abc47d3]{top:var(--kv-simple-map-popup-offset, 4px);left:var(--kv-simple-map-popup-offset, 4px)}.kv-simple-map-popup-enter-active[data-v-0abc47d3],.kv-simple-map-popup-leave-active[data-v-0abc47d3]{transition:opacity .18s ease-out}.kv-simple-map-popup-enter-from[data-v-0abc47d3],.kv-simple-map-popup-leave-to[data-v-0abc47d3]{opacity:0}.kv-simple-map-popup-enter-to[data-v-0abc47d3],.kv-simple-map-popup-leave-from[data-v-0abc47d3]{opacity:1}
|
package/dist/vue/KvSimpleMap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./KvSimpleMap2.js";
|
|
2
2
|
import "./KvSimpleMap.css";
|
|
3
3
|
import p from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const r = /* @__PURE__ */ p(o, [["__scopeId", "data-v-
|
|
4
|
+
const r = /* @__PURE__ */ p(o, [["__scopeId", "data-v-0abc47d3"]]);
|
|
5
5
|
export {
|
|
6
6
|
r as default
|
|
7
7
|
};
|
package/dist/vue/KvSimpleMap2.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { defineComponent as Ue, useSlots as Ye, computed as
|
|
2
|
-
import { mdiPlus as
|
|
1
|
+
import { defineComponent as Ue, useSlots as Ye, computed as a, ref as x, watch as Y, onMounted as Xe, onBeforeUnmount as Ge, openBlock as h, createElementBlock as b, normalizeStyle as $, createElementVNode as M, Fragment as qe, renderList as Ke, unref as C, createVNode as L, createCommentVNode as T, Transition as je, withCtx as Je, normalizeClass as Qe, renderSlot as et, toDisplayString as ie } from "vue";
|
|
2
|
+
import { mdiPlus as tt, mdiMinus as ot, mdiPlay as nt } from "@mdi/js";
|
|
3
3
|
import N from "@kiva/kv-tokens";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { ALL_COUNTRIES_ISO_MAP as
|
|
8
|
-
import { useMapTourCycle as
|
|
9
|
-
import
|
|
10
|
-
const
|
|
4
|
+
import lt from "../data/simpleMapPaths.js";
|
|
5
|
+
import at from "../data/simpleMapCountryPaths.js";
|
|
6
|
+
import O from "../data/simpleMapCentroids.js";
|
|
7
|
+
import { ALL_COUNTRIES_ISO_MAP as re } from "../data/allCountriesISOMap.js";
|
|
8
|
+
import { useMapTourCycle as ut } from "../utils/useMapTourCycle.js";
|
|
9
|
+
import X from "./KvMaterialIcon.js";
|
|
10
|
+
const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"], st = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "kv-simple-map__zoom-controls tw-absolute tw-top-2 tw-right-2 tw-flex tw-flex-col tw-gap-1"
|
|
13
|
-
},
|
|
13
|
+
}, ct = ["disabled"], pt = ["disabled"], mt = { class: "kv-simple-map__popup-layer tw-absolute tw-inset-0 tw-pointer-events-none" }, ft = { class: "kv-simple-map__popup-content" }, vt = { class: "kv-simple-map__default-popup" }, dt = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "tw-text-label"
|
|
16
|
-
},
|
|
16
|
+
}, yt = {
|
|
17
17
|
key: 1,
|
|
18
18
|
class: "tw-text-caption"
|
|
19
|
-
}, R = 1300.02, D = 571.784,
|
|
19
|
+
}, R = 1300.02, D = 571.784, xt = "cubic-bezier(0.76, 0, 0.24, 1)", ht = 60, $t = /* @__PURE__ */ Ue({
|
|
20
20
|
__name: "KvSimpleMap",
|
|
21
21
|
props: {
|
|
22
22
|
/**
|
|
@@ -187,23 +187,23 @@ const ut = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
187
187
|
fadeDuration: { type: Number, default: 500 }
|
|
188
188
|
},
|
|
189
189
|
setup(k) {
|
|
190
|
-
const n = k,
|
|
191
|
-
function
|
|
192
|
-
return n.height != null ? `${n.height}px` :
|
|
190
|
+
const n = k, se = Ye(), G = a(() => !!se.popup), E = x(null), r = x(0), w = x(0);
|
|
191
|
+
function ce() {
|
|
192
|
+
return n.height != null ? `${n.height}px` : r.value ? `${r.value / n.aspectRatio}px` : `${100 / n.aspectRatio}%`;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const pe = a(() => ({
|
|
195
195
|
width: n.width != null ? `${n.width}px` : "100%",
|
|
196
|
-
height:
|
|
196
|
+
height: ce(),
|
|
197
197
|
paddingBottom: n.height != null ? void 0 : `${100 / n.aspectRatio}%`
|
|
198
198
|
}));
|
|
199
|
-
let
|
|
200
|
-
function
|
|
199
|
+
let S = null;
|
|
200
|
+
function q() {
|
|
201
201
|
const e = E.value;
|
|
202
202
|
if (!e) return;
|
|
203
203
|
const t = e.getBoundingClientRect();
|
|
204
|
-
|
|
204
|
+
r.value = t.width, w.value = t.height;
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const me = a(() => n.countries), fe = a(() => n.loop), A = x(!1), ve = a(() => n.autoplay && !A.value), de = a(() => ({
|
|
207
207
|
initialDelay: n.initialDelay,
|
|
208
208
|
panDuration: n.panDuration,
|
|
209
209
|
holdPerStep: n.holdPerStep,
|
|
@@ -211,105 +211,118 @@ const ut = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
211
211
|
holdAll: n.holdAll,
|
|
212
212
|
fadeDuration: n.fadeDuration
|
|
213
213
|
})), {
|
|
214
|
-
panIdx:
|
|
215
|
-
highlighted:
|
|
216
|
-
showPopupIdx:
|
|
217
|
-
isRunning:
|
|
218
|
-
start:
|
|
219
|
-
} =
|
|
220
|
-
const e =
|
|
214
|
+
panIdx: K,
|
|
215
|
+
highlighted: ye,
|
|
216
|
+
showPopupIdx: j,
|
|
217
|
+
isRunning: m,
|
|
218
|
+
start: xe
|
|
219
|
+
} = ut(me, ve, fe, de.value), f = a(() => r.value ? r.value / R : 1), J = a(() => {
|
|
220
|
+
const e = f.value, t = D * e;
|
|
221
221
|
return {
|
|
222
222
|
x: 0,
|
|
223
|
-
y: Math.max(0, (
|
|
223
|
+
y: Math.max(0, (w.value - t) / 2),
|
|
224
224
|
scale: e
|
|
225
225
|
};
|
|
226
226
|
});
|
|
227
|
-
function
|
|
228
|
-
return e.cx != null && e.cy != null ? { cx: e.cx, cy: e.cy } :
|
|
227
|
+
function he(e) {
|
|
228
|
+
return e.cx != null && e.cy != null ? { cx: e.cx, cy: e.cy } : O[e.id] ?? null;
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
const be = a(() => {
|
|
231
|
+
const l = Math.max(0, Math.min(1, (r.value - 320) / 880));
|
|
232
|
+
return n.zoomFactor * (1.4 - l * (1.4 - 1));
|
|
233
|
+
}), we = a(() => {
|
|
234
|
+
if (K.value < 0) return null;
|
|
235
|
+
const e = n.countries[K.value];
|
|
233
236
|
if (!e) return null;
|
|
234
|
-
const t =
|
|
237
|
+
const t = he(e);
|
|
235
238
|
if (!t) return null;
|
|
236
|
-
const o =
|
|
239
|
+
const o = f.value * be.value;
|
|
240
|
+
let l = o;
|
|
241
|
+
const u = O[e.id];
|
|
242
|
+
if (u) {
|
|
243
|
+
const d = Math.max(2 * (u.xMax - u.cx), 20), V = Math.max(2 * (u.yMax - u.cy), 20), I = 0.45;
|
|
244
|
+
l = Math.min(
|
|
245
|
+
r.value * I / d,
|
|
246
|
+
w.value * I / V
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
const s = f.value * n.maxZoom, i = Math.min(s, Math.max(o, l));
|
|
237
250
|
return {
|
|
238
|
-
x:
|
|
239
|
-
y:
|
|
240
|
-
scale:
|
|
251
|
+
x: r.value / 2 - t.cx * i,
|
|
252
|
+
y: w.value / 2 - t.cy * i,
|
|
253
|
+
scale: i
|
|
241
254
|
};
|
|
242
|
-
}),
|
|
243
|
-
if (!n.fitToCountries || !n.countries.length || !
|
|
244
|
-
let e = 1 / 0, t = 1 / 0, o = -1 / 0,
|
|
245
|
-
if (n.countries.forEach((
|
|
246
|
-
if (
|
|
247
|
-
|
|
255
|
+
}), c = x({ x: 0, y: 0, scale: 1 }), B = x(!1), Q = x(!1), Z = x(!1), ee = a(() => {
|
|
256
|
+
if (!n.fitToCountries || !n.countries.length || !r.value || !w.value) return null;
|
|
257
|
+
let e = 1 / 0, t = 1 / 0, o = -1 / 0, l = -1 / 0;
|
|
258
|
+
if (n.countries.forEach((p) => {
|
|
259
|
+
if (p.cx != null && p.cy != null) {
|
|
260
|
+
p.cx < e && (e = p.cx), p.cx > o && (o = p.cx), p.cy < t && (t = p.cy), p.cy > l && (l = p.cy);
|
|
248
261
|
return;
|
|
249
262
|
}
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
252
|
-
const
|
|
253
|
-
|
|
263
|
+
const y = O[p.id];
|
|
264
|
+
if (!y) return;
|
|
265
|
+
const ae = 2 * y.cx - y.xMax, ue = 2 * y.cy - y.yMax;
|
|
266
|
+
ae < e && (e = ae), ue < t && (t = ue), y.xMax > o && (o = y.xMax), y.yMax > l && (l = y.yMax);
|
|
254
267
|
}), !Number.isFinite(e)) return null;
|
|
255
|
-
const
|
|
268
|
+
const u = Math.max(0, n.fitPadding), s = Math.max(1, o - e) * (1 + u * 2), i = Math.max(1, l - t) * (1 + u * 2), d = Math.min(r.value / s, w.value / i), V = f.value * n.minZoom, I = f.value * n.maxZoom, U = Math.max(V, Math.min(I, d)), We = (e + o) / 2, Ve = (t + l) / 2;
|
|
256
269
|
return {
|
|
257
|
-
x:
|
|
258
|
-
y:
|
|
259
|
-
scale:
|
|
270
|
+
x: r.value / 2 - We * U,
|
|
271
|
+
y: w.value / 2 - Ve * U,
|
|
272
|
+
scale: U
|
|
260
273
|
};
|
|
261
|
-
}),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}, { immediate: !0 }),
|
|
265
|
-
|
|
266
|
-
}),
|
|
274
|
+
}), ge = a(() => ee.value ?? J.value), F = a(() => m.value ? we.value ?? ee.value ?? J.value : c.value);
|
|
275
|
+
Y(ge, (e) => {
|
|
276
|
+
m.value || Z.value || (c.value = e);
|
|
277
|
+
}, { immediate: !0 }), Y(() => n.countries, () => {
|
|
278
|
+
Z.value = !1;
|
|
279
|
+
}), Y(() => n.autoplay, () => {
|
|
267
280
|
A.value = !1;
|
|
268
281
|
});
|
|
269
|
-
const
|
|
270
|
-
const { x: e, y: t, scale: o } =
|
|
282
|
+
const Me = a(() => {
|
|
283
|
+
const { x: e, y: t, scale: o } = F.value, l = !B.value && Q.value;
|
|
271
284
|
return {
|
|
272
285
|
width: `${R}px`,
|
|
273
286
|
height: `${D}px`,
|
|
274
287
|
transformOrigin: "0 0",
|
|
275
288
|
transform: `translate(${e}px, ${t}px) scale(${o})`,
|
|
276
|
-
transition:
|
|
289
|
+
transition: l ? `transform ${n.panDuration}ms ${xt}` : "none",
|
|
277
290
|
willChange: "transform"
|
|
278
291
|
};
|
|
279
|
-
}), _ =
|
|
292
|
+
}), _ = x(null), H = a(() => {
|
|
280
293
|
const e = /* @__PURE__ */ new Map();
|
|
281
294
|
return n.countries.forEach((t) => e.set(t.id, t)), e;
|
|
282
295
|
});
|
|
283
|
-
function
|
|
284
|
-
return
|
|
296
|
+
function _e(e) {
|
|
297
|
+
return H.value.has(e) || !!re[e];
|
|
285
298
|
}
|
|
286
|
-
function
|
|
287
|
-
return
|
|
299
|
+
function z(e) {
|
|
300
|
+
return _e(e);
|
|
288
301
|
}
|
|
289
|
-
const
|
|
290
|
-
function
|
|
302
|
+
const P = N.colors["eco-green"], Ce = [P[1], P[2], P[3], P[4]], te = a(() => n.highlightColor ?? P.DEFAULT), ke = a(() => n.baseColor ?? N.colors.gray[200]), Se = N.colors.gray[300];
|
|
303
|
+
function Pe(e) {
|
|
291
304
|
if (e == null || e < n.loanCountTiers[0]) return null;
|
|
292
305
|
for (let t = n.loanCountTiers.length - 1; t >= 0; t -= 1)
|
|
293
|
-
if (e >= n.loanCountTiers[t]) return
|
|
306
|
+
if (e >= n.loanCountTiers[t]) return Ce[t];
|
|
294
307
|
return null;
|
|
295
308
|
}
|
|
296
|
-
function
|
|
309
|
+
function $e(e) {
|
|
297
310
|
return {
|
|
298
311
|
transition: `fill ${n.fadeDuration}ms ease-in-out`,
|
|
299
|
-
cursor:
|
|
312
|
+
cursor: z(e) && !m.value ? "pointer" : "inherit"
|
|
300
313
|
};
|
|
301
314
|
}
|
|
302
|
-
function
|
|
303
|
-
const t =
|
|
304
|
-
return
|
|
315
|
+
function Te(e) {
|
|
316
|
+
const t = H.value.get(e), o = t ? Pe(t.loanCount) : null, l = _.value === e && z(e);
|
|
317
|
+
return ye.value.has(e) ? te.value : l ? o ? te.value : Se : o ?? ke.value;
|
|
305
318
|
}
|
|
306
|
-
function
|
|
307
|
-
|
|
319
|
+
function Ne(e) {
|
|
320
|
+
m.value || z(e) && (_.value = e);
|
|
308
321
|
}
|
|
309
|
-
function
|
|
322
|
+
function Re(e) {
|
|
310
323
|
_.value === e && (_.value = null);
|
|
311
324
|
}
|
|
312
|
-
function
|
|
325
|
+
function De(e, t = !1) {
|
|
313
326
|
if (e.cx != null && e.cy != null)
|
|
314
327
|
return {
|
|
315
328
|
cx: e.cx,
|
|
@@ -319,125 +332,127 @@ const ut = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
319
332
|
yMin: e.cy,
|
|
320
333
|
yMax: e.cy
|
|
321
334
|
};
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
335
|
+
const o = O[e.id];
|
|
336
|
+
if (!o) return null;
|
|
337
|
+
const l = t && o.popupCx != null ? o.popupCx : o.cx, u = t && o.popupCy != null ? o.popupCy : o.cy, s = t && o.popupXMax != null ? o.popupXMax : o.xMax, i = t && o.popupYMax != null ? o.popupYMax : o.yMax;
|
|
338
|
+
return {
|
|
339
|
+
cx: l,
|
|
340
|
+
cy: u,
|
|
341
|
+
xMax: s,
|
|
342
|
+
yMax: i,
|
|
343
|
+
xMin: 2 * l - s,
|
|
344
|
+
yMin: 2 * u - i
|
|
345
|
+
};
|
|
331
346
|
}
|
|
332
|
-
function
|
|
333
|
-
const t =
|
|
347
|
+
function oe(e) {
|
|
348
|
+
const t = De(e, !0);
|
|
334
349
|
if (!t) return null;
|
|
335
|
-
const o =
|
|
350
|
+
const o = F.value, l = { "--kv-simple-map-popup-offset": `${n.popupOffset}px` };
|
|
336
351
|
if (n.popupPlacement === "bottom-right")
|
|
337
352
|
return {
|
|
338
353
|
placement: "bottom-right",
|
|
339
354
|
style: {
|
|
340
355
|
left: `${t.xMax * o.scale + o.x}px`,
|
|
341
356
|
top: `${t.yMax * o.scale + o.y}px`,
|
|
342
|
-
...
|
|
357
|
+
...l
|
|
343
358
|
}
|
|
344
359
|
};
|
|
345
|
-
const
|
|
360
|
+
const u = t.cx * o.scale + o.x, s = t.yMin * o.scale + o.y, i = t.yMax * o.scale + o.y, d = s < ht ? "bottom" : "top";
|
|
346
361
|
return {
|
|
347
|
-
placement:
|
|
362
|
+
placement: d,
|
|
348
363
|
style: {
|
|
349
|
-
left: `${
|
|
350
|
-
top: `${
|
|
351
|
-
...
|
|
364
|
+
left: `${u}px`,
|
|
365
|
+
top: `${d === "top" ? s : i}px`,
|
|
366
|
+
...l
|
|
352
367
|
}
|
|
353
368
|
};
|
|
354
369
|
}
|
|
355
|
-
function
|
|
370
|
+
function ne(e) {
|
|
356
371
|
return !!e.name || e.loanCount != null;
|
|
357
372
|
}
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const e = n.countries[
|
|
361
|
-
if (!e || !
|
|
362
|
-
const t =
|
|
373
|
+
const v = a(() => {
|
|
374
|
+
if (m.value && j.value >= 0) {
|
|
375
|
+
const e = n.countries[j.value];
|
|
376
|
+
if (!e || !G.value && !ne(e)) return null;
|
|
377
|
+
const t = oe(e);
|
|
363
378
|
return t ? { country: e, ...t } : null;
|
|
364
379
|
}
|
|
365
|
-
if (!
|
|
366
|
-
const e = _.value, t =
|
|
367
|
-
if (!
|
|
368
|
-
const o =
|
|
380
|
+
if (!m.value && _.value) {
|
|
381
|
+
const e = _.value, t = H.value.get(e) ?? { id: e, name: re[e] };
|
|
382
|
+
if (!G.value && !ne(t)) return null;
|
|
383
|
+
const o = oe(t);
|
|
369
384
|
return o ? { country: t, ...o } : null;
|
|
370
385
|
}
|
|
371
386
|
return null;
|
|
372
387
|
});
|
|
373
|
-
function
|
|
388
|
+
function Ee(e) {
|
|
374
389
|
return e === 1 ? "1 loan" : `${e} loans`;
|
|
375
390
|
}
|
|
376
|
-
let
|
|
377
|
-
function
|
|
378
|
-
|
|
379
|
-
...
|
|
380
|
-
x:
|
|
381
|
-
y:
|
|
391
|
+
let g = null;
|
|
392
|
+
function W(e) {
|
|
393
|
+
g && (c.value = {
|
|
394
|
+
...c.value,
|
|
395
|
+
x: g.tx + (e.clientX - g.x),
|
|
396
|
+
y: g.ty + (e.clientY - g.y)
|
|
382
397
|
});
|
|
383
398
|
}
|
|
384
|
-
function
|
|
385
|
-
B.value = !1,
|
|
399
|
+
function Ae() {
|
|
400
|
+
B.value = !1, g = null, window.removeEventListener("pointermove", W);
|
|
386
401
|
}
|
|
387
|
-
function
|
|
388
|
-
e.button !== 0 && e.pointerType === "mouse" || (
|
|
402
|
+
function Be(e) {
|
|
403
|
+
e.button !== 0 && e.pointerType === "mouse" || (m.value && (c.value = { ...F.value }, A.value = !0), n.allowDragging && (Z.value = !0, B.value = !0, g = {
|
|
389
404
|
x: e.clientX,
|
|
390
405
|
y: e.clientY,
|
|
391
|
-
tx:
|
|
392
|
-
ty:
|
|
393
|
-
}, window.addEventListener("pointermove",
|
|
406
|
+
tx: c.value.x,
|
|
407
|
+
ty: c.value.y
|
|
408
|
+
}, window.addEventListener("pointermove", W), window.addEventListener("pointerup", Ae, { once: !0 })));
|
|
394
409
|
}
|
|
395
|
-
const
|
|
396
|
-
function
|
|
397
|
-
A.value = !1,
|
|
410
|
+
const Ze = a(() => n.autoplay && !m.value);
|
|
411
|
+
function Ie() {
|
|
412
|
+
A.value = !1, xe();
|
|
398
413
|
}
|
|
399
|
-
const
|
|
400
|
-
function
|
|
401
|
-
const t =
|
|
402
|
-
if (Math.abs(
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
x:
|
|
407
|
-
y:
|
|
408
|
-
scale:
|
|
414
|
+
const Le = a(() => !n.allowDragging || m.value ? "default" : B.value ? "grabbing" : "grab"), Oe = a(() => c.value.scale < f.value * n.maxZoom - 1e-3), Fe = a(() => c.value.scale > f.value * n.minZoom + 1e-3);
|
|
415
|
+
function le(e) {
|
|
416
|
+
const t = c.value, o = f.value * n.minZoom, l = f.value * n.maxZoom, u = Math.min(l, Math.max(o, t.scale + e * f.value));
|
|
417
|
+
if (Math.abs(u - t.scale) < 1e-6) return;
|
|
418
|
+
Z.value = !0;
|
|
419
|
+
const s = r.value, i = w.value, d = u / t.scale;
|
|
420
|
+
c.value = {
|
|
421
|
+
x: s / 2 - (s / 2 - t.x) * d,
|
|
422
|
+
y: i / 2 - (i / 2 - t.y) * d,
|
|
423
|
+
scale: u
|
|
409
424
|
};
|
|
410
425
|
}
|
|
411
|
-
function
|
|
412
|
-
|
|
426
|
+
function He() {
|
|
427
|
+
le(n.zoomStep);
|
|
413
428
|
}
|
|
414
|
-
function
|
|
415
|
-
|
|
429
|
+
function ze() {
|
|
430
|
+
le(-n.zoomStep);
|
|
416
431
|
}
|
|
417
|
-
return
|
|
418
|
-
|
|
432
|
+
return Xe(() => {
|
|
433
|
+
q(), typeof ResizeObserver < "u" && E.value && (S = new ResizeObserver(q), S.observe(E.value)), requestAnimationFrame(() => {
|
|
419
434
|
requestAnimationFrame(() => {
|
|
420
|
-
|
|
435
|
+
Q.value = !0;
|
|
421
436
|
});
|
|
422
437
|
});
|
|
423
|
-
}),
|
|
424
|
-
|
|
425
|
-
}), (e, t) => (
|
|
438
|
+
}), Ge(() => {
|
|
439
|
+
S == null || S.disconnect(), window.removeEventListener("pointermove", W);
|
|
440
|
+
}), (e, t) => (h(), b("div", {
|
|
426
441
|
ref_key: "rootRef",
|
|
427
442
|
ref: E,
|
|
428
443
|
class: "kv-simple-map tw-relative tw-block tw-overflow-hidden",
|
|
429
|
-
style: $(
|
|
444
|
+
style: $(pe.value)
|
|
430
445
|
}, [
|
|
431
|
-
|
|
446
|
+
M("div", {
|
|
432
447
|
class: "kv-simple-map__clip tw-absolute tw-inset-0 tw-overflow-hidden",
|
|
433
|
-
style: $({ backgroundColor: k.oceanColor, cursor:
|
|
434
|
-
onPointerdown:
|
|
448
|
+
style: $({ backgroundColor: k.oceanColor, cursor: Le.value }),
|
|
449
|
+
onPointerdown: Be
|
|
435
450
|
}, [
|
|
436
|
-
|
|
451
|
+
M("div", {
|
|
437
452
|
class: "kv-simple-map__pan-layer tw-absolute tw-top-0 tw-left-0",
|
|
438
|
-
style: $(
|
|
453
|
+
style: $(Me.value)
|
|
439
454
|
}, [
|
|
440
|
-
(
|
|
455
|
+
(h(), b("svg", {
|
|
441
456
|
width: R,
|
|
442
457
|
height: D,
|
|
443
458
|
viewBox: `0 0 ${R} ${D}`,
|
|
@@ -445,74 +460,74 @@ const ut = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
445
460
|
"aria-hidden": "true",
|
|
446
461
|
class: "tw-block"
|
|
447
462
|
}, [
|
|
448
|
-
(
|
|
463
|
+
(h(!0), b(qe, null, Ke(C(at), (o) => (h(), b("path", {
|
|
449
464
|
key: o.id,
|
|
450
|
-
d: C(
|
|
451
|
-
fill:
|
|
465
|
+
d: C(lt)[o.key],
|
|
466
|
+
fill: Te(o.id),
|
|
452
467
|
"fill-rule": "evenodd",
|
|
453
468
|
"clip-rule": "evenodd",
|
|
454
469
|
stroke: "white",
|
|
455
470
|
"stroke-linejoin": "round",
|
|
456
|
-
style: $(
|
|
457
|
-
onPointerenter: (
|
|
458
|
-
onPointerleave: (
|
|
471
|
+
style: $($e(o.id)),
|
|
472
|
+
onPointerenter: (l) => Ne(o.id),
|
|
473
|
+
onPointerleave: (l) => Re(o.id)
|
|
459
474
|
}, null, 44, rt))), 128))
|
|
460
|
-
], 8,
|
|
475
|
+
], 8, it))
|
|
461
476
|
], 4)
|
|
462
477
|
], 36),
|
|
463
|
-
k.showZoomControls && !C(
|
|
464
|
-
|
|
478
|
+
k.showZoomControls && !C(m) ? (h(), b("div", st, [
|
|
479
|
+
M("button", {
|
|
465
480
|
type: "button",
|
|
466
481
|
class: "kv-simple-map__control-btn",
|
|
467
|
-
disabled: !
|
|
482
|
+
disabled: !Oe.value,
|
|
468
483
|
"aria-label": "Zoom in",
|
|
469
|
-
onClick:
|
|
484
|
+
onClick: He
|
|
470
485
|
}, [
|
|
471
|
-
L(
|
|
486
|
+
L(X, {
|
|
472
487
|
class: "tw-w-2 tw-h-2",
|
|
473
|
-
icon: C(
|
|
488
|
+
icon: C(tt)
|
|
474
489
|
}, null, 8, ["icon"])
|
|
475
|
-
], 8,
|
|
476
|
-
|
|
490
|
+
], 8, ct),
|
|
491
|
+
M("button", {
|
|
477
492
|
type: "button",
|
|
478
493
|
class: "kv-simple-map__control-btn",
|
|
479
|
-
disabled: !
|
|
494
|
+
disabled: !Fe.value,
|
|
480
495
|
"aria-label": "Zoom out",
|
|
481
|
-
onClick:
|
|
496
|
+
onClick: ze
|
|
482
497
|
}, [
|
|
483
|
-
L(
|
|
498
|
+
L(X, {
|
|
484
499
|
class: "tw-w-2 tw-h-2",
|
|
485
|
-
icon: C(
|
|
500
|
+
icon: C(ot)
|
|
486
501
|
}, null, 8, ["icon"])
|
|
487
|
-
], 8,
|
|
502
|
+
], 8, pt)
|
|
488
503
|
])) : T("", !0),
|
|
489
|
-
|
|
504
|
+
Ze.value ? (h(), b("button", {
|
|
490
505
|
key: 1,
|
|
491
506
|
type: "button",
|
|
492
507
|
class: "kv-simple-map__control-btn kv-simple-map__play-btn tw-absolute tw-bottom-2 tw-right-2",
|
|
493
508
|
"aria-label": "Resume tour",
|
|
494
|
-
onClick:
|
|
509
|
+
onClick: Ie
|
|
495
510
|
}, [
|
|
496
|
-
L(
|
|
511
|
+
L(X, {
|
|
497
512
|
class: "tw-w-2 tw-h-2",
|
|
498
513
|
icon: C(nt)
|
|
499
514
|
}, null, 8, ["icon"])
|
|
500
515
|
])) : T("", !0),
|
|
501
|
-
|
|
502
|
-
L(
|
|
503
|
-
default:
|
|
504
|
-
|
|
505
|
-
key:
|
|
506
|
-
class:
|
|
507
|
-
style: $(
|
|
516
|
+
M("div", mt, [
|
|
517
|
+
L(je, { name: "kv-simple-map-popup" }, {
|
|
518
|
+
default: Je(() => [
|
|
519
|
+
v.value ? (h(), b("div", {
|
|
520
|
+
key: v.value.country.id,
|
|
521
|
+
class: Qe(["kv-simple-map__popup tw-absolute", `kv-simple-map__popup--${v.value.placement}`]),
|
|
522
|
+
style: $(v.value.style)
|
|
508
523
|
}, [
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
country:
|
|
524
|
+
M("div", ft, [
|
|
525
|
+
et(e.$slots, "popup", {
|
|
526
|
+
country: v.value.country
|
|
512
527
|
}, () => [
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
528
|
+
M("div", vt, [
|
|
529
|
+
v.value.country.name ? (h(), b("div", dt, ie(v.value.country.name), 1)) : T("", !0),
|
|
530
|
+
v.value.country.loanCount != null ? (h(), b("div", yt, ie(Ee(v.value.country.loanCount)), 1)) : T("", !0)
|
|
516
531
|
])
|
|
517
532
|
], !0)
|
|
518
533
|
])
|
|
@@ -525,5 +540,5 @@ const ut = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
525
540
|
}
|
|
526
541
|
});
|
|
527
542
|
export {
|
|
528
|
-
|
|
543
|
+
$t as default
|
|
529
544
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "8.13.
|
|
3
|
+
"version": "8.13.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"embla-carousel-fade",
|
|
126
126
|
"popper.js"
|
|
127
127
|
],
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "351df7e5ef5fcaff1a4f99394321c549da15a435"
|
|
129
129
|
}
|