@datagouv/components-next 1.0.1 → 1.0.2-dev.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.
Files changed (33) hide show
  1. package/dist/{Control-BNCDn-8E.js → Control-DuZJdKV_.js} +1 -1
  2. package/dist/{Datafair.client-B5lBpOl8.js → Datafair.client-DpeBuzZZ.js} +1 -1
  3. package/dist/{Event-BOgJUhNR.js → Event--kp8kMdJ.js} +21 -21
  4. package/dist/{Image-BN-4XkIn.js → Image-34hvypZI.js} +114 -58
  5. package/dist/{JsonPreview.client-Doz1Z0BS.js → JsonPreview.client-B3sQR-rW.js} +1 -1
  6. package/dist/{Map-BdT3i2C4.js → Map-BjUnLyj8.js} +1534 -1466
  7. package/dist/{MapContainer.client-oiieO8H-.js → MapContainer.client-BA6GCqKX.js} +7 -7
  8. package/dist/{OSM-CamriM9b.js → OSM-s40W6sQ2.js} +22 -12
  9. package/dist/{PdfPreview.client-CdAhkDFJ.js → PdfPreview.client-CbeSChb8.js} +1 -1
  10. package/dist/Pmtiles.client-D8pFim1L.js +25190 -0
  11. package/dist/{ScaleLine-BiesrgOv.js → ScaleLine-KW-nXqp3.js} +2 -2
  12. package/dist/Swagger.client-B-2Q16qa.js +4 -0
  13. package/dist/{Tile-DCuqwNOI.js → Tile-DbNFNPfU.js} +189 -172
  14. package/dist/{TileImage-CmZf8EdU.js → TileImage-BsXBxMtq.js} +132 -102
  15. package/dist/{View-DcDc7N2K.js → View-BR92hTWP.js} +8 -8
  16. package/dist/{XmlPreview.client-CrjHf74q.js → XmlPreview.client-DWJt61wG.js} +2 -2
  17. package/dist/{common-C4rDcQpp.js → common-PJfpC179.js} +34 -33
  18. package/dist/components-next.css +4 -4
  19. package/dist/components-next.js +1 -1
  20. package/dist/components.css +1 -1
  21. package/dist/{index-Bbu9rOHt.js → index-DVp7Y0Xu.js} +11105 -6743
  22. package/dist/{main-CiH8ZmBI.js → main-CrSRA2X-.js} +22125 -22173
  23. package/dist/{proj-CKwYjU38.js → proj-DsetBcW7.js} +513 -498
  24. package/dist/{tilecoord-YW3qEH_j.js → tilecoord-Db24Px13.js} +242 -224
  25. package/dist/{vue3-xml-viewer.common-Bi_bsV6C.js → vue3-xml-viewer.common-BjA4LdSC.js} +1 -1
  26. package/package.json +2 -1
  27. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +1 -50
  28. package/src/composables/useResourceCapabilities.ts +1 -15
  29. package/src/functions/api.ts +3 -11
  30. package/src/types/resources.ts +0 -10
  31. package/dist/Pmtiles.client-B0v8tGJQ.js +0 -22812
  32. package/dist/Swagger.client-CsK65JnG.js +0 -4
  33. package/src/functions/resourceCapabilities.ts +0 -55
