Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextgis/paint

Package Overview
Dependencies
Maintainers
3
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/paint - npm Package Compare versions

Comparing version 1.15.1 to 1.16.0

51

lib/index.d.ts
import type { Feature } from 'geojson';
import type { PropertiesFilter } from '@nextgis/properties-filter';
export declare interface Base3DPaint {
type?: Paint3DType;
color?: string | Expression;
fill?: boolean;
fillColor?: string | Expression;
stroke?: boolean;
strokeWidth?: number | Expression;
strokeColor?: string | Expression;
}
export declare interface BasePaint extends BasePaintTypes {

@@ -27,6 +37,18 @@ color?: string | Expression;

export declare function createExpressionCallback(paint: VectorAdapterLayerPaint): GetPaintCallback | undefined;
export declare function createExpressionCallback(paint: Record<string, any>): GetPaintCallback | undefined;
export declare interface Ellipsoid3DPaint extends Base3DPaint {
type: 'ellipsoid';
length: number;
width: number;
height: number;
}
export declare type Expression = [ExpressionName, ...any[]];
export declare function expressionCallback<P = Record<string, any>>(paint: P, defaultPaint?: P, getPaintFunctions?: Record<string, GetPaintFunction>): CirclePaint | PathPaint | PinPaint | {
(feature: Feature): VectorAdapterLayerPaint;
paint: P;
};
export declare type ExpressionName = 'get' | 'match';

@@ -42,2 +64,8 @@

export declare interface GetPaint3DCallback<F extends Feature = Feature> {
(feature: F): VectorAdapterLayerPaint;
type?: Paint3DType;
paint?: VectorAdapterLayerPaint3D;
}
export declare interface GetPaintCallback<F extends Feature = Feature> {

@@ -79,2 +107,6 @@ (feature: F): VectorAdapterLayerPaint;

export declare type Paint3D<F extends Feature = Feature, P extends Properties | null = F['properties']> = VectorAdapterLayerPaint3D | GetPaintCallback<F> | PropertyPaint3D<P extends null ? Properties : P>;
export declare type Paint3DType = 'ellipsoid' | 'sphere';
export declare type PaintType = 'circle' | 'path' | 'pin' | 'icon' | 'get-paint';

@@ -114,2 +146,7 @@

export declare type PropertiesPaint3D<P extends Properties = Properties> = [
VectorAdapterLayerPaint3D | undefined,
...PropertyPaint<P>[]
];
export declare type PropertyPaint<P extends Properties = Properties> = [

@@ -120,4 +157,16 @@ PropertiesFilter<P>,

export declare type PropertyPaint3D<P extends Properties = Properties> = [
PropertiesFilter<P>,
VectorAdapterLayerPaint3D
];
export declare interface Sphere3DPaint extends Base3DPaint {
type: 'sphere';
radius: number;
}
export declare type VectorAdapterLayerPaint = CirclePaint | PathPaint | IconPaint | PinPaint | GetCustomPaintOptions;
export declare type VectorAdapterLayerPaint3D = Sphere3DPaint | Ellipsoid3DPaint;
export { }

36

lib/paint.cjs.js

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.15.1; author: NextGIS */
/** Bundle of @nextgis/paint; version: 1.16.0; author: NextGIS */
'use strict';

@@ -167,2 +167,20 @@

}
function expressionCallback(paint, defaultPaint, getPaintFunctions) {
var expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
var newPaint = __assign({}, defaultPaint);
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint(paint, defaultPaint, getPaintFunctions) {

@@ -197,16 +215,3 @@ if (!paint) {

else {
var expressionCallback_1 = createExpressionCallback(paint);
if (expressionCallback_1) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
}

@@ -236,2 +241,3 @@ if (isPaintCallback(newPaint)) {

exports.createExpressionCallback = createExpressionCallback;
exports.expressionCallback = expressionCallback;
exports.isBasePaint = isBasePaint;

@@ -238,0 +244,0 @@ exports.isExpression = isExpression;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@nextgis/properties-filter");function t(r){return!!Array.isArray(r)}function n(r){return!!Array.isArray(r)}function e(r){return"[object Object]"===Object.prototype.toString.call(r)}function i(r){return"function"==typeof r}var o=function(){return o=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r},o.apply(this,arguments)};var a={get:function(r,t){return r.properties&&r.properties[t[0]]},match:function(r,t){var n=t[0],e=t.slice(1),i=n;Array.isArray(n)&&(i=f(r,n));for(var o=e.splice(-1,e.length%2)[0],a=0;a<e.length-1;a+=2){if(e[a]===i)return e[a+1]}return o}};function f(r,t){var n=t[0],e=t.slice(1),i=a[n];if(i)return i(r,e)}function u(r){return function(t){return f(t,r)}}var c=["iconSize","iconAnchor"];function p(r){var n=!1,e={};for(var i in r)if(-1===c.indexOf(i)){var a=i,f=r[a];t(f)&&(n=!0,e[a]=u(f))}if(n)return function(t){var n={};for(var i in e)n[i]=e[i](t);return o(o({},r),n)}}exports.createExpressionCallback=p,exports.isBasePaint=function(r){return!!e(r)&&("get-paint"!==r.type&&"icon"!==r.type)},exports.isExpression=t,exports.isIcon=function(r){return"icon"===r.type||"html"in r},exports.isPaint=e,exports.isPaintCallback=i,exports.isPropertiesPaint=n,exports.preparePaint=function t(e,a,f){if(!e)throw new Error("paint is empty");var u=o({},a);if(i(e)){var c=function(r){var n=t(e(r),a,f);return n.type=e.type,n};return c.type=e.type,c}if(n(e))return function(n){return t(function(t){for(var n={},e=[],i=0,a=t;i<a.length;i++){var f=a[i];f&&(Array.isArray(f)?e.push(f):n=f)}return function(t){var i=e.find((function(n){return r.featureFilter(t,n[0])}));return i?o(o({},n),i[1]):n}}(e)(n),a,f)};if("get-paint"===e.type){var s=function(r,t){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&t){var n=t[r.from];if(n)return n(r.options)}}(e,f);s&&(u=t(s,a,f))}else{if("icon"===e.type)return e;var l=p(e);if(l){var y=function(r){return t(l(r),a,f)};return y.paint=e,y}(u=o(o({},u),e)).fill=void 0===u.fill||u.fill,u.stroke=void 0!==u.stroke?u.stroke:!u.fill||!(!u.strokeColor&&!u.strokeOpacity)}return i(u)||("color"in u&&(u.strokeColor||(u.strokeColor=u.color),u.fillColor||(u.fillColor=u.color)),"opacity"in u&&(void 0===u.strokeOpacity&&(u.strokeOpacity=u.opacity),void 0===u.fillOpacity&&(u.fillOpacity=u.opacity))),u};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@nextgis/properties-filter");function t(r){return!!Array.isArray(r)}function n(r){return!!Array.isArray(r)}function e(r){return"[object Object]"===Object.prototype.toString.call(r)}function i(r){return"function"==typeof r}var o=function(){return o=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r},o.apply(this,arguments)};var a={get:function(r,t){return r.properties&&r.properties[t[0]]},match:function(r,t){var n=t[0],e=t.slice(1),i=n;Array.isArray(n)&&(i=f(r,n));for(var o=e.splice(-1,e.length%2)[0],a=0;a<e.length-1;a+=2){if(e[a]===i)return e[a+1]}return o}};function f(r,t){var n=t[0],e=t.slice(1),i=a[n];if(i)return i(r,e)}function u(r){return function(t){return f(t,r)}}var c=["iconSize","iconAnchor"];function p(r){var n=!1,e={};for(var i in r)if(-1===c.indexOf(i)){var a=i,f=r[a];t(f)&&(n=!0,e[a]=u(f))}if(n)return function(t){var n={};for(var i in e)n[i]=e[i](t);return o(o({},r),n)}}function s(r,t,n){var e=p(r);if(e){var i=function(r){return l(e(r),t,n)};return i.paint=r,i}var a=o({},t);return(a=o(o({},a),r)).fill=void 0===a.fill||a.fill,a.stroke=void 0!==a.stroke?a.stroke:!a.fill||!(!a.strokeColor&&!a.strokeOpacity),a}function l(t,e,a){if(!t)throw new Error("paint is empty");var f=o({},e);if(i(t)){var u=function(r){var n=l(t(r),e,a);return n.type=t.type,n};return u.type=t.type,u}if(n(t))return function(n){return l(function(t){for(var n={},e=[],i=0,a=t;i<a.length;i++){var f=a[i];f&&(Array.isArray(f)?e.push(f):n=f)}return function(t){var i=e.find((function(n){return r.featureFilter(t,n[0])}));return i?o(o({},n),i[1]):n}}(t)(n),e,a)};if("get-paint"===t.type){var c=function(r,t){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&t){var n=t[r.from];if(n)return n(r.options)}}(t,a);c&&(f=l(c,e,a))}else{if("icon"===t.type)return t;f=s(t,e,a)}return i(f)||("color"in f&&(f.strokeColor||(f.strokeColor=f.color),f.fillColor||(f.fillColor=f.color)),"opacity"in f&&(void 0===f.strokeOpacity&&(f.strokeOpacity=f.opacity),void 0===f.fillOpacity&&(f.fillOpacity=f.opacity))),f}exports.createExpressionCallback=p,exports.expressionCallback=s,exports.isBasePaint=function(r){return!!e(r)&&("get-paint"!==r.type&&"icon"!==r.type)},exports.isExpression=t,exports.isIcon=function(r){return"icon"===r.type||"html"in r},exports.isPaint=e,exports.isPaintCallback=i,exports.isPropertiesPaint=n,exports.preparePaint=l;
//# sourceMappingURL=paint.cjs.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.15.1; author: NextGIS */
/** Bundle of @nextgis/paint; version: 1.16.0; author: NextGIS */
function isExpression(value) {

@@ -247,2 +247,20 @@ if (Array.isArray(value)) {

}
function expressionCallback(paint, defaultPaint, getPaintFunctions) {
var expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
var newPaint = __assign({}, defaultPaint);
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint(paint, defaultPaint, getPaintFunctions) {

@@ -277,16 +295,3 @@ if (!paint) {

else {
var expressionCallback_1 = createExpressionCallback(paint);
if (expressionCallback_1) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
}

@@ -315,3 +320,3 @@ if (isPaintCallback(newPaint)) {

export { createExpressionCallback, isBasePaint, isExpression, isIcon, isPaint, isPaintCallback, isPropertiesPaint, preparePaint };
export { createExpressionCallback, expressionCallback, isBasePaint, isExpression, isIcon, isPaint, isPaintCallback, isPropertiesPaint, preparePaint };
//# sourceMappingURL=paint.esm-browser.js.map

@@ -1,2 +0,2 @@

function r(r){return!!Array.isArray(r)}function n(r){return!!Array.isArray(r)}function t(r){return"[object Object]"===Object.prototype.toString.call(r)}function e(r){return!!t(r)&&("get-paint"!==r.type&&"icon"!==r.type)}function i(r){return"function"==typeof r}function o(r){return"icon"===r.type||"html"in r}var u=function(){return u=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r},u.apply(this,arguments)};var f={get:function(r,n){return r.properties&&r.properties[n[0]]},match:function(r,n){var t=n[0],e=n.slice(1),i=t;Array.isArray(t)&&(i=c(r,t));for(var o=e.splice(-1,e.length%2)[0],u=0;u<e.length-1;u+=2){if(e[u]===i)return e[u+1]}return o}};function c(r,n){var t=n[0],e=n.slice(1),i=f[t];if(i)return i(r,e)}function a(r){return function(n){return c(n,r)}}var p=["iconSize","iconAnchor"];function l(n){var t=!1,e={};for(var i in n)if(-1===p.indexOf(i)){var o=i,f=n[o];r(f)&&(t=!0,e[o]=a(f))}if(t)return function(r){var t={};for(var i in e)t[i]=e[i](r);return u(u({},n),t)}}function y(r,n,t){if((n=String(n))===(r=String(r)))return!0;if(t&&n.toUpperCase()===r.toUpperCase())return!0;var e,i="^".concat((e=n,e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(r)}var s={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,n){return y(r,n)},ilike:function(r,n){return y(r,n,!0)}};function v(r,n){var t=u({},r.properties);return!!t&&(t.$id=r.id,g(t,n))}function g(r,n){var t="string"==typeof n[0]?n[0]:"all",e=function(n){if(3===(c=n).length&&"string"==typeof c[0]&&"string"==typeof c[1]){var t=n[0],e=n[1],i=n[2],o=s[e];if(o){if(("like"===e||"ilike"===e)&&"string"==typeof t){var u="",f=t.replace(/^%?(\w+)%?$/,(function(n,e){return u=r[e],t.replace(e,i)}));return o(u,f)}return o(r[t],i)}return!1}return g(r,n);var c},i=n.filter((function(r){return Array.isArray(r)}));return"any"===t?i.some(e):i.every(e)}function k(r,t,e){if(!r)throw new Error("paint is empty");var o=u({},t);if(i(r)){var f=function(n){var i=k(r(n),t,e);return i.type=r.type,i};return f.type=r.type,f}if(n(r))return function(n){return k(function(r){for(var n={},t=[],e=0,i=r;e<i.length;e++){var o=i[e];o&&(Array.isArray(o)?t.push(o):n=o)}return function(r){var e=t.find((function(n){return v(r,n[0])}));return e?u(u({},n),e[1]):n}}(r)(n),t,e)};if("get-paint"===r.type){var c=function(r,n){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&n){var t=n[r.from];if(t)return t(r.options)}}(r,e);c&&(o=k(c,t,e))}else{if("icon"===r.type)return r;var a=l(r);if(a){var p=function(r){return k(a(r),t,e)};return p.paint=r,p}(o=u(u({},o),r)).fill=void 0===o.fill||o.fill,o.stroke=void 0!==o.stroke?o.stroke:!o.fill||!(!o.strokeColor&&!o.strokeOpacity)}return i(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}export{l as createExpressionCallback,e as isBasePaint,r as isExpression,o as isIcon,t as isPaint,i as isPaintCallback,n as isPropertiesPaint,k as preparePaint};
function r(r){return!!Array.isArray(r)}function n(r){return!!Array.isArray(r)}function t(r){return"[object Object]"===Object.prototype.toString.call(r)}function e(r){return!!t(r)&&("get-paint"!==r.type&&"icon"!==r.type)}function i(r){return"function"==typeof r}function o(r){return"icon"===r.type||"html"in r}var u=function(){return u=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r},u.apply(this,arguments)};var f={get:function(r,n){return r.properties&&r.properties[n[0]]},match:function(r,n){var t=n[0],e=n.slice(1),i=t;Array.isArray(t)&&(i=c(r,t));for(var o=e.splice(-1,e.length%2)[0],u=0;u<e.length-1;u+=2){if(e[u]===i)return e[u+1]}return o}};function c(r,n){var t=n[0],e=n.slice(1),i=f[t];if(i)return i(r,e)}function a(r){return function(n){return c(n,r)}}var p=["iconSize","iconAnchor"];function l(n){var t=!1,e={};for(var i in n)if(-1===p.indexOf(i)){var o=i,f=n[o];r(f)&&(t=!0,e[o]=a(f))}if(t)return function(r){var t={};for(var i in e)t[i]=e[i](r);return u(u({},n),t)}}function y(r,n,t){if((n=String(n))===(r=String(r)))return!0;if(t&&n.toUpperCase()===r.toUpperCase())return!0;var e,i="^".concat((e=n,e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(r)}var s={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,n){return y(r,n)},ilike:function(r,n){return y(r,n,!0)}};function v(r,n){var t=u({},r.properties);return!!t&&(t.$id=r.id,g(t,n))}function g(r,n){var t="string"==typeof n[0]?n[0]:"all",e=function(n){if(3===(c=n).length&&"string"==typeof c[0]&&"string"==typeof c[1]){var t=n[0],e=n[1],i=n[2],o=s[e];if(o){if(("like"===e||"ilike"===e)&&"string"==typeof t){var u="",f=t.replace(/^%?(\w+)%?$/,(function(n,e){return u=r[e],t.replace(e,i)}));return o(u,f)}return o(r[t],i)}return!1}return g(r,n);var c},i=n.filter((function(r){return Array.isArray(r)}));return"any"===t?i.some(e):i.every(e)}function k(r,n,t){var e=l(r);if(e){var i=function(r){return O(e(r),n,t)};return i.paint=r,i}var o=u({},n);return(o=u(u({},o),r)).fill=void 0===o.fill||o.fill,o.stroke=void 0!==o.stroke?o.stroke:!o.fill||!(!o.strokeColor&&!o.strokeOpacity),o}function O(r,t,e){if(!r)throw new Error("paint is empty");var o=u({},t);if(i(r)){var f=function(n){var i=O(r(n),t,e);return i.type=r.type,i};return f.type=r.type,f}if(n(r))return function(n){return O(function(r){for(var n={},t=[],e=0,i=r;e<i.length;e++){var o=i[e];o&&(Array.isArray(o)?t.push(o):n=o)}return function(r){var e=t.find((function(n){return v(r,n[0])}));return e?u(u({},n),e[1]):n}}(r)(n),t,e)};if("get-paint"===r.type){var c=function(r,n){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&n){var t=n[r.from];if(t)return t(r.options)}}(r,e);c&&(o=O(c,t,e))}else{if("icon"===r.type)return r;o=k(r,t,e)}return i(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}export{l as createExpressionCallback,k as expressionCallback,e as isBasePaint,r as isExpression,o as isIcon,t as isPaint,i as isPaintCallback,n as isPropertiesPaint,O as preparePaint};
//# sourceMappingURL=paint.esm-browser.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.15.1; author: NextGIS */
/** Bundle of @nextgis/paint; version: 1.16.0; author: NextGIS */
import { featureFilter } from '@nextgis/properties-filter';

@@ -163,2 +163,20 @@

}
function expressionCallback(paint, defaultPaint, getPaintFunctions) {
var expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
var newPaint = __assign({}, defaultPaint);
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint(paint, defaultPaint, getPaintFunctions) {

@@ -193,16 +211,3 @@ if (!paint) {

else {
var expressionCallback_1 = createExpressionCallback(paint);
if (expressionCallback_1) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
}

@@ -231,3 +236,3 @@ if (isPaintCallback(newPaint)) {

export { createExpressionCallback, isBasePaint, isExpression, isIcon, isPaint, isPaintCallback, isPropertiesPaint, preparePaint };
export { createExpressionCallback, expressionCallback, isBasePaint, isExpression, isIcon, isPaint, isPaintCallback, isPropertiesPaint, preparePaint };
//# sourceMappingURL=paint.esm-bundler.js.map

@@ -1,2 +0,2 @@

import{featureFilter as r}from"@nextgis/properties-filter";function t(r){return!!Array.isArray(r)}function n(r){return!!Array.isArray(r)}function i(r){return"[object Object]"===Object.prototype.toString.call(r)}function o(r){return!!i(r)&&("get-paint"!==r.type&&"icon"!==r.type)}function e(r){return"function"==typeof r}function f(r){return"icon"===r.type||"html"in r}var u=function(){return u=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return r},u.apply(this,arguments)};var c={get:function(r,t){return r.properties&&r.properties[t[0]]},match:function(r,t){var n=t[0],i=t.slice(1),o=n;Array.isArray(n)&&(o=a(r,n));for(var e=i.splice(-1,i.length%2)[0],f=0;f<i.length-1;f+=2){if(i[f]===o)return i[f+1]}return e}};function a(r,t){var n=t[0],i=t.slice(1),o=c[n];if(o)return o(r,i)}function p(r){return function(t){return a(t,r)}}var l=["iconSize","iconAnchor"];function y(r){var n=!1,i={};for(var o in r)if(-1===l.indexOf(o)){var e=o,f=r[e];t(f)&&(n=!0,i[e]=p(f))}if(n)return function(t){var n={};for(var o in i)n[o]=i[o](t);return u(u({},r),n)}}function s(t,i,o){if(!t)throw new Error("paint is empty");var f=u({},i);if(e(t)){var c=function(r){var n=s(t(r),i,o);return n.type=t.type,n};return c.type=t.type,c}if(n(t))return function(n){return s(function(t){for(var n={},i=[],o=0,e=t;o<e.length;o++){var f=e[o];f&&(Array.isArray(f)?i.push(f):n=f)}return function(t){var o=i.find((function(n){return r(t,n[0])}));return o?u(u({},n),o[1]):n}}(t)(n),i,o)};if("get-paint"===t.type){var a=function(r,t){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&t){var n=t[r.from];if(n)return n(r.options)}}(t,o);a&&(f=s(a,i,o))}else{if("icon"===t.type)return t;var p=y(t);if(p){var l=function(r){return s(p(r),i,o)};return l.paint=t,l}(f=u(u({},f),t)).fill=void 0===f.fill||f.fill,f.stroke=void 0!==f.stroke?f.stroke:!f.fill||!(!f.strokeColor&&!f.strokeOpacity)}return e(f)||("color"in f&&(f.strokeColor||(f.strokeColor=f.color),f.fillColor||(f.fillColor=f.color)),"opacity"in f&&(void 0===f.strokeOpacity&&(f.strokeOpacity=f.opacity),void 0===f.fillOpacity&&(f.fillOpacity=f.opacity))),f}export{y as createExpressionCallback,o as isBasePaint,t as isExpression,f as isIcon,i as isPaint,e as isPaintCallback,n as isPropertiesPaint,s as preparePaint};
import{featureFilter as r}from"@nextgis/properties-filter";function t(r){return!!Array.isArray(r)}function n(r){return!!Array.isArray(r)}function i(r){return"[object Object]"===Object.prototype.toString.call(r)}function o(r){return!!i(r)&&("get-paint"!==r.type&&"icon"!==r.type)}function e(r){return"function"==typeof r}function f(r){return"icon"===r.type||"html"in r}var u=function(){return u=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return r},u.apply(this,arguments)};var c={get:function(r,t){return r.properties&&r.properties[t[0]]},match:function(r,t){var n=t[0],i=t.slice(1),o=n;Array.isArray(n)&&(o=a(r,n));for(var e=i.splice(-1,i.length%2)[0],f=0;f<i.length-1;f+=2){if(i[f]===o)return i[f+1]}return e}};function a(r,t){var n=t[0],i=t.slice(1),o=c[n];if(o)return o(r,i)}function p(r){return function(t){return a(t,r)}}var l=["iconSize","iconAnchor"];function y(r){var n=!1,i={};for(var o in r)if(-1===l.indexOf(o)){var e=o,f=r[e];t(f)&&(n=!0,i[e]=p(f))}if(n)return function(t){var n={};for(var o in i)n[o]=i[o](t);return u(u({},r),n)}}function s(r,t,n){var i=y(r);if(i){var o=function(r){return v(i(r),t,n)};return o.paint=r,o}var e=u({},t);return(e=u(u({},e),r)).fill=void 0===e.fill||e.fill,e.stroke=void 0!==e.stroke?e.stroke:!e.fill||!(!e.strokeColor&&!e.strokeOpacity),e}function v(t,i,o){if(!t)throw new Error("paint is empty");var f=u({},i);if(e(t)){var c=function(r){var n=v(t(r),i,o);return n.type=t.type,n};return c.type=t.type,c}if(n(t))return function(n){return v(function(t){for(var n={},i=[],o=0,e=t;o<e.length;o++){var f=e[o];f&&(Array.isArray(f)?i.push(f):n=f)}return function(t){var o=i.find((function(n){return r(t,n[0])}));return o?u(u({},n),o[1]):n}}(t)(n),i,o)};if("get-paint"===t.type){var a=function(r,t){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&t){var n=t[r.from];if(n)return n(r.options)}}(t,o);a&&(f=v(a,i,o))}else{if("icon"===t.type)return t;f=s(t,i,o)}return e(f)||("color"in f&&(f.strokeColor||(f.strokeColor=f.color),f.fillColor||(f.fillColor=f.color)),"opacity"in f&&(void 0===f.strokeOpacity&&(f.strokeOpacity=f.opacity),void 0===f.fillOpacity&&(f.fillOpacity=f.opacity))),f}export{y as createExpressionCallback,s as expressionCallback,o as isBasePaint,t as isExpression,f as isIcon,i as isPaint,e as isPaintCallback,n as isPropertiesPaint,v as preparePaint};
//# sourceMappingURL=paint.esm-bundler.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.15.1; author: NextGIS */
/** Bundle of @nextgis/paint; version: 1.16.0; author: NextGIS */
var Paint = (function (exports) {

@@ -250,2 +250,20 @@ 'use strict';

}
function expressionCallback(paint, defaultPaint, getPaintFunctions) {
var expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
var newPaint = __assign({}, defaultPaint);
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint(paint, defaultPaint, getPaintFunctions) {

@@ -280,16 +298,3 @@ if (!paint) {

else {
var expressionCallback_1 = createExpressionCallback(paint);
if (expressionCallback_1) {
var expressionPaintCb = function (feature) {
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
};
expressionPaintCb.paint = paint;
return expressionPaintCb;
}
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
}

@@ -319,2 +324,3 @@ if (isPaintCallback(newPaint)) {

exports.createExpressionCallback = createExpressionCallback;
exports.expressionCallback = expressionCallback;
exports.isBasePaint = isBasePaint;

@@ -321,0 +327,0 @@ exports.isExpression = isExpression;

@@ -1,2 +0,2 @@

var Paint=function(r){"use strict";function n(r){return!!Array.isArray(r)}function t(r){return!!Array.isArray(r)}function e(r){return"[object Object]"===Object.prototype.toString.call(r)}function i(r){return"function"==typeof r}var o=function(){return o=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r},o.apply(this,arguments)};var u={get:function(r,n){return r.properties&&r.properties[n[0]]},match:function(r,n){var t=n[0],e=n.slice(1),i=t;Array.isArray(t)&&(i=f(r,t));for(var o=e.splice(-1,e.length%2)[0],u=0;u<e.length-1;u+=2){if(e[u]===i)return e[u+1]}return o}};function f(r,n){var t=n[0],e=n.slice(1),i=u[t];if(i)return i(r,e)}function c(r){return function(n){return f(n,r)}}var a=["iconSize","iconAnchor"];function p(r){var t=!1,e={};for(var i in r)if(-1===a.indexOf(i)){var u=i,f=r[u];n(f)&&(t=!0,e[u]=c(f))}if(t)return function(n){var t={};for(var i in e)t[i]=e[i](n);return o(o({},r),t)}}function l(r,n,t){if((n=String(n))===(r=String(r)))return!0;if(t&&n.toUpperCase()===r.toUpperCase())return!0;var e,i="^".concat((e=n,e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(r)}var s={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,n){return l(r,n)},ilike:function(r,n){return l(r,n,!0)}};function y(r,n){var t=o({},r.properties);return!!t&&(t.$id=r.id,v(t,n))}function v(r,n){var t="string"==typeof n[0]?n[0]:"all",e=function(n){if(3===(c=n).length&&"string"==typeof c[0]&&"string"==typeof c[1]){var t=n[0],e=n[1],i=n[2],o=s[e];if(o){if(("like"===e||"ilike"===e)&&"string"==typeof t){var u="",f=t.replace(/^%?(\w+)%?$/,(function(n,e){return u=r[e],t.replace(e,i)}));return o(u,f)}return o(r[t],i)}return!1}return v(r,n);var c},i=n.filter((function(r){return Array.isArray(r)}));return"any"===t?i.some(e):i.every(e)}return r.createExpressionCallback=p,r.isBasePaint=function(r){return!!e(r)&&("get-paint"!==r.type&&"icon"!==r.type)},r.isExpression=n,r.isIcon=function(r){return"icon"===r.type||"html"in r},r.isPaint=e,r.isPaintCallback=i,r.isPropertiesPaint=t,r.preparePaint=function r(n,e,u){if(!n)throw new Error("paint is empty");var f=o({},e);if(i(n)){var c=function(t){var i=r(n(t),e,u);return i.type=n.type,i};return c.type=n.type,c}if(t(n))return function(t){return r(function(r){for(var n={},t=[],e=0,i=r;e<i.length;e++){var u=i[e];u&&(Array.isArray(u)?t.push(u):n=u)}return function(r){var e=t.find((function(n){return y(r,n[0])}));return e?o(o({},n),e[1]):n}}(n)(t),e,u)};if("get-paint"===n.type){var a=function(r,n){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&n){var t=n[r.from];if(t)return t(r.options)}}(n,u);a&&(f=r(a,e,u))}else{if("icon"===n.type)return n;var l=p(n);if(l){var s=function(n){return r(l(n),e,u)};return s.paint=n,s}(f=o(o({},f),n)).fill=void 0===f.fill||f.fill,f.stroke=void 0!==f.stroke?f.stroke:!f.fill||!(!f.strokeColor&&!f.strokeOpacity)}return i(f)||("color"in f&&(f.strokeColor||(f.strokeColor=f.color),f.fillColor||(f.fillColor=f.color)),"opacity"in f&&(void 0===f.strokeOpacity&&(f.strokeOpacity=f.opacity),void 0===f.fillOpacity&&(f.fillOpacity=f.opacity))),f},Object.defineProperty(r,"__esModule",{value:!0}),r}({});
var Paint=function(r){"use strict";function n(r){return!!Array.isArray(r)}function t(r){return!!Array.isArray(r)}function e(r){return"[object Object]"===Object.prototype.toString.call(r)}function i(r){return"function"==typeof r}var o=function(){return o=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r},o.apply(this,arguments)};var u={get:function(r,n){return r.properties&&r.properties[n[0]]},match:function(r,n){var t=n[0],e=n.slice(1),i=t;Array.isArray(t)&&(i=f(r,t));for(var o=e.splice(-1,e.length%2)[0],u=0;u<e.length-1;u+=2){if(e[u]===i)return e[u+1]}return o}};function f(r,n){var t=n[0],e=n.slice(1),i=u[t];if(i)return i(r,e)}function a(r){return function(n){return f(n,r)}}var c=["iconSize","iconAnchor"];function l(r){var t=!1,e={};for(var i in r)if(-1===c.indexOf(i)){var u=i,f=r[u];n(f)&&(t=!0,e[u]=a(f))}if(t)return function(n){var t={};for(var i in e)t[i]=e[i](n);return o(o({},r),t)}}function p(r,n,t){if((n=String(n))===(r=String(r)))return!0;if(t&&n.toUpperCase()===r.toUpperCase())return!0;var e,i="^".concat((e=n,e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,t?"i":"").exec(r)}var s={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,n){return p(r,n)},ilike:function(r,n){return p(r,n,!0)}};function y(r,n){var t=o({},r.properties);return!!t&&(t.$id=r.id,v(t,n))}function v(r,n){var t="string"==typeof n[0]?n[0]:"all",e=function(n){if(3===(a=n).length&&"string"==typeof a[0]&&"string"==typeof a[1]){var t=n[0],e=n[1],i=n[2],o=s[e];if(o){if(("like"===e||"ilike"===e)&&"string"==typeof t){var u="",f=t.replace(/^%?(\w+)%?$/,(function(n,e){return u=r[e],t.replace(e,i)}));return o(u,f)}return o(r[t],i)}return!1}return v(r,n);var a},i=n.filter((function(r){return Array.isArray(r)}));return"any"===t?i.some(e):i.every(e)}function g(r,n,t){var e=l(r);if(e){var i=function(r){return k(e(r),n,t)};return i.paint=r,i}var u=o({},n);return(u=o(o({},u),r)).fill=void 0===u.fill||u.fill,u.stroke=void 0!==u.stroke?u.stroke:!u.fill||!(!u.strokeColor&&!u.strokeOpacity),u}function k(r,n,e){if(!r)throw new Error("paint is empty");var u=o({},n);if(i(r)){var f=function(t){var i=k(r(t),n,e);return i.type=r.type,i};return f.type=r.type,f}if(t(r))return function(t){return k(function(r){for(var n={},t=[],e=0,i=r;e<i.length;e++){var u=i[e];u&&(Array.isArray(u)?t.push(u):n=u)}return function(r){var e=t.find((function(n){return y(r,n[0])}));return e?o(o({},n),e[1]):n}}(r)(t),n,e)};if("get-paint"===r.type){var a=function(r,n){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&n){var t=n[r.from];if(t)return t(r.options)}}(r,e);a&&(u=k(a,n,e))}else{if("icon"===r.type)return r;u=g(r,n,e)}return i(u)||("color"in u&&(u.strokeColor||(u.strokeColor=u.color),u.fillColor||(u.fillColor=u.color)),"opacity"in u&&(void 0===u.strokeOpacity&&(u.strokeOpacity=u.opacity),void 0===u.fillOpacity&&(u.fillOpacity=u.opacity))),u}return r.createExpressionCallback=l,r.expressionCallback=g,r.isBasePaint=function(r){return!!e(r)&&("get-paint"!==r.type&&"icon"!==r.type)},r.isExpression=n,r.isIcon=function(r){return"icon"===r.type||"html"in r},r.isPaint=e,r.isPaintCallback=i,r.isPropertiesPaint=t,r.preparePaint=k,Object.defineProperty(r,"__esModule",{value:!0}),r}({});
//# sourceMappingURL=paint.global.prod.js.map
{
"name": "@nextgis/paint",
"version": "1.15.1",
"version": "1.16.0",
"description": "Create style for vector layer",

@@ -51,3 +51,3 @@ "main": "index.js",

},
"gitHead": "78e77a6f52e60941ddbde3af8ad559b174950d4d"
"gitHead": "59104ab823b9439c90aefabdf31330f86cf3f33b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc