diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:45:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:45:13 +0000 |
commit | 3c99fde45db83b531c41c350ed4d0ac2a3c40c62 (patch) | |
tree | ad5257daf9e41556ed73875ab56b69162dffdac1 /debian/missing-sources/leaflet.js/core | |
parent | Adding upstream version 1.1.0. (diff) | |
download | icingaweb2-module-map-3c99fde45db83b531c41c350ed4d0ac2a3c40c62.tar.xz icingaweb2-module-map-3c99fde45db83b531c41c350ed4d0ac2a3c40c62.zip |
Adding debian version 1.1.0-3.debian/1.1.0-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/leaflet.js/core')
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Browser.js | 147 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Class.js | 126 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Class.leafdoc | 197 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Events.js | 295 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Events.leafdoc | 143 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Handler.js | 57 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/Util.js | 241 | ||||
-rw-r--r-- | debian/missing-sources/leaflet.js/core/index.js | 15 |
8 files changed, 1221 insertions, 0 deletions
diff --git a/debian/missing-sources/leaflet.js/core/Browser.js b/debian/missing-sources/leaflet.js/core/Browser.js new file mode 100644 index 0000000..a2d97f7 --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Browser.js @@ -0,0 +1,147 @@ +import {svgCreate} from '../layer/vector/SVG.Util';
+
+/*
+ * @namespace Browser
+ * @aka L.Browser
+ *
+ * A namespace with static properties for browser/feature detection used by Leaflet internally.
+ *
+ * @example
+ *
+ * ```js
+ * if (L.Browser.ielt9) {
+ * alert('Upgrade your browser, dude!');
+ * }
+ * ```
+ */
+
+var style = document.documentElement.style;
+
+// @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).
+export var ie = 'ActiveXObject' in window;
+
+// @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.
+export var ielt9 = ie && !document.addEventListener;
+
+// @property edge: Boolean; `true` for the Edge web browser.
+export var edge = 'msLaunchUri' in navigator && !('documentMode' in document);
+
+// @property webkit: Boolean;
+// `true` for webkit-based browsers like Chrome and Safari (including mobile versions).
+export var webkit = userAgentContains('webkit');
+
+// @property android: Boolean
+// `true` for any browser running on an Android platform.
+export var android = userAgentContains('android');
+
+// @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.
+export var android23 = userAgentContains('android 2') || userAgentContains('android 3');
+
+/* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */
+var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit
+// @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)
+export var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);
+
+// @property opera: Boolean; `true` for the Opera browser
+export var opera = !!window.opera;
+
+// @property chrome: Boolean; `true` for the Chrome browser.
+export var chrome = userAgentContains('chrome');
+
+// @property gecko: Boolean; `true` for gecko-based browsers like Firefox.
+export var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;
+
+// @property safari: Boolean; `true` for the Safari browser.
+export var safari = !chrome && userAgentContains('safari');
+
+export var phantom = userAgentContains('phantom');
+
+// @property opera12: Boolean
+// `true` for the Opera browser supporting CSS transforms (version 12 or later).
+export var opera12 = 'OTransition' in style;
+
+// @property win: Boolean; `true` when the browser is running in a Windows platform
+export var win = navigator.platform.indexOf('Win') === 0;
+
+// @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.
+export var ie3d = ie && ('transition' in style);
+
+// @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.
+export var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;
+
+// @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.
+export var gecko3d = 'MozPerspective' in style;
+
+// @property any3d: Boolean
+// `true` for all browsers supporting CSS transforms.
+export var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;
+
+// @property mobile: Boolean; `true` for all browsers running in a mobile device.
+export var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');
+
+// @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.
+export var mobileWebkit = mobile && webkit;
+
+// @property mobileWebkit3d: Boolean
+// `true` for all webkit-based browsers in a mobile device supporting CSS transforms.
+export var mobileWebkit3d = mobile && webkit3d;
+
+// @property msPointer: Boolean
+// `true` for browsers implementing the Microsoft touch events model (notably IE10).
+export var msPointer = !window.PointerEvent && window.MSPointerEvent;
+
+// @property pointer: Boolean
+// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
+export var pointer = !!(window.PointerEvent || msPointer);
+
+// @property touch: Boolean
+// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
+// This does not necessarily mean that the browser is running in a computer with
+// a touchscreen, it only means that the browser is capable of understanding
+// touch events.
+export var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||
+ (window.DocumentTouch && document instanceof window.DocumentTouch));
+
+// @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.
+export var mobileOpera = mobile && opera;
+
+// @property mobileGecko: Boolean
+// `true` for gecko-based browsers running in a mobile device.
+export var mobileGecko = mobile && gecko;
+
+// @property retina: Boolean
+// `true` for browsers on a high-resolution "retina" screen.
+export var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
+
+
+// @property canvas: Boolean
+// `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
+export var canvas = (function () {
+ return !!document.createElement('canvas').getContext;
+}());
+
+// @property svg: Boolean
+// `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).
+export var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect);
+
+// @property vml: Boolean
+// `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).
+export var vml = !svg && (function () {
+ try {
+ var div = document.createElement('div');
+ div.innerHTML = '<v:shape adj="1"/>';
+
+ var shape = div.firstChild;
+ shape.style.behavior = 'url(#default#VML)';
+
+ return shape && (typeof shape.adj === 'object');
+
+ } catch (e) {
+ return false;
+ }
+}());
+
+
+function userAgentContains(str) {
+ return navigator.userAgent.toLowerCase().indexOf(str) >= 0;
+}
diff --git a/debian/missing-sources/leaflet.js/core/Class.js b/debian/missing-sources/leaflet.js/core/Class.js new file mode 100644 index 0000000..df367b6 --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Class.js @@ -0,0 +1,126 @@ +import * as Util from './Util';
+
+// @class Class
+// @aka L.Class
+
+// @section
+// @uninheritable
+
+// Thanks to John Resig and Dean Edwards for inspiration!
+
+export function Class() {}
+
+Class.extend = function (props) {
+
+ // @function extend(props: Object): Function
+ // [Extends the current class](#class-inheritance) given the properties to be included.
+ // Returns a Javascript function that is a class constructor (to be called with `new`).
+ var NewClass = function () {
+
+ // call the constructor
+ if (this.initialize) {
+ this.initialize.apply(this, arguments);
+ }
+
+ // call all constructor hooks
+ this.callInitHooks();
+ };
+
+ var parentProto = NewClass.__super__ = this.prototype;
+
+ var proto = Util.create(parentProto);
+ proto.constructor = NewClass;
+
+ NewClass.prototype = proto;
+
+ // inherit parent's statics
+ for (var i in this) {
+ if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') {
+ NewClass[i] = this[i];
+ }
+ }
+
+ // mix static properties into the class
+ if (props.statics) {
+ Util.extend(NewClass, props.statics);
+ delete props.statics;
+ }
+
+ // mix includes into the prototype
+ if (props.includes) {
+ checkDeprecatedMixinEvents(props.includes);
+ Util.extend.apply(null, [proto].concat(props.includes));
+ delete props.includes;
+ }
+
+ // merge options
+ if (proto.options) {
+ props.options = Util.extend(Util.create(proto.options), props.options);
+ }
+
+ // mix given properties into the prototype
+ Util.extend(proto, props);
+
+ proto._initHooks = [];
+
+ // add method for calling all hooks
+ proto.callInitHooks = function () {
+
+ if (this._initHooksCalled) { return; }
+
+ if (parentProto.callInitHooks) {
+ parentProto.callInitHooks.call(this);
+ }
+
+ this._initHooksCalled = true;
+
+ for (var i = 0, len = proto._initHooks.length; i < len; i++) {
+ proto._initHooks[i].call(this);
+ }
+ };
+
+ return NewClass;
+};
+
+
+// @function include(properties: Object): this
+// [Includes a mixin](#class-includes) into the current class.
+Class.include = function (props) {
+ Util.extend(this.prototype, props);
+ return this;
+};
+
+// @function mergeOptions(options: Object): this
+// [Merges `options`](#class-options) into the defaults of the class.
+Class.mergeOptions = function (options) {
+ Util.extend(this.prototype.options, options);
+ return this;
+};
+
+// @function addInitHook(fn: Function): this
+// Adds a [constructor hook](#class-constructor-hooks) to the class.
+Class.addInitHook = function (fn) { // (Function) || (String, args...)
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ var init = typeof fn === 'function' ? fn : function () {
+ this[fn].apply(this, args);
+ };
+
+ this.prototype._initHooks = this.prototype._initHooks || [];
+ this.prototype._initHooks.push(init);
+ return this;
+};
+
+function checkDeprecatedMixinEvents(includes) {
+ if (typeof L === 'undefined' || !L || !L.Mixin) { return; }
+
+ includes = Util.isArray(includes) ? includes : [includes];
+
+ for (var i = 0; i < includes.length; i++) {
+ if (includes[i] === L.Mixin.Events) {
+ console.warn('Deprecated include of L.Mixin.Events: ' +
+ 'this property will be removed in future releases, ' +
+ 'please inherit from L.Evented instead.', new Error().stack);
+ }
+ }
+}
diff --git a/debian/missing-sources/leaflet.js/core/Class.leafdoc b/debian/missing-sources/leaflet.js/core/Class.leafdoc new file mode 100644 index 0000000..dbcf85e --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Class.leafdoc @@ -0,0 +1,197 @@ + +@class Class +@aka L.Class + +L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented here. + +In addition to implementing a simple classical inheritance model, it introduces several special properties for convenient code organization — options, includes and statics. + + +@example + +```js +var MyClass = L.Class.extend({ +initialize: function (greeter) { + this.greeter = greeter; + // class constructor +}, + +greet: function (name) { + alert(this.greeter + ', ' + name) + } +}); + +// create instance of MyClass, passing "Hello" to the constructor +var a = new MyClass("Hello"); + +// call greet method, alerting "Hello, World" +a.greet("World"); +``` + +@section Class Factories +@example + +You may have noticed that Leaflet objects are created without using +the `new` keyword. This is achieved by complementing each class with a +lowercase factory method: + +```js +new L.Map('map'); // becomes: +L.map('map'); +``` + +The factories are implemented very easily, and you can do this for your own classes: + +```js +L.map = function (id, options) { + return new L.Map(id, options); +}; +``` +@section Inheritance +@example + +You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it: + +```js +var MyChildClass = MyClass.extend({ + // ... new properties and methods +}); +``` + +This will create a class that inherits all methods and properties of the parent class (through a proper prototype chain), adding or overriding the ones you pass to extend. It will also properly react to instanceof: + +```js +var a = new MyChildClass(); +a instanceof MyChildClass; // true +a instanceof MyClass; // true +``` + +You can call parent methods (including constructor) from corresponding child ones (as you do with super calls in other languages) by accessing parent class prototype and using JavaScript's call or apply: + +``` +var MyChildClass = MyClass.extend({ + initialize: function () { + MyClass.prototype.initialize.call(this, "Yo"); + }, + + greet: function (name) { + MyClass.prototype.greet.call(this, 'bro ' + name + '!'); + } +}); + +var a = new MyChildClass(); +a.greet('Jason'); // alerts "Yo, bro Jason!" +``` + +@section Options +@example + +`options` is a special property that unlike other objects that you pass +to `extend` will be merged with the parent one instead of overriding it +completely, which makes managing configuration of objects and default +values convenient: + +```js +var MyClass = L.Class.extend({ + options: { + myOption1: 'foo', + myOption2: 'bar' + } +}); + +var MyChildClass = MyClass.extend({ + options: { + myOption1: 'baz', + myOption3: 5 + } +}); + +var a = new MyChildClass(); +a.options.myOption1; // 'baz' +a.options.myOption2; // 'bar' +a.options.myOption3; // 5 +``` + +There's also [`L.Util.setOptions`](#util-setoptions), a method for +conveniently merging options passed to constructor with the defaults +defines in the class: + +```js +var MyClass = L.Class.extend({ + options: { + foo: 'bar', + bla: 5 + }, + + initialize: function (options) { + L.Util.setOptions(this, options); + ... + } +}); + +var a = new MyClass({bla: 10}); +a.options; // {foo: 'bar', bla: 10} +``` + +Note that the options object allows any keys, not just +the options defined by the class and its base classes. +This means you can use the options object to store +application specific information, as long as you avoid +keys that are already used by the class in question. + +@section Includes +@example + +`includes` is a special class property that merges all specified objects into the class (such objects are called mixins). + +```js + var MyMixin = { + foo: function () { ... }, + bar: 5 +}; + +var MyClass = L.Class.extend({ + includes: MyMixin +}); + +var a = new MyClass(); +a.foo(); +``` + +You can also do such includes in runtime with the `include` method: + +```js +MyClass.include(MyMixin); +``` + +`statics` is just a convenience property that injects specified object properties as the static properties of the class, useful for defining constants: + +```js +var MyClass = L.Class.extend({ + statics: { + FOO: 'bar', + BLA: 5 + } +}); + +MyClass.FOO; // 'bar' +``` + + +@section Constructor hooks +@example + +If you're a plugin developer, you often need to add additional initialization code to existing classes (e.g. editing hooks for `L.Polyline`). Leaflet comes with a way to do it easily using the `addInitHook` method: + +```js +MyClass.addInitHook(function () { + // ... do something in constructor additionally + // e.g. add event listeners, set custom properties etc. +}); +``` + +You can also use the following shortcut when you just need to make one additional method call: + +```js +MyClass.addInitHook('methodName', arg1, arg2, …); +``` diff --git a/debian/missing-sources/leaflet.js/core/Events.js b/debian/missing-sources/leaflet.js/core/Events.js new file mode 100644 index 0000000..fc78b26 --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Events.js @@ -0,0 +1,295 @@ +import {Class} from './Class';
+import * as Util from './Util';
+
+/*
+ * @class Evented
+ * @aka L.Evented
+ * @inherits Class
+ *
+ * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).
+ *
+ * @example
+ *
+ * ```js
+ * map.on('click', function(e) {
+ * alert(e.latlng);
+ * } );
+ * ```
+ *
+ * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
+ *
+ * ```js
+ * function onClick(e) { ... }
+ *
+ * map.on('click', onClick);
+ * map.off('click', onClick);
+ * ```
+ */
+
+export var Events = {
+ /* @method on(type: String, fn: Function, context?: Object): this
+ * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).
+ *
+ * @alternative
+ * @method on(eventMap: Object): this
+ * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
+ */
+ on: function (types, fn, context) {
+
+ // types can be a map of types/handlers
+ if (typeof types === 'object') {
+ for (var type in types) {
+ // we don't process space-separated events here for performance;
+ // it's a hot path since Layer uses the on(obj) syntax
+ this._on(type, types[type], fn);
+ }
+
+ } else {
+ // types can be a string of space-separated words
+ types = Util.splitWords(types);
+
+ for (var i = 0, len = types.length; i < len; i++) {
+ this._on(types[i], fn, context);
+ }
+ }
+
+ return this;
+ },
+
+ /* @method off(type: String, fn?: Function, context?: Object): this
+ * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.
+ *
+ * @alternative
+ * @method off(eventMap: Object): this
+ * Removes a set of type/listener pairs.
+ *
+ * @alternative
+ * @method off: this
+ * Removes all listeners to all events on the object.
+ */
+ off: function (types, fn, context) {
+
+ if (!types) {
+ // clear all listeners if called without arguments
+ delete this._events;
+
+ } else if (typeof types === 'object') {
+ for (var type in types) {
+ this._off(type, types[type], fn);
+ }
+
+ } else {
+ types = Util.splitWords(types);
+
+ for (var i = 0, len = types.length; i < len; i++) {
+ this._off(types[i], fn, context);
+ }
+ }
+
+ return this;
+ },
+
+ // attach listener (without syntactic sugar now)
+ _on: function (type, fn, context) {
+ this._events = this._events || {};
+
+ /* get/init listeners for type */
+ var typeListeners = this._events[type];
+ if (!typeListeners) {
+ typeListeners = [];
+ this._events[type] = typeListeners;
+ }
+
+ if (context === this) {
+ // Less memory footprint.
+ context = undefined;
+ }
+ var newListener = {fn: fn, ctx: context},
+ listeners = typeListeners;
+
+ // check if fn already there
+ for (var i = 0, len = listeners.length; i < len; i++) {
+ if (listeners[i].fn === fn && listeners[i].ctx === context) {
+ return;
+ }
+ }
+
+ listeners.push(newListener);
+ },
+
+ _off: function (type, fn, context) {
+ var listeners,
+ i,
+ len;
+
+ if (!this._events) { return; }
+
+ listeners = this._events[type];
+
+ if (!listeners) {
+ return;
+ }
+
+ if (!fn) {
+ // Set all removed listeners to noop so they are not called if remove happens in fire
+ for (i = 0, len = listeners.length; i < len; i++) {
+ listeners[i].fn = Util.falseFn;
+ }
+ // clear all listeners for a type if function isn't specified
+ delete this._events[type];
+ return;
+ }
+
+ if (context === this) {
+ context = undefined;
+ }
+
+ if (listeners) {
+
+ // find fn and remove it
+ for (i = 0, len = listeners.length; i < len; i++) {
+ var l = listeners[i];
+ if (l.ctx !== context) { continue; }
+ if (l.fn === fn) {
+
+ // set the removed listener to noop so that's not called if remove happens in fire
+ l.fn = Util.falseFn;
+
+ if (this._firingCount) {
+ /* copy array in case events are being fired */
+ this._events[type] = listeners = listeners.slice();
+ }
+ listeners.splice(i, 1);
+
+ return;
+ }
+ }
+ }
+ },
+
+ // @method fire(type: String, data?: Object, propagate?: Boolean): this
+ // Fires an event of the specified type. You can optionally provide an data
+ // object — the first argument of the listener function will contain its
+ // properties. The event can optionally be propagated to event parents.
+ fire: function (type, data, propagate) {
+ if (!this.listens(type, propagate)) { return this; }
+
+ var event = Util.extend({}, data, {
+ type: type,
+ target: this,
+ sourceTarget: data && data.sourceTarget || this
+ });
+
+ if (this._events) {
+ var listeners = this._events[type];
+
+ if (listeners) {
+ this._firingCount = (this._firingCount + 1) || 1;
+ for (var i = 0, len = listeners.length; i < len; i++) {
+ var l = listeners[i];
+ l.fn.call(l.ctx || this, event);
+ }
+
+ this._firingCount--;
+ }
+ }
+
+ if (propagate) {
+ // propagate the event to parents (set with addEventParent)
+ this._propagateEvent(event);
+ }
+
+ return this;
+ },
+
+ // @method listens(type: String): Boolean
+ // Returns `true` if a particular event type has any listeners attached to it.
+ listens: function (type, propagate) {
+ var listeners = this._events && this._events[type];
+ if (listeners && listeners.length) { return true; }
+
+ if (propagate) {
+ // also check parents for listeners if event propagates
+ for (var id in this._eventParents) {
+ if (this._eventParents[id].listens(type, propagate)) { return true; }
+ }
+ }
+ return false;
+ },
+
+ // @method once(…): this
+ // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.
+ once: function (types, fn, context) {
+
+ if (typeof types === 'object') {
+ for (var type in types) {
+ this.once(type, types[type], fn);
+ }
+ return this;
+ }
+
+ var handler = Util.bind(function () {
+ this
+ .off(types, fn, context)
+ .off(types, handler, context);
+ }, this);
+
+ // add a listener that's executed once and removed after that
+ return this
+ .on(types, fn, context)
+ .on(types, handler, context);
+ },
+
+ // @method addEventParent(obj: Evented): this
+ // Adds an event parent - an `Evented` that will receive propagated events
+ addEventParent: function (obj) {
+ this._eventParents = this._eventParents || {};
+ this._eventParents[Util.stamp(obj)] = obj;
+ return this;
+ },
+
+ // @method removeEventParent(obj: Evented): this
+ // Removes an event parent, so it will stop receiving propagated events
+ removeEventParent: function (obj) {
+ if (this._eventParents) {
+ delete this._eventParents[Util.stamp(obj)];
+ }
+ return this;
+ },
+
+ _propagateEvent: function (e) {
+ for (var id in this._eventParents) {
+ this._eventParents[id].fire(e.type, Util.extend({
+ layer: e.target,
+ propagatedFrom: e.target
+ }, e), true);
+ }
+ }
+};
+
+// aliases; we should ditch those eventually
+
+// @method addEventListener(…): this
+// Alias to [`on(…)`](#evented-on)
+Events.addEventListener = Events.on;
+
+// @method removeEventListener(…): this
+// Alias to [`off(…)`](#evented-off)
+
+// @method clearAllEventListeners(…): this
+// Alias to [`off()`](#evented-off)
+Events.removeEventListener = Events.clearAllEventListeners = Events.off;
+
+// @method addOneTimeEventListener(…): this
+// Alias to [`once(…)`](#evented-once)
+Events.addOneTimeEventListener = Events.once;
+
+// @method fireEvent(…): this
+// Alias to [`fire(…)`](#evented-fire)
+Events.fireEvent = Events.fire;
+
+// @method hasEventListeners(…): Boolean
+// Alias to [`listens(…)`](#evented-listens)
+Events.hasEventListeners = Events.listens;
+
+export var Evented = Class.extend(Events);
diff --git a/debian/missing-sources/leaflet.js/core/Events.leafdoc b/debian/missing-sources/leaflet.js/core/Events.leafdoc new file mode 100644 index 0000000..f5142e1 --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Events.leafdoc @@ -0,0 +1,143 @@ + +@namespace Event objects + + +Whenever a class inheriting from `Evented` fires an event, a listener function +will be called with an event argument, which is a plain object containing +information about the event. For example: + +```js +map.on('click', function(ev) { + alert(ev.latlng); // ev is an event object (MouseEvent in this case) +}); +``` + +The information available depends on the event type: + + +@miniclass Event (Event objects) +@section +The base event object. All other event objects contain these properties too. +@property type: String +The event type (e.g. `'click'`). +@property target: Object +The object that fired the event. For propagated events, the last object in +the propagation chain that fired the event. +@property sourceTarget: Object +The object that originally fired the event. For non-propagated events, this will +be the same as the `target`. +@property propagatedFrom: Object +For propagated events, the last object that propagated the event to its +event parent. +@property layer: Object +**Deprecated.** The same as `propagatedFrom`. + + +@miniclass KeyboardEvent (Event objects) +@inherits Event +@property originalEvent: DOMEvent +The original [DOM `KeyboardEvent`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent) that triggered this Leaflet event. + +@miniclass MouseEvent (Event objects) +@inherits Event +@property latlng: LatLng +The geographical point where the mouse event occured. +@property layerPoint: Point +Pixel coordinates of the point where the mouse event occured relative to the map layer. +@property containerPoint: Point +Pixel coordinates of the point where the mouse event occured relative to the map сontainer. +@property originalEvent: DOMEvent +The original [DOM `MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) or [DOM `TouchEvent`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent) that triggered this Leaflet event. + +@miniclass LocationEvent (Event objects) +@inherits Event +@property latlng: LatLng +Detected geographical location of the user. +@property bounds: LatLngBounds +Geographical bounds of the area user is located in (with respect to the accuracy of location). +@property accuracy: Number +Accuracy of location in meters. +@property altitude: Number +Height of the position above the WGS84 ellipsoid in meters. +@property altitudeAccuracy: Number +Accuracy of altitude in meters. +@property heading: Number +The direction of travel in degrees counting clockwise from true North. +@property speed: Number +Current velocity in meters per second. +@property timestamp: Number +The time when the position was acquired. + +@miniclass ErrorEvent (Event objects) +@inherits Event +@property message: String +Error message. +@property code: Number +Error code (if applicable). + +@miniclass LayerEvent (Event objects) +@inherits Event +@property layer: Layer +The layer that was added or removed. + +@miniclass LayersControlEvent (Event objects) +@inherits Event +@property layer: Layer +The layer that was added or removed. +@property name: String +The name of the layer that was added or removed. + +@miniclass TileEvent (Event objects) +@inherits Event +@property tile: HTMLElement +The tile element (image). +@property coords: Point +Point object with the tile's `x`, `y`, and `z` (zoom level) coordinates. + +@miniclass TileErrorEvent (Event objects) +@inherits Event +@property tile: HTMLElement +The tile element (image). +@property coords: Point +Point object with the tile's `x`, `y`, and `z` (zoom level) coordinates. +@property error: * +Error passed to the tile's `done()` callback. + +@miniclass ResizeEvent (Event objects) +@inherits Event +@property oldSize: Point +The old size before resize event. +@property newSize: Point +The new size after the resize event. + +@miniclass GeoJSONEvent (Event objects) +@inherits Event +@property layer: Layer +The layer for the GeoJSON feature that is being added to the map. +@property properties: Object +GeoJSON properties of the feature. +@property geometryType: String +GeoJSON geometry type of the feature. +@property id: String +GeoJSON ID of the feature (if present). + +@miniclass PopupEvent (Event objects) +@inherits Event +@property popup: Popup +The popup that was opened or closed. + +@miniclass TooltipEvent (Event objects) +@inherits Event +@property tooltip: Tooltip +The tooltip that was opened or closed. + +@miniclass DragEndEvent (Event objects) +@inherits Event +@property distance: Number +The distance in pixels the draggable element was moved by. + +@miniclass ZoomAnimEvent (Event objects) +@inherits Event +@property center: LatLng; The current center of the map +@property zoom: Number; The current zoom level of the map +@property noUpdate: Boolean; Whether layers should update their contents due to this event diff --git a/debian/missing-sources/leaflet.js/core/Handler.js b/debian/missing-sources/leaflet.js/core/Handler.js new file mode 100644 index 0000000..8ad639b --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Handler.js @@ -0,0 +1,57 @@ +import {Class} from './Class'; + +/* + L.Handler is a base class for handler classes that are used internally to inject + interaction features like dragging to classes like Map and Marker. +*/ + +// @class Handler +// @aka L.Handler +// Abstract class for map interaction handlers + +export var Handler = Class.extend({ + initialize: function (map) { + this._map = map; + }, + + // @method enable(): this + // Enables the handler + enable: function () { + if (this._enabled) { return this; } + + this._enabled = true; + this.addHooks(); + return this; + }, + + // @method disable(): this + // Disables the handler + disable: function () { + if (!this._enabled) { return this; } + + this._enabled = false; + this.removeHooks(); + return this; + }, + + // @method enabled(): Boolean + // Returns `true` if the handler is enabled + enabled: function () { + return !!this._enabled; + } + + // @section Extension methods + // Classes inheriting from `Handler` must implement the two following methods: + // @method addHooks() + // Called when the handler is enabled, should add event hooks. + // @method removeHooks() + // Called when the handler is disabled, should remove the event hooks added previously. +}); + +// @section There is static function which can be called without instantiating L.Handler: +// @function addTo(map: Map, name: String): this +// Adds a new Handler to the given map with the given name. +Handler.addTo = function (map, name) { + map.addHandler(name, this); + return this; +}; diff --git a/debian/missing-sources/leaflet.js/core/Util.js b/debian/missing-sources/leaflet.js/core/Util.js new file mode 100644 index 0000000..f3d22ec --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/Util.js @@ -0,0 +1,241 @@ +/*
+ * @namespace Util
+ *
+ * Various utility functions, used by Leaflet internally.
+ */
+
+export var freeze = Object.freeze;
+Object.freeze = function (obj) { return obj; };
+
+// @function extend(dest: Object, src?: Object): Object
+// Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.
+export function extend(dest) {
+ var i, j, len, src;
+
+ for (j = 1, len = arguments.length; j < len; j++) {
+ src = arguments[j];
+ for (i in src) {
+ dest[i] = src[i];
+ }
+ }
+ return dest;
+}
+
+// @function create(proto: Object, properties?: Object): Object
+// Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)
+export var create = Object.create || (function () {
+ function F() {}
+ return function (proto) {
+ F.prototype = proto;
+ return new F();
+ };
+})();
+
+// @function bind(fn: Function, …): Function
+// Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
+// Has a `L.bind()` shortcut.
+export function bind(fn, obj) {
+ var slice = Array.prototype.slice;
+
+ if (fn.bind) {
+ return fn.bind.apply(fn, slice.call(arguments, 1));
+ }
+
+ var args = slice.call(arguments, 2);
+
+ return function () {
+ return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);
+ };
+}
+
+// @property lastId: Number
+// Last unique ID used by [`stamp()`](#util-stamp)
+export var lastId = 0;
+
+// @function stamp(obj: Object): Number
+// Returns the unique ID of an object, assigning it one if it doesn't have it.
+export function stamp(obj) {
+ /*eslint-disable */
+ obj._leaflet_id = obj._leaflet_id || ++lastId;
+ return obj._leaflet_id;
+ /* eslint-enable */
+}
+
+// @function throttle(fn: Function, time: Number, context: Object): Function
+// Returns a function which executes function `fn` with the given scope `context`
+// (so that the `this` keyword refers to `context` inside `fn`'s code). The function
+// `fn` will be called no more than one time per given amount of `time`. The arguments
+// received by the bound function will be any arguments passed when binding the
+// function, followed by any arguments passed when invoking the bound function.
+// Has an `L.throttle` shortcut.
+export function throttle(fn, time, context) {
+ var lock, args, wrapperFn, later;
+
+ later = function () {
+ // reset lock and call if queued
+ lock = false;
+ if (args) {
+ wrapperFn.apply(context, args);
+ args = false;
+ }
+ };
+
+ wrapperFn = function () {
+ if (lock) {
+ // called too soon, queue to call later
+ args = arguments;
+
+ } else {
+ // call and lock until later
+ fn.apply(context, arguments);
+ setTimeout(later, time);
+ lock = true;
+ }
+ };
+
+ return wrapperFn;
+}
+
+// @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number
+// Returns the number `num` modulo `range` in such a way so it lies within
+// `range[0]` and `range[1]`. The returned value will be always smaller than
+// `range[1]` unless `includeMax` is set to `true`.
+export function wrapNum(x, range, includeMax) {
+ var max = range[1],
+ min = range[0],
+ d = max - min;
+ return x === max && includeMax ? x : ((x - min) % d + d) % d + min;
+}
+
+// @function falseFn(): Function
+// Returns a function which always returns `false`.
+export function falseFn() { return false; }
+
+// @function formatNum(num: Number, digits?: Number): Number
+// Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default.
+export function formatNum(num, digits) {
+ var pow = Math.pow(10, (digits === undefined ? 6 : digits));
+ return Math.round(num * pow) / pow;
+}
+
+// @function trim(str: String): String
+// Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)
+export function trim(str) {
+ return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
+}
+
+// @function splitWords(str: String): String[]
+// Trims and splits the string on whitespace and returns the array of parts.
+export function splitWords(str) {
+ return trim(str).split(/\s+/);
+}
+
+// @function setOptions(obj: Object, options: Object): Object
+// Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.
+export function setOptions(obj, options) {
+ if (!obj.hasOwnProperty('options')) {
+ obj.options = obj.options ? create(obj.options) : {};
+ }
+ for (var i in options) {
+ obj.options[i] = options[i];
+ }
+ return obj.options;
+}
+
+// @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String
+// Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}`
+// translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will
+// be appended at the end. If `uppercase` is `true`, the parameter names will
+// be uppercased (e.g. `'?A=foo&B=bar'`)
+export function getParamString(obj, existingUrl, uppercase) {
+ var params = [];
+ for (var i in obj) {
+ params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));
+ }
+ return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
+}
+
+var templateRe = /\{ *([\w_-]+) *\}/g;
+
+// @function template(str: String, data: Object): String
+// Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`
+// and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string
+// `('Hello foo, bar')`. You can also specify functions instead of strings for
+// data values — they will be evaluated passing `data` as an argument.
+export function template(str, data) {
+ return str.replace(templateRe, function (str, key) {
+ var value = data[key];
+
+ if (value === undefined) {
+ throw new Error('No value provided for variable ' + str);
+
+ } else if (typeof value === 'function') {
+ value = value(data);
+ }
+ return value;
+ });
+}
+
+// @function isArray(obj): Boolean
+// Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)
+export var isArray = Array.isArray || function (obj) {
+ return (Object.prototype.toString.call(obj) === '[object Array]');
+};
+
+// @function indexOf(array: Array, el: Object): Number
+// Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)
+export function indexOf(array, el) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === el) { return i; }
+ }
+ return -1;
+}
+
+// @property emptyImageUrl: String
+// Data URI string containing a base64-encoded empty GIF image.
+// Used as a hack to free memory from unused images on WebKit-powered
+// mobile devices (by setting image `src` to this string).
+export var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
+
+// inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/
+
+function getPrefixed(name) {
+ return window['webkit' + name] || window['moz' + name] || window['ms' + name];
+}
+
+var lastTime = 0;
+
+// fallback for IE 7-8
+function timeoutDefer(fn) {
+ var time = +new Date(),
+ timeToCall = Math.max(0, 16 - (time - lastTime));
+
+ lastTime = time + timeToCall;
+ return window.setTimeout(fn, timeToCall);
+}
+
+export var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;
+export var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') ||
+ getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); };
+
+// @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number
+// Schedules `fn` to be executed when the browser repaints. `fn` is bound to
+// `context` if given. When `immediate` is set, `fn` is called immediately if
+// the browser doesn't have native support for
+// [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),
+// otherwise it's delayed. Returns a request ID that can be used to cancel the request.
+export function requestAnimFrame(fn, context, immediate) {
+ if (immediate && requestFn === timeoutDefer) {
+ fn.call(context);
+ } else {
+ return requestFn.call(window, bind(fn, context));
+ }
+}
+
+// @function cancelAnimFrame(id: Number): undefined
+// Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).
+export function cancelAnimFrame(id) {
+ if (id) {
+ cancelFn.call(window, id);
+ }
+}
diff --git a/debian/missing-sources/leaflet.js/core/index.js b/debian/missing-sources/leaflet.js/core/index.js new file mode 100644 index 0000000..ae9297d --- /dev/null +++ b/debian/missing-sources/leaflet.js/core/index.js @@ -0,0 +1,15 @@ +import * as Browser from './Browser'; +export {Browser}; + +export {Class} from './Class'; + +import {Evented} from './Events'; +import {Events} from './Events'; +export {Evented}; +export var Mixin = {Events: Events}; + +export {Handler} from './Handler'; + +import * as Util from './Util'; +export {Util}; +export {extend, bind, stamp, setOptions} from './Util'; |