@vaadin/map 23.0.0-beta1 → 23.0.0-beta5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/map",
3
- "version": "23.0.0-beta1",
3
+ "version": "23.0.0-beta5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,14 +35,15 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "23.0.0-beta1",
38
+ "@vaadin/component-base": "23.0.0-beta5",
39
39
  "@vaadin/vaadin-license-checker": "^2.1.0",
40
- "ol": "6.11.0"
40
+ "@vaadin/vaadin-themable-mixin": "23.0.0-beta5",
41
+ "ol": "6.12.1-dev.1645111187932"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@esm-bundle/chai": "^4.3.4",
44
45
  "@vaadin/testing-helpers": "^0.3.2",
45
46
  "sinon": "^9.2.4"
46
47
  },
47
- "gitHead": "467244b76021176c109df675799b07029b293e58"
48
+ "gitHead": "4c388aeec6623869c70896c909799804fc95d0f9"
48
49
  }
@@ -4,7 +4,7 @@
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import OpenLayersMap from 'ol/Map.js';
7
- import { ElementMixin } from '@vaadin/component-base';
7
+ import { ElementMixin, FocusMixin, ResizeMixin } from '@vaadin/component-base';
8
8
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
9
9
 
10
10
  /**
@@ -44,15 +44,17 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
44
44
  * @extends HTMLElement
45
45
  * @mixes ThemableMixin
46
46
  * @mixes ElementMixin
47
+ * @mixes FocusMixin
48
+ * @mixes ResizeMixin
47
49
  */
