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