decidim 0.26.9 → 0.26.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/lib/decidim/version.rb +1 -1
  3. data/package-lock.json +7 -7
  4. data/packages/browserslist-config/package.json +1 -1
  5. data/packages/core/node_modules/leaflet/CHANGELOG.md +2191 -0
  6. data/packages/core/node_modules/leaflet/LICENSE +26 -0
  7. data/packages/core/node_modules/leaflet/README.md +55 -0
  8. data/packages/core/node_modules/leaflet/dist/images/layers-2x.png +0 -0
  9. data/packages/core/node_modules/leaflet/dist/images/layers.png +0 -0
  10. data/packages/core/node_modules/leaflet/dist/images/marker-icon-2x.png +0 -0
  11. data/packages/core/node_modules/leaflet/dist/images/marker-icon.png +0 -0
  12. data/packages/core/node_modules/leaflet/dist/images/marker-shadow.png +0 -0
  13. data/packages/core/node_modules/leaflet/dist/leaflet-src.esm.js +14419 -0
  14. data/packages/core/node_modules/leaflet/dist/leaflet-src.esm.js.map +1 -0
  15. data/packages/core/node_modules/leaflet/dist/leaflet-src.js +14512 -0
  16. data/packages/core/node_modules/leaflet/dist/leaflet-src.js.map +1 -0
  17. data/packages/core/node_modules/leaflet/dist/leaflet.css +661 -0
  18. data/packages/core/node_modules/leaflet/dist/leaflet.js +6 -0
  19. data/packages/core/node_modules/leaflet/dist/leaflet.js.map +1 -0
  20. data/packages/core/node_modules/leaflet/package.json +149 -0
  21. data/packages/core/node_modules/leaflet/src/Leaflet.js +24 -0
  22. data/packages/core/node_modules/leaflet/src/control/Control.Attribution.js +148 -0
  23. data/packages/core/node_modules/leaflet/src/control/Control.Layers.js +443 -0
  24. data/packages/core/node_modules/leaflet/src/control/Control.Scale.js +132 -0
  25. data/packages/core/node_modules/leaflet/src/control/Control.Zoom.js +146 -0
  26. data/packages/core/node_modules/leaflet/src/control/Control.js +174 -0
  27. data/packages/core/node_modules/leaflet/src/control/index.js +17 -0
  28. data/packages/core/node_modules/leaflet/src/core/Browser.js +220 -0
  29. data/packages/core/node_modules/leaflet/src/core/Class.js +135 -0
  30. data/packages/core/node_modules/leaflet/src/core/Class.leafdoc +197 -0
  31. data/packages/core/node_modules/leaflet/src/core/Events.js +344 -0
  32. data/packages/core/node_modules/leaflet/src/core/Events.leafdoc +143 -0
  33. data/packages/core/node_modules/leaflet/src/core/Handler.js +57 -0
  34. data/packages/core/node_modules/leaflet/src/core/Util.js +241 -0
  35. data/packages/core/node_modules/leaflet/src/core/index.js +15 -0
  36. data/packages/core/node_modules/leaflet/src/dom/DomEvent.DoubleTap.js +91 -0
  37. data/packages/core/node_modules/leaflet/src/dom/DomEvent.Pointer.js +97 -0
  38. data/packages/core/node_modules/leaflet/src/dom/DomEvent.js +315 -0
  39. data/packages/core/node_modules/leaflet/src/dom/DomUtil.js +349 -0
  40. data/packages/core/node_modules/leaflet/src/dom/Draggable.js +220 -0
  41. data/packages/core/node_modules/leaflet/src/dom/PosAnimation.js +113 -0
  42. data/packages/core/node_modules/leaflet/src/dom/index.js +9 -0
  43. data/packages/core/node_modules/leaflet/src/geo/LatLng.js +137 -0
  44. data/packages/core/node_modules/leaflet/src/geo/LatLngBounds.js +251 -0
  45. data/packages/core/node_modules/leaflet/src/geo/crs/CRS.EPSG3395.js +20 -0
  46. data/packages/core/node_modules/leaflet/src/geo/crs/CRS.EPSG3857.js +27 -0
  47. data/packages/core/node_modules/leaflet/src/geo/crs/CRS.EPSG4326.js +23 -0
  48. data/packages/core/node_modules/leaflet/src/geo/crs/CRS.Earth.js +33 -0
  49. data/packages/core/node_modules/leaflet/src/geo/crs/CRS.Simple.js +36 -0
  50. data/packages/core/node_modules/leaflet/src/geo/crs/CRS.js +139 -0
  51. data/packages/core/node_modules/leaflet/src/geo/crs/index.js +15 -0
  52. data/packages/core/node_modules/leaflet/src/geo/index.js +7 -0
  53. data/packages/core/node_modules/leaflet/src/geo/projection/Projection.LonLat.js +28 -0
  54. data/packages/core/node_modules/leaflet/src/geo/projection/Projection.Mercator.js +49 -0
  55. data/packages/core/node_modules/leaflet/src/geo/projection/Projection.SphericalMercator.js +44 -0
  56. data/packages/core/node_modules/leaflet/src/geo/projection/index.js +26 -0
  57. data/packages/core/node_modules/leaflet/src/geometry/Bounds.js +219 -0
  58. data/packages/core/node_modules/leaflet/src/geometry/LineUtil.js +306 -0
  59. data/packages/core/node_modules/leaflet/src/geometry/Point.js +222 -0
  60. data/packages/core/node_modules/leaflet/src/geometry/PolyUtil.js +129 -0
  61. data/packages/core/node_modules/leaflet/src/geometry/Transformation.js +79 -0
  62. data/packages/core/node_modules/leaflet/src/geometry/index.js +8 -0
  63. data/packages/core/node_modules/leaflet/src/images/layers.svg +1 -0
  64. data/packages/core/node_modules/leaflet/src/images/logo.svg +1 -0
  65. data/packages/core/node_modules/leaflet/src/images/marker.svg +1 -0
  66. data/packages/core/node_modules/leaflet/src/layer/DivOverlay.js +348 -0
  67. data/packages/core/node_modules/leaflet/src/layer/FeatureGroup.js +94 -0
  68. data/packages/core/node_modules/leaflet/src/layer/GeoJSON.js +452 -0
  69. data/packages/core/node_modules/leaflet/src/layer/ImageOverlay.js +270 -0
  70. data/packages/core/node_modules/leaflet/src/layer/Layer.Interactive.leafdoc +39 -0
  71. data/packages/core/node_modules/leaflet/src/layer/Layer.js +275 -0
  72. data/packages/core/node_modules/leaflet/src/layer/LayerGroup.js +159 -0
  73. data/packages/core/node_modules/leaflet/src/layer/Popup.js +506 -0
  74. data/packages/core/node_modules/leaflet/src/layer/SVGOverlay.js +50 -0
  75. data/packages/core/node_modules/leaflet/src/layer/Tooltip.js +444 -0
  76. data/packages/core/node_modules/leaflet/src/layer/VideoOverlay.js +106 -0
  77. data/packages/core/node_modules/leaflet/src/layer/index.js +24 -0
  78. data/packages/core/node_modules/leaflet/src/layer/marker/DivIcon.js +74 -0
  79. data/packages/core/node_modules/leaflet/src/layer/marker/Icon.Default.js +66 -0
  80. data/packages/core/node_modules/leaflet/src/layer/marker/Icon.js +165 -0
  81. data/packages/core/node_modules/leaflet/src/layer/marker/Marker.Drag.js +161 -0
  82. data/packages/core/node_modules/leaflet/src/layer/marker/Marker.js +419 -0
  83. data/packages/core/node_modules/leaflet/src/layer/marker/index.js +8 -0
  84. data/packages/core/node_modules/leaflet/src/layer/tile/GridLayer.js +923 -0
  85. data/packages/core/node_modules/leaflet/src/layer/tile/TileLayer.WMS.js +137 -0
  86. data/packages/core/node_modules/leaflet/src/layer/tile/TileLayer.js +289 -0
  87. data/packages/core/node_modules/leaflet/src/layer/tile/index.js +6 -0
  88. data/packages/core/node_modules/leaflet/src/layer/vector/Canvas.js +492 -0
  89. data/packages/core/node_modules/leaflet/src/layer/vector/Circle.js +113 -0
  90. data/packages/core/node_modules/leaflet/src/layer/vector/CircleMarker.js +109 -0
  91. data/packages/core/node_modules/leaflet/src/layer/vector/Path.js +148 -0
  92. data/packages/core/node_modules/leaflet/src/layer/vector/Polygon.js +159 -0
  93. data/packages/core/node_modules/leaflet/src/layer/vector/Polyline.js +307 -0
  94. data/packages/core/node_modules/leaflet/src/layer/vector/Rectangle.js +57 -0
  95. data/packages/core/node_modules/leaflet/src/layer/vector/Renderer.getRenderer.js +45 -0
  96. data/packages/core/node_modules/leaflet/src/layer/vector/Renderer.js +133 -0
  97. data/packages/core/node_modules/leaflet/src/layer/vector/SVG.Util.js +39 -0
  98. data/packages/core/node_modules/leaflet/src/layer/vector/SVG.VML.js +144 -0
  99. data/packages/core/node_modules/leaflet/src/layer/vector/SVG.js +207 -0
  100. data/packages/core/node_modules/leaflet/src/layer/vector/index.js +14 -0
  101. data/packages/core/node_modules/leaflet/src/map/Map.js +1751 -0
  102. data/packages/core/node_modules/leaflet/src/map/Map.methodOptions.leafdoc +112 -0
  103. data/packages/core/node_modules/leaflet/src/map/handler/Map.BoxZoom.js +152 -0
  104. data/packages/core/node_modules/leaflet/src/map/handler/Map.DoubleClickZoom.js +55 -0
  105. data/packages/core/node_modules/leaflet/src/map/handler/Map.Drag.js +235 -0
  106. data/packages/core/node_modules/leaflet/src/map/handler/Map.Keyboard.js +183 -0
  107. data/packages/core/node_modules/leaflet/src/map/handler/Map.ScrollWheelZoom.js +91 -0
  108. data/packages/core/node_modules/leaflet/src/map/handler/Map.TapHold.js +102 -0
  109. data/packages/core/node_modules/leaflet/src/map/handler/Map.TouchZoom.js +130 -0
  110. data/packages/core/node_modules/leaflet/src/map/index.js +17 -0
  111. data/packages/core/package.json +1 -1
  112. data/packages/dev/package.json +1 -1
  113. data/packages/elections/package.json +1 -1
  114. data/packages/eslint-config/package.json +1 -1
  115. data/packages/stylelint-config/package.json +1 -1
  116. data/packages/webpacker/package.json +1 -1
  117. metadata +148 -42