48
- declare class Map extends ThemableMixin(ElementMixin(HTMLElement)) {
50
+ declare class Map extends ResizeMixin(FocusMixin(ThemableMixin(ElementMixin(HTMLElement)))) {
49
51
  /**
50
52
  * The internal OpenLayers map instance used to configure the map.
51
53
  * See the OpenLayers [API](https://openlayers.org/en/latest/apidoc/) and
52
54
  * [examples](https://openlayers.org/en/latest/examples/) for further information.
53
55
  * @returns {*}
54
56
  */
55
- get configuration(): OpenLayersMap | undefined;
57
+ get configuration(): OpenLayersMap;
56
58
  }
57
59
 
58
60
  declare global {
package/src/vaadin-map.js CHANGED
@@ -3,9 +3,14 @@
3
3
  * Copyright (c) 2022 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
+ import '@vaadin/vaadin-license-checker/vaadin-license-checker.js';
6
7
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
+ import { defaults as defaultControls } from 'ol/control';
9
+ import { defaults as defaultInteractions } from 'ol/interaction';
7
10
  import OpenLayersMap from 'ol/Map.js';
8
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
+ import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
13
+ import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
9
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
15
 
11
16
  function isEnabled() {
@@ -49,27 +54,321 @@ function isEnabled() {
49
54
  * @extends HTMLElement
50
55
  * @mixes ThemableMixin
51
56
  * @mixes ElementMixin
57
+ * @mixes FocusMixin
58
+ * @mixes ResizeMixin
52
59
  */
53
- class Map extends ElementMixin(ThemableMixin(PolymerElement)) {
60
+ class Map extends ResizeMixin(FocusMixin(ElementMixin(ThemableMixin(PolymerElement)))) {
54
61
  static get template() {
55
62
  return html`
56
63
  <style>
57
64
  :host {
58
65
  display: block;
59
- width: 100%;
66
+ height: 400px;
67
+ flex: 1 1 auto;
68
+ align-self: stretch;
60
69
  overflow: hidden;
61
70
  }
62
71
 
72
+ :host([hidden]) {
73
+ display: none !important;
74
+ }
75
+
63
76
  #map {
64
77
  width: 100%;
65
78
  height: 100%;
79
+ outline: none;
66
80
  }
67
81
 
68
- :host([hidden]) {
69
- display: none !important;
82
+ #map,
83
+ .ol-viewport,
84
+ .ol-layers {
85
+ border-radius: inherit;
86
+ overflow: hidden;
87
+ }
88
+
89
+ #map:fullscreen {
90
+ border-radius: 0;
91
+ }
92
+
93
+ #map:-webkit-full-screen {
94
+ border-radius: 0;
95
+ }
96
+
97
+ /* Functional styles, copied from 'ol/ol.css' */
98
+
99
+ .ol-box {
100
+ box-sizing: border-box;
101
+ border-radius: 2px;
102
+ border: 1px solid rgba(0, 0, 0, 0.5);
103
+ background-color: rgba(255, 255, 255, 0.2);
104
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
105
+ }
106
+
107
+ .ol-unsupported {
108
+ display: none;
109
+ }
110
+
111
+ .ol-viewport,
112
+ .ol-unselectable {
113
+ -webkit-touch-callout: none;
114
+ -webkit-user-select: none;
115
+ -moz-user-select: none;
116
+ -ms-user-select: none;
117
+ user-select: none;
118
+ -webkit-tap-highlight-color: transparent;
119
+ }
120
+
121
+ .ol-viewport canvas {
122
+ all: unset;
123
+ }
124
+
125
+ .ol-selectable {
126
+ -webkit-touch-callout: default;
127
+ -webkit-user-select: text;
128
+ -moz-user-select: text;
129
+ -ms-user-select: text;
130
+ user-select: text;
131
+ }
132
+
133
+ .ol-grabbing {
134
+ cursor: -webkit-grabbing;
135
+ cursor: -moz-grabbing;
136
+ cursor: grabbing;
137
+ }
138
+
139
+ .ol-grab {
140
+ cursor: move;
141
+ cursor: -webkit-grab;
142
+ cursor: -moz-grab;
143
+ cursor: grab;
144
+ }
145
+
146
+ /* Control positioning and styling */
147
+
148
+ .ol-overlaycontainer-stopevent {
149
+ display: grid;
150
+ grid-template-columns: min-content 1fr min-content;
151
+ grid-template-rows: min-content 1fr min-content min-content min-content min-content;
152
+ padding: var(--vaadin-map-controls-inset, 0.25em);
153
+ box-sizing: border-box;
154
+ grid-template-areas:
155
+ 'scale mouse-position fullscreen'
156
+ 'overview-map . zoom-extent'
157
+ 'overview-map . compass'
158
+ 'overview-map . zoom-slider'
159
+ 'overview-map . zoom'
160
+ 'overview-map attribution attribution';
161
+ }
162
+
163
+ .ol-mouse-position {
164
+ grid-area: mouse-position;
165
+ align-self: start;
166
+ text-align: center;
167
+ font-size: 0.625em;
168
+ color: #000;
169
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
170
+ }
171
+
172
+ .ol-scale-line,
173
+ .ol-scale-bar {
174
+ grid-area: scale;
175
+ position: relative;
176
+ pointer-events: none !important;
177
+ color: #000;
178
+ }
179
+
180
+ .ol-scale-line-inner {
181
+ border: 1px solid rgba(0, 0, 0, 0.5);
182
+ border-top: none;
183
+ font-size: 0.625em;
184
+ text-align: center;
185
+ will-change: contents, width, filter;
186
+ transition: all 0.25s;
187
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
188
+ }
189
+
190
+ .ol-scale-bar-inner {
191
+ border: 1px solid rgba(0, 0, 0, 0.5);
192
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
193
+ overflow: hidden;
194
+ }
195
+
196
+ .ol-scale-step-marker {
197
+ display: none;
198
+ }
199
+
200
+ .ol-scale-step-text {
201
+ position: absolute;
202
+ top: 0.75em;
203
+ font-size: 0.625em;
204
+ color: #000;
205
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
206
+ white-space: nowrap;
207
+ overflow: hidden;
208
+ }
209
+
210
+ .ol-scale-text {
211
+ position: absolute;
212
+ font-size: 0.625em;
213
+ top: 2em;
214
+ color: #000;
215
+ white-space: nowrap;
216
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
217
+ }
218
+
219
+ .ol-scale-singlebar {
220
+ height: 0.25em;
221
+ opacity: 0.5;
222
+ }
223
+
224
+ .ol-control {
225
+ margin: 0.25em;
226
+ }
227
+
228
+ .ol-control button {
229
+ -webkit-appearance: none;
230
+ border: 0;
231
+ margin: 0;
232
+ padding: 0;
233
+ background: #fff;
234
+ font: inherit;
235
+ color: inherit;
236
+ width: 1.5em;
237
+ height: 1.5em;
238
+ }
239
+
240
+ .ol-control button::-moz-focus-inner {
241
+ border: none;
242
+ padding: 0;
243
+ }
244
+
245
+ .ol-compass {
246
+ grid-area: compass;
247
+ display: block;
248
+ will-change: transform;
249
+ }
250
+
251
+ .ol-zoom {
252
+ grid-area: zoom;
253
+ display: flex;
254
+ flex-direction: column;
255
+ }
256
+
257
+ .ol-zoom-in:empty::before {
258
+ content: var(--vaadin-map-icon-zoom-in, '+');
259
+ }
260
+
261
+ .ol-zoom-out:empty::before {
262
+ content: var(--vaadin-map-icon-zoom-out, '–');
263
+ }
264
+
265
+ .ol-attribution {
266
+ grid-area: attribution;
267
+ margin-inline-start: auto !important;
268
+ display: flex;
269
+ flex-flow: row-reverse;
270
+ }
271
+
272
+ .ol-attribution.ol-uncollapsible {
273
+ margin-inline-end: calc(var(--vaadin-map-controls-inset, 0.25em) * -1);
274
+ margin-block-end: calc(var(--vaadin-map-controls-inset, 0.25em) * -1);
275
+ }
276
+
277
+ .ol-attribution button span:empty::before {
278
+ content: var(--vaadin-map-icon-attribution-collapse, '▸');
279
+ }
280
+
281
+ .ol-attribution.ol-collapsed button span:empty::before {
282
+ content: var(--vaadin-map-icon-attribution-expand, 'ℹ');
283
+ }
284
+
285
+ .ol-attribution ul {
286
+ display: flex;
287
+ align-items: center;
288
+ gap: 1em;
289
+ list-style: none;
290
+ margin: 0;
291
+ padding: 0.25em 0.5em;
292
+ font-size: 0.8em;
293
+ }
294
+
295
+ .ol-attribution.ol-collapsed ul {
296
+ display: none;
297
+ }
298
+
299
+ .ol-attribution.ol-uncollapsible button {
300
+ display: none;
301
+ }
302
+
303
+ .ol-rotate {
304
+ grid-area: compass;
305
+ }
306
+
307
+ .ol-compass:empty::before {
308
+ content: var(--vaadin-map-icon-compass, '↑');
309
+ }
310
+
311
+ .ol-full-screen {
312
+ grid-area: fullscreen;
313
+ }
314
+
315
+ .ol-full-screen button:empty::before {
316
+ content: var(--vaadin-map-icon-fullscreen, '⤢');
317
+ }
318
+
319
+ .ol-full-screen .ol-full-screen-true:empty::before {
320
+ content: var(--vaadin-map-icon-close, '×');
321
+ }
322
+
323
+ .ol-overviewmap {
324
+ grid-area: overview-map;
325
+ align-self: end;
326
+ width: max-content;
327
+ }
328
+
329
+ .ol-overviewmap button span:empty::before {
330
+ content: var(--vaadin-map-icon-overview-map-collapse, '▾');
331
+ }
332
+
333
+ .ol-overviewmap.ol-collapsed button span:empty::before {
334
+ content: var(--vaadin-map-icon-overview-map-expand, '▴');
335
+ }
336
+
337
+ .ol-overviewmap-map {
338
+ height: 10em;
339
+ width: 10em;
340
+ border: 1px solid rgba(0, 0, 0, 0.5);
341
+ }
342
+
343
+ .ol-overviewmap.ol-collapsed .ol-overviewmap-map,
344
+ .ol-overviewmap.ol-uncollapsible button {
345
+ display: none;
346
+ }
347
+
348
+ .ol-overviewmap-box {
349
+ border: 1px dashed rgba(0, 0, 0, 0.5);
350
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
351
+ will-change: filter;
352
+ cursor: move;
353
+ }
354
+
355
+ .ol-zoomslider {
356
+ grid-area: zoom-slider;
357
+ height: 8em;
358
+ }
359
+
360
+ .ol-zoomslider button {
361
+ position: relative;
362
+ height: 0.5em;
363
+ display: block;
364
+ border-radius: inherit;
365
+ }
366
+
367
+ .ol-zoom-extent {
368
+ grid-area: zoom-extent;
369
+ align-self: end;
70
370
  }
71
371
  </style>
72
- <div id="map"></div>
73
372
  `;
74
373
  }
75
374
 
@@ -77,6 +376,17 @@ class Map extends ElementMixin(ThemableMixin(PolymerElement)) {
77
376
  return 'vaadin-map';
78
377
  }
79
378
 
379
+ /** @protected */
380
+ static _finalizeClass() {
381
+ super._finalizeClass();
382
+
383
+ const devModeCallback = window.Vaadin.developmentModeCallback;
384
+ const licenseChecker = devModeCallback && devModeCallback['vaadin-license-checker'];
385
+ if (typeof licenseChecker === 'function') {
386
+ licenseChecker(Map);
387
+ }
388
+ }
389
+
80
390
  /**
81
391
  * The internal OpenLayers map instance used to configure the map.
82
392
  * See the OpenLayers [API](https://openlayers.org/en/latest/apidoc/) and
@@ -87,18 +397,74 @@ class Map extends ElementMixin(ThemableMixin(PolymerElement)) {
87
397
  return this._configuration;
88
398
  }
89
399
 
400
+ constructor() {
401
+ super();
402
+ // Create map container element and initialize OL map instance
403
+ this._mapTarget = document.createElement('div');
404
+ this._mapTarget.id = 'map';
405
+ // Ensure accessible keyboard controls are enabled
406
+ this._mapTarget.setAttribute('tabindex', '0');
407
+ const options = {
408
+ // Override default controls to remove default labels, which is required to
409
+ // correctly display icons through pseudo-element
410
+ controls: defaultControls({
411
+ rotate: false,
412
+ zoomOptions: { zoomInLabel: '', zoomOutLabel: '' }
413
+ }),
414
+ // Override default interactions to allow mouse-wheel zoom + drag-pan when not focused
415
+ interactions: defaultInteractions({ onFocusOnly: false }),
416
+ target: this._mapTarget
417
+ };
418
+ this._configuration = new OpenLayersMap(options);
419
+ }
420
+
90
421
  /** @protected */
91
422
  ready() {
92
423
  super.ready();
424
+ // Add map container to shadow root, trigger OL resize calculation
425
+ this.shadowRoot.appendChild(this._mapTarget);
426
+ this.__addMapFocusListeners();
427
+ }
93
428
 
94
- this.__initMap();
429
+ /**
430
+ * Implements resize callback from ResizeMixin to update size of OL map instance
431
+ * @override
432
+ * @protected
433
+ */
434
+ _onResize(_contentRect) {
435
+ this._configuration.updateSize();
95
436
  }
96
437
 
97
- /** @private */
98
- __initMap() {
99
- this._configuration = new OpenLayersMap({
100
- target: this.$.map
438
+ /**
439
+ * Registers focus listeners on the map container to manually manage focus in
440
+ * FocusMixin. FocusMixin currently assumes that the focusable element will
441
+ * be in the light DOM and is available as event target.
442
+ * The map container however is in the shadow DOM and thus focus events will
443
+ * always have the host element as target.
444
+ * @private
445
+ */
446
+ __addMapFocusListeners() {
447
+ this._mapTarget.addEventListener('focusin', (e) => {
448
+ if (e.target === this._mapTarget) {
449
+ this._setFocused(true);
450
+ }
101
451
  });
452
+ this._mapTarget.addEventListener('focusout', () => {
453
+ this._setFocused(false);
454
+ });
455
+ }
456
+
457
+ /**
458
+ * Overrides method from `FocusMixin` to disable automatic focus management.
459
+ * See custom logic in __addMapFocusListeners
460
+ *
461
+ * @param {FocusEvent} _event
462
+ * @return {boolean}
463
+ * @override
464
+ * @protected
465
+ */
466
+ _shouldSetFocus(_event) {
467
+ return false;
102
468
  }
103
469
  }
104
470
 
@@ -0,0 +1,186 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2022 - 2022 Vaadin Ltd.
4
+ * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
+ */
6
+ import '@vaadin/vaadin-lumo-styles/color.js';
7
+ import '@vaadin/vaadin-lumo-styles/typography.js';
8
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
9
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
10
+ import '@vaadin/vaadin-lumo-styles/style.js';
11
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
12
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
+
14
+ registerStyles(
15
+ 'vaadin-map',
16
+ css`
17
+ :host {
18
+ font-family: var(--lumo-font-family);
19
+ font-size: var(--lumo-font-size-m);
20
+ --vaadin-map-controls-inset: var(--lumo-space-xs);
21
+ --vaadin-map-icon-zoom-in: var(--lumo-icons-plus);
22
+ --vaadin-map-icon-zoom-out: var(--lumo-icons-minus);
23
+ --vaadin-map-icon-compass: var(--lumo-icons-arrow-up);
24
+ --vaadin-map-icon-overview-map-collapse: var(--lumo-icons-angle-down);
25
+ --vaadin-map-icon-overview-map-expand: var(--lumo-icons-angle-up);
26
+ --vaadin-map-icon-close: var(--lumo-icons-cross);
27
+ --vaadin-map-icon-attribution-collapse: var(--lumo-icons-angle-right);
28
+ }
29
+
30
+ :host(:not([theme~='borderless'])) {
31
+ border-radius: var(--lumo-border-radius-l);
32
+ position: relative;
33
+ }
34
+
35
+ :host(:not([theme~='borderless']))::before {
36
+ content: '';
37
+ position: absolute;
38
+ inset: 0;
39
+ border: 1px solid var(--lumo-contrast-10pct);
40
+ border-radius: inherit;
41
+ z-index: 1;
42
+ pointer-events: none;
43
+ }
44
+
45
+ :host([focus-ring]) {
46
+ box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
47
+ }
48
+
49
+ .ol-control,
50
+ .ol-scale-bar,
51
+ .ol-scale-line {
52
+ margin: var(--lumo-space-xs);
53
+ }
54
+
55
+ .ol-control {
56
+ border-radius: var(--lumo-border-radius-m);
57
+ transition: 0.15s box-shadow, 0.15s background-color;
58
+ -webkit-backdrop-filter: blur(8px);
59
+ }
60
+
61
+ .ol-control:hover {
62
+ background-color: var(--lumo-base-color);
63
+ }
64
+
65
+ .ol-control:not(.ol-uncollapsible):hover {
66
+ box-shadow: var(--lumo-box-shadow-s);
67
+ background-color: var(--lumo-shade-20pct);
68
+ }
69
+
70
+ .ol-control button {
71
+ width: var(--lumo-size-s);
72
+ height: var(--lumo-size-s);
73
+ border-radius: inherit;
74
+ font-family: 'lumo-icons';
75
+ font-size: var(--lumo-icon-size-s);
76
+ font-weight: 400;
77
+ }
78
+
79
+ .ol-control button,
80
+ .ol-attribution:not(.ol-uncollapsible) ul {
81
+ transition: 0.15s opacity;
82
+ background-color: var(--lumo-base-color);
83
+ color: var(--lumo-body-text-color);
84
+ opacity: 0.65;
85
+ }
86
+
87
+ .ol-control:hover button,
88
+ .ol-control button:focus,
89
+ .ol-attribution:hover ul {
90
+ opacity: 1;
91
+ }
92
+
93
+ .ol-control button:hover {
94
+ color: var(--lumo-primary-text-color);
95
+ }
96
+
97
+ .ol-control button:active {
98
+ background: var(--lumo-base-color) linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
99
+ }
100
+
101
+ @supports not selector(:focus-visible) {
102
+ .ol-control button:focus {
103
+ outline: none;
104
+ box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
105
+ }
106
+ }
107
+
108
+ .ol-control button:focus-visible {
109
+ outline: none;
110
+ box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
111
+ }
112
+
113
+ .ol-zoom {
114
+ gap: 2px;
115
+ }
116
+
117
+ button.ol-zoom-in {
118
+ border-bottom-left-radius: 0;
119
+ border-bottom-right-radius: 0;
120
+ }
121
+
122
+ button.ol-zoom-out {
123
+ border-top-left-radius: 0;
124
+ border-top-right-radius: 0;
125
+ }
126
+
127
+ .ol-attribution.ol-uncollapsible {
128
+ border-radius: var(--lumo-border-radius-m) 0 0 0;
129
+ }
130
+
131
+ .ol-attribution ul {
132
+ font-size: var(--lumo-font-size-xxs);
133
+ color: var(--lumo-secondary-text-color);
134
+ padding: var(--lumo-space-xs) var(--lumo-space-s);
135
+ cursor: default;
136
+ }
137
+
138
+ .ol-attribution:not(.ol-uncollapsible) ul {
139
+ background-color: var(--lumo-base-color);
140
+ }
141
+
142
+ .ol-attribution a {
143
+ color: inherit;
144
+ cursor: pointer;
145
+ }
146
+
147
+ .ol-scale-bar-inner {
148
+ border-radius: var(--lumo-border-radius-s);
149
+ }
150
+
151
+ .ol-full-screen {
152
+ height: var(--lumo-size-s);
153
+ }
154
+
155
+ .ol-overviewmap:not(.ol-collapsed),
156
+ .ol-overviewmap:not(.ol-collapsed):hover {
157
+ background-color: var(--lumo-base-color);
158
+ box-shadow: var(--lumo-box-shadow-s);
159
+ transition: 0.15s box-shadow;
160
+ }
161
+
162
+ .ol-overviewmap-map {
163
+ margin: var(--lumo-space-xs);
164
+ border: 0;
165
+ border-radius: var(--lumo-border-radius-s);
166
+ }
167
+
168
+ .ol-overviewmap:not(.ol-uncollapsible) .ol-overviewmap-map {
169
+ margin-bottom: 0;
170
+ }
171
+
172
+ .ol-zoomslider:not(.ol-uncollapsible):hover {
173
+ box-shadow: none;
174
+ overflow: visible;
175
+ }
176
+
177
+ .ol-zoomslider button {
178
+ height: var(--lumo-space-m);
179
+ }
180
+
181
+ .ol-zoomslider:hover button {
182
+ box-shadow: var(--lumo-box-shadow-s);
183
+ }
184
+ `,
185
+ { moduleId: 'lumo-map' }
186
+ );
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2022 - 2022 Vaadin Ltd.
4
+ * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
+ */
6
+ import './vaadin-map-styles.js';
7
+ import '../../src/vaadin-map.js';
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2022 - 2022 Vaadin Ltd.
4
+ * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
+ */
6
+ import '@vaadin/vaadin-material-styles/color.js';
7
+ import '@vaadin/vaadin-material-styles/shadow.js';
8
+ import '@vaadin/vaadin-material-styles/typography.js';
9
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+
11
+ registerStyles(
12
+ 'vaadin-map',
13
+ css`
14
+ :host {
15
+ font-family: var(--material-font-family);
16
+ font-size: var(--material-body-font-size);
17
+ }
18
+
19
+ :host(:not([theme~='borderless'])) {
20
+ border-radius: 4px;
21
+ border: 1px solid var(--material-divider-color);
22
+ }
23
+
24
+ :host([focus-ring]) {
25
+ box-shadow: 0 0 0 2px var(--material-primary-color);
26
+ }
27
+
28
+ .ol-control {
29
+ border-radius: 4px;
30
+ transition: 0.1s box-shadow;
31
+ box-shadow: var(--material-shadow-elevation-2dp);
32
+ }
33
+
34
+ .ol-control:hover {
35
+ background-color: var(--material-background-color);
36
+ }
37
+
38
+ .ol-control:not(.ol-uncollapsible):hover {
39
+ box-shadow: var(--material-shadow-elevation-4dp);
40
+ background-color: rgba(0, 0, 0, 0.2);
41
+ }
42
+
43
+ .ol-control button {
44
+ width: 2em;
45
+ height: 2em;
46
+ background-color: var(--material-background-color);
47
+ border-radius: inherit;
48
+ }
49
+
50
+ .ol-control button,
51
+ .ol-attribution:not(.ol-uncollapsible) ul {
52
+ color: var(--material-secondary-text-color);
53
+ }
54
+
55
+ .ol-control:hover button,
56
+ .ol-attribution:hover ul {
57
+ color: var(--material-body-text-color);
58
+ }
59
+
60
+ .ol-control button:hover {
61
+ color: var(--material-primary-text-color);
62
+ }
63
+
64
+ .ol-control button:active {
65
+ background-color: var(--material-secondary-background-color);
66
+ }
67
+
68
+ @supports not selector(:focus-visible) {
69
+ .ol-control button:focus {
70
+ outline: none;
71
+ box-shadow: 0 0 0 2px var(--material-primary-color);
72
+ }
73
+ }
74
+
75
+ .ol-control button:focus-visible {
76
+ outline: none;
77
+ box-shadow: 0 0 0 2px var(--material-primary-color);
78
+ }
79
+
80
+ .ol-zoom {
81
+ gap: 1px;
82
+ }
83
+
84
+ button.ol-zoom-in {
85
+ border-bottom-left-radius: 0;
86
+ border-bottom-right-radius: 0;
87
+ }
88
+
89
+ button.ol-zoom-out {
90
+ border-top-left-radius: 0;
91
+ border-top-right-radius: 0;
92
+ }
93
+
94
+ .ol-attribution.ol-uncollapsible {
95
+ border-radius: 4px 0 0;
96
+ }
97
+
98
+ .ol-attribution ul {
99
+ font-size: var(--material-caption-font-size);
100
+ cursor: default;
101
+ }
102
+
103
+ .ol-attribution:not(.ol-uncollapsible) ul {
104
+ background-color: var(--material-background-color);
105
+ }
106
+
107
+ .ol-attribution a {
108
+ color: inherit;
109
+ cursor: pointer;
110
+ }
111
+
112
+ .ol-scale-bar-inner {
113
+ border-radius: 4px;
114
+ }
115
+
116
+ .ol-full-screen {
117
+ height: 2em;
118
+ }
119
+
120
+ .ol-overviewmap:not(.ol-collapsed),
121
+ .ol-overviewmap:not(.ol-collapsed):hover {
122
+ background-color: var(--material-background-color);
123
+ }
124
+
125
+ .ol-overviewmap-map {
126
+ margin: 2px;
127
+ border: 0;
128
+ border-radius: 2px;
129
+ }
130
+
131
+ .ol-zoomslider,
132
+ .ol-zoomslider:not(.ol-uncollapsible):hover {
133
+ box-shadow: none;
134
+ overflow: visible;
135
+ }
136
+
137
+ .ol-zoomslider button {
138
+ height: 16px;
139
+ box-shadow: var(--material-shadow-elevation-2dp);
140
+ }
141
+
142
+ .ol-zoomslider:hover button {
143
+ box-shadow: var(--material-shadow-elevation-4dp);
144
+ }
145
+ `,
146
+ { moduleId: 'material-map' }
147
+ );
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2022 - 2022 Vaadin Ltd.
4
+ * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
+ */
6
+ import './vaadin-map-styles.js';
7
+ import '../../src/vaadin-map.js';
package/vaadin-map.js CHANGED
@@ -1,2 +1,2 @@
1
- import './theme/vaadin-map-base-theme.js';
1
+ import './theme/lumo/vaadin-map.js';
2
2
  export * from './src/vaadin-map.js';
@@ -1,305 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2022 - 2022 Vaadin Ltd.
4
- * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
- */
6
-
7
- /**
8
- * @licence OpenLayers
9
- *
10
- * BSD 2-Clause License, https://github.com/openlayers/openlayers/blob/main/LICENSE.md
11
- */
12
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
-
14
- // Adopted from `ol/ol.css`
15
- const mapBaseTheme = css`
16
- .ol-box {
17
- box-sizing: border-box;
18
- border-radius: 2px;
19
- border: 1.5px solid rgb(179, 197, 219);
20
- background-color: rgba(255, 255, 255, 0.4);
21
- }
22
-
23
- .ol-mouse-position {
24
- top: 8px;
25
- right: 8px;
26
- position: absolute;
27
- }
28
-
29
- .ol-scale-line {
30
- background: rgba(0, 60, 136, 0.3);
31
- border-radius: 4px;
32
- bottom: 8px;
33
- left: 8px;
34
- padding: 2px;
35
- position: absolute;
36
- }
37
- .ol-scale-line-inner {
38
- border: 1px solid #eee;
39
- border-top: none;
40
- color: #eee;
41
- font-size: 10px;
42
- text-align: center;
43
- margin: 1px;
44
- will-change: contents, width;
45
- transition: all 0.25s;
46
- }
47
- .ol-scale-bar {
48
- position: absolute;
49
- bottom: 8px;
50
- left: 8px;
51
- }
52
- .ol-scale-step-marker {
53
- width: 1px;
54
- height: 15px;
55
- background-color: #000000;
56
- float: right;
57
- z-index: 10;
58
- }
59
- .ol-scale-step-text {
60
- position: absolute;
61
- bottom: -5px;
62
- font-size: 12px;
63
- z-index: 11;
64
- color: #000000;
65
- text-shadow: -2px 0 #ffffff, 0 2px #ffffff, 2px 0 #ffffff, 0 -2px #ffffff;
66
- }
67
- .ol-scale-text {
68
- position: absolute;
69
- font-size: 14px;
70
- text-align: center;
71
- bottom: 25px;
72
- color: #000000;
73
- text-shadow: -2px 0 #ffffff, 0 2px #ffffff, 2px 0 #ffffff, 0 -2px #ffffff;
74
- }
75
- .ol-scale-singlebar {
76
- position: relative;
77
- height: 10px;
78
- z-index: 9;
79
- box-sizing: border-box;
80
- border: 1px solid black;
81
- }
82
-
83
- .ol-unsupported {
84
- display: none;
85
- }
86
- .ol-viewport,
87
- .ol-unselectable {
88
- -webkit-touch-callout: none;
89
- -webkit-user-select: none;
90
- -moz-user-select: none;
91
- -ms-user-select: none;
92
- user-select: none;
93
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
94
- }
95
- .ol-viewport canvas {
96
- all: unset;
97
- }
98
- .ol-selectable {
99
- -webkit-touch-callout: default;
100
- -webkit-user-select: text;
101
- -moz-user-select: text;
102
- -ms-user-select: text;
103
- user-select: text;
104
- }
105
- .ol-grabbing {
106
- cursor: -webkit-grabbing;
107
- cursor: -moz-grabbing;
108
- cursor: grabbing;
109
- }
110
- .ol-grab {
111
- cursor: move;
112
- cursor: -webkit-grab;
113
- cursor: -moz-grab;
114
- cursor: grab;
115
- }
116
- .ol-control {
117
- position: absolute;
118
- background-color: rgba(255, 255, 255, 0.4);
119
- border-radius: 4px;
120
- padding: 2px;
121
- }
122
- .ol-control:hover {
123
- background-color: rgba(255, 255, 255, 0.6);
124
- }
125
- .ol-zoom {
126
- top: 0.5em;
127
- left: 0.5em;
128
- }
129
- .ol-rotate {
130
- top: 0.5em;
131
- right: 0.5em;
132
- transition: opacity 0.25s linear, visibility 0s linear;
133
- }
134
- .ol-rotate.ol-hidden {
135
- opacity: 0;
136
- visibility: hidden;
137
- transition: opacity 0.25s linear, visibility 0s linear 0.25s;
138
- }
139
- .ol-zoom-extent {
140
- top: 4.643em;
141
- left: 0.5em;
142
- }
143
- .ol-full-screen {
144
- right: 0.5em;
145
- top: 0.5em;
146
- }
147
-
148
- .ol-control button {
149
- display: block;
150
- margin: 1px;
151
- padding: 0;
152
- color: white;
153
- font-weight: bold;
154
- text-decoration: none;
155
- font-size: inherit;
156
- text-align: center;
157
- height: 1.375em;
158
- width: 1.375em;
159
- line-height: 0.4em;
160
- background-color: rgba(0, 60, 136, 0.5);
161
- border: none;
162
- border-radius: 2px;
163
- }
164
- .ol-control button::-moz-focus-inner {
165
- border: none;
166
- padding: 0;
167
- }
168
- .ol-zoom-extent button {
169
- line-height: 1.4em;
170
- }
171
- .ol-compass {
172
- display: block;
173
- font-weight: normal;
174
- font-size: 1.2em;
175
- will-change: transform;
176
- }
177
- .ol-touch .ol-control button {
178
- font-size: 1.5em;
179
- }
180
- .ol-touch .ol-zoom-extent {
181
- top: 5.5em;
182
- }
183
- .ol-control button:hover,
184
- .ol-control button:focus {
185
- text-decoration: none;
186
- background-color: rgba(0, 60, 136, 0.7);
187
- }
188
- .ol-zoom .ol-zoom-in {
189
- border-radius: 2px 2px 0 0;
190
- }
191
- .ol-zoom .ol-zoom-out {
192
- border-radius: 0 0 2px 2px;
193
- }
194
-
195
- .ol-attribution {
196
- text-align: right;
197
- bottom: 0.5em;
198
- right: 0.5em;
199
- max-width: calc(100% - 1.3em);
200
- display: flex;
201
- flex-flow: row-reverse;
202
- align-items: center;
203
- }
204
- .ol-attribution a {
205
- color: rgba(0, 60, 136, 0.7);
206
- text-decoration: none;
207
- }
208
- .ol-attribution ul {
209
- margin: 0;
210
- padding: 1px 0.5em;
211
- color: #000;
212
- text-shadow: 0 0 2px #fff;
213
- font-size: 12px;
214
- }
215
- .ol-attribution li {
216
- display: inline;
217
- list-style: none;
218
- }
219
- .ol-attribution li:not(:last-child):after {
220
- content: ' ';
221
- }
222
- .ol-attribution img {
223
- max-height: 2em;
224
- max-width: inherit;
225
- vertical-align: middle;
226
- }
227
- .ol-attribution button {
228
- flex-shrink: 0;
229
- }
230
- .ol-attribution.ol-collapsed ul {
231
- display: none;
232
- }
233
- .ol-attribution:not(.ol-collapsed) {
234
- background: rgba(255, 255, 255, 0.8);
235
- }
236
- .ol-attribution.ol-uncollapsible {
237
- bottom: 0;
238
- right: 0;
239
- border-radius: 4px 0 0;
240
- }
241
- .ol-attribution.ol-uncollapsible img {
242
- margin-top: -0.2em;
243
- max-height: 1.6em;
244
- }
245
- .ol-attribution.ol-uncollapsible button {
246
- display: none;
247
- }
248
-
249
- .ol-zoomslider {
250
- top: 4.5em;
251
- left: 0.5em;
252
- height: 200px;
253
- }
254
- .ol-zoomslider button {
255
- position: relative;
256
- height: 10px;
257
- }
258
-
259
- .ol-touch .ol-zoomslider {
260
- top: 5.5em;
261
- }
262
-
263
- .ol-overviewmap {
264
- left: 0.5em;
265
- bottom: 0.5em;
266
- }
267
- .ol-overviewmap.ol-uncollapsible {
268
- bottom: 0;
269
- left: 0;
270
- border-radius: 0 4px 0 0;
271
- }
272
- .ol-overviewmap .ol-overviewmap-map,
273
- .ol-overviewmap button {
274
- display: block;
275
- }
276
- .ol-overviewmap .ol-overviewmap-map {
277
- border: 1px solid #7b98bc;
278
- height: 150px;
279
- margin: 2px;
280
- width: 150px;
281
- }
282
- .ol-overviewmap:not(.ol-collapsed) button {
283
- bottom: 2px;
284
- left: 2px;
285
- position: absolute;
286
- }
287
- .ol-overviewmap.ol-collapsed .ol-overviewmap-map,
288
- .ol-overviewmap.ol-uncollapsible button {
289
- display: none;
290
- }
291
- .ol-overviewmap:not(.ol-collapsed) {
292
- background: rgba(255, 255, 255, 0.8);
293
- }
294
- .ol-overviewmap-box {
295
- border: 2px dotted rgba(0, 60, 136, 0.7);
296
- }
297
-
298
- .ol-overviewmap .ol-overviewmap-box:hover {
299
- cursor: move;
300
- }
301
- `;
302
-
303
- registerStyles('vaadin-map', mapBaseTheme, { moduleId: 'vaadin-map-base-theme' });
304
-
305
- export { mapBaseTheme };