@vaadin/map 24.7.0-alpha4 → 24.7.0-alpha5

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": "24.7.0-alpha4",
3
+ "version": "24.7.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,16 +35,18 @@
35
35
  "polymer"
36
36
  ],
37
37
  "dependencies": {
38
+ "@open-wc/dedupe-mixin": "^1.3.0",
38
39
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "24.7.0-alpha4",
40
- "@vaadin/component-base": "24.7.0-alpha4",
41
- "@vaadin/vaadin-lumo-styles": "24.7.0-alpha4",
42
- "@vaadin/vaadin-material-styles": "24.7.0-alpha4",
43
- "@vaadin/vaadin-themable-mixin": "24.7.0-alpha4",
40
+ "@vaadin/a11y-base": "24.7.0-alpha5",
41
+ "@vaadin/component-base": "24.7.0-alpha5",
42
+ "@vaadin/vaadin-lumo-styles": "24.7.0-alpha5",
43
+ "@vaadin/vaadin-material-styles": "24.7.0-alpha5",
44
+ "@vaadin/vaadin-themable-mixin": "24.7.0-alpha5",
45
+ "lit": "^3.0.0",
44
46
  "ol": "6.13.0"
45
47
  },
46
48
  "devDependencies": {
47
- "@vaadin/chai-plugins": "24.7.0-alpha4",
49
+ "@vaadin/chai-plugins": "24.7.0-alpha5",
48
50
  "@vaadin/testing-helpers": "^1.1.0",
49
51
  "sinon": "^18.0.0"
50
52
  },
@@ -53,5 +55,5 @@
53
55
  "web-types.json",
54
56
  "web-types.lit.json"
55
57
  ],
