@geolonia/embed 4.2.1 → 4.2.2

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.
@@ -31,6 +31,8 @@ declare class CustomAttributionControl implements IControl {
31
31
  private _attribHTML;
32
32
  private styleId;
33
33
  private styleOwner;
34
+ private printQuery;
35
+ private onMediaPrintChange;
34
36
  constructor(options?: {});
35
37
  getDefaultPosition(): ControlPosition;
36
38
  onAdd(map: any): any;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "4.2.1";
1
+ export declare const VERSION = "4.2.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/embed",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Geolonia embed JS API",
5
5
  "main": "dist/embed.js",
6
6
  "types": "dist/embed.d.ts",
@@ -53,8 +53,8 @@
53
53
  "@mapbox/geojson-extent": "^1.0.0",
54
54
  "@mapbox/point-geometry": "^0.1.0",
55
55
  "@turf/center": "^6.0.1",
56
- "maplibre-gl": "3.0.1",
57
- "pmtiles": "^2.7.2",
56
+ "maplibre-gl": "3.4.1",
57
+ "pmtiles": "2.11.0",
58
58
  "sanitize-html": "^2.8.0",
59
59
  "tinycolor2": "^1.4.1"
60
60
  }
@@ -35,6 +35,8 @@ class CustomAttributionControl implements IControl {
35
35
  private _attribHTML;
36
36
  private styleId;
37
37
  private styleOwner;
38
+ private printQuery;
39
+ private onMediaPrintChange;
38
40
 
39
41
  constructor(options = {}) {
40
42
  this.options = options;
@@ -190,6 +192,12 @@ class CustomAttributionControl implements IControl {
190
192
  }
191
193
  }
192
194
 
195
+ @media print {
196
+ .maplibregl-ctrl-attrib-button {
197
+ display: none!important;
198
+ }
199
+ }
200
+
193
201
  .maplibregl-ctrl-attrib a {
194
202
  color: rgba(0,0,0,.75);
195
203
  text-decoration: none;
@@ -218,6 +226,16 @@ class CustomAttributionControl implements IControl {
218
226
  shadow.appendChild(style);
219
227
  shadow.appendChild(this._shadowContainer);
220
228
 
229
+ this.printQuery = window.matchMedia('print');
230
+ this.onMediaPrintChange = (e) => {
231
+ if (e.matches) {
232
+ // force open
233
+ this._shadowContainer.setAttribute('open', '');
234
+ this._shadowContainer.classList.remove('maplibregl-compact-show');
235
+ }
236
+ };
237
+ this.printQuery.addEventListener('change', this.onMediaPrintChange);
238
+
221
239
  return this._container;
222
240
  }
223
241
 
@@ -233,6 +251,8 @@ class CustomAttributionControl implements IControl {
233
251
  this._map = undefined;
234
252
  this._compact = undefined;
235
253
  this._attribHTML = undefined;
254
+
255
+ this.printQuery.removeEventListener('change', this.onMediaPrintChange);
236
256
  }
237
257
 
238
258
  _setElementTitle(element, title) {
package/src/style.css CHANGED
@@ -129,3 +129,9 @@
129
129
  display: block!important;
130
130
  }
131
131
  /* End: CSS for Attribution */
132
+
133
+ @media print {
134
+ .maplibregl-control-container button {
135
+ display: none;
136
+ }
137
+ }