@datagouv/components-next 1.0.2-dev.207 → 1.0.2-dev.209

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.
Files changed (28) hide show
  1. package/dist/{Control-B9WQxlpJ.js → Control-DMgMzWnv.js} +1 -1
  2. package/dist/{Datafair.client-CZhPt853.js → Datafair.client-DpdHdQSx.js} +1 -1
  3. package/dist/{Event-iXDrp-fy.js → Event-CfA33G1K.js} +9 -9
  4. package/dist/{Image-mNMBOofs.js → Image-Dueb7njC.js} +12 -12
  5. package/dist/{ImagePreview.client-CTF6hyMR.js → ImagePreview.client-CtbvW_Q_.js} +1 -1
  6. package/dist/{JsonPreview.client-BwsgTnR7.js → JsonPreview.client-CboMjF2M.js} +2 -2
  7. package/dist/{Map-BfqKMw0S.js → Map-B4L0JtRr.js} +1113 -1025
  8. package/dist/{MapContainer.client-C95seuim.js → MapContainer.client-BPAbtzkr.js} +7 -7
  9. package/dist/{OSM-CcrUhItr.js → OSM-BUakwXg7.js} +1 -1
  10. package/dist/{PdfPreview.client-DaXPl9xc.js → PdfPreview.client-DQF8gS3o.js} +2 -2
  11. package/dist/{Pmtiles.client-PSLUkGmF.js → Pmtiles.client-B-X5pTXq.js} +5788 -5737
  12. package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-McCfJHd3.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-CzFj5TX2.js} +1 -1
  13. package/dist/{ScaleLine-VGQ7nkMS.js → ScaleLine-4id_Lp0T.js} +2 -2
  14. package/dist/{Tile-CSpn0Ca8.js → Tile-DI5PtNs-.js} +375 -325
  15. package/dist/{TileImage-CpbaEFwd.js → TileImage-DFTatxB8.js} +83 -63
  16. package/dist/{View-BYBpt-AU.js → View-CwG9s9BF.js} +108 -101
  17. package/dist/{XmlPreview.client-BOVVyHXW.js → XmlPreview.client-BvlwpV00.js} +3 -3
  18. package/dist/{common-BoeTUnDZ.js → common-C3bYhKiN.js} +71 -70
  19. package/dist/components-next.css +1 -1
  20. package/dist/components-next.js +1 -1
  21. package/dist/components.css +2 -2
  22. package/dist/{index-CeH9i6IP.js → index-D2eZ5uVt.js} +5683 -5785
  23. package/dist/{leaflet-src-D1Cl1V-1.js → leaflet-src-CM7H_PEp.js} +1 -1
  24. package/dist/{main-DADRUTDs.js → main-D1VXLvop.js} +12531 -13523
  25. package/dist/{proj-DxGbobp7.js → proj-DQrI7bbu.js} +302 -282
  26. package/dist/{tilecoord-DvX7WWiA.js → tilecoord-xLae1hR5.js} +106 -106
  27. package/dist/{vue3-xml-viewer.common-BzsQ7xw8.js → vue3-xml-viewer.common-D8NyU_-4.js} +1 -1
  28. package/package.json +25 -25
@@ -1,41 +1,43 @@
1
- import { b as Y, e as f, d as G, h as D, w as v, I as K, R as N, g as k } from "./tilecoord-DvX7WWiA.js";
2
- import { t as d, s as W, T as _, i as q } from "./Image-mNMBOofs.js";
3
- import { aT as H, an as $, D as j, J as V, a6 as B, K as F, P as x, y as E, M as J, z as Q, I as w, U as tt, aU as et, R as it, B as nt, a as R, al as rt, G as st, e as P, E as ot } from "./proj-DxGbobp7.js";
4
- import { a as m, x as A, y as lt, D as at } from "./common-BoeTUnDZ.js";
5
- const T = [0, 0, 0], g = 5;
6
- class U {
1
+ import { b as Y, e as f, d as w, h as D, w as v, I as K, R as N, g as k } from "./tilecoord-xLae1hR5.js";
2
+ import { t as g, s as W, T as _, i as H } from "./Image-Dueb7njC.js";
3
+ import { aV as q, ao as V, D as j, K as $, a7 as B, L as x, Q as F, y as E, M as J, z as Q, J as G, W as tt, aW as et, S as it, B as nt, a as R, am as rt, H as st, e as P, E as ot } from "./proj-DQrI7bbu.js";
4
+ import { a as m, x as A, y as lt, D as at } from "./common-C3bYhKiN.js";
5
+ const T = [0, 0, 0], d = 5;
6
+ class O {
7
7
  /**
8
8
  * @param {Options} options Tile grid options.
9
9
  */
10
10
  constructor(t) {
11
- this.minZoom = t.minZoom !== void 0 ? t.minZoom : 0, this.resolutions_ = t.resolutions, m(
12
- H(
11
+ let e = t.minZoom;
12
+ const i = t.resolutions;
13
+ e === void 0 && i && (e = i.findIndex((r) => r !== void 0)), this.minZoom = e !== void 0 ? e : 0, this.resolutions_ = i, m(
14
+ q(
13
15
  this.resolutions_,
14
16
  /**
15
17
  * @param {number} a First resolution
16
18
  * @param {number} b Second resolution
17
19
  * @return {number} Comparison result
18
20
  */
19
- (n, s) => s - n
21
+ (r, l) => l - r
20
22
  ),
21
23
  "`resolutions` must be sorted in descending order"
22
24
  );
23
- let e;
25
+ let n;
24
26
  if (!t.origins) {
25
- for (let n = 0, s = this.resolutions_.length - 1; n < s; ++n)
26
- if (!e)
27
- e = this.resolutions_[n] / this.resolutions_[n + 1];
28
- else if (this.resolutions_[n] / this.resolutions_[n + 1] !== e) {
29
- e = void 0;
27
+ for (let r = 0, l = this.resolutions_.length - 1; r < l; ++r)
28
+ if (!n)
29
+ n = this.resolutions_[r] / this.resolutions_[r + 1];
30
+ else if (this.resolutions_[r] / this.resolutions_[r + 1] !== n) {
31
+ n = void 0;
30
32
  break;
31
33
  }
32
34
  }
33
- this.zoomFactor_ = e, this.maxZoom = this.resolutions_.length - 1, this.origin_ = t.origin !== void 0 ? t.origin : null, this.origins_ = null, t.origins !== void 0 && (this.origins_ = t.origins, m(
35
+ this.zoomFactor_ = n, this.maxZoom = this.resolutions_.length - 1, this.origin_ = t.origin !== void 0 ? t.origin : null, this.origins_ = null, t.origins !== void 0 && (this.origins_ = t.origins, m(
34
36
  this.origins_.length == this.resolutions_.length,
35
37
  "Number of `origins` and `resolutions` must be equal"
36
38
  ));
37
- const i = t.extent;
38
- i !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = $(i)), m(
39
+ const s = t.extent;
40
+ s !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = V(s)), m(
39
41
  !this.origin_ && this.origins_ || this.origin_ && !this.origins_,
40
42
  "Either `origin` or `origins` must be configured, never both"
41
43
  ), this.tileSizes_ = null, t.tileSizes !== void 0 && (this.tileSizes_ = t.tileSizes, m(
@@ -44,19 +46,19 @@ class U {
44
46
  )), this.tileSize_ = t.tileSize !== void 0 ? t.tileSize : this.tileSizes_ ? null : A, m(
45
47
  !this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
46
48
  "Either `tileSize` or `tileSizes` must be configured, never both"
47
- ), this.extent_ = i !== void 0 ? i : null, this.fullTileRanges_ = null, this.tmpSize_ = [0, 0], this.tmpExtent_ = [0, 0, 0, 0], t.sizes !== void 0 ? this.fullTileRanges_ = t.sizes.map((n, s) => {
48
- const r = new Y(
49
- Math.min(0, n[0]),
50
- Math.max(n[0] - 1, -1),
51
- Math.min(0, n[1]),
52
- Math.max(n[1] - 1, -1)
49
+ ), this.extent_ = s !== void 0 ? s : null, this.fullTileRanges_ = null, this.tmpSize_ = [0, 0], this.tmpExtent_ = [0, 0, 0, 0], t.tileRanges !== void 0 ? this.fullTileRanges_ = t.tileRanges : t.sizes !== void 0 ? this.fullTileRanges_ = t.sizes.map((r, l) => {
50
+ const a = new Y(
51
+ Math.min(0, r[0]),
52
+ Math.max(r[0] - 1, -1),
53
+ Math.min(0, r[1]),
54
+ Math.max(r[1] - 1, -1)
53
55
  );
54
- if (i) {
55
- const l = this.getTileRangeForExtentAndZ(i, s);
56
- r.minX = Math.max(l.minX, r.minX), r.maxX = Math.min(l.maxX, r.maxX), r.minY = Math.max(l.minY, r.minY), r.maxY = Math.min(l.maxY, r.maxY);
56
+ if (s) {
57
+ const h = this.getTileRangeForExtentAndZ(s, l);
58
+ a.minX = Math.max(h.minX, a.minX), a.maxX = Math.min(h.maxX, a.maxX), a.minY = Math.max(h.minY, a.minY), a.maxY = Math.min(h.maxY, a.maxY);
57
59
  }
58
- return r;
59
- }) : i && this.calculateTileRanges_(i);
60
+ return a;
61
+ }) : s && this.calculateTileRanges_(s);
60
62
  }
61
63
  /**
62
64
  * Call a function with each tile coordinate for a given extent and zoom level.
@@ -226,7 +228,7 @@ class U {
226
228
  * @return {import("../coordinate.js").Coordinate} Tile center.
227
229
  */
228
230
  getTileCoordCenter(t) {
229
- const e = this.getOrigin(t[0]), i = this.getResolution(t[0]), n = d(this.getTileSize(t[0]), this.tmpSize_);
231
+ const e = this.getOrigin(t[0]), i = this.getResolution(t[0]), n = g(this.getTileSize(t[0]), this.tmpSize_);
230
232
  return [
231
233
  e[0] + (t[1] + 0.5) * n[0] * i,
232
234
  e[1] - (t[2] + 0.5) * n[1] * i
@@ -241,7 +243,7 @@ class U {
241
243
  * @api
242
244
  */
243
245
  getTileCoordExtent(t, e) {
244
- const i = this.getOrigin(t[0]), n = this.getResolution(t[0]), s = d(this.getTileSize(t[0]), this.tmpSize_), r = i[0] + t[1] * s[0] * n, l = i[1] - (t[2] + 1) * s[1] * n, a = r + s[0] * n, h = l + s[1] * n;
246
+ const i = this.getOrigin(t[0]), n = this.getResolution(t[0]), s = g(this.getTileSize(t[0]), this.tmpSize_), r = i[0] + t[1] * s[0] * n, l = i[1] - (t[2] + 1) * s[1] * n, a = r + s[0] * n, h = l + s[1] * n;
245
247
  return j(r, l, a, h, e);
246
248
  }
247
249
  /**
@@ -278,9 +280,9 @@ class U {
278
280
  * @private
279
281
  */
280
282
  getTileCoordForXYAndResolution_(t, e, i, n, s) {
281
- const r = this.getZForResolution(i), l = i / this.getResolution(r), a = this.getOrigin(r), h = d(this.getTileSize(r), this.tmpSize_);
283
+ const r = this.getZForResolution(i), l = i / this.getResolution(r), a = this.getOrigin(r), h = g(this.getTileSize(r), this.tmpSize_);
282
284
  let c = l * (t - a[0]) / i / h[0], u = l * (a[1] - e) / i / h[1];
283
- return n ? (c = F(c, g) - 1, u = F(u, g) - 1) : (c = x(c, g), u = x(u, g)), G(r, c, u, s);
285
+ return n ? (c = x(c, d) - 1, u = x(u, d) - 1) : (c = F(c, d), u = F(u, d)), w(r, c, u, s);
284
286
  }
285
287
  /**
286
288
  * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
@@ -298,9 +300,9 @@ class U {
298
300
  * @private
299
301
  */
300
302
  getTileCoordForXYAndZ_(t, e, i, n, s) {
301
- const r = this.getOrigin(i), l = this.getResolution(i), a = d(this.getTileSize(i), this.tmpSize_);
303
+ const r = this.getOrigin(i), l = this.getResolution(i), a = g(this.getTileSize(i), this.tmpSize_);
302
304
  let h = (t - r[0]) / l / a[0], c = (r[1] - e) / l / a[1];
303
- return n ? (h = F(h, g) - 1, c = F(c, g) - 1) : (h = x(h, g), c = x(c, g)), G(i, h, c, s);
305
+ return n ? (h = x(h, d) - 1, c = x(c, d) - 1) : (h = F(h, d), c = F(c, d)), w(i, h, c, s);
304
306
  }
305
307
  /**
306
308
  * Get a tile coordinate given a map coordinate and zoom level.
@@ -362,7 +364,7 @@ class U {
362
364
  * @api
363
365
  */
364
366
  getZForResolution(t, e) {
365
- const i = V(
367
+ const i = $(
366
368
  this.resolutions_,
367
369
  t,
368
370
  e || 0
@@ -395,14 +397,14 @@ class U {
395
397
  this.fullTileRanges_ = i;
396
398
  }
397
399
  }
398
- function O(o) {
400
+ function U(o) {
399
401
  let t = o.getDefaultTileGrid();
400
402
  return t || (t = ut(o), o.setDefaultTileGrid(t)), t;
401
403
  }
402
404
  function ht(o, t, e) {
403
- const i = t[0], n = o.getTileCoordCenter(t), s = p(e);
405
+ const i = t[0], n = o.getTileCoordCenter(t), s = Z(e);
404
406
  if (!tt(s, n)) {
405
- const r = w(s), l = Math.ceil(
407
+ const r = G(s), l = Math.ceil(
406
408
  (s[0] - n[0]) / r
407
409
  );
408
410
  return n[0] += r * l, o.getTileCoordForCoordAndZ(n, i);
@@ -412,7 +414,7 @@ function ht(o, t, e) {
412
414
  function ct(o, t, e, i) {
413
415
  i = i !== void 0 ? i : "top-left";
414
416
  const n = X(o, t, e);
415
- return new U({
417
+ return new O({
416
418
  extent: o,
417
419
  origin: et(o, i),
418
420
  resolutions: n,
@@ -431,11 +433,11 @@ function jt(o) {
431
433
  t.maxResolution
432
434
  )
433
435
  };
434
- return new U(i);
436
+ return new O(i);
435
437
  }
436
438
  function X(o, t, e, i) {
437
- t = t !== void 0 ? t : at, e = d(e !== void 0 ? e : A);
438
- const n = Q(o), s = w(o);
439
+ t = t !== void 0 ? t : at, e = g(e !== void 0 ? e : A);
440
+ const n = Q(o), s = G(o);
439
441
  i = i > 0 ? i : Math.max(s / e[0], n / e[1]);
440
442
  const r = t + 1, l = new Array(r);
441
443
  for (let a = 0; a < r; ++a)
@@ -443,10 +445,10 @@ function X(o, t, e, i) {
443
445
  return l;
444
446
  }
445
447
  function ut(o, t, e, i) {
446
- const n = p(o);
448
+ const n = Z(o);
447
449
  return ct(n, t, e, i);
448
450
  }
449
- function p(o) {
451
+ function Z(o) {
450
452
  o = E(o);
451
453
  let t = o.getExtent();
452
454
  if (!t) {
@@ -455,7 +457,7 @@ function p(o) {
455
457
  }
456
458
  return t;
457
459
  }
458
- function wt(o, t) {
460
+ function Gt(o, t) {
459
461
  const e = [];
460
462
  Object.keys(t).forEach(function(n) {
461
463
  t[n] !== null && t[n] !== void 0 && e.push(n + "=" + encodeURIComponent(t[n]));
@@ -463,9 +465,9 @@ function wt(o, t) {
463
465
  const i = e.join("&");
464
466
  return o = o.replace(/[?&]$/, ""), o += o.includes("?") ? "&" : "?", o + i;
465
467
  }
466
- const gt = /\{z\}/g, dt = /\{x\}/g, ft = /\{y\}/g, Tt = /\{-y\}/g;
468
+ const dt = /\{z\}/g, gt = /\{x\}/g, ft = /\{y\}/g, Tt = /\{-y\}/g;
467
469
  function mt(o, t, e, i, n) {
468
- return o.replace(gt, t.toString()).replace(dt, e.toString()).replace(ft, i.toString()).replace(Tt, function() {
470
+ return o.replace(dt, t.toString()).replace(gt, e.toString()).replace(ft, i.toString()).replace(Tt, function() {
469
471
  if (n === void 0)
470
472
  throw new Error(
471
473
  "If the URL template has a {-y} placeholder, the grid extent must be known"
@@ -491,7 +493,7 @@ function _t(o) {
491
493
  }
492
494
  return t.push(o), t;
493
495
  }
494
- function Ft(o, t) {
496
+ function xt(o, t) {
495
497
  return (
496
498
  /**
497
499
  * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
@@ -512,10 +514,10 @@ function Ft(o, t) {
512
514
  })
513
515
  );
514
516
  }
515
- function xt(o, t) {
517
+ function Ft(o, t) {
516
518
  const e = o.length, i = new Array(e);
517
519
  for (let n = 0; n < e; ++n)
518
- i[n] = Ft(o[n], t);
520
+ i[n] = xt(o[n], t);
519
521
  return Rt(i);
520
522
  }
521
523
  function Rt(o) {
@@ -581,6 +583,24 @@ class Et extends nt {
581
583
  getView() {
582
584
  return this.viewPromise_;
583
585
  }
586
+ /**
587
+ * Resolve once the source is ready to be used (its state is `ready`), or
588
+ * reject if it fails to load (its state is `error`). Sources that configure
589
+ * asynchronously can use this to expose data (e.g. dimensions) through a
590
+ * promise instead of the `change` event.
591
+ * @return {Promise<void>} Resolves when the source is ready.
592
+ * @protected
593
+ */
594
+ ready() {
595
+ const t = this.getState();
596
+ return t === "ready" ? Promise.resolve() : t === "error" ? Promise.reject(new Error("Source failed to load")) : new Promise((e, i) => {
597
+ const n = () => {
598
+ const s = this.getState();
599
+ s === "ready" ? (this.un("change", n), e()) : s === "error" && (this.un("change", n), i(new Error("Source failed to load")));
600
+ };
601
+ this.on("change", n);
602
+ });
603
+ }
584
604
  /**
585
605
  * Get the state of the source, see {@link import("./Source.js").State} for possible states.
586
606
  * @return {import("./Source.js").State} State.
@@ -643,7 +663,7 @@ class St extends Et {
643
663
  interpolate: t.interpolate
644
664
  }), this.on, this.once, this.un, this.tilePixelRatio_ = t.tilePixelRatio !== void 0 ? t.tilePixelRatio : 1, this.tileGrid = t.tileGrid !== void 0 ? t.tileGrid : null;
645
665
  const e = [256, 256];
646
- this.tileGrid && d(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), e), this.tmpSize = [0, 0], this.key_ = t.key || R(this), this.tileOptions = {
666
+ this.tileGrid && g(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), e), this.tmpSize = [0, 0], this.key_ = t.key || R(this), this.tileOptions = {
647
667
  transition: t.transition,
648
668
  interpolate: t.interpolate
649
669
  }, this.zDirection = t.zDirection ? t.zDirection : 0;
@@ -705,7 +725,7 @@ class St extends Et {
705
725
  * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
706
726
  */
707
727
  getTileGridForProjection(t) {
708
- return this.tileGrid ? this.tileGrid : O(t);
728
+ return this.tileGrid ? this.tileGrid : U(t);
709
729
  }
710
730
  /**
711
731
  * Get the tile pixel ratio for this source. Subclasses may override this
@@ -724,7 +744,7 @@ class St extends Et {
724
744
  * @return {import("../size.js").Size} Tile size.
725
745
  */
726
746
  getTilePixelSize(t, e, i) {
727
- const n = this.getTileGridForProjection(i), s = this.getTilePixelRatio(e), r = d(n.getTileSize(t), this.tmpSize);
747
+ const n = this.getTileGridForProjection(i), s = this.getTilePixelRatio(e), r = g(n.getTileSize(t), this.tmpSize);
728
748
  return s == 1 ? r : W(r, s, this.tmpSize);
729
749
  }
730
750
  /**
@@ -885,7 +905,7 @@ class z extends St {
885
905
  this.urls = t;
886
906
  const e = t.join(`
887
907
  `);
888
- this.generateTileUrlFunction_ ? this.setTileUrlFunction(xt(t, this.tileGrid), e) : this.setKey(e);
908
+ this.generateTileUrlFunction_ ? this.setTileUrlFunction(Ft(t, this.tileGrid), e) : this.setKey(e);
889
909
  }
890
910
  /**
891
911
  * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
@@ -953,7 +973,7 @@ class At extends z {
953
973
  if (this.tileGrid && (!e || P(e, t)))
954
974
  return this.tileGrid;
955
975
  const i = R(t);
956
- return i in this.tileGridForProjection || (this.tileGridForProjection[i] = O(t)), this.tileGridForProjection[i];
976
+ return i in this.tileGridForProjection || (this.tileGridForProjection[i] = U(t)), this.tileGridForProjection[i];
957
977
  }
958
978
  /**
959
979
  * @param {number} z Tile coordinate z.
@@ -1014,7 +1034,7 @@ class At extends z {
1014
1034
  S,
1015
1035
  this.getTilePixelRatio(n),
1016
1036
  this.getGutter(),
1017
- (Z, L, I, M) => this.getTileInternal(Z, L, I, M, l, r),
1037
+ (p, L, I, M) => this.getTileInternal(p, L, I, M, l, r),
1018
1038
  this.reprojectionErrorThreshold_,
1019
1039
  this.renderReprojectionEdges_,
1020
1040
  this.tileOptions
@@ -1070,7 +1090,7 @@ class At extends z {
1070
1090
  }
1071
1091
  }
1072
1092
  function yt(o, t) {
1073
- if (q) {
1093
+ if (H) {
1074
1094
  const e = o.getCrossOrigin();
1075
1095
  let i = "same-origin", n = "same-origin";
1076
1096
  e === "anonymous" || e === "" ? (i = "cors", n = "omit") : e === "use-credentials" && (i = "cors", n = "include");
@@ -1098,12 +1118,12 @@ export {
1098
1118
  Et as S,
1099
1119
  At as T,
1100
1120
  z as U,
1101
- U as a,
1102
- wt as b,
1121
+ O as a,
1122
+ Gt as b,
1103
1123
  jt as c,
1104
1124
  _t as d,
1105
- p as e,
1125
+ Z as e,
1106
1126
  Rt as f,
1107
- O as g,
1108
- xt as h
1127
+ U as g,
1128
+ Ft as h
1109
1129
  };