@nextgis/ngw-leaflet 1.18.9 → 1.18.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ngw-leaflet.esm-browser.js +143 -102
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +2 -2
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +145 -105
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +2 -2
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.18.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.18.11; author: NextGIS */
|
|
2
2
|
function styleInject(css, ref) {
|
|
3
3
|
if ( ref === void 0 ) ref = {};
|
|
4
4
|
var insertAt = ref.insertAt;
|
|
@@ -15301,6 +15301,13 @@ function fallback(cb) {
|
|
|
15301
15301
|
};
|
|
15302
15302
|
}
|
|
15303
15303
|
|
|
15304
|
+
function evaluateArgs(cb) {
|
|
15305
|
+
return (args, data) => {
|
|
15306
|
+
const unwrap = args.map((a) => a());
|
|
15307
|
+
return cb(unwrap, data);
|
|
15308
|
+
};
|
|
15309
|
+
}
|
|
15310
|
+
|
|
15304
15311
|
const array = (args) => {
|
|
15305
15312
|
const [firstArg, secondArg, thirdArg] = args;
|
|
15306
15313
|
let requiredType = undefined;
|
|
@@ -15331,47 +15338,78 @@ const array = (args) => {
|
|
|
15331
15338
|
}
|
|
15332
15339
|
return value;
|
|
15333
15340
|
};
|
|
15341
|
+
function typeOfValue(value) {
|
|
15342
|
+
if (value === null)
|
|
15343
|
+
return 'null';
|
|
15344
|
+
switch (typeof value) {
|
|
15345
|
+
case 'string':
|
|
15346
|
+
return 'string';
|
|
15347
|
+
case 'number':
|
|
15348
|
+
return 'number';
|
|
15349
|
+
case 'boolean':
|
|
15350
|
+
return 'boolean';
|
|
15351
|
+
case 'object':
|
|
15352
|
+
if (Array.isArray(value)) {
|
|
15353
|
+
let arrayType = 'value';
|
|
15354
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
15355
|
+
arrayType = 'number';
|
|
15356
|
+
}
|
|
15357
|
+
else if (value.every((item) => typeof item === 'string')) {
|
|
15358
|
+
arrayType = 'string';
|
|
15359
|
+
}
|
|
15360
|
+
else if (value.every((item) => typeof item === 'boolean')) {
|
|
15361
|
+
arrayType = 'boolean';
|
|
15362
|
+
}
|
|
15363
|
+
return `array<${arrayType}, ${value.length}>`;
|
|
15364
|
+
}
|
|
15365
|
+
else {
|
|
15366
|
+
return 'object';
|
|
15367
|
+
}
|
|
15368
|
+
default:
|
|
15369
|
+
return 'undefined';
|
|
15370
|
+
}
|
|
15371
|
+
}
|
|
15334
15372
|
const typeExpressions = {
|
|
15335
|
-
array,
|
|
15336
|
-
boolean: fallback((arg) => (typeof arg === 'boolean' ? arg : undefined)),
|
|
15337
|
-
literal: ([arg]) => arg,
|
|
15338
|
-
number: fallback((arg) => (typeof arg === 'number' ? arg : undefined)),
|
|
15339
|
-
object: fallback((arg) => arg !== null && typeof arg === 'object' && !Array.isArray(arg)
|
|
15373
|
+
array: evaluateArgs(array),
|
|
15374
|
+
boolean: evaluateArgs(fallback((arg) => (typeof arg === 'boolean' ? arg : undefined))),
|
|
15375
|
+
literal: evaluateArgs(([arg]) => arg),
|
|
15376
|
+
number: evaluateArgs(fallback((arg) => (typeof arg === 'number' ? arg : undefined))),
|
|
15377
|
+
object: evaluateArgs(fallback((arg) => arg !== null && typeof arg === 'object' && !Array.isArray(arg)
|
|
15340
15378
|
? arg
|
|
15341
|
-
: undefined),
|
|
15342
|
-
string: fallback((arg) => (typeof arg === 'string' ? arg : undefined)),
|
|
15343
|
-
'to-boolean': fallback(Boolean),
|
|
15344
|
-
'to-number': fallback(Number),
|
|
15345
|
-
'to-string': fallback(String),
|
|
15346
|
-
typeof: ([arg]) =>
|
|
15379
|
+
: undefined)),
|
|
15380
|
+
string: evaluateArgs(fallback((arg) => (typeof arg === 'string' ? arg : undefined))),
|
|
15381
|
+
'to-boolean': evaluateArgs(fallback(Boolean)),
|
|
15382
|
+
'to-number': evaluateArgs(fallback(Number)),
|
|
15383
|
+
'to-string': evaluateArgs(fallback(String)),
|
|
15384
|
+
typeof: evaluateArgs(([arg]) => typeOfValue(arg)),
|
|
15347
15385
|
};
|
|
15348
15386
|
|
|
15349
15387
|
const mathExpressions = {
|
|
15350
|
-
'+': (args) => args.reduce((a, b) => a + b, 0),
|
|
15351
|
-
'-': (args) => args.reduce((a, b) => a - b),
|
|
15352
|
-
'*': (args) => args.reduce((a, b) => a * b, 1),
|
|
15353
|
-
'/': (args) => args.reduce((a, b) => a / b),
|
|
15354
|
-
'%': (args) => args[0] % args[1],
|
|
15355
|
-
'^': (args) => Math.pow(args[0], args[1]),
|
|
15356
|
-
abs: (args) => Math.abs(args[0]),
|
|
15357
|
-
acos: (args) => Math.acos(args[0]),
|
|
15358
|
-
asin: (args) => Math.asin(args[0]),
|
|
15359
|
-
atan: (args) => Math.atan(args[0]),
|
|
15360
|
-
ceil: (args) => Math.ceil(args[0]),
|
|
15361
|
-
cos: (args) => Math.cos(args[0]),
|
|
15388
|
+
'+': evaluateArgs((args) => args.reduce((a, b) => a + b, 0)),
|
|
15389
|
+
'-': evaluateArgs((args) => args.reduce((a, b) => a - b)),
|
|
15390
|
+
'*': evaluateArgs((args) => args.reduce((a, b) => a * b, 1)),
|
|
15391
|
+
'/': evaluateArgs((args) => args.reduce((a, b) => a / b)),
|
|
15392
|
+
'%': evaluateArgs((args) => args[0] % args[1]),
|
|
15393
|
+
'^': evaluateArgs((args) => Math.pow(args[0], args[1])),
|
|
15394
|
+
abs: evaluateArgs((args) => Math.abs(args[0])),
|
|
15395
|
+
acos: evaluateArgs((args) => Math.acos(args[0])),
|
|
15396
|
+
asin: evaluateArgs((args) => Math.asin(args[0])),
|
|
15397
|
+
atan: evaluateArgs((args) => Math.atan(args[0])),
|
|
15398
|
+
ceil: evaluateArgs((args) => Math.ceil(args[0])),
|
|
15399
|
+
cos: evaluateArgs((args) => Math.cos(args[0])),
|
|
15362
15400
|
e: () => Math.E,
|
|
15363
|
-
floor: (args) => Math.floor(args[0]),
|
|
15364
|
-
ln: (args) => Math.log(args[0]),
|
|
15401
|
+
floor: evaluateArgs((args) => Math.floor(args[0])),
|
|
15402
|
+
ln: evaluateArgs((args) => Math.log(args[0])),
|
|
15365
15403
|
ln2: () => Math.LN2,
|
|
15366
|
-
log10: (args) => Math.log10(args[0]),
|
|
15367
|
-
log2: (args) => Math.log2(args[0]),
|
|
15368
|
-
max: (args) => Math.max(...args),
|
|
15369
|
-
min: (args) => Math.min(...args),
|
|
15404
|
+
log10: evaluateArgs((args) => Math.log10(args[0])),
|
|
15405
|
+
log2: evaluateArgs((args) => Math.log2(args[0])),
|
|
15406
|
+
max: evaluateArgs((args) => Math.max(...args)),
|
|
15407
|
+
min: evaluateArgs((args) => Math.min(...args)),
|
|
15370
15408
|
pi: () => Math.PI,
|
|
15371
|
-
round: (args) => Math.round(args[0]),
|
|
15372
|
-
sin: (args) => Math.sin(args[0]),
|
|
15373
|
-
sqrt: (args) => Math.sqrt(args[0]),
|
|
15374
|
-
tan: (args) => Math.tan(args[0]),
|
|
15409
|
+
round: evaluateArgs((args) => Math.round(args[0])),
|
|
15410
|
+
sin: evaluateArgs((args) => Math.sin(args[0])),
|
|
15411
|
+
sqrt: evaluateArgs((args) => Math.sqrt(args[0])),
|
|
15412
|
+
tan: evaluateArgs((args) => Math.tan(args[0])),
|
|
15375
15413
|
};
|
|
15376
15414
|
|
|
15377
15415
|
function get([key, objExp], data) {
|
|
@@ -15423,132 +15461,133 @@ function slice(args) {
|
|
|
15423
15461
|
throw new Error(`Invalid input type for 'slice'. Expected string or array, got ${typeof input}.`);
|
|
15424
15462
|
}
|
|
15425
15463
|
const lookupExpressions = {
|
|
15426
|
-
get,
|
|
15427
|
-
length,
|
|
15428
|
-
at,
|
|
15429
|
-
has,
|
|
15430
|
-
in: inFunc,
|
|
15431
|
-
'index-of': indexOf,
|
|
15432
|
-
slice,
|
|
15464
|
+
get: evaluateArgs(get),
|
|
15465
|
+
length: evaluateArgs(length),
|
|
15466
|
+
at: evaluateArgs(at),
|
|
15467
|
+
has: evaluateArgs(has),
|
|
15468
|
+
in: evaluateArgs(inFunc),
|
|
15469
|
+
'index-of': evaluateArgs(indexOf),
|
|
15470
|
+
slice: evaluateArgs(slice),
|
|
15433
15471
|
};
|
|
15434
15472
|
|
|
15435
15473
|
const stringExpressions = {
|
|
15436
|
-
concat: (args) => args.reduce((a, b) => String(a) + String(b), ''),
|
|
15437
|
-
downcase: (args) => String(args[0]).toLowerCase(),
|
|
15438
|
-
upcase: (args) => String(args[0]).toUpperCase(),
|
|
15474
|
+
concat: evaluateArgs((args) => args.reduce((a, b) => String(a) + String(b), '')),
|
|
15475
|
+
downcase: evaluateArgs((args) => String(args[0]).toLowerCase()),
|
|
15476
|
+
upcase: evaluateArgs((args) => String(args[0]).toUpperCase()),
|
|
15439
15477
|
};
|
|
15440
15478
|
|
|
15441
15479
|
function not([expr]) {
|
|
15442
15480
|
return !expr;
|
|
15443
15481
|
}
|
|
15444
|
-
const checkCompareValues = ([a, b]) => {
|
|
15445
|
-
if (typeof a !== typeof b) {
|
|
15446
|
-
throw new Error('Values have different types.');
|
|
15447
|
-
}
|
|
15448
|
-
};
|
|
15449
15482
|
function notEqual([a, b]) {
|
|
15450
|
-
checkCompareValues([a, b]);
|
|
15451
15483
|
return a !== b;
|
|
15452
15484
|
}
|
|
15453
15485
|
function lessThan([left, right]) {
|
|
15454
|
-
checkCompareValues([left, right]);
|
|
15455
15486
|
return left < right;
|
|
15456
15487
|
}
|
|
15457
15488
|
function lessThanOrEqual([left, right]) {
|
|
15458
|
-
checkCompareValues([left, right]);
|
|
15459
15489
|
return left <= right;
|
|
15460
15490
|
}
|
|
15461
15491
|
function equal([left, right]) {
|
|
15462
|
-
checkCompareValues([left, right]);
|
|
15463
15492
|
return left === right;
|
|
15464
15493
|
}
|
|
15465
15494
|
function greaterThan([left, right]) {
|
|
15466
|
-
checkCompareValues([left, right]);
|
|
15467
15495
|
return left > right;
|
|
15468
15496
|
}
|
|
15469
15497
|
function greaterThanOrEqual([left, right]) {
|
|
15470
|
-
checkCompareValues([left, right]);
|
|
15471
15498
|
return left >= right;
|
|
15472
15499
|
}
|
|
15473
|
-
|
|
15500
|
+
const coalesce = (args) => {
|
|
15501
|
+
for (let i = 0; i < args.length; i++) {
|
|
15502
|
+
const arg = args[i]();
|
|
15503
|
+
if (arg !== null && arg !== undefined) {
|
|
15504
|
+
return arg;
|
|
15505
|
+
}
|
|
15506
|
+
}
|
|
15507
|
+
return null;
|
|
15508
|
+
};
|
|
15509
|
+
const all = (args) => {
|
|
15474
15510
|
for (let i = 0; i < args.length; i++) {
|
|
15475
|
-
const arg = args[i];
|
|
15511
|
+
const arg = args[i]();
|
|
15476
15512
|
if (!arg) {
|
|
15477
15513
|
return false;
|
|
15478
15514
|
}
|
|
15479
15515
|
}
|
|
15480
15516
|
return true;
|
|
15481
|
-
}
|
|
15482
|
-
|
|
15517
|
+
};
|
|
15518
|
+
const any = (args) => {
|
|
15483
15519
|
for (let i = 0; i < args.length; i++) {
|
|
15484
|
-
const arg = args[i];
|
|
15520
|
+
const arg = args[i]();
|
|
15485
15521
|
if (arg) {
|
|
15486
15522
|
return true;
|
|
15487
15523
|
}
|
|
15488
15524
|
}
|
|
15489
15525
|
return false;
|
|
15490
|
-
}
|
|
15491
|
-
|
|
15492
|
-
const [
|
|
15526
|
+
};
|
|
15527
|
+
const match = (args) => {
|
|
15528
|
+
const [lookupFn, ...cases] = args;
|
|
15529
|
+
const lookup = lookupFn();
|
|
15493
15530
|
// remove last odd item from cases array
|
|
15494
15531
|
const defValue = cases.splice(-1, cases.length % 2)[0];
|
|
15495
15532
|
for (let fry = 0; fry < cases.length - 1; fry += 2) {
|
|
15496
|
-
const key = cases[fry];
|
|
15533
|
+
const key = cases[fry]();
|
|
15497
15534
|
if (key === lookup) {
|
|
15498
|
-
return cases[fry + 1];
|
|
15535
|
+
return cases[fry + 1]();
|
|
15499
15536
|
}
|
|
15500
15537
|
}
|
|
15501
|
-
return defValue;
|
|
15502
|
-
}
|
|
15503
|
-
|
|
15538
|
+
return defValue();
|
|
15539
|
+
};
|
|
15540
|
+
const caseFunc = (args) => {
|
|
15504
15541
|
if (args.length < 2) {
|
|
15505
15542
|
throw new Error('The "case" function requires at least a condition and a corresponding output.');
|
|
15506
15543
|
}
|
|
15507
|
-
const fallback = args[args.length - 1];
|
|
15508
15544
|
if (args.length % 2 === 0) {
|
|
15509
15545
|
throw new Error('Missing a fallback value or unmatched condition-output pair.');
|
|
15510
15546
|
}
|
|
15511
15547
|
for (let i = 0; i < args.length - 1; i += 2) {
|
|
15512
|
-
const condition = args[i];
|
|
15513
|
-
const value = args[i + 1];
|
|
15548
|
+
const condition = args[i]();
|
|
15549
|
+
const value = args[i + 1]();
|
|
15514
15550
|
if (condition) {
|
|
15515
15551
|
return value;
|
|
15516
15552
|
}
|
|
15517
15553
|
}
|
|
15518
|
-
|
|
15519
|
-
|
|
15554
|
+
const fallback = args[args.length - 1];
|
|
15555
|
+
return fallback();
|
|
15556
|
+
};
|
|
15520
15557
|
const decisionExpressions = {
|
|
15521
|
-
'!': not,
|
|
15522
|
-
'!=': notEqual,
|
|
15523
|
-
'<': lessThan,
|
|
15524
|
-
'<=': lessThanOrEqual,
|
|
15525
|
-
'==': equal,
|
|
15526
|
-
'>': greaterThan,
|
|
15527
|
-
'>=': greaterThanOrEqual,
|
|
15528
|
-
|
|
15529
|
-
|
|
15558
|
+
'!': evaluateArgs(not),
|
|
15559
|
+
'!=': evaluateArgs(notEqual),
|
|
15560
|
+
'<': evaluateArgs(lessThan),
|
|
15561
|
+
'<=': evaluateArgs(lessThanOrEqual),
|
|
15562
|
+
'==': evaluateArgs(equal),
|
|
15563
|
+
'>': evaluateArgs(greaterThan),
|
|
15564
|
+
'>=': evaluateArgs(greaterThanOrEqual),
|
|
15565
|
+
coalesce,
|
|
15566
|
+
all,
|
|
15567
|
+
any,
|
|
15530
15568
|
case: caseFunc,
|
|
15531
15569
|
match,
|
|
15532
15570
|
};
|
|
15533
15571
|
|
|
15534
|
-
|
|
15535
|
-
const [
|
|
15572
|
+
const step = (args) => {
|
|
15573
|
+
const [inputFn, defaultValue, ...stops] = args;
|
|
15574
|
+
const input = inputFn();
|
|
15536
15575
|
if (typeof input !== 'number') {
|
|
15537
|
-
return defaultValue;
|
|
15576
|
+
return defaultValue();
|
|
15538
15577
|
}
|
|
15539
15578
|
for (let i = 0; i < stops.length - 2; i += 2) {
|
|
15540
|
-
const stopInput = stops[i];
|
|
15541
|
-
const stopOutput = stops[i + 1];
|
|
15542
|
-
const nextStopInput = stops[i + 2];
|
|
15579
|
+
const stopInput = stops[i]();
|
|
15580
|
+
const stopOutput = stops[i + 1]();
|
|
15581
|
+
const nextStopInput = stops[i + 2]();
|
|
15543
15582
|
if (input >= stopInput && input < nextStopInput) {
|
|
15544
15583
|
return stopOutput;
|
|
15545
15584
|
}
|
|
15546
15585
|
}
|
|
15547
|
-
if (input >= stops[stops.length - 2]) {
|
|
15548
|
-
return stops[stops.length - 1];
|
|
15586
|
+
if (input >= stops[stops.length - 2]()) {
|
|
15587
|
+
return stops[stops.length - 1]();
|
|
15549
15588
|
}
|
|
15550
|
-
return defaultValue;
|
|
15551
|
-
}
|
|
15589
|
+
return defaultValue();
|
|
15590
|
+
};
|
|
15552
15591
|
|
|
15553
15592
|
const COLORS = {
|
|
15554
15593
|
aliceblue: '#f0f8ff',
|
|
@@ -15817,21 +15856,23 @@ function linearInterpolation(input, input1, output1, input2, output2) {
|
|
|
15817
15856
|
}
|
|
15818
15857
|
throw new Error('Unsupported output type for linear interpolation.');
|
|
15819
15858
|
}
|
|
15820
|
-
|
|
15859
|
+
const interpolate = ([interpolationFn, inputFn, ...stops]) => {
|
|
15821
15860
|
if (stops.length < 2) {
|
|
15822
15861
|
throw new Error('At least two stops are required');
|
|
15823
15862
|
}
|
|
15824
|
-
if (typeof input !== 'number') {
|
|
15825
|
-
throw new Error('Input must be a number.');
|
|
15826
|
-
}
|
|
15827
15863
|
if (stops.length < 2 || stops.length % 2 !== 0) {
|
|
15828
15864
|
throw new Error('Invalid stops provided.');
|
|
15829
15865
|
}
|
|
15866
|
+
const input = inputFn();
|
|
15867
|
+
if (typeof input !== 'number') {
|
|
15868
|
+
throw new Error('Input must be a number.');
|
|
15869
|
+
}
|
|
15870
|
+
const interpolation = interpolationFn();
|
|
15830
15871
|
for (let i = 0; i < stops.length - 2; i += 2) {
|
|
15831
|
-
const stopInput1 = stops[i];
|
|
15832
|
-
const stopOutput1 = stops[i + 1];
|
|
15833
|
-
const stopInput2 = stops[i + 2];
|
|
15834
|
-
const stopOutput2 = stops[i + 3];
|
|
15872
|
+
const stopInput1 = stops[i]();
|
|
15873
|
+
const stopOutput1 = stops[i + 1]();
|
|
15874
|
+
const stopInput2 = stops[i + 2]();
|
|
15875
|
+
const stopOutput2 = stops[i + 3]();
|
|
15835
15876
|
if (input >= stopInput1 && input <= stopInput2) {
|
|
15836
15877
|
if (interpolation[0] === 'linear') {
|
|
15837
15878
|
return linearInterpolation(input, stopInput1, stopOutput1, stopInput2, stopOutput2);
|
|
@@ -15850,7 +15891,7 @@ function interpolate([interpolation, input, ...stops]) {
|
|
|
15850
15891
|
}
|
|
15851
15892
|
}
|
|
15852
15893
|
throw new Error('Invalid interpolation type.');
|
|
15853
|
-
}
|
|
15894
|
+
};
|
|
15854
15895
|
|
|
15855
15896
|
const interpolationExpressions = {
|
|
15856
15897
|
step,
|
|
@@ -15880,7 +15921,7 @@ function evaluate(expression, data = {}) {
|
|
|
15880
15921
|
const [name, ...args] = expression;
|
|
15881
15922
|
const expressionFun = expressions[name];
|
|
15882
15923
|
if (expressionFun) {
|
|
15883
|
-
return expressionFun(args.map((arg) => (isExpression(arg) ? evaluate(arg, data) : arg)
|
|
15924
|
+
return expressionFun(args.map((arg) => () => isExpression(arg) ? evaluate(arg, data) : arg), data);
|
|
15884
15925
|
}
|
|
15885
15926
|
throw new Error(`Expression "${name}" is not supported.`);
|
|
15886
15927
|
}
|