@@ -1,4 +1,4 @@
1
- import { B as o, u as h, V as m, l as c } from "./proj-CKwYjU38.js";
1
+ import { B as o, u as h, V as m, l as c } from "./proj-DsetBcW7.js";
2
2
  const g = {
3
3
  /**
4
4
  * Triggered after a map frame is rendered.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as f, computed as a, createElementBlock as o, openBlock as t, createBlock as p, createElementVNode as i, withCtx as m, createVNode as _, unref as c, toDisplayString as x } from "vue";
2
- import { a as h, _ as v, F as g } from "./main-CiH8ZmBI.js";
2
+ import { a as h, _ as v, F as g } from "./main-CrSRA2X-.js";
3
3
  const k = { class: "fr-text--xs" }, b = { key: 0 }, y = ["src"], B = /* @__PURE__ */ f({
4
4
  __name: "Datafair.client",
5
5
  props: {
@@ -1,7 +1,7 @@
1
- import { H as x } from "./View-DcDc7N2K.js";
2
- import { a as I } from "./common-C4rDcQpp.js";
3
- import { B as C, a6 as h, ak as m, u as S, l as p, E as N, i as L, a3 as P, I as Z } from "./proj-CKwYjU38.js";
4
- import { c as T } from "./Image-BN-4XkIn.js";
1
+ import { H as x } from "./View-BR92hTWP.js";
2
+ import { a as I } from "./common-PJfpC179.js";
3
+ import { B as C, a7 as h, al as m, u as S, l as p, E as N, i as L, a4 as P, J as Z } from "./proj-DsetBcW7.js";
4
+ import { c as T } from "./Image-34hvypZI.js";
5
5
  const n = {
6
6
  OPACITY: "opacity",
7
7
  VISIBLE: "visible",
@@ -596,16 +596,16 @@ function V() {
596
596
  desynchronized: !0
597
597
  })), _;
598
598
  }
599
- const B = /^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i, k = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i, w = /^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i, z = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
599
+ const B = /^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i, w = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i, z = /^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i, F = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
600
600
  function f(t, e) {
601
601
  return t.endsWith("%") ? Number(t.substring(0, t.length - 1)) / e : Number(t);
602
602
  }
603
- function l(t) {
603
+ function d(t) {
604
604
  throw new Error('failed to parse "' + t + '" as color');
605
605
  }
606
606
  function A(t) {
607
607
  if (t.toLowerCase().startsWith("rgb")) {
608
- const a = t.match(k) || t.match(B) || t.match(w);
608
+ const a = t.match(w) || t.match(B) || t.match(z);
609
609
  if (a) {
610
610
  const o = a[4], u = 100 / 255;
611
611
  return [
@@ -615,10 +615,10 @@ function A(t) {
615
615
  o !== void 0 ? h(f(o, 100), 0, 1) : 1
616
616
  ];
617
617
  }
618
- l(t);
618
+ d(t);
619
619
  }
620
620
  if (t.startsWith("#")) {
621
- if (z.test(t)) {
621
+ if (F.test(t)) {
622
622
  const a = t.substring(1), o = a.length <= 4 ? 1 : 2, u = [0, 0, 0, 255];
623
623
  for (let c = 0, g = a.length; c < g; c += o) {
624
624
  let y = parseInt(a.substring(c, c + o), 16);
@@ -626,12 +626,12 @@ function A(t) {
626
626
  }
627
627
  return u[3] = u[3] / 255, u;
628
628
  }
629
- l(t);
629
+ d(t);
630
630
  }
631
631
  const e = V();
632
632
  e.fillStyle = "#abcdef";
633
633
  let r = e.fillStyle;
634
- e.fillStyle = t, e.fillStyle === r && (e.fillStyle = "#fedcba", r = e.fillStyle, e.fillStyle = t, e.fillStyle === r && l(t));
634
+ e.fillStyle = t, e.fillStyle === r && (e.fillStyle = "#fedcba", r = e.fillStyle, e.fillStyle = t, e.fillStyle === r && d(t));
635
635
  const s = e.fillStyle;
636
636
  if (s.startsWith("#") || s.startsWith("rgba"))
637
637
  return A(s);
@@ -642,7 +642,7 @@ function A(t) {
642
642
  function v(t) {
643
643
  return typeof t == "string" ? t : H(t);
644
644
  }
645
- const F = 1024, d = {};
645
+ const k = 1024, l = {};
646
646
  let R = 0;
647
647
  function J(t) {
648
648
  if (t.length === 4)
@@ -683,18 +683,18 @@ function ee(t) {
683
683
  function j(t) {
684
684
  if (t === "none")
685
685
  return U;
686
- if (d.hasOwnProperty(t))
687
- return d[t];
688
- if (R >= F) {
686
+ if (l.hasOwnProperty(t))
687
+ return l[t];
688
+ if (R >= k) {
689
689
  let r = 0;
690
- for (const s in d)
691
- (r++ & 3) === 0 && (delete d[s], --R);
690
+ for (const s in l)
691
+ (r++ & 3) === 0 && (delete l[s], --R);
692
692
  }
693
693
  const e = A(t);
694
- e.length !== 4 && l(t);
694
+ e.length !== 4 && d(t);
695
695
  for (const r of e)
696
- isNaN(r) && l(t);
697
- return d[t] = e, ++R, e;
696
+ isNaN(r) && d(t);
697
+ return l[t] = e, ++R, e;
698
698
  }
699
699
  function te(t) {
700
700
  return Array.isArray(t) ? t : j(t);
@@ -715,7 +715,7 @@ class re extends Z {
715
715
  * @param {import("../transform.js").Transform} [inversePixelTransform] Transform for
716
716
  * CSS pixels to rendered pixels.
717
717
  * @param {import("../Map.js").FrameState} [frameState] Frame state.
718
- * @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [context] Context.
718
+ * @param {?(CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D|WebGLRenderingContext)} [context] Context.
719
719
  */
720
720
  constructor(e, r, s, i) {
721
721
  super(e), this.inversePixelTransform = r, this.frameState = s, this.context = i;
@@ -1,7 +1,7 @@
1
- import { aC as I, E as f, aq as R, aB as d, u as C } from "./proj-CKwYjU38.js";
2
- const r = typeof navigator < "u" && typeof navigator.userAgent < "u" ? navigator.userAgent.toLowerCase() : "", v = r.includes("safari") && !r.includes("chrom");
3
- v && (r.includes("version/15.4") || /cpu (os|iphone os) 15_4 like mac os x/.test(r));
4
- const D = r.includes("webkit") && !r.includes("edge"), _ = r.includes("macintosh"), m = typeof devicePixelRatio < "u" ? devicePixelRatio : 1, A = typeof WorkerGlobalScope < "u" && typeof OffscreenCanvas < "u" && self instanceof WorkerGlobalScope, u = typeof Image < "u" && Image.prototype.decode, p = typeof createImageBitmap == "function", w = (function() {
1
+ import { aC as v, E as f, aq as C, aB as h, u as R } from "./proj-DsetBcW7.js";
2
+ const r = typeof navigator < "u" && typeof navigator.userAgent < "u" ? navigator.userAgent.toLowerCase() : "", I = r.includes("safari") && !r.includes("chrom");
3
+ I && (r.includes("version/15.4") || /cpu (os|iphone os) 15_4 like mac os x/.test(r));
4
+ const L = r.includes("webkit") && !r.includes("edge"), D = r.includes("macintosh"), w = typeof devicePixelRatio < "u" ? devicePixelRatio : 1, y = typeof WorkerGlobalScope < "u" && typeof OffscreenCanvas < "u" && self instanceof WorkerGlobalScope, u = typeof Image < "u" && Image.prototype.decode, p = typeof createImageBitmap == "function", O = (function() {
5
5
  let e = !1;
6
6
  try {
7
7
  const t = Object.defineProperty({}, "passive", {
@@ -13,7 +13,7 @@ const D = r.includes("webkit") && !r.includes("edge"), _ = r.includes("macintosh
13
13
  } catch {
14
14
  }
15
15
  return e;
16
- })(), O = {
16
+ })(), _ = {
17
17
  IDLE: 0,
18
18
  LOADING: 1,
19
19
  LOADED: 2,
@@ -24,21 +24,23 @@ const D = r.includes("webkit") && !r.includes("edge"), _ = r.includes("macintosh
24
24
  ERROR: 3,
25
25
  EMPTY: 4
26
26
  };
27
- function g(e, t, n, i) {
27
+ function m(e, t, n, i) {
28
28
  let s;
29
29
  return n && n.length ? s = /** @type {HTMLCanvasElement} */
30
- n.shift() : A ? s = new OffscreenCanvas(e || 300, t || 300) : s = document.createElement("canvas"), e && (s.width = e), t && (s.height = t), /** @type {CanvasRenderingContext2D} */
30
+ n.shift() : y ? s = new class extends OffscreenCanvas {
31
+ style = {};
32
+ }(e ?? 300, t ?? 150) : s = document.createElement("canvas"), e && (s.width = e), t && (s.height = t), /** @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} */
31
33
  s.getContext("2d", i);
32
34
  }
33
35
  let l;
34
- function S() {
35
- return l || (l = g(1, 1)), l;
36
+ function N() {
37
+ return l || (l = m(1, 1)), l;
36
38
  }
37
39
  function T(e) {
38
40
  const t = e.canvas;
39
41
  t.width = 1, t.height = 1, e.clearRect(0, 0, 1, 1);
40
42
  }
41
- function P(e) {
43
+ function S(e) {
42
44
  let t = e.offsetWidth;
43
45
  const n = getComputedStyle(e);
44
46
  return t += parseInt(n.marginLeft, 10) + parseInt(n.marginRight, 10), t;
@@ -48,15 +50,15 @@ function M(e) {
48
50
  const n = getComputedStyle(e);
49
51
  return t += parseInt(n.marginTop, 10) + parseInt(n.marginBottom, 10), t;
50
52
  }
51
- function N(e, t) {
53
+ function P(e, t) {
52
54
  const n = t.parentNode;
53
55
  n && n.replaceChild(e, t);
54
56
  }
55
- function B(e) {
57
+ function k(e) {
56
58
  for (; e.lastChild; )
57
59
  e.lastChild.remove();
58
60
  }
59
- function G(e, t) {
61
+ function B(e, t) {
60
62
  const n = e.childNodes;
61
63
  for (let i = 0; ; ++i) {
62
64
  const s = n[i], o = t[i];
@@ -75,23 +77,75 @@ function G(e, t) {
75
77
  }
76
78
  }
77
79
  }
80
+ function G() {
81
+ return new Proxy(
82
+ {
83
+ /**
84
+ * @type {Array<HTMLElement>}
85
+ */
86
+ childNodes: [],
87
+ /**
88
+ * @param {HTMLElement} node html node.
89
+ * @return {HTMLElement} html node.
90
+ */
91
+ appendChild: function(t) {
92
+ return this.childNodes.push(t), t;
93
+ },
94
+ /**
95
+ * dummy function, as this structure is not supposed to have a parent.
96
+ */
97
+ remove: function() {
98
+ },
99
+ /**
100
+ * @param {HTMLElement} node html node.
101
+ * @return {HTMLElement} html node.
102
+ */
103
+ removeChild: function(t) {
104
+ const n = this.childNodes.indexOf(t);
105
+ if (n === -1)
106
+ throw new Error("Node to remove was not found");
107
+ return this.childNodes.splice(n, 1), t;
108
+ },
109
+ /**
110
+ * @param {HTMLElement} newNode new html node.
111
+ * @param {HTMLElement} referenceNode reference html node.
112
+ * @return {HTMLElement} new html node.
113
+ */
114
+ insertBefore: function(t, n) {
115
+ const i = this.childNodes.indexOf(n);
116
+ if (i === -1)
117
+ throw new Error("Reference node not found");
118
+ return this.childNodes.splice(i, 0, t), t;
119
+ },
120
+ style: {}
121
+ },
122
+ {
123
+ get(t, n, i) {
124
+ return n === "firstElementChild" ? t.childNodes.length > 0 ? t.childNodes[0] : null : Reflect.get(t, n, i);
125
+ }
126
+ }
127
+ );
128
+ }
78
129
  function W(e) {
130
+ return typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas;
131
+ }
132
+ function b(e) {
79
133
  return e[0] > 0 && e[1] > 0;
80
134
  }
81
- function b(e, t, n) {
135
+ function H(e, t, n) {
82
136
  return n === void 0 && (n = [0, 0]), n[0] = e[0] * t + 0.5 | 0, n[1] = e[1] * t + 0.5 | 0, n;
83
137
  }
84
- function k(e, t) {
138
+ function V(e, t) {
85
139
  return Array.isArray(e) ? e : (t === void 0 ? t = [e, e] : (t[0] = e, t[1] = e), t);
86
140
  }
87
- const c = {
141
+ const a = {
88
142
  IDLE: 0,
89
143
  LOADING: 1,
90
144
  LOADED: 2,
91
145
  ERROR: 3,
92
146
  EMPTY: 4
93
147
  };
94
- class V extends I {
148
+ class F extends v {
95
149
  /**
96
150
  * @param {import("./extent.js").Extent} extent Extent.
97
151
  * @param {number|Array<number>|undefined} resolution Resolution. If provided as array, x and y
@@ -100,7 +154,7 @@ class V extends I {
100
154
  * @param {import("./ImageState.js").default|Loader} stateOrLoader State.
101
155
  */
102
156
  constructor(t, n, i, s) {
103
- super(), this.extent = t, this.pixelRatio_ = i, this.resolution = n, this.state = typeof s == "function" ? c.IDLE : s, this.image_ = null, this.loader = typeof s == "function" ? s : null;
157
+ super(), this.extent = t, this.pixelRatio_ = i, this.resolution = n, this.state = typeof s == "function" ? a.IDLE : s, this.image_ = null, this.loader = typeof s == "function" ? s : null;
104
158
  }
105
159
  /**
106
160
  * @protected
@@ -145,19 +199,19 @@ class V extends I {
145
199
  * Load not yet loaded URI.
146
200
  */
147
201
  load() {
148
- if (this.state == c.IDLE && this.loader) {
149
- this.state = c.LOADING, this.changed();
202
+ if (this.state == a.IDLE && this.loader) {
203
+ this.state = a.LOADING, this.changed();
150
204
  const t = this.getResolution(), n = Array.isArray(t) ? t[0] : t;
151
- R(
205
+ C(
152
206
  () => this.loader(
153
207
  this.getExtent(),
154
208
  n,
155
209
  this.getPixelRatio()
156
210
  )
157
211
  ).then((i) => {
158
- "image" in i && (this.image_ = i.image), "extent" in i && (this.extent = i.extent), "resolution" in i && (this.resolution = i.resolution), "pixelRatio" in i && (this.pixelRatio_ = i.pixelRatio), (i instanceof HTMLImageElement || p && i instanceof ImageBitmap || i instanceof HTMLCanvasElement || i instanceof HTMLVideoElement) && (this.image_ = i), this.state = c.LOADED;
212
+ "image" in i && (this.image_ = i.image), "extent" in i && (this.extent = i.extent), "resolution" in i && (this.resolution = i.resolution), "pixelRatio" in i && (this.pixelRatio_ = i.pixelRatio), (i instanceof HTMLImageElement || p && i instanceof ImageBitmap || i instanceof HTMLCanvasElement || i instanceof HTMLVideoElement) && (this.image_ = i), this.state = a.LOADED;
159
213
  }).catch((i) => {
160
- this.state = c.ERROR, console.error(i);
214
+ this.state = a.ERROR, console.error(i);
161
215
  }).finally(() => this.changed());
162
216
  }
163
217
  }
@@ -174,74 +228,76 @@ class V extends I {
174
228
  this.resolution = t;
175
229
  }
176
230
  }
177
- function F(e, t, n) {
231
+ function K(e, t, n) {
178
232
  const i = (
179
233
  /** @type {HTMLImageElement} */
180
234
  e
181
235
  );
182
- let s = !0, o = !1, a = !1;
183
- const h = [
184
- d(i, f.LOAD, function() {
185
- a = !0, o || t();
236
+ let s = !0, o = !1, c = !1;
237
+ const d = [
238
+ h(i, f.LOAD, function() {
239
+ c = !0, o || t();
186
240
  })
187
241
  ];
188
242
  return i.src && u ? (o = !0, i.decode().then(function() {
189
243
  s && t();
190
244
  }).catch(function(E) {
191
- s && (a ? t() : n());
192
- })) : h.push(d(i, f.ERROR, n)), function() {
193
- s = !1, h.forEach(C);
245
+ s && (c ? t() : n());
246
+ })) : d.push(h(i, f.ERROR, n)), function() {
247
+ s = !1, d.forEach(R);
194
248
  };
195
249
  }
196
- function y(e, t) {
250
+ function x(e, t) {
197
251
  return new Promise((n, i) => {
198
252
  function s() {
199
- a(), n(e);
253
+ c(), n(e);
200
254
  }
201
255
  function o() {
202
- a(), i(new Error("Image load error"));
256
+ c(), i(new Error("Image load error"));
203
257
  }
204
- function a() {
258
+ function c() {
205
259
  e.removeEventListener("load", s), e.removeEventListener("error", o);
206
260
  }
207
261
  e.addEventListener("load", s), e.addEventListener("error", o);
208
262
  });
209
263
  }
210
- function x(e, t) {
264
+ function g(e, t) {
211
265
  return t && (e.src = t), e.src && u ? new Promise(
212
266
  (n, i) => e.decode().then(() => n(e)).catch(
213
267
  (s) => e.complete && e.width ? n(e) : i(s)
214
268
  )
215
- ) : y(e);
269
+ ) : x(e);
216
270
  }
217
- function K(e, t) {
271
+ function q(e, t) {
218
272
  return t && (e.src = t), e.src && u && p ? e.decode().then(() => createImageBitmap(e)).catch((n) => {
219
273
  if (e.complete && e.width)
220
274
  return e;
221
275
  throw n;
222
- }) : x(e);
276
+ }) : g(e);
223
277
  }
224
278
  export {
225
- m as D,
226
- V as I,
227
- _ as M,
228
- w as P,
229
- O as T,
230
- D as W,
279
+ w as D,
280
+ F as I,
281
+ D as M,
282
+ O as P,
283
+ _ as T,
284
+ y as W,
231
285
  M as a,
232
286
  T as b,
233
- g as c,
234
- c as d,
235
- K as e,
236
- N as f,
237
- S as g,
238
- x as h,
239
- A as i,
287
+ m as c,
288
+ a as d,
289
+ q as e,
290
+ P as f,
291
+ L as g,
292
+ N as h,
293
+ g as i,
240
294
  G as j,
241
- W as k,
242
- F as l,
243
- P as o,
244
- B as r,
245
- b as s,
246
- k as t
295
+ B as k,
296
+ W as l,
297
+ b as m,
298
+ K as n,
299
+ S as o,
300
+ k as r,
301
+ H as s,
302
+ V as t
247
303
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as S, defineAsyncComponent as b, ref as o, computed as w, onMounted as N, createElementBlock as p, openBlock as r, createBlock as f, createCommentVNode as T, createVNode as u, unref as t, toDisplayString as i, withCtx as d, createElementVNode as h } from "vue";
2
- import { u as P, a as E, g as q, _ as m, F as v } from "./main-CiH8ZmBI.js";
2
+ import { u as P, a as E, g as q, _ as m, F as v } from "./main-CrSRA2X-.js";
3
3
  const B = { class: "fr-text--xs" }, O = { key: 0 }, V = {
4
4
  key: 1,
5
5
  class: "text-gray-medium"