@npm9912/v-map 0.1.1 → 0.2.1
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/README.md +17 -5
- package/dist/cjs/{cesium-provider-BiFFyAl9.js → cesium-provider-CTtu9eTD.js} +6 -5
- package/dist/cjs/{deck-provider-Ctq3Q8a1.js → deck-provider-fNa818HH.js} +9 -9
- package/dist/cjs/events-BMG7RKne.js +11 -0
- package/dist/cjs/{geotiff-source-RaNzzWkC.js → geotiff-source-B9ARUE9z.js} +1 -1
- package/dist/cjs/{index-ISOEpMC3.js → index-9APmzoa2.js} +6 -6
- package/dist/cjs/{index-CbVT-Con.js → index-BJg0ncfC.js} +4 -4
- package/dist/cjs/{index-CJvvX4yx.js → index-C1ubapwF.js} +4 -4
- package/dist/cjs/{index-B8LHqjyg.js → index-ChrKyU6i.js} +4 -4
- package/dist/cjs/{index-JSwBbvGA.js → index-DmGHwivM.js} +1 -0
- package/dist/cjs/{layer-extension-B_olS0rc.js → layer-extension-D3a-1DFI.js} +1 -1
- package/dist/cjs/{leaflet-provider-DOqfs7g5.js → leaflet-provider-7Nw-AdV_.js} +6 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{messages-D7h4m8Tx.js → messages-CFCxeG8p.js} +0 -9
- package/dist/cjs/{openlayers-provider-Dfeg6L4n.js → openlayers-provider-DMxYtFkS.js} +5 -4
- package/dist/cjs/{polygon-layer-B9PrN7vr.js → polygon-layer-Dx1ZWZP0.js} +1 -1
- package/dist/cjs/{scenegraph-layer-DwNoxQdi.js → scenegraph-layer-ctLehP0q.js} +1 -1
- package/dist/cjs/v-map-builder.cjs.entry.js +4 -3
- package/dist/cjs/v-map-error.cjs.entry.js +121 -0
- package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +11 -10
- package/dist/cjs/{v-map-layer-helper-iAzxAg9I.js → v-map-layer-helper-DnWpjZ_Q.js} +7 -6
- package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +5 -4
- package/dist/cjs/v-map-layercontrol.cjs.entry.js +1 -1
- package/dist/cjs/v-map.cjs.js +2 -2
- package/dist/cjs/{v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js → v-map.v-map-layer-osm.v-map-layergroup-BJ3_NqAj.js} +16 -15
- package/dist/cjs/v-map_3.cjs.entry.js +5 -4
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/v-map/v-map.css +3 -0
- package/dist/collection/components/v-map-error/v-map-error.css +136 -0
- package/dist/collection/components/v-map-error/v-map-error.js +277 -0
- package/dist/collection/components/v-map-error/v-map-error.test.js +131 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +1 -1
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +1 -1
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +1 -1
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +1 -1
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +1 -1
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +1 -1
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +1 -1
- package/dist/collection/components/v-map-style/v-map-style.js +1 -1
- package/dist/components/cesium-provider.js +1 -1
- package/dist/components/deck-provider.js +1 -1
- package/dist/components/events.js +1 -1
- package/dist/components/geotiff-source.js +1 -1
- package/dist/components/leaflet-provider.js +1 -1
- package/dist/components/logger.js +1 -0
- package/dist/components/openlayers-provider.js +1 -1
- package/dist/components/v-map-builder.js +2 -2
- package/dist/components/v-map-error.d.ts +11 -0
- package/dist/components/v-map-error.js +1 -0
- package/dist/components/v-map-layer-geojson2.js +1 -1
- package/dist/components/v-map-layer-geotiff2.js +1 -1
- package/dist/components/v-map-layer-google2.js +1 -1
- package/dist/components/v-map-layer-helper.js +1 -1
- package/dist/components/v-map-layer-osm2.js +1 -1
- package/dist/components/v-map-layer-scatterplot2.js +1 -1
- package/dist/components/v-map-layer-terrain-geotiff.js +1 -1
- package/dist/components/v-map-layer-terrain2.js +1 -1
- package/dist/components/v-map-layer-tile3d2.js +1 -1
- package/dist/components/v-map-layer-wcs2.js +1 -1
- package/dist/components/v-map-layer-wfs2.js +1 -1
- package/dist/components/v-map-layer-wkt2.js +1 -1
- package/dist/components/v-map-layer-wms2.js +1 -1
- package/dist/components/v-map-layer-xyz2.js +1 -1
- package/dist/components/v-map-layergroup2.js +1 -1
- package/dist/components/v-map-style2.js +2 -2
- package/dist/components/v-map2.js +1 -1
- package/dist/esm/{cesium-provider-BJfAup3w.js → cesium-provider-Bh__cBGf.js} +6 -5
- package/dist/esm/{deck-provider-C7U9VDEq.js → deck-provider-DxIpS4lY.js} +9 -9
- package/dist/esm/events-CrV_misM.js +9 -0
- package/dist/esm/{geotiff-source-esnDnC-u.js → geotiff-source-BRjO-Dvr.js} +1 -1
- package/dist/esm/{index-BIEmlzCf.js → index-Bh2gBu9u.js} +5 -5
- package/dist/esm/{index-jzneDarq.js → index-BoNyIrdq.js} +1 -1
- package/dist/esm/{index-jN06TXUp.js → index-C3mnOs0I.js} +4 -4
- package/dist/esm/{index-B1zwA4IC.js → index-C63kfbil.js} +6 -6
- package/dist/esm/{index-DbSdn93t.js → index-DxbztwCv.js} +7 -7
- package/dist/esm/{layer-extension-CZXK5goK.js → layer-extension-C5Y2UES3.js} +1 -1
- package/dist/esm/{leaflet-provider-Q41TB6ku.js → leaflet-provider-k6JSYiYX.js} +6 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{messages-CMKJzsgL.js → messages-QJHuuz0g.js} +1 -9
- package/dist/esm/{openlayers-provider-CMsDsQTQ.js → openlayers-provider-DIquf3Tx.js} +5 -4
- package/dist/esm/{polygon-layer-ByhxGhWC.js → polygon-layer-ZIT5mJy5.js} +1 -1
- package/dist/esm/{scenegraph-layer-09K_B6DT.js → scenegraph-layer-CNIRd2uu.js} +1 -1
- package/dist/esm/v-map-builder.entry.js +3 -2
- package/dist/esm/v-map-error.entry.js +119 -0
- package/dist/esm/v-map-layer-geojson_12.entry.js +10 -9
- package/dist/esm/{v-map-layer-helper-Dys44Cgo.js → v-map-layer-helper-CuHYsU9f.js} +2 -1
- package/dist/esm/v-map-layer-terrain-geotiff.entry.js +5 -4
- package/dist/esm/v-map-layercontrol.entry.js +1 -1
- package/dist/esm/v-map.js +3 -3
- package/dist/esm/{v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js → v-map.v-map-layer-osm.v-map-layergroup-Zwdvm9PG.js} +10 -9
- package/dist/esm/v-map_3.entry.js +5 -4
- package/dist/types/components/v-map-error/v-map-error.d.ts +79 -0
- package/dist/types/components/v-map-error/v-map-error.test.d.ts +1 -0
- package/dist/types/components.d.ts +128 -0
- package/dist/v-map/p-05ee633f.entry.js +1 -0
- package/dist/v-map/p-08ad1392.entry.js +1 -0
- package/dist/v-map/p-2-mR3oVa.js +1 -0
- package/dist/v-map/{p-c21c93fe.entry.js → p-3a57b64a.entry.js} +1 -1
- package/dist/v-map/p-58dda864.entry.js +1 -0
- package/dist/v-map/p-915314c0.entry.js +10 -0
- package/dist/v-map/{p-MyTSFnEk.js → p-9Rt23jlQ.js} +1 -1
- package/dist/v-map/p-BSsFEMZP.js +1 -0
- package/dist/v-map/{p-jzneDarq.js → p-BoNyIrdq.js} +2 -2
- package/dist/v-map/p-BpE6L1g0.js +1 -0
- package/dist/v-map/{p-DvHXtWUg.js → p-C0M0-Kvt.js} +1 -1
- package/dist/v-map/p-CbiLpFhO.js +1 -0
- package/dist/v-map/p-Ci70E1EM.js +1 -0
- package/dist/v-map/p-CrV_misM.js +1 -0
- package/dist/v-map/{p-DrOQ9V4h.js → p-DAf4itFZ.js} +1 -1
- package/dist/v-map/p-DVBtCUtQ.js +1 -0
- package/dist/v-map/{p-CZqY0yW4.js → p-DuJ_mTaq.js} +1 -1
- package/dist/v-map/p-G6iftXUC.js +1 -0
- package/dist/v-map/{p-CMKJzsgL.js → p-QJHuuz0g.js} +1 -1
- package/dist/v-map/{p-aa410e64.entry.js → p-e21ea0ce.entry.js} +2 -2
- package/dist/v-map/{p-DmICdG34.js → p-rCyRSFJb.js} +2 -2
- package/dist/v-map/{p-CafTHT9i.js → p-vhbi5XXi.js} +1 -1
- package/dist/v-map/{p-Dckgonw8.js → p-yXLNXXx-.js} +1 -1
- package/dist/v-map/v-map.esm.js +1 -1
- package/package.json +1 -1
- package/dist/v-map/p--vVleK-M.js +0 -1
- package/dist/v-map/p-09d10db0.entry.js +0 -1
- package/dist/v-map/p-5eba6058.entry.js +0 -10
- package/dist/v-map/p-6b102336.entry.js +0 -1
- package/dist/v-map/p-BdijL4Av.js +0 -1
- package/dist/v-map/p-BeFu0ap4.js +0 -1
- package/dist/v-map/p-BxFJezdK.js +0 -1
- package/dist/v-map/p-DCTHyf58.js +0 -1
- package/dist/v-map/p-WaMDUuAz.js +0 -1
- package/dist/v-map/p-uiIP-taz.js +0 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
|
+
import { VMapEvents } from "../../utils/events";
|
|
3
|
+
const MSG_COMPONENT = 'v-map-error';
|
|
4
|
+
/**
|
|
5
|
+
* `<v-map-error>` lauscht auf das `vmap-error` Event seiner Eltern-`<v-map>`
|
|
6
|
+
* (oder einer per `for`-Attribut adressierten Karte) und rendert die Fehler
|
|
7
|
+
* als kleine, opinionated gestylte Toast-Stapel innerhalb des Karten-Containers.
|
|
8
|
+
*
|
|
9
|
+
* Damit können einfache HTML-Beispiele Fehler sichtbar machen, ohne eine
|
|
10
|
+
* Zeile JavaScript zu schreiben.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <v-map flavour="ol">
|
|
15
|
+
* <v-map-error position="top-right" auto-dismiss="5000"></v-map-error>
|
|
16
|
+
* <v-map-layergroup group-title="Basiskarten" basemapid="OSM-BASE">
|
|
17
|
+
* <v-map-layer-osm id="OSM-BASE" label="OSM"></v-map-layer-osm>
|
|
18
|
+
* </v-map-layergroup>
|
|
19
|
+
* </v-map>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @part container - Wrapper um den gesamten Toast-Stapel
|
|
23
|
+
* @part toast - Einzelner Fehler-Toast (anpassbar via `::part(toast)`)
|
|
24
|
+
* @part badge - Typ-Badge innerhalb des Toasts (z. B. "network", "validation")
|
|
25
|
+
* @part message - Fehler-Nachricht innerhalb des Toasts
|
|
26
|
+
* @part close - Schliessen-Button innerhalb des Toasts
|
|
27
|
+
*/
|
|
28
|
+
export class VMapError {
|
|
29
|
+
host;
|
|
30
|
+
/**
|
|
31
|
+
* ID der `<v-map>`-Karte, deren Fehler angezeigt werden sollen.
|
|
32
|
+
* Wenn nicht angegeben, hängt sich die Komponente an das nächste
|
|
33
|
+
* `<v-map>`-Vorfahrenelement im DOM-Baum.
|
|
34
|
+
*/
|
|
35
|
+
for;
|
|
36
|
+
/**
|
|
37
|
+
* Position des Toast-Stapels innerhalb des `<v-map>`-Containers.
|
|
38
|
+
* @default 'top-right'
|
|
39
|
+
*/
|
|
40
|
+
position = 'top-right';
|
|
41
|
+
/**
|
|
42
|
+
* Auto-Dismiss-Zeit in Millisekunden. `0` deaktiviert das automatische
|
|
43
|
+
* Ausblenden — Toasts bleiben dann sichtbar, bis sie manuell geschlossen
|
|
44
|
+
* oder durch einen neueren Fehler aus dem Stapel gedrängt werden.
|
|
45
|
+
* @default 5000
|
|
46
|
+
*/
|
|
47
|
+
autoDismiss = 5000;
|
|
48
|
+
/**
|
|
49
|
+
* Maximale Anzahl gleichzeitig sichtbarer Toasts. Ältere werden bei
|
|
50
|
+
* Überschreitung am oberen Ende des Stapels entfernt.
|
|
51
|
+
* @default 3
|
|
52
|
+
*/
|
|
53
|
+
max = 3;
|
|
54
|
+
/**
|
|
55
|
+
* Zusätzliches Logging in die Browser-Console.
|
|
56
|
+
* - `'none'` (Default): nur Toast-Anzeige, kein Console-Output
|
|
57
|
+
* - `'console'`: jeder Fehler wird zusätzlich mit `console.error` geloggt
|
|
58
|
+
* @default 'none'
|
|
59
|
+
*/
|
|
60
|
+
log = 'none';
|
|
61
|
+
toasts = [];
|
|
62
|
+
mapElement = null;
|
|
63
|
+
boundHandler = (e) => this.onError(e);
|
|
64
|
+
retryTimer;
|
|
65
|
+
nextId = 0;
|
|
66
|
+
// ---- Lifecycle ----------------------------------------------------------
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
this.attach();
|
|
69
|
+
}
|
|
70
|
+
disconnectedCallback() {
|
|
71
|
+
this.detach();
|
|
72
|
+
for (const t of this.toasts) {
|
|
73
|
+
if (t.timeoutId !== undefined)
|
|
74
|
+
clearTimeout(t.timeoutId);
|
|
75
|
+
}
|
|
76
|
+
this.toasts = [];
|
|
77
|
+
if (this.retryTimer !== undefined) {
|
|
78
|
+
clearTimeout(this.retryTimer);
|
|
79
|
+
this.retryTimer = undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// ---- DOM-Discovery ------------------------------------------------------
|
|
83
|
+
attach(retry = 0) {
|
|
84
|
+
const target = this.for
|
|
85
|
+
? document.getElementById(this.for)
|
|
86
|
+
: this.host.closest('v-map');
|
|
87
|
+
if (target instanceof HTMLElement) {
|
|
88
|
+
this.mapElement = target;
|
|
89
|
+
this.mapElement.addEventListener(VMapEvents.Error, this.boundHandler);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Karte noch nicht im DOM - kurz warten und erneut versuchen
|
|
93
|
+
if (retry < 50) {
|
|
94
|
+
this.retryTimer = window.setTimeout(() => this.attach(retry + 1), 100);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
detach() {
|
|
98
|
+
if (this.mapElement) {
|
|
99
|
+
this.mapElement.removeEventListener(VMapEvents.Error, this.boundHandler);
|
|
100
|
+
this.mapElement = null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// ---- Error Handling -----------------------------------------------------
|
|
104
|
+
onError(e) {
|
|
105
|
+
const detail = e.detail;
|
|
106
|
+
if (!detail)
|
|
107
|
+
return;
|
|
108
|
+
if (this.log === 'console') {
|
|
109
|
+
console.error(`[${MSG_COMPONENT}]`, detail.type, detail.message, detail);
|
|
110
|
+
}
|
|
111
|
+
const id = this.nextId++;
|
|
112
|
+
const toast = { id, detail };
|
|
113
|
+
if (this.autoDismiss > 0) {
|
|
114
|
+
toast.timeoutId = window.setTimeout(() => this.dismiss(id), this.autoDismiss);
|
|
115
|
+
}
|
|
116
|
+
const next = [...this.toasts, toast];
|
|
117
|
+
while (next.length > this.max) {
|
|
118
|
+
const removed = next.shift();
|
|
119
|
+
if (removed?.timeoutId !== undefined)
|
|
120
|
+
clearTimeout(removed.timeoutId);
|
|
121
|
+
}
|
|
122
|
+
this.toasts = next;
|
|
123
|
+
}
|
|
124
|
+
dismiss(id) {
|
|
125
|
+
const target = this.toasts.find(t => t.id === id);
|
|
126
|
+
if (target?.timeoutId !== undefined)
|
|
127
|
+
clearTimeout(target.timeoutId);
|
|
128
|
+
this.toasts = this.toasts.filter(t => t.id !== id);
|
|
129
|
+
}
|
|
130
|
+
// ---- Render -------------------------------------------------------------
|
|
131
|
+
render() {
|
|
132
|
+
return (h(Host, { key: 'edec9031306084f0b55ac6ef5b21e69995ca912c' }, h("div", { key: '665451bfd7a0957b947715654707705904e11d6b', class: "stack", part: "container" }, this.toasts.map(t => (h("div", { key: t.id, class: "toast", part: "toast", role: "alert", "aria-live": "assertive" }, h("span", { class: "badge", part: "badge" }, t.detail.type), h("span", { class: "message", part: "message" }, t.detail.message), h("button", { type: "button", class: "close", part: "close", "aria-label": "Schliessen", onClick: () => this.dismiss(t.id) }, '\u00d7')))))));
|
|
133
|
+
}
|
|
134
|
+
static get is() { return "v-map-error"; }
|
|
135
|
+
static get encapsulation() { return "shadow"; }
|
|
136
|
+
static get originalStyleUrls() {
|
|
137
|
+
return {
|
|
138
|
+
"$": ["v-map-error.css"]
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
static get styleUrls() {
|
|
142
|
+
return {
|
|
143
|
+
"$": ["v-map-error.css"]
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
static get properties() {
|
|
147
|
+
return {
|
|
148
|
+
"for": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"mutable": false,
|
|
151
|
+
"complexType": {
|
|
152
|
+
"original": "string",
|
|
153
|
+
"resolved": "string",
|
|
154
|
+
"references": {}
|
|
155
|
+
},
|
|
156
|
+
"required": false,
|
|
157
|
+
"optional": true,
|
|
158
|
+
"docs": {
|
|
159
|
+
"tags": [],
|
|
160
|
+
"text": "ID der `<v-map>`-Karte, deren Fehler angezeigt werden sollen.\nWenn nicht angegeben, h\u00E4ngt sich die Komponente an das n\u00E4chste\n`<v-map>`-Vorfahrenelement im DOM-Baum."
|
|
161
|
+
},
|
|
162
|
+
"getter": false,
|
|
163
|
+
"setter": false,
|
|
164
|
+
"reflect": false,
|
|
165
|
+
"attribute": "for"
|
|
166
|
+
},
|
|
167
|
+
"position": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "ToastPosition",
|
|
172
|
+
"resolved": "\"bottom\" | \"bottom-left\" | \"bottom-right\" | \"top\" | \"top-left\" | \"top-right\"",
|
|
173
|
+
"references": {
|
|
174
|
+
"ToastPosition": {
|
|
175
|
+
"location": "global",
|
|
176
|
+
"id": "global::ToastPosition"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [{
|
|
184
|
+
"name": "default",
|
|
185
|
+
"text": "'top-right'"
|
|
186
|
+
}],
|
|
187
|
+
"text": "Position des Toast-Stapels innerhalb des `<v-map>`-Containers."
|
|
188
|
+
},
|
|
189
|
+
"getter": false,
|
|
190
|
+
"setter": false,
|
|
191
|
+
"reflect": true,
|
|
192
|
+
"attribute": "position",
|
|
193
|
+
"defaultValue": "'top-right'"
|
|
194
|
+
},
|
|
195
|
+
"autoDismiss": {
|
|
196
|
+
"type": "number",
|
|
197
|
+
"mutable": false,
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "number",
|
|
200
|
+
"resolved": "number",
|
|
201
|
+
"references": {}
|
|
202
|
+
},
|
|
203
|
+
"required": false,
|
|
204
|
+
"optional": false,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [{
|
|
207
|
+
"name": "default",
|
|
208
|
+
"text": "5000"
|
|
209
|
+
}],
|
|
210
|
+
"text": "Auto-Dismiss-Zeit in Millisekunden. `0` deaktiviert das automatische\nAusblenden \u2014 Toasts bleiben dann sichtbar, bis sie manuell geschlossen\noder durch einen neueren Fehler aus dem Stapel gedr\u00E4ngt werden."
|
|
211
|
+
},
|
|
212
|
+
"getter": false,
|
|
213
|
+
"setter": false,
|
|
214
|
+
"reflect": false,
|
|
215
|
+
"attribute": "auto-dismiss",
|
|
216
|
+
"defaultValue": "5000"
|
|
217
|
+
},
|
|
218
|
+
"max": {
|
|
219
|
+
"type": "number",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "number",
|
|
223
|
+
"resolved": "number",
|
|
224
|
+
"references": {}
|
|
225
|
+
},
|
|
226
|
+
"required": false,
|
|
227
|
+
"optional": false,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [{
|
|
230
|
+
"name": "default",
|
|
231
|
+
"text": "3"
|
|
232
|
+
}],
|
|
233
|
+
"text": "Maximale Anzahl gleichzeitig sichtbarer Toasts. \u00C4ltere werden bei\n\u00DCberschreitung am oberen Ende des Stapels entfernt."
|
|
234
|
+
},
|
|
235
|
+
"getter": false,
|
|
236
|
+
"setter": false,
|
|
237
|
+
"reflect": false,
|
|
238
|
+
"attribute": "max",
|
|
239
|
+
"defaultValue": "3"
|
|
240
|
+
},
|
|
241
|
+
"log": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"mutable": false,
|
|
244
|
+
"complexType": {
|
|
245
|
+
"original": "LogMode",
|
|
246
|
+
"resolved": "\"console\" | \"none\"",
|
|
247
|
+
"references": {
|
|
248
|
+
"LogMode": {
|
|
249
|
+
"location": "global",
|
|
250
|
+
"id": "global::LogMode"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"required": false,
|
|
255
|
+
"optional": false,
|
|
256
|
+
"docs": {
|
|
257
|
+
"tags": [{
|
|
258
|
+
"name": "default",
|
|
259
|
+
"text": "'none'"
|
|
260
|
+
}],
|
|
261
|
+
"text": "Zus\u00E4tzliches Logging in die Browser-Console.\n- `'none'` (Default): nur Toast-Anzeige, kein Console-Output\n- `'console'`: jeder Fehler wird zus\u00E4tzlich mit `console.error` geloggt"
|
|
262
|
+
},
|
|
263
|
+
"getter": false,
|
|
264
|
+
"setter": false,
|
|
265
|
+
"reflect": false,
|
|
266
|
+
"attribute": "log",
|
|
267
|
+
"defaultValue": "'none'"
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
static get states() {
|
|
272
|
+
return {
|
|
273
|
+
"toasts": {}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
static get elementRef() { return "host"; }
|
|
277
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { afterEach, beforeAll, describe, expect, it } from "vitest";
|
|
2
|
+
import { createLiveMap, createTaggedElement, loadVMapBundle, waitFor, waitForHydration, } from "../../testing/browser-test-utils";
|
|
3
|
+
import { VMapEvents } from "../../utils/events";
|
|
4
|
+
function dispatchError(target, detail) {
|
|
5
|
+
target.dispatchEvent(new CustomEvent(VMapEvents.Error, {
|
|
6
|
+
detail,
|
|
7
|
+
bubbles: true,
|
|
8
|
+
composed: true,
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
async function mountMapWithErrorComponent(attributes = {}) {
|
|
12
|
+
const map = createLiveMap();
|
|
13
|
+
const errorEl = createTaggedElement('v-map-error');
|
|
14
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
15
|
+
errorEl.setAttribute(name, value);
|
|
16
|
+
}
|
|
17
|
+
map.appendChild(errorEl);
|
|
18
|
+
document.body.appendChild(map);
|
|
19
|
+
await waitForHydration(map);
|
|
20
|
+
await waitForHydration(errorEl);
|
|
21
|
+
return { map, errorEl };
|
|
22
|
+
}
|
|
23
|
+
describe('v-map-error browser', () => {
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
await loadVMapBundle();
|
|
26
|
+
await customElements.whenDefined('v-map');
|
|
27
|
+
await customElements.whenDefined('v-map-error');
|
|
28
|
+
});
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
document.body.innerHTML = '';
|
|
31
|
+
});
|
|
32
|
+
it('hydrates and renders an empty stack initially', async () => {
|
|
33
|
+
const { errorEl } = await mountMapWithErrorComponent({
|
|
34
|
+
position: 'top-right',
|
|
35
|
+
'auto-dismiss': '0',
|
|
36
|
+
});
|
|
37
|
+
const stack = errorEl.shadowRoot?.querySelector('.stack');
|
|
38
|
+
expect(stack).toBeTruthy();
|
|
39
|
+
expect(stack?.querySelectorAll('.toast').length).toBe(0);
|
|
40
|
+
});
|
|
41
|
+
it('renders a toast when its parent v-map dispatches vmap-error', async () => {
|
|
42
|
+
const { map, errorEl } = await mountMapWithErrorComponent({
|
|
43
|
+
'auto-dismiss': '0',
|
|
44
|
+
});
|
|
45
|
+
dispatchError(map, {
|
|
46
|
+
type: 'network',
|
|
47
|
+
message: 'WMS request failed',
|
|
48
|
+
});
|
|
49
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 1);
|
|
50
|
+
const toast = errorEl.shadowRoot.querySelector('.toast');
|
|
51
|
+
expect(toast.textContent).toContain('WMS request failed');
|
|
52
|
+
expect(toast.textContent).toContain('network');
|
|
53
|
+
expect(toast.getAttribute('role')).toBe('alert');
|
|
54
|
+
});
|
|
55
|
+
it('positions the stack via the position attribute', async () => {
|
|
56
|
+
const { map, errorEl } = await mountMapWithErrorComponent({
|
|
57
|
+
position: 'bottom-left',
|
|
58
|
+
'auto-dismiss': '0',
|
|
59
|
+
});
|
|
60
|
+
dispatchError(map, { type: 'parse', message: 'positioned' });
|
|
61
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 1);
|
|
62
|
+
const stack = errorEl.shadowRoot.querySelector('.stack');
|
|
63
|
+
const stackRect = stack.getBoundingClientRect();
|
|
64
|
+
const mapRect = map.getBoundingClientRect();
|
|
65
|
+
// bottom-left: stack should sit near map's bottom-left corner
|
|
66
|
+
expect(Math.abs(stackRect.left - mapRect.left)).toBeLessThan(40);
|
|
67
|
+
expect(Math.abs(stackRect.bottom - mapRect.bottom)).toBeLessThan(40);
|
|
68
|
+
});
|
|
69
|
+
it('overlays the map container with a high z-index host', async () => {
|
|
70
|
+
const { errorEl } = await mountMapWithErrorComponent({
|
|
71
|
+
'auto-dismiss': '0',
|
|
72
|
+
});
|
|
73
|
+
const computed = window.getComputedStyle(errorEl);
|
|
74
|
+
expect(computed.position).toBe('absolute');
|
|
75
|
+
expect(parseInt(computed.zIndex, 10)).toBeGreaterThanOrEqual(1000);
|
|
76
|
+
expect(computed.pointerEvents).toBe('none');
|
|
77
|
+
});
|
|
78
|
+
it('caps the toast stack at the configured max', async () => {
|
|
79
|
+
const { map, errorEl } = await mountMapWithErrorComponent({
|
|
80
|
+
'auto-dismiss': '0',
|
|
81
|
+
max: '2',
|
|
82
|
+
});
|
|
83
|
+
dispatchError(map, { type: 'network', message: 'first' });
|
|
84
|
+
dispatchError(map, { type: 'network', message: 'second' });
|
|
85
|
+
dispatchError(map, { type: 'network', message: 'third' });
|
|
86
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 2);
|
|
87
|
+
const messages = Array.from(errorEl.shadowRoot.querySelectorAll('.message')).map(node => node.textContent?.trim());
|
|
88
|
+
expect(messages).toEqual(['second', 'third']);
|
|
89
|
+
});
|
|
90
|
+
it('removes a toast when the close button is clicked', async () => {
|
|
91
|
+
const { map, errorEl } = await mountMapWithErrorComponent({
|
|
92
|
+
'auto-dismiss': '0',
|
|
93
|
+
});
|
|
94
|
+
dispatchError(map, { type: 'parse', message: 'click me away' });
|
|
95
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 1);
|
|
96
|
+
const closeBtn = errorEl.shadowRoot.querySelector('.close');
|
|
97
|
+
closeBtn.click();
|
|
98
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 0);
|
|
99
|
+
});
|
|
100
|
+
it('auto-dismisses a toast after the configured timeout', async () => {
|
|
101
|
+
const { map, errorEl } = await mountMapWithErrorComponent({
|
|
102
|
+
'auto-dismiss': '200',
|
|
103
|
+
});
|
|
104
|
+
dispatchError(map, { type: 'network', message: 'fades' });
|
|
105
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 1);
|
|
106
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 0, 2_000);
|
|
107
|
+
});
|
|
108
|
+
it('targets a v-map by id via the for attribute', async () => {
|
|
109
|
+
const left = createLiveMap();
|
|
110
|
+
left.id = 'left';
|
|
111
|
+
const right = createLiveMap();
|
|
112
|
+
right.id = 'right';
|
|
113
|
+
const errorEl = createTaggedElement('v-map-error');
|
|
114
|
+
errorEl.setAttribute('for', 'right');
|
|
115
|
+
errorEl.setAttribute('auto-dismiss', '0');
|
|
116
|
+
document.body.appendChild(left);
|
|
117
|
+
document.body.appendChild(right);
|
|
118
|
+
document.body.appendChild(errorEl);
|
|
119
|
+
await waitForHydration(left);
|
|
120
|
+
await waitForHydration(right);
|
|
121
|
+
await waitForHydration(errorEl);
|
|
122
|
+
// dispatch on the wrong map - must NOT show
|
|
123
|
+
dispatchError(left, { type: 'network', message: 'wrong' });
|
|
124
|
+
await new Promise(resolve => requestAnimationFrame(() => resolve(undefined)));
|
|
125
|
+
expect(errorEl.shadowRoot?.querySelectorAll('.toast').length).toBe(0);
|
|
126
|
+
// dispatch on the right map - must show
|
|
127
|
+
dispatchError(right, { type: 'network', message: 'right' });
|
|
128
|
+
await waitFor(() => (errorEl.shadowRoot?.querySelectorAll('.toast').length ?? 0) === 1);
|
|
129
|
+
expect(errorEl.shadowRoot?.querySelector('.message')?.textContent).toBe('right');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -363,7 +363,7 @@ export class VMapLayerGeoJSON {
|
|
|
363
363
|
return config;
|
|
364
364
|
}
|
|
365
365
|
render() {
|
|
366
|
-
return h("slot", { key: '
|
|
366
|
+
return h("slot", { key: '92aa382d5258a981896ef7316cc269b095304d13', name: "geojson", onSlotchange: this.onSlotChange });
|
|
367
367
|
}
|
|
368
368
|
static get is() { return "v-map-layer-geojson"; }
|
|
369
369
|
static get encapsulation() { return "shadow"; }
|
|
@@ -209,7 +209,7 @@ export class VMapLayerTerrain {
|
|
|
209
209
|
return config;
|
|
210
210
|
}
|
|
211
211
|
render() {
|
|
212
|
-
return h("slot", { key: '
|
|
212
|
+
return h("slot", { key: 'fa57254fc8c1a200ca5e2788bcc9f2beaa388a49' });
|
|
213
213
|
}
|
|
214
214
|
static get is() { return "v-map-layer-terrain"; }
|
|
215
215
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js
CHANGED
|
@@ -187,7 +187,7 @@ export class VMapLayerTerrainGeotiff {
|
|
|
187
187
|
log(MSG_COMPONENT + MSG.COMPONENT_WILL_RENDER);
|
|
188
188
|
}
|
|
189
189
|
render() {
|
|
190
|
-
return h("slot", { key: '
|
|
190
|
+
return h("slot", { key: '9d6029408f7126a557ae123b418b7aed610b798c' });
|
|
191
191
|
}
|
|
192
192
|
static get is() { return "v-map-layer-terrain-geotiff"; }
|
|
193
193
|
static get encapsulation() { return "shadow"; }
|
|
@@ -201,7 +201,7 @@ export class VMapLayerTile3d {
|
|
|
201
201
|
return config;
|
|
202
202
|
}
|
|
203
203
|
render() {
|
|
204
|
-
return h("slot", { key: '
|
|
204
|
+
return h("slot", { key: '808774d80fbe0948330b8e7f94c08d331bc49a99' });
|
|
205
205
|
}
|
|
206
206
|
static get is() { return "v-map-layer-tile3d"; }
|
|
207
207
|
static get encapsulation() { return "shadow"; }
|
|
@@ -129,7 +129,7 @@ export class VMapLayerWcs {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
render() {
|
|
132
|
-
return h("slot", { key: '
|
|
132
|
+
return h("slot", { key: '02f2834e39c6e4d041f401d982a97af14d1c3e4d' });
|
|
133
133
|
}
|
|
134
134
|
static get is() { return "v-map-layer-wcs"; }
|
|
135
135
|
static get encapsulation() { return "shadow"; }
|
|
@@ -182,7 +182,7 @@ export class VMapLayerWfs {
|
|
|
182
182
|
return config;
|
|
183
183
|
}
|
|
184
184
|
render() {
|
|
185
|
-
return h("slot", { key: '
|
|
185
|
+
return h("slot", { key: 'fb3fcca9a332f5b0bacce83b61152869b9afd820' });
|
|
186
186
|
}
|
|
187
187
|
static get is() { return "v-map-layer-wfs"; }
|
|
188
188
|
static get encapsulation() { return "shadow"; }
|
|
@@ -94,7 +94,7 @@ export class VMapLayerGroup {
|
|
|
94
94
|
return this.groupId;
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
97
|
-
return h("slot", { key: '
|
|
97
|
+
return h("slot", { key: 'cffd8e9ece1377275f6d23503004eeffafa4cfcd' });
|
|
98
98
|
}
|
|
99
99
|
static get is() { return "v-map-layergroup"; }
|
|
100
100
|
static get encapsulation() { return "shadow"; }
|
|
@@ -248,7 +248,7 @@ export class VMapStyle {
|
|
|
248
248
|
return this.error;
|
|
249
249
|
}
|
|
250
250
|
render() {
|
|
251
|
-
return (h("div", { key: '
|
|
251
|
+
return (h("div", { key: '8e1c5cdf6914778d39e8dd74a35d92cd65f7f32c', class: "style-container" }, this.isLoading && h("div", { key: '3c82160e21fa5f8a4ece8399b0e5cc42204104f2', class: "loading" }, "Loading style..."), this.error && (h("div", { key: '2017dd34fb9c95595c72611204ad8b7fcb411098', class: "error" }, "Style Error: ", this.error.message)), this.parsedStyle && (h("div", { key: 'a1d2893f784deca67748dd1a757dd0b2aae39974', class: "success" }, "Style loaded (", this.format.toUpperCase(), ")", this.getLayerTargets().length > 0 && (h("div", { key: '4e798d938ed53bbac980b9e98b05960c907b0447', class: "targets" }, "Targets: ", this.getLayerTargets().join(', '))))), h("slot", { key: 'e32cf2619d0347bcf0ded90cc13ddd5a168cc483' })));
|
|
252
252
|
}
|
|
253
253
|
static get is() { return "v-map-style"; }
|
|
254
254
|
static get encapsulation() { return "shadow"; }
|