ol-mapbox-style
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -891,3 +891,3 @@ (function(_g){(function(f){var r=(typeof require==='function'?require:function(name){return {"_":null,"openlayers":ol}[name];});if (typeof exports==='object'&&typeof module!=='undefined'){module.exports=f(r)}else if(typeof define==='function'&&define.amd){define(["_","openlayers"],f.bind(_g,r))}else{f(r)}})(function(require,define,module,exports){var _m=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var hsl = /^hsla?\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/; | ||
var hsl = /^hsla?\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/; | ||
var match = string.match(hsl); | ||
@@ -904,2 +904,4 @@ | ||
} | ||
return null; | ||
}; | ||
@@ -912,3 +914,3 @@ | ||
var hwb = /^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/; | ||
var hwb = /^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/; | ||
var match = string.match(hwb); | ||
@@ -924,2 +926,4 @@ | ||
} | ||
return null; | ||
}; | ||
@@ -935,4 +939,4 @@ | ||
return rgba.length < 4 || rgba[3] === 1 | ||
? 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')' | ||
: 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')'; | ||
? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')' | ||
: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')'; | ||
}; | ||
@@ -987,9 +991,9 @@ | ||
},{"color-name":2,"simple-swizzle":8}],4:[function(require,module,exports){ | ||
(function(){function l(a,b){document.addEventListener?a.addEventListener("scroll",b,!1):a.attachEvent("scroll",b)}function m(a){document.body?a():document.addEventListener?document.addEventListener("DOMContentLoaded",function c(){document.removeEventListener("DOMContentLoaded",c);a()}):document.attachEvent("onreadystatechange",function k(){if("interactive"==document.readyState||"complete"==document.readyState)document.detachEvent("onreadystatechange",k),a()})};function q(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.f=document.createElement("span");this.g=-1;this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;"; | ||
(function(){function m(a,b){document.addEventListener?a.addEventListener("scroll",b,!1):a.attachEvent("scroll",b)}function n(a){document.body?a():document.addEventListener?document.addEventListener("DOMContentLoaded",function c(){document.removeEventListener("DOMContentLoaded",c);a()}):document.attachEvent("onreadystatechange",function l(){if("interactive"==document.readyState||"complete"==document.readyState)document.detachEvent("onreadystatechange",l),a()})};function t(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.f=document.createElement("span");this.g=-1;this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;"; | ||
this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;";this.b.appendChild(this.h);this.c.appendChild(this.f);this.a.appendChild(this.b);this.a.appendChild(this.c)} | ||
function w(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+b+";"}function x(a){var b=a.a.offsetWidth,c=b+100;a.f.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.g!==b?(a.g=b,!0):!1}function z(a,b){function c(){var a=k;x(a)&&null!==a.a.parentNode&&b(a.g)}var k=a;l(a.b,c);l(a.c,c);x(a)};function A(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"normal"}var B=null,C=null,D=null;function H(){if(null===C){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}C=""!==a.style.font}return C}function I(a,b){return[a.style,a.weight,H()?a.stretch:"","100px",b].join(" ")} | ||
A.prototype.load=function(a,b){var c=this,k=a||"BESbswy",y=b||3E3,E=(new Date).getTime();return new Promise(function(a,b){null===D&&(D=!!document.fonts);if(D){var J=new Promise(function(a,b){function e(){(new Date).getTime()-E>=y?b():document.fonts.load(I(c,'"'+c.family+'"'),k).then(function(c){1<=c.length?a():setTimeout(e,25)},function(){b()})}e()}),K=new Promise(function(a,c){setTimeout(c,y)});Promise.race([K,J]).then(function(){a(c)},function(){b(c)})}else m(function(){function r(){var b;if(b= | ||
-1!=f&&-1!=g||-1!=f&&-1!=h||-1!=g&&-1!=h)(b=f!=g&&f!=h&&g!=h)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(f==t&&g==t&&h==t||f==u&&g==u&&h==u||f==v&&g==v&&h==v)),b=!b;b&&(null!==d.parentNode&&d.parentNode.removeChild(d),clearTimeout(G),a(c))}function F(){if((new Date).getTime()-E>=y)null!==d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a|| | ||
void 0===a)f=e.a.offsetWidth,g=n.a.offsetWidth,h=p.a.offsetWidth,r();G=setTimeout(F,50)}}var e=new q(k),n=new q(k),p=new q(k),f=-1,g=-1,h=-1,t=-1,u=-1,v=-1,d=document.createElement("div"),G=0;d.dir="ltr";w(e,I(c,"sans-serif"));w(n,I(c,"serif"));w(p,I(c,"monospace"));d.appendChild(e.a);d.appendChild(n.a);d.appendChild(p.a);document.body.appendChild(d);t=e.a.offsetWidth;u=n.a.offsetWidth;v=p.a.offsetWidth;F();z(e,function(a){f=a;r()});w(e,I(c,'"'+c.family+'",sans-serif'));z(n,function(a){g=a;r()}); | ||
w(n,I(c,'"'+c.family+'",serif'));z(p,function(a){h=a;r()});w(p,I(c,'"'+c.family+'",monospace'))})})};"undefined"!==typeof module?module.exports=A:(window.FontFaceObserver=A,window.FontFaceObserver.prototype.load=A.prototype.load);}()); | ||
function x(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+b+";"}function y(a){var b=a.a.offsetWidth,c=b+100;a.f.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.g!==b?(a.g=b,!0):!1}function z(a,b){function c(){var a=l;y(a)&&a.a.parentNode&&b(a.g)}var l=a;m(a.b,c);m(a.c,c);y(a)};function A(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"normal"}var B=null,C=null,E=null,F=null;function I(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}E=""!==a.style.font}return E}function J(a,b){return[a.style,a.weight,I()?a.stretch:"","100px",b].join(" ")} | ||
A.prototype.load=function(a,b){var c=this,l=a||"BESbswy",r=0,D=b||3E3,G=(new Date).getTime();return new Promise(function(a,b){var e;null===F&&(F=!!document.fonts);if(e=F)null===C&&(C=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),e=!C;if(e){e=new Promise(function(a,b){function f(){(new Date).getTime()-G>=D?b():document.fonts.load(J(c,'"'+c.family+'"'),l).then(function(c){1<=c.length?a():setTimeout(f,25)},function(){b()})}f()});var K=new Promise(function(a, | ||
c){r=setTimeout(c,D)});Promise.race([K,e]).then(function(){clearTimeout(r);a(c)},function(){b(c)})}else n(function(){function e(){var b;if(b=-1!=g&&-1!=h||-1!=g&&-1!=k||-1!=h&&-1!=k)(b=g!=h&&g!=k&&h!=k)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(g==u&&h==u&&k==u||g==v&&h==v&&k==v||g==w&&h==w&&k==w)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(r),a(c))} | ||
function H(){if((new Date).getTime()-G>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a||void 0===a)g=f.a.offsetWidth,h=p.a.offsetWidth,k=q.a.offsetWidth,e();r=setTimeout(H,50)}}var f=new t(l),p=new t(l),q=new t(l),g=-1,h=-1,k=-1,u=-1,v=-1,w=-1,d=document.createElement("div");d.dir="ltr";x(f,J(c,"sans-serif"));x(p,J(c,"serif"));x(q,J(c,"monospace"));d.appendChild(f.a);d.appendChild(p.a);d.appendChild(q.a);document.body.appendChild(d);u=f.a.offsetWidth;v=p.a.offsetWidth; | ||
w=q.a.offsetWidth;H();z(f,function(a){g=a;e()});x(f,J(c,'"'+c.family+'",sans-serif'));z(p,function(a){h=a;e()});x(p,J(c,'"'+c.family+'",serif'));z(q,function(a){k=a;e()});x(q,J(c,'"'+c.family+'",monospace'))})})};"undefined"!==typeof module?module.exports=A:(window.FontFaceObserver=A,window.FontFaceObserver.prototype.load=A.prototype.load);}()); | ||
@@ -1000,3 +1004,3 @@ },{}],5:[function(require,module,exports){ | ||
module.exports = function isArrayish(obj) { | ||
if (!obj) { | ||
if (!obj || typeof obj === 'string') { | ||
return false; | ||
@@ -1022,3 +1026,3 @@ } | ||
} else { | ||
var zoomAndFeatureDependent = typeof parameters.stops[0][0] === 'object'; | ||
var zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === 'object'; | ||
var featureDependent = zoomAndFeatureDependent || parameters.property !== undefined; | ||
@@ -1035,2 +1039,4 @@ var zoomDependent = zoomAndFeatureDependent || !featureDependent; | ||
innerFun = evaluateCategoricalFunction; | ||
} else if (type === 'identity') { | ||
innerFun = evaluateIdentityFunction; | ||
} else { | ||
@@ -1127,3 +1133,7 @@ throw new Error('Unknown function type "' + type + '"'); | ||
function evaluateIdentityFunction(parameters, input) { | ||
return input; | ||
} | ||
function interpolate(input, base, inputLower, inputUpper, outputLower, outputUpper) { | ||
@@ -1166,3 +1176,3 @@ if (typeof outputLower === 'function') { | ||
function isFunctionDefinition(value) { | ||
return typeof value === 'object' && value.stops; | ||
return typeof value === 'object' && (value.stops || value.type === 'identity'); | ||
} | ||
@@ -1169,0 +1179,0 @@ |
{ | ||
"name": "ol-mapbox-style", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Use Mapbox style objects with OpenLayers", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"dist": "mkdir -p dist && browserify -p [ standalonify --name olms --deps [ null --openlayers ol ] ] index.js > dist/olms.js", | ||
"doc": "documentation build index.js -f md", | ||
"doc": "documentation readme -s API index.js", | ||
"pretest": "eslint src", | ||
@@ -35,21 +35,21 @@ "test": "mocha" | ||
"dependencies": { | ||
"color-string": "1.2.0", | ||
"fontfaceobserver": "2.0.4", | ||
"mapbox-gl-function": "1.2.1", | ||
"color-string": "1.4.0", | ||
"fontfaceobserver": "2.0.7", | ||
"mapbox-gl-function": "1.3.0", | ||
"mapbox-to-css-font": "1.0.2" | ||
}, | ||
"devDependencies": { | ||
"browserify": "13.1.0", | ||
"browserify": "13.1.1", | ||
"cssify": "1.0.3", | ||
"documentation": "4.0.0-beta10", | ||
"eslint": "3.6.1", | ||
"eslint-config-openlayers": "5.0.0", | ||
"documentation": "4.0.0-beta16", | ||
"eslint": "3.12.1", | ||
"eslint-config-openlayers": "6.0.0", | ||
"expect.js": "0.3.1", | ||
"jsdom": "9.5.0", | ||
"jsdom": "9.8.3", | ||
"jsdom-global": "2.1.0", | ||
"mapbox-gl-styles": "2.0.2", | ||
"mocha": "3.1.0", | ||
"openlayers": "3.18.2", | ||
"mocha": "3.2.0", | ||
"openlayers": "3.20.0", | ||
"standalonify": "0.1.3" | ||
} | ||
} |
@@ -45,2 +45,4 @@ # ol-mapbox-style | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
### getStyleFunction | ||
@@ -56,3 +58,3 @@ | ||
- `source` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `source` key from the Mapbox GL style object. | ||
- `resolutions` **\[([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)> | [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined))]** Resolutions for mapping resolution to zoom level. For tile layers, this can | ||
- `resolutions` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)> | [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined))?** Resolutions for mapping resolution to zoom level. For tile layers, this can | ||
be `layer.getSource().getTileGrid().getResolutions()`. (optional, default `[156543.03392804097, | ||
@@ -64,9 +66,8 @@ 78271.51696402048,39135.75848201024,19567.87924100512,9783.93962050256, | ||
1.194328566955879,0.5971642834779395,0.29858214173896974, | ||
0.14929107086948487]`) | ||
- `onChange` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Callback which will be called when | ||
0.14929107086948487,0.07464553543474244]`) | ||
- `onChange` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)?** Callback which will be called when | ||
the style is ready to use for rendering, and every time a new resource (e.g. | ||
icon sprite or font) is ready to be applied. When the `glStyle` has no | ||
`sprite` and only standard fonts, the style will be ready to use | ||
immediately, and the callback can be omitted. (optional, default | ||
`function(){}`) | ||
`sprite` and only standard fonts, the style will be ready to use immediately, | ||
and the callback can be omitted. (optional, default `function(){}`) | ||
@@ -73,0 +74,0 @@ Returns **ol.style.StyleFunction** Style function for use in |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79804
2050
96
+ Addedcolor-string@1.4.0(transitive)
+ Addedfontfaceobserver@2.0.7(transitive)
+ Addedmapbox-gl-function@1.3.0(transitive)
- Removedcolor-string@1.2.0(transitive)
- Removedfontfaceobserver@2.0.4(transitive)
- Removedmapbox-gl-function@1.2.1(transitive)
Updatedcolor-string@1.4.0
Updatedfontfaceobserver@2.0.7
Updatedmapbox-gl-function@1.3.0