@@ -0,0 +1,146 @@
1
+
2
+ import {Control} from './Control';
3
+ import {Map} from '../map/Map';
4
+ import * as DomUtil from '../dom/DomUtil';
5
+ import * as DomEvent from '../dom/DomEvent';
6
+
7
+ /*
8
+ * @class Control.Zoom
9
+ * @aka L.Control.Zoom
10
+ * @inherits Control
11
+ *
12
+ * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.
13
+ */
14
+
15
+ export var Zoom = Control.extend({
16
+ // @section
17
+ // @aka Control.Zoom options
18
+ options: {
19
+ position: 'topleft',
20
+
21
+ // @option zoomInText: String = '<span aria-hidden="true">+</span>'
22
+ // The text set on the 'zoom in' button.
23
+ zoomInText: '<span aria-hidden="true">+</span>',
24
+
25
+ // @option zoomInTitle: String = 'Zoom in'
26
+ // The title set on the 'zoom in' button.
27
+ zoomInTitle: 'Zoom in',
28
+
29
+ // @option zoomOutText: String = '<span aria-hidden="true">&#x2212;</span>'
30
+ // The text set on the 'zoom out' button.
31
+ zoomOutText: '<span aria-hidden="true">&#x2212;</span>',
32
+
33
+ // @option zoomOutTitle: String = 'Zoom out'
34
+ // The title set on the 'zoom out' button.
35
+ zoomOutTitle: 'Zoom out'
36
+ },
37
+
38
+ onAdd: function (map) {
39
+ var zoomName = 'leaflet-control-zoom',
40
+ container = DomUtil.create('div', zoomName + ' leaflet-bar'),
41
+ options = this.options;
42
+
43
+ this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle,
44
+ zoomName + '-in', container, this._zoomIn);
45
+ this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle,
46
+ zoomName + '-out', container, this._zoomOut);
47
+
48
+ this._updateDisabled();
49
+ map.on('zoomend zoomlevelschange', this._updateDisabled, this);
50
+
51
+ return container;
52
+ },
53
+
54
+ onRemove: function (map) {
55
+ map.off('zoomend zoomlevelschange', this._updateDisabled, this);
56
+ },
57
+
58
+ disable: function () {
59
+ this._disabled = true;
60
+ this._updateDisabled();
61
+ return this;
62
+ },
63
+
64
+ enable: function () {
65
+ this._disabled = false;
66
+ this._updateDisabled();
67
+ return this;
68
+ },
69
+
70
+ _zoomIn: function (e) {
71
+ if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {
72
+ this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
73
+ }
74
+ },
75
+
76
+ _zoomOut: function (e) {
77
+ if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {
78
+ this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
79
+ }
80
+ },
81
+
82
+ _createButton: function (html, title, className, container, fn) {
83
+ var link = DomUtil.create('a', className, container);
84
+ link.innerHTML = html;
85
+ link.href = '#';
86
+ link.title = title;
87
+
88
+ /*
89
+ * Will force screen readers like VoiceOver to read this as "Zoom in - button"
90
+ */
91
+ link.setAttribute('role', 'button');
92
+ link.setAttribute('aria-label', title);
93
+
94
+ DomEvent.disableClickPropagation(link);
95
+ DomEvent.on(link, 'click', DomEvent.stop);
96
+ DomEvent.on(link, 'click', fn, this);
97
+ DomEvent.on(link, 'click', this._refocusOnMap, this);
98
+
99
+ return link;
100
+ },
101
+
102
+ _updateDisabled: function () {
103
+ var map = this._map,
104
+ className = 'leaflet-disabled';
105
+
106
+ DomUtil.removeClass(this._zoomInButton, className);
107
+ DomUtil.removeClass(this._zoomOutButton, className);
108
+ this._zoomInButton.setAttribute('aria-disabled', 'false');
109
+ this._zoomOutButton.setAttribute('aria-disabled', 'false');
110
+
111
+ if (this._disabled || map._zoom === map.getMinZoom()) {
112
+ DomUtil.addClass(this._zoomOutButton, className);
113
+ this._zoomOutButton.setAttribute('aria-disabled', 'true');
114
+ }
115
+ if (this._disabled || map._zoom === map.getMaxZoom()) {
116
+ DomUtil.addClass(this._zoomInButton, className);
117
+ this._zoomInButton.setAttribute('aria-disabled', 'true');
118
+ }
119
+ }
120
+ });
121
+
122
+ // @namespace Map
123
+ // @section Control options
124
+ // @option zoomControl: Boolean = true
125
+ // Whether a [zoom control](#control-zoom) is added to the map by default.
126
+ Map.mergeOptions({
127
+ zoomControl: true
128
+ });
129
+
130
+ Map.addInitHook(function () {
131
+ if (this.options.zoomControl) {
132
+ // @section Controls
133
+ // @property zoomControl: Control.Zoom
134
+ // The default zoom control (only available if the
135
+ // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).
136
+ this.zoomControl = new Zoom();
137
+ this.addControl(this.zoomControl);
138
+ }
139
+ });
140
+
141
+ // @namespace Control.Zoom
142
+ // @factory L.control.zoom(options: Control.Zoom options)
143
+ // Creates a zoom control
144
+ export var zoom = function (options) {
145
+ return new Zoom(options);
146
+ };
@@ -0,0 +1,174 @@
1
+
2
+ import {Class} from '../core/Class';
3
+ import {Map} from '../map/Map';
4
+ import * as Util from '../core/Util';
5
+ import * as DomUtil from '../dom/DomUtil';
6
+
7
+ /*
8
+ * @class Control
9
+ * @aka L.Control
10
+ * @inherits Class
11
+ *
12
+ * L.Control is a base class for implementing map controls. Handles positioning.
13
+ * All other controls extend from this class.
14
+ */
15
+
16
+ export var Control = Class.extend({
17
+ // @section
18
+ // @aka Control Options
19
+ options: {
20
+ // @option position: String = 'topright'
21
+ // The position of the control (one of the map corners). Possible values are `'topleft'`,
22
+ // `'topright'`, `'bottomleft'` or `'bottomright'`
23
+ position: 'topright'
24
+ },
25
+
26
+ initialize: function (options) {
27
+ Util.setOptions(this, options);
28
+ },
29
+
30
+ /* @section
31
+ * Classes extending L.Control will inherit the following methods:
32
+ *
33
+ * @method getPosition: string
34
+ * Returns the position of the control.
35
+ */
36
+ getPosition: function () {
37
+ return this.options.position;
38
+ },
39
+
40
+ // @method setPosition(position: string): this
41
+ // Sets the position of the control.
42
+ setPosition: function (position) {
43
+ var map = this._map;
44
+
45
+ if (map) {
46
+ map.removeControl(this);
47
+ }
48
+
49
+ this.options.position = position;
50
+
51
+ if (map) {
52
+ map.addControl(this);
53
+ }
54
+
55
+ return this;
56
+ },
57
+
58
+ // @method getContainer: HTMLElement
59
+ // Returns the HTMLElement that contains the control.
60
+ getContainer: function () {
61
+ return this._container;
62
+ },
63
+
64
+ // @method addTo(map: Map): this
65
+ // Adds the control to the given map.
66
+ addTo: function (map) {
67
+ this.remove();
68
+ this._map = map;
69
+
70
+ var container = this._container = this.onAdd(map),
71
+ pos = this.getPosition(),
72
+ corner = map._controlCorners[pos];
73
+
74
+ DomUtil.addClass(container, 'leaflet-control');
75
+
76
+ if (pos.indexOf('bottom') !== -1) {
77
+ corner.insertBefore(container, corner.firstChild);
78
+ } else {
79
+ corner.appendChild(container);
80
+ }
81
+
82
+ this._map.on('unload', this.remove, this);
83
+
84
+ return this;
85
+ },
86
+
87
+ // @method remove: this
88
+ // Removes the control from the map it is currently active on.
89
+ remove: function () {
90
+ if (!this._map) {
91
+ return this;
92
+ }
93
+
94
+ DomUtil.remove(this._container);
95
+
96
+ if (this.onRemove) {
97
+ this.onRemove(this._map);
98
+ }
99
+
100
+ this._map.off('unload', this.remove, this);
101
+ this._map = null;
102
+
103
+ return this;
104
+ },
105
+
106
+ _refocusOnMap: function (e) {
107
+ // if map exists and event is not a keyboard event
108
+ if (this._map && e && e.screenX > 0 && e.screenY > 0) {
109
+ this._map.getContainer().focus();
110
+ }
111
+ }
112
+ });
113
+
114
+ export var control = function (options) {
115
+ return new Control(options);
116
+ };
117
+
118
+ /* @section Extension methods
119
+ * @uninheritable
120
+ *
121
+ * Every control should extend from `L.Control` and (re-)implement the following methods.
122
+ *
123
+ * @method onAdd(map: Map): HTMLElement
124
+ * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).
125
+ *
126
+ * @method onRemove(map: Map)
127
+ * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).
128
+ */
129
+
130
+ /* @namespace Map
131
+ * @section Methods for Layers and Controls
132
+ */
133
+ Map.include({
134
+ // @method addControl(control: Control): this
135
+ // Adds the given control to the map
136
+ addControl: function (control) {
137
+ control.addTo(this);
138
+ return this;
139
+ },
140
+
141
+ // @method removeControl(control: Control): this
142
+ // Removes the given control from the map
143
+ removeControl: function (control) {
144
+ control.remove();
145
+ return this;
146
+ },
147
+
148
+ _initControlPos: function () {
149
+ var corners = this._controlCorners = {},
150
+ l = 'leaflet-',
151
+ container = this._controlContainer =
152
+ DomUtil.create('div', l + 'control-container', this._container);
153
+
154
+ function createCorner(vSide, hSide) {
155
+ var className = l + vSide + ' ' + l + hSide;
156
+
157
+ corners[vSide + hSide] = DomUtil.create('div', className, container);
158
+ }
159
+
160
+ createCorner('top', 'left');
161
+ createCorner('top', 'right');
162
+ createCorner('bottom', 'left');
163
+ createCorner('bottom', 'right');
164
+ },
165
+
166
+ _clearControlPos: function () {
167
+ for (var i in this._controlCorners) {
168
+ DomUtil.remove(this._controlCorners[i]);
169
+ }
170
+ DomUtil.remove(this._controlContainer);
171
+ delete this._controlCorners;
172
+ delete this._controlContainer;
173
+ }
174
+ });
@@ -0,0 +1,17 @@
1
+ import {Control, control} from './Control';
2
+ import {Layers, layers} from './Control.Layers';
3
+ import {Zoom, zoom} from './Control.Zoom';
4
+ import {Scale, scale} from './Control.Scale';
5
+ import {Attribution, attribution} from './Control.Attribution';
6
+
7
+ Control.Layers = Layers;
8
+ Control.Zoom = Zoom;
9
+ Control.Scale = Scale;
10
+ Control.Attribution = Attribution;
11
+
12
+ control.layers = layers;
13
+ control.zoom = zoom;
14
+ control.scale = scale;
15
+ control.attribution = attribution;
16
+
17
+ export {Control, control};
@@ -0,0 +1,220 @@
1
+ import * as Util from './Util';
2
+ import {svgCreate} from '../layer/vector/SVG.Util';
3
+
4
+ /*
5
+ * @namespace Browser
6
+ * @aka L.Browser
7
+ *
8
+ * A namespace with static properties for browser/feature detection used by Leaflet internally.
9
+ *
10
+ * @example
11
+ *
12
+ * ```js
13
+ * if (L.Browser.ielt9) {
14
+ * alert('Upgrade your browser, dude!');
15
+ * }
16
+ * ```
17
+ */
18
+
19
+ var style = document.documentElement.style;
20
+
21
+ // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).
22
+ var ie = 'ActiveXObject' in window;
23
+
24
+ // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.
25
+ var ielt9 = ie && !document.addEventListener;
26
+
27
+ // @property edge: Boolean; `true` for the Edge web browser.
28
+ var edge = 'msLaunchUri' in navigator && !('documentMode' in document);
29
+
30
+ // @property webkit: Boolean;
31
+ // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).
32
+ var webkit = userAgentContains('webkit');
33
+
34
+ // @property android: Boolean
35
+ // **Deprecated.** `true` for any browser running on an Android platform.
36
+ var android = userAgentContains('android');
37
+
38
+ // @property android23: Boolean; **Deprecated.** `true` for browsers running on Android 2 or Android 3.
39
+ var android23 = userAgentContains('android 2') || userAgentContains('android 3');
40
+
41
+ /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */
42
+ var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit
43
+ // @property androidStock: Boolean; **Deprecated.** `true` for the Android stock browser (i.e. not Chrome)
44
+ var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);
45
+
46
+ // @property opera: Boolean; `true` for the Opera browser
47
+ var opera = !!window.opera;
48
+
49
+ // @property chrome: Boolean; `true` for the Chrome browser.
50
+ var chrome = !edge && userAgentContains('chrome');
51
+
52
+ // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.
53
+ var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;
54
+
55
+ // @property safari: Boolean; `true` for the Safari browser.
56
+ var safari = !chrome && userAgentContains('safari');
57
+
58
+ var phantom = userAgentContains('phantom');
59
+
60
+ // @property opera12: Boolean
61
+ // `true` for the Opera browser supporting CSS transforms (version 12 or later).
62
+ var opera12 = 'OTransition' in style;
63
+
64
+ // @property win: Boolean; `true` when the browser is running in a Windows platform
65
+ var win = navigator.platform.indexOf('Win') === 0;
66
+
67
+ // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.
68
+ var ie3d = ie && ('transition' in style);
69
+
70
+ // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.
71
+ var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;
72
+
73
+ // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.
74
+ var gecko3d = 'MozPerspective' in style;
75
+
76
+ // @property any3d: Boolean
77
+ // `true` for all browsers supporting CSS transforms.
78
+ var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;
79
+
80
+ // @property mobile: Boolean; `true` for all browsers running in a mobile device.
81
+ var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');
82
+
83
+ // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.
84
+ var mobileWebkit = mobile && webkit;
85
+
86
+ // @property mobileWebkit3d: Boolean
87
+ // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.
88
+ var mobileWebkit3d = mobile && webkit3d;
89
+
90
+ // @property msPointer: Boolean
91
+ // `true` for browsers implementing the Microsoft touch events model (notably IE10).
92
+ var msPointer = !window.PointerEvent && window.MSPointerEvent;
93
+
94
+ // @property pointer: Boolean
95
+ // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
96
+ var pointer = !!(window.PointerEvent || msPointer);
97
+
98
+ // @property touchNative: Boolean
99
+ // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
100
+ // **This does not necessarily mean** that the browser is running in a computer with
101
+ // a touchscreen, it only means that the browser is capable of understanding
102
+ // touch events.
103
+ var touchNative = 'ontouchstart' in window || !!window.TouchEvent;
104
+
105
+ // @property touch: Boolean
106
+ // `true` for all browsers supporting either [touch](#browser-touch) or [pointer](#browser-pointer) events.
107
+ // Note: pointer events will be preferred (if available), and processed for all `touch*` listeners.
108
+ var touch = !window.L_NO_TOUCH && (touchNative || pointer);
109
+
110
+ // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.
111
+ var mobileOpera = mobile && opera;
112
+
113
+ // @property mobileGecko: Boolean
114
+ // `true` for gecko-based browsers running in a mobile device.
115
+ var mobileGecko = mobile && gecko;
116
+
117
+ // @property retina: Boolean
118
+ // `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
119
+ var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
120
+
121
+ // @property passiveEvents: Boolean
122
+ // `true` for browsers that support passive events.
123
+ var passiveEvents = (function () {
124
+ var supportsPassiveOption = false;
125
+ try {
126
+ var opts = Object.defineProperty({}, 'passive', {
127
+ get: function () { // eslint-disable-line getter-return
128
+ supportsPassiveOption = true;
129
+ }
130
+ });
131
+ window.addEventListener('testPassiveEventSupport', Util.falseFn, opts);
132
+ window.removeEventListener('testPassiveEventSupport', Util.falseFn, opts);
133
+ } catch (e) {
134
+ // Errors can safely be ignored since this is only a browser support test.
135
+ }
136
+ return supportsPassiveOption;
137
+ }());
138
+
139
+ // @property canvas: Boolean
140
+ // `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
141
+ var canvas = (function () {
142
+ return !!document.createElement('canvas').getContext;
143
+ }());
144
+
145
+ // @property svg: Boolean
146
+ // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).
147
+ var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect);
148
+
149
+ var inlineSvg = !!svg && (function () {
150
+ var div = document.createElement('div');
151
+ div.innerHTML = '<svg/>';
152
+ return (div.firstChild && div.firstChild.namespaceURI) === 'http://www.w3.org/2000/svg';
153
+ })();
154
+
155
+ // @property vml: Boolean
156
+ // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).
157
+ var vml = !svg && (function () {
158
+ try {
159
+ var div = document.createElement('div');
160
+ div.innerHTML = '<v:shape adj="1"/>';
161
+
162
+ var shape = div.firstChild;
163
+ shape.style.behavior = 'url(#default#VML)';
164
+
165
+ return shape && (typeof shape.adj === 'object');
166
+
167
+ } catch (e) {
168
+ return false;
169
+ }
170
+ }());
171
+
172
+
173
+ // @property mac: Boolean; `true` when the browser is running in a Mac platform
174
+ var mac = navigator.platform.indexOf('Mac') === 0;
175
+
176
+ // @property mac: Boolean; `true` when the browser is running in a Linux platform
177
+ var linux = navigator.platform.indexOf('Linux') === 0;
178
+
179
+ function userAgentContains(str) {
180
+ return navigator.userAgent.toLowerCase().indexOf(str) >= 0;
181
+ }
182
+
183
+
184
+ export default {
185
+ ie: ie,
186
+ ielt9: ielt9,
187
+ edge: edge,
188
+ webkit: webkit,
189
+ android: android,
190
+ android23: android23,
191
+ androidStock: androidStock,
192
+ opera: opera,
193
+ chrome: chrome,
194
+ gecko: gecko,
195
+ safari: safari,
196
+ phantom: phantom,
197
+ opera12: opera12,
198
+ win: win,
199
+ ie3d: ie3d,
200
+ webkit3d: webkit3d,
201
+ gecko3d: gecko3d,
202
+ any3d: any3d,
203
+ mobile: mobile,
204
+ mobileWebkit: mobileWebkit,
205
+ mobileWebkit3d: mobileWebkit3d,
206
+ msPointer: msPointer,
207
+ pointer: pointer,
208
+ touch: touch,
209
+ touchNative: touchNative,
210
+ mobileOpera: mobileOpera,
211
+ mobileGecko: mobileGecko,
212
+ retina: retina,
213
+ passiveEvents: passiveEvents,
214
+ canvas: canvas,
215
+ svg: svg,
216
+ vml: vml,
217
+ inlineSvg: inlineSvg,
218
+ mac: mac,
219
+ linux: linux
220
+ };
@@ -0,0 +1,135 @@
1
+ import * as Util from './Util';
2
+
3
+ // @class Class
4
+ // @aka L.Class
5
+
6
+ // @section
7
+ // @uninheritable
8
+
9
+ // Thanks to John Resig and Dean Edwards for inspiration!
10
+
11
+ export function Class() {}
12
+
13
+ Class.extend = function (props) {
14
+
15
+ // @function extend(props: Object): Function
16
+ // [Extends the current class](#class-inheritance) given the properties to be included.
17
+ // Returns a Javascript function that is a class constructor (to be called with `new`).
18
+ var NewClass = function () {
19
+
20
+ Util.setOptions(this);
21
+
22
+ // call the constructor
23
+ if (this.initialize) {
24
+ this.initialize.apply(this, arguments);
25
+ }
26
+
27
+ // call all constructor hooks
28
+ this.callInitHooks();
29
+ };
30
+
31
+ var parentProto = NewClass.__super__ = this.prototype;
32
+
33
+ var proto = Util.create(parentProto);
34
+ proto.constructor = NewClass;
35
+
36
+ NewClass.prototype = proto;
37
+
38
+ // inherit parent's statics
39
+ for (var i in this) {
40
+ if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {
41
+ NewClass[i] = this[i];
42
+ }
43
+ }
44
+
45
+ // mix static properties into the class
46
+ if (props.statics) {
47
+ Util.extend(NewClass, props.statics);
48
+ }
49
+
50
+ // mix includes into the prototype
51
+ if (props.includes) {
52
+ checkDeprecatedMixinEvents(props.includes);
53
+ Util.extend.apply(null, [proto].concat(props.includes));
54
+ }
55
+
56
+ // mix given properties into the prototype
57
+ Util.extend(proto, props);
58
+ delete proto.statics;
59
+ delete proto.includes;
60
+
61
+ // merge options
62
+ if (proto.options) {
63
+ proto.options = parentProto.options ? Util.create(parentProto.options) : {};
64
+ Util.extend(proto.options, props.options);
65
+ }
66
+
67
+ proto._initHooks = [];
68
+
69
+ // add method for calling all hooks
70
+ proto.callInitHooks = function () {
71
+
72
+ if (this._initHooksCalled) { return; }
73
+
74
+ if (parentProto.callInitHooks) {
75
+ parentProto.callInitHooks.call(this);
76
+ }
77
+
78
+ this._initHooksCalled = true;
79
+
80
+ for (var i = 0, len = proto._initHooks.length; i < len; i++) {
81
+ proto._initHooks[i].call(this);
82
+ }
83
+ };
84
+
85
+ return NewClass;
86
+ };
87
+
88
+
89
+ // @function include(properties: Object): this
90
+ // [Includes a mixin](#class-includes) into the current class.
91
+ Class.include = function (props) {
92
+ var parentOptions = this.prototype.options;
93
+ Util.extend(this.prototype, props);
94
+ if (props.options) {
95
+ this.prototype.options = parentOptions;
96
+ this.mergeOptions(props.options);
97
+ }
98
+ return this;
99
+ };
100
+
101
+ // @function mergeOptions(options: Object): this
102
+ // [Merges `options`](#class-options) into the defaults of the class.
103
+ Class.mergeOptions = function (options) {
104
+ Util.extend(this.prototype.options, options);
105
+ return this;
106
+ };
107
+
108
+ // @function addInitHook(fn: Function): this
109
+ // Adds a [constructor hook](#class-constructor-hooks) to the class.
110
+ Class.addInitHook = function (fn) { // (Function) || (String, args...)
111
+ var args = Array.prototype.slice.call(arguments, 1);
112
+
113
+ var init = typeof fn === 'function' ? fn : function () {
114
+ this[fn].apply(this, args);
115
+ };
116
+
117
+ this.prototype._initHooks = this.prototype._initHooks || [];
118
+ this.prototype._initHooks.push(init);
119
+ return this;
120
+ };
121
+
122
+ function checkDeprecatedMixinEvents(includes) {
123
+ /* global L: true */
124
+ if (typeof L === 'undefined' || !L || !L.Mixin) { return; }
125
+
126
+ includes = Util.isArray(includes) ? includes : [includes];
127
+
128
+ for (var i = 0; i < includes.length; i++) {
129
+ if (includes[i] === L.Mixin.Events) {
130
+ console.warn('Deprecated include of L.Mixin.Events: ' +
131
+ 'this property will be removed in future releases, ' +
132
+ 'please inherit from L.Evented instead.', new Error().stack);
133
+ }
134
+ }
135
+ }