56
- "gitHead": "d7165cebf9dcf6a7e9e22f6353662d33404b4856"
58
+ "gitHead": "f9fa2bd652780a344d5e0329b8aafbcbd72ebd14"
57
59
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ export * from './vaadin-map.js';
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { html, LitElement } from 'lit';
12
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
+ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
15
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
16
+ import { MapMixin } from './vaadin-map-mixin.js';
17
+ import { mapStyles } from './vaadin-map-styles.js';
18
+
19
+ /**
20
+ * LitElement based version of `<vaadin-map>` web component.
21
+ *
22
+ * ## Disclaimer
23
+ *
24
+ * This component is an experiment and not yet a part of Vaadin platform.
25
+ * There is no ETA regarding specific Vaadin version where it'll land.
26
+ */
27
+ class Map extends MapMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
28
+ static get is() {
29
+ return 'vaadin-map';
30
+ }
31
+
32
+ static get cvdlName() {
33
+ return 'vaadin-map';
34
+ }
35
+
36
+ static get styles() {
37
+ return mapStyles;
38
+ }
39
+
40
+ /** @protected */
41
+ render() {
42
+ return html``;
43
+ }
44
+ }
45
+
46
+ defineCustomElement(Map);
47
+
48
+ export { Map };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import type { Constructor } from '@open-wc/dedupe-mixin';
12
+ import type OpenLayersMap from 'ol/Map.js';
13
+ import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
14
+ import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
15
+
16
+ export declare function MapMixin<T extends Constructor<HTMLElement>>(
17
+ base: T,
18
+ ): Constructor<MapMixinClass> & Constructor<ResizeMixinClass> & Constructor<FocusMixinClass> & T;
19
+
20
+ export declare class MapMixinClass {
21
+ /**
22
+ * The internal OpenLayers map instance used to configure the map.
23
+ * See the OpenLayers [API](https://openlayers.org/en/latest/apidoc/) and
24
+ * [examples](https://openlayers.org/en/latest/examples/) for further information.
25
+ * @returns {*}
26
+ */
27
+ get configuration(): OpenLayersMap;
28
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { defaults as defaultControls } from 'ol/control';
12
+ import { defaults as defaultInteractions } from 'ol/interaction';
13
+ import OpenLayersMap from 'ol/Map.js';
14
+ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
15
+ import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
16
+
17
+ /**
18
+ * @polymerMixin
19
+ * @mixes ResizeMixin
20
+ * @mixes FocusMixin
21
+ */
22
+ export const MapMixin = (superClass) =>
23
+ class extends FocusMixin(ResizeMixin(superClass)) {
24
+ constructor() {
25
+ super();
26
+ // Create map container element and initialize OL map instance
27
+ this._mapTarget = document.createElement('div');
28
+ this._mapTarget.id = 'map';
29
+ // Ensure accessible keyboard controls are enabled
30
+ this._mapTarget.setAttribute('tabindex', '0');
31
+ const options = {
32
+ // Override default controls to remove default labels, which is required to
33
+ // correctly display icons through pseudo-element
34
+ controls: defaultControls({
35
+ rotate: false,
36
+ zoomOptions: { zoomInLabel: '', zoomOutLabel: '' },
37
+ }),
38
+ // Override default interactions to allow mouse-wheel zoom + drag-pan when not focused
39
+ interactions: defaultInteractions({ onFocusOnly: false }),
40
+ target: this._mapTarget,
41
+ };
42
+ this._configuration = new OpenLayersMap(options);
43
+ }
44
+
45
+ /**
46
+ * The internal OpenLayers map instance used to configure the map.
47
+ * See the OpenLayers [API](https://openlayers.org/en/latest/apidoc/) and
48
+ * [examples](https://openlayers.org/en/latest/examples/) for further information.
49
+ * @returns {*}
50
+ */
51
+ get configuration() {
52
+ return this._configuration;
53
+ }
54
+
55
+ /** @protected */
56
+ ready() {
57
+ super.ready();
58
+ // Add map container to shadow root, trigger OL resize calculation
59
+ this.shadowRoot.appendChild(this._mapTarget);
60
+ this.__addMapFocusListeners();
61
+ }
62
+
63
+ /**
64
+ * Implements resize callback from ResizeMixin to update size of OL map instance
65
+ * @override
66
+ * @protected
67
+ */
68
+ _onResize(_contentRect) {
69
+ this._configuration.updateSize();
70
+ }
71
+
72
+ /**
73
+ * Registers focus listeners on the map container to manually manage focus in
74
+ * FocusMixin. FocusMixin currently assumes that the focusable element will
75
+ * be in the light DOM and is available as event target.
76
+ * The map container however is in the shadow DOM and thus focus events will
77
+ * always have the host element as target.
78
+ * @private
79
+ */
80
+ __addMapFocusListeners() {
81
+ this._mapTarget.addEventListener('focusin', (e) => {
82
+ if (e.target === this._mapTarget) {
83
+ this._setFocused(true);
84
+ }
85
+ });
86
+ this._mapTarget.addEventListener('focusout', () => {
87
+ this._setFocused(false);
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Overrides method from `FocusMixin` to disable automatic focus management.
93
+ * See custom logic in __addMapFocusListeners
94
+ *
95
+ * @param {FocusEvent} _event
96
+ * @return {boolean}
97
+ * @override
98
+ * @protected
99
+ */
100
+ _shouldSetFocus(_event) {
101
+ return false;
102
+ }
103
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import type { CSSResult } from 'lit';
12
+
13
+ export const mapStyles: CSSResult;
@@ -0,0 +1,314 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
+
13
+ export const mapStyles = css`
14
+ :host {
15
+ display: block;
16
+ height: 400px;
17
+ flex: 1 1 auto;
18
+ align-self: stretch;
19
+ overflow: hidden;
20
+ }
21
+
22
+ :host([hidden]) {
23
+ display: none !important;
24
+ }
25
+
26
+ #map {
27
+ width: 100%;
28
+ height: 100%;
29
+ outline: none;
30
+ }
31
+
32
+ #map,
33
+ .ol-viewport,
34
+ .ol-layers {
35
+ border-radius: inherit;
36
+ overflow: hidden;
37
+ }
38
+
39
+ #map:fullscreen {
40
+ border-radius: 0;
41
+ }
42
+
43
+ #map:-webkit-full-screen {
44
+ border-radius: 0;
45
+ }
46
+
47
+ /* Functional styles, copied from 'ol/ol.css' */
48
+
49
+ .ol-box {
50
+ box-sizing: border-box;
51
+ border-radius: 2px;
52
+ border: 1px solid rgba(0, 0, 0, 0.5);
53
+ background-color: rgba(255, 255, 255, 0.2);
54
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
55
+ }
56
+
57
+ .ol-unsupported {
58
+ display: none;
59
+ }
60
+
61
+ .ol-viewport,
62
+ .ol-unselectable {
63
+ -webkit-touch-callout: none;
64
+ -webkit-user-select: none;
65
+ user-select: none;
66
+ -webkit-tap-highlight-color: transparent;
67
+ }
68
+
69
+ .ol-viewport canvas {
70
+ all: unset;
71
+ }
72
+
73
+ .ol-selectable {
74
+ -webkit-touch-callout: default;
75
+ -webkit-user-select: text;
76
+ user-select: text;
77
+ }
78
+
79
+ .ol-grabbing {
80
+ cursor: grabbing;
81
+ }
82
+
83
+ .ol-grab {
84
+ cursor: move;
85
+ cursor: grab;
86
+ }
87
+
88
+ /* Control positioning and styling */
89
+
90
+ .ol-overlaycontainer-stopevent {
91
+ /* stylelint-disable declaration-block-no-redundant-longhand-properties */
92
+ display: grid;
93
+ grid-template-columns: min-content 1fr min-content;
94
+ grid-template-rows: min-content 1fr min-content min-content min-content min-content;
95
+ padding: var(--vaadin-map-controls-inset, 0.25em);
96
+ box-sizing: border-box;
97
+ grid-template-areas:
98
+ 'scale mouse-position fullscreen'
99
+ 'overview-map . zoom-extent'
100
+ 'overview-map . compass'
101
+ 'overview-map . zoom-slider'
102
+ 'overview-map . zoom'
103
+ 'overview-map attribution attribution';
104
+ }
105
+
106
+ .ol-mouse-position {
107
+ grid-area: mouse-position;
108
+ align-self: start;
109
+ text-align: center;
110
+ font-size: 0.625em;
111
+ color: #000;
112
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
113
+ }
114
+
115
+ .ol-scale-line,
116
+ .ol-scale-bar {
117
+ grid-area: scale;
118
+ position: relative;
119
+ pointer-events: none !important;
120
+ color: #000;
121
+ }
122
+
123
+ .ol-scale-line-inner {
124
+ border: 1px solid rgba(0, 0, 0, 0.5);
125
+ border-top: none;
126
+ font-size: 0.625em;
127
+ text-align: center;
128
+ will-change: contents, width, filter;
129
+ transition: all 0.25s;
130
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
131
+ }
132
+
133
+ .ol-scale-bar-inner {
134
+ border: 1px solid rgba(0, 0, 0, 0.5);
135
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
136
+ overflow: hidden;
137
+ }
138
+
139
+ .ol-scale-step-marker {
140
+ display: none;
141
+ }
142
+
143
+ .ol-scale-step-text {
144
+ position: absolute;
145
+ top: 0.75em;
146
+ font-size: 0.625em;
147
+ color: #000;
148
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
149
+ white-space: nowrap;
150
+ overflow: hidden;
151
+ }
152
+
153
+ .ol-scale-text {
154
+ position: absolute;
155
+ font-size: 0.625em;
156
+ top: 2em;
157
+ color: #000;
158
+ white-space: nowrap;
159
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
160
+ }
161
+
162
+ .ol-scale-singlebar {
163
+ height: 0.25em;
164
+ opacity: 0.5;
165
+ }
166
+
167
+ .ol-control {
168
+ margin: 0.25em;
169
+ }
170
+
171
+ .ol-control button {
172
+ -webkit-appearance: none;
173
+ border: 0;
174
+ margin: 0;
175
+ padding: 0;
176
+ background: #fff;
177
+ font: inherit;
178
+ color: inherit;
179
+ width: 1.5em;
180
+ height: 1.5em;
181
+ }
182
+
183
+ .ol-control button::-moz-focus-inner {
184
+ border: none;
185
+ padding: 0;
186
+ }
187
+
188
+ .ol-compass {
189
+ grid-area: compass;
190
+ display: block;
191
+ will-change: transform;
192
+ }
193
+
194
+ .ol-zoom {
195
+ grid-area: zoom;
196
+ display: flex;
197
+ flex-direction: column;
198
+ }
199
+
200
+ .ol-zoom-in:empty::before {
201
+ content: var(--vaadin-map-icon-zoom-in, '+');
202
+ }
203
+
204
+ .ol-zoom-out:empty::before {
205
+ content: var(--vaadin-map-icon-zoom-out, '\\2013');
206
+ }
207
+
208
+ .ol-attribution {
209
+ grid-area: attribution;
210
+ margin-inline-start: auto !important;
211
+ display: flex;
212
+ flex-flow: row-reverse;
213
+ }
214
+
215
+ .ol-attribution.ol-uncollapsible {
216
+ margin-inline-end: calc(var(--vaadin-map-controls-inset, 0.25em) * -1);
217
+ margin-block-end: calc(var(--vaadin-map-controls-inset, 0.25em) * -1);
218
+ }
219
+
220
+ .ol-attribution button span:empty::before {
221
+ content: var(--vaadin-map-icon-attribution-collapse, '\\25B8');
222
+ }
223
+
224
+ .ol-attribution.ol-collapsed button span:empty::before {
225
+ content: var(--vaadin-map-icon-attribution-expand, '\\2139');
226
+ }
227
+
228
+ .ol-attribution ul {
229
+ display: flex;
230
+ align-items: center;
231
+ gap: 1em;
232
+ list-style: none;
233
+ margin: 0;
234
+ padding: 0.25em 0.5em;
235
+ font-size: 0.8em;
236
+ }
237
+
238
+ .ol-attribution.ol-collapsed ul {
239
+ display: none;
240
+ }
241
+
242
+ .ol-attribution.ol-uncollapsible button {
243
+ display: none;
244
+ }
245
+
246
+ .ol-rotate {
247
+ grid-area: compass;
248
+ }
249
+
250
+ .ol-compass:empty::before {
251
+ content: var(--vaadin-map-icon-compass, '\\2191');
252
+ }
253
+
254
+ .ol-full-screen {
255
+ grid-area: fullscreen;
256
+ }
257
+
258
+ .ol-full-screen button:empty::before {
259
+ content: var(--vaadin-map-icon-fullscreen, '\\2922');
260
+ }
261
+
262
+ .ol-full-screen .ol-full-screen-true:empty::before {
263
+ content: var(--vaadin-map-icon-close, '\\00D7');
264
+ }
265
+
266
+ .ol-overviewmap {
267
+ grid-area: overview-map;
268
+ align-self: end;
269
+ width: max-content;
270
+ }
271
+
272
+ .ol-overviewmap button span:empty::before {
273
+ content: var(--vaadin-map-icon-overview-map-collapse, '\\25BE');
274
+ }
275
+
276
+ .ol-overviewmap.ol-collapsed button span:empty::before {
277
+ content: var(--vaadin-map-icon-overview-map-expand, '\\25B4');
278
+ }
279
+
280
+ .ol-overviewmap-map {
281
+ height: 10em;
282
+ width: 10em;
283
+ border: 1px solid rgba(0, 0, 0, 0.5);
284
+ }
285
+
286
+ .ol-overviewmap.ol-collapsed .ol-overviewmap-map,
287
+ .ol-overviewmap.ol-uncollapsible button {
288
+ display: none;
289
+ }
290
+
291
+ .ol-overviewmap-box {
292
+ border: 1px dashed rgba(0, 0, 0, 0.5);
293
+ filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
294
+ will-change: filter;
295
+ cursor: move;
296
+ }
297
+
298
+ .ol-zoomslider {
299
+ grid-area: zoom-slider;
300
+ height: 8em;
301
+ }
302
+
303
+ .ol-zoomslider button {
304
+ position: relative;
305
+ height: 0.5em;
306
+ display: block;
307
+ border-radius: inherit;
308
+ }
309
+
310
+ .ol-zoom-extent {
311
+ grid-area: zoom-extent;
312
+ align-self: end;
313
+ }
314
+ `;
@@ -8,11 +8,9 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import type OpenLayersMap from 'ol/Map.js';
12
- import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
13
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
- import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
15
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
13
+ import { MapMixin } from './vaadin-map-mixin.js';
16
14
 
17
15
  /**
18
16
  * `vaadin-map` is a web component for displaying web maps.
@@ -50,18 +48,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
50
48
  * @extends HTMLElement
51
49
  * @mixes ThemableMixin
52
50
  * @mixes ElementMixin
53
- * @mixes FocusMixin
54
- * @mixes ResizeMixin
51
+ * @mixes MapMixin
55
52
  */
56
- declare class Map extends ResizeMixin(FocusMixin(ThemableMixin(ElementMixin(HTMLElement)))) {
57
- /**
58
- * The internal OpenLayers map instance used to configure the map.
59
- * See the OpenLayers [API](https://openlayers.org/en/latest/apidoc/) and
60
- * [examples](https://openlayers.org/en/latest/examples/) for further information.
61
- * @returns {*}
62
- */
63
- get configuration(): OpenLayersMap;
64
- }
53
+ declare class Map extends MapMixin(ThemableMixin(ElementMixin(HTMLElement))) {}
65
54
 
66
55
  declare global {
67
56
  interface HTMLElementTagNameMap {
package/src/vaadin-map.js CHANGED
@@ -9,14 +9,13 @@
9
9
  * license.
10
10
  */
11
11
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
- import { defaults as defaultControls } from 'ol/control';
13
- import { defaults as defaultInteractions } from 'ol/interaction';
14
- import OpenLayersMap from 'ol/Map.js';
15
- import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
16
12
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
17
13
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
18
- import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
19
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
+ import { MapMixin } from './vaadin-map-mixin.js';
16
+ import { mapStyles } from './vaadin-map-styles.js';
17
+
18
+ registerStyles('vaadin-map', mapStyles, { moduleId: 'vaadin-map-styles' });
20
19
 
21
20
  /**
22
21
  * `vaadin-map` is a web component for displaying web maps.
@@ -54,322 +53,11 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
54
53
  *
55
54
  * @customElement
56
55
  * @extends HTMLElement
56
+ * @mixes MapMixin
57
57
  * @mixes ThemableMixin
58
58
  * @mixes ElementMixin
59
- * @mixes FocusMixin
60
- * @mixes ResizeMixin
61
59
  */
62
- class Map extends ResizeMixin(FocusMixin(ElementMixin(ThemableMixin(PolymerElement)))) {
63
- static get template() {
64
- return html`
65
- <style>
66
- :host {
67
- display: block;
68
- height: 400px;
69
- flex: 1 1 auto;
70
- align-self: stretch;
71
- overflow: hidden;
72
- }
73
-
74
- :host([hidden]) {
75
- display: none !important;
76
- }
77
-
78
- #map {
79
- width: 100%;
80
- height: 100%;
81
- outline: none;
82
- }
83
-
84
- #map,
85
- .ol-viewport,
86
- .ol-layers {
87
- border-radius: inherit;
88
- overflow: hidden;
89
- }
90
-
91
- #map:fullscreen {
92
- border-radius: 0;
93
- }
94
-
95
- #map:-webkit-full-screen {
96
- border-radius: 0;
97
- }
98
-
99
- /* Functional styles, copied from 'ol/ol.css' */
100
-
101
- .ol-box {
102
- box-sizing: border-box;
103
- border-radius: 2px;
104
- border: 1px solid rgba(0, 0, 0, 0.5);
105
- background-color: rgba(255, 255, 255, 0.2);
106
- box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
107
- }
108
-
109
- .ol-unsupported {
110
- display: none;
111
- }
112
-
113
- .ol-viewport,
114
- .ol-unselectable {
115
- -webkit-touch-callout: none;
116
- -webkit-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
- user-select: text;
129
- }
130
-
131
- .ol-grabbing {
132
- cursor: -webkit-grabbing;
133
- cursor: -moz-grabbing;
134
- cursor: grabbing;
135
- }
136
-
137
- .ol-grab {
138
- cursor: move;
139
- cursor: -webkit-grab;
140
- cursor: -moz-grab;
141
- cursor: grab;
142
- }
143
-
144
- /* Control positioning and styling */
145
-
146
- .ol-overlaycontainer-stopevent {
147
- display: grid;
148
- grid-template-columns: min-content 1fr min-content;
149
- grid-template-rows: min-content 1fr min-content min-content min-content min-content;
150
- padding: var(--vaadin-map-controls-inset, 0.25em);
151
- box-sizing: border-box;
152
- grid-template-areas:
153
- 'scale mouse-position fullscreen'
154
- 'overview-map . zoom-extent'
155
- 'overview-map . compass'
156
- 'overview-map . zoom-slider'
157
- 'overview-map . zoom'
158
- 'overview-map attribution attribution';
159
- }
160
-
161
- .ol-mouse-position {
162
- grid-area: mouse-position;
163
- align-self: start;
164
- text-align: center;
165
- font-size: 0.625em;
166
- color: #000;
167
- filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
168
- }
169
-
170
- .ol-scale-line,
171
- .ol-scale-bar {
172
- grid-area: scale;
173
- position: relative;
174
- pointer-events: none !important;
175
- color: #000;
176
- }
177
-
178
- .ol-scale-line-inner {
179
- border: 1px solid rgba(0, 0, 0, 0.5);
180
- border-top: none;
181
- font-size: 0.625em;
182
- text-align: center;
183
- will-change: contents, width, filter;
184
- transition: all 0.25s;
185
- filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
186
- }
187
-
188
- .ol-scale-bar-inner {
189
- border: 1px solid rgba(0, 0, 0, 0.5);
190
- box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
191
- overflow: hidden;
192
- }
193
-
194
- .ol-scale-step-marker {
195
- display: none;
196
- }
197
-
198
- .ol-scale-step-text {
199
- position: absolute;
200
- top: 0.75em;
201
- font-size: 0.625em;
202
- color: #000;
203
- filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
204
- white-space: nowrap;
205
- overflow: hidden;
206
- }
207
-
208
- .ol-scale-text {
209
- position: absolute;
210
- font-size: 0.625em;
211
- top: 2em;
212
- color: #000;
213
- white-space: nowrap;
214
- filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
215
- }
216
-
217
- .ol-scale-singlebar {
218
- height: 0.25em;
219
- opacity: 0.5;
220
- }
221
-
222
- .ol-control {
223
- margin: 0.25em;
224
- }
225
-
226
- .ol-control button {
227
- -webkit-appearance: none;
228
- border: 0;
229
- margin: 0;
230
- padding: 0;
231
- background: #fff;
232
- font: inherit;
233
- color: inherit;
234
- width: 1.5em;
235
- height: 1.5em;
236
- }
237
-
238
- .ol-control button::-moz-focus-inner {
239
- border: none;
240
- padding: 0;
241
- }
242
-
243
- .ol-compass {
244
- grid-area: compass;
245
- display: block;
246
- will-change: transform;
247
- }
248
-
249
- .ol-zoom {
250
- grid-area: zoom;
251
- display: flex;
252
- flex-direction: column;
253
- }
254
-
255
- .ol-zoom-in:empty::before {
256
- content: var(--vaadin-map-icon-zoom-in, '+');
257
- }
258
-
259
- .ol-zoom-out:empty::before {
260
- content: var(--vaadin-map-icon-zoom-out, '\\2013');
261
- }
262
-
263
- .ol-attribution {
264
- grid-area: attribution;
265
- margin-inline-start: auto !important;
266
- display: flex;
267
- flex-flow: row-reverse;
268
- }
269
-
270
- .ol-attribution.ol-uncollapsible {
271
- margin-inline-end: calc(var(--vaadin-map-controls-inset, 0.25em) * -1);
272
- margin-block-end: calc(var(--vaadin-map-controls-inset, 0.25em) * -1);
273
- }
274
-
275
- .ol-attribution button span:empty::before {
276
- content: var(--vaadin-map-icon-attribution-collapse, '\\25B8');
277
- }
278
-
279
- .ol-attribution.ol-collapsed button span:empty::before {
280
- content: var(--vaadin-map-icon-attribution-expand, '\\2139');
281
- }
282
-
283
- .ol-attribution ul {
284
- display: flex;
285
- align-items: center;
286
- gap: 1em;
287
- list-style: none;
288
- margin: 0;
289
- padding: 0.25em 0.5em;
290
- font-size: 0.8em;
291
- }
292
-
293
- .ol-attribution.ol-collapsed ul {
294
- display: none;
295
- }
296
-
297
- .ol-attribution.ol-uncollapsible button {
298
- display: none;
299
- }
300
-
301
- .ol-rotate {
302
- grid-area: compass;
303
- }
304
-
305
- .ol-compass:empty::before {
306
- content: var(--vaadin-map-icon-compass, '\\2191');
307
- }
308
-
309
- .ol-full-screen {
310
- grid-area: fullscreen;
311
- }
312
-
313
- .ol-full-screen button:empty::before {
314
- content: var(--vaadin-map-icon-fullscreen, '\\2922');
315
- }
316
-
317
- .ol-full-screen .ol-full-screen-true:empty::before {
318
- content: var(--vaadin-map-icon-close, '\\00D7');
319
- }
320
-
321
- .ol-overviewmap {
322
- grid-area: overview-map;
323
- align-self: end;
324
- width: max-content;
325
- }
326
-
327
- .ol-overviewmap button span:empty::before {
328
- content: var(--vaadin-map-icon-overview-map-collapse, '\\25BE');
329
- }
330
-
331
- .ol-overviewmap.ol-collapsed button span:empty::before {
332
- content: var(--vaadin-map-icon-overview-map-expand, '\\25B4');
333
- }
334
-
335
- .ol-overviewmap-map {
336
- height: 10em;
337
- width: 10em;
338
- border: 1px solid rgba(0, 0, 0, 0.5);
339
- }
340
-
341
- .ol-overviewmap.ol-collapsed .ol-overviewmap-map,
342
- .ol-overviewmap.ol-uncollapsible button {
343
- display: none;
344
- }
345
-
346
- .ol-overviewmap-box {
347
- border: 1px dashed rgba(0, 0, 0, 0.5);
348
- filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
349
- will-change: filter;
350
- cursor: move;
351
- }
352
-
353
- .ol-zoomslider {
354
- grid-area: zoom-slider;
355
- height: 8em;
356
- }
357
-
358
- .ol-zoomslider button {
359
- position: relative;
360
- height: 0.5em;
361
- display: block;
362
- border-radius: inherit;
363
- }
364
-
365
- .ol-zoom-extent {
366
- grid-area: zoom-extent;
367
- align-self: end;
368
- }
369
- </style>
370
- `;
371
- }
372
-
60
+ class Map extends MapMixin(ThemableMixin(ElementMixin(PolymerElement))) {
373
61
  static get is() {
374
62
  return 'vaadin-map';
375
63
  }
@@ -378,84 +66,8 @@ class Map extends ResizeMixin(FocusMixin(ElementMixin(ThemableMixin(PolymerEleme
378
66
  return 'vaadin-map';
379
67
  }
380
68
 
381
- constructor() {
382
- super();
383
- // Create map container element and initialize OL map instance
384
- this._mapTarget = document.createElement('div');
385
- this._mapTarget.id = 'map';
386
- // Ensure accessible keyboard controls are enabled
387
- this._mapTarget.setAttribute('tabindex', '0');
388
- const options = {
389
- // Override default controls to remove default labels, which is required to
390
- // correctly display icons through pseudo-element
391
- controls: defaultControls({
392
- rotate: false,
393
- zoomOptions: { zoomInLabel: '', zoomOutLabel: '' },
394
- }),
395
- // Override default interactions to allow mouse-wheel zoom + drag-pan when not focused
396
- interactions: defaultInteractions({ onFocusOnly: false }),
397
- target: this._mapTarget,
398
- };
399
- this._configuration = new OpenLayersMap(options);
400
- }
401
-
402
- /**
403
- * The internal OpenLayers map instance used to configure the map.
404
- * See the OpenLayers [API](https://openlayers.org/en/latest/apidoc/) and
405
- * [examples](https://openlayers.org/en/latest/examples/) for further information.
406
- * @returns {*}
407
- */
408
- get configuration() {
409
- return this._configuration;
410
- }
411
-
412
- /** @protected */
413
- ready() {
414
- super.ready();
415
- // Add map container to shadow root, trigger OL resize calculation
416
- this.shadowRoot.appendChild(this._mapTarget);
417
- this.__addMapFocusListeners();
418
- }
419
-
420
- /**
421
- * Implements resize callback from ResizeMixin to update size of OL map instance
422
- * @override
423
- * @protected
424
- */
425
- _onResize(_contentRect) {
426
- this._configuration.updateSize();
427
- }
428
-
429
- /**
430
- * Registers focus listeners on the map container to manually manage focus in
431
- * FocusMixin. FocusMixin currently assumes that the focusable element will
432
- * be in the light DOM and is available as event target.
433
- * The map container however is in the shadow DOM and thus focus events will
434
- * always have the host element as target.
435
- * @private
436
- */
437
- __addMapFocusListeners() {
438
- this._mapTarget.addEventListener('focusin', (e) => {
439
- if (e.target === this._mapTarget) {
440
- this._setFocused(true);
441
- }
442
- });
443
- this._mapTarget.addEventListener('focusout', () => {
444
- this._setFocused(false);
445
- });
446
- }
447
-
448
- /**
449
- * Overrides method from `FocusMixin` to disable automatic focus management.
450
- * See custom logic in __addMapFocusListeners
451
- *
452
- * @param {FocusEvent} _event
453
- * @return {boolean}
454
- * @override
455
- * @protected
456
- */
457
- _shouldSetFocus(_event) {
458
- return false;
69
+ static get template() {
70
+ return html``;
459
71
  }
460
72
  }
461
73
 
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import './vaadin-map-styles.js';
12
+ import '../../src/vaadin-lit-map.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import './vaadin-map-styles.js';
12
+ import '../../src/vaadin-lit-map.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import './vaadin-map-styles.js';
12
+ import '../../src/vaadin-lit-map.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import './vaadin-map-styles.js';
12
+ import '../../src/vaadin-lit-map.js';
@@ -0,0 +1 @@
1
+ export * from './vaadin-map.js';
@@ -0,0 +1,2 @@
1
+ import './theme/lumo/vaadin-lit-map.js';
2
+ export * from './src/vaadin-lit-map.js';
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/map",
4
- "version": "24.7.0-alpha4",
4
+ "version": "24.7.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/map",
4
- "version": "24.7.0-alpha4",
4
+ "version": "24.7.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {