@nextgis/ngw-leaflet 1.18.10 → 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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.18.10; author: NextGIS */
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;
@@ -15338,6 +15338,37 @@ const array = (args) => {
15338
15338
  }
15339
15339
  return value;
15340
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
+ }
15341
15372
  const typeExpressions = {
15342
15373
  array: evaluateArgs(array),
15343
15374
  boolean: evaluateArgs(fallback((arg) => (typeof arg === 'boolean' ? arg : undefined))),
@@ -15350,7 +15381,7 @@ const typeExpressions = {
15350
15381
  'to-boolean': evaluateArgs(fallback(Boolean)),
15351
15382
  'to-number': evaluateArgs(fallback(Number)),
15352
15383
  'to-string': evaluateArgs(fallback(String)),
15353
- typeof: evaluateArgs(([arg]) => typeof arg),
15384
+ typeof: evaluateArgs(([arg]) => typeOfValue(arg)),
15354
15385
  };
15355
15386
 
15356
15387
  const mathExpressions = {
@@ -15448,35 +15479,33 @@ const stringExpressions = {
15448
15479
  function not([expr]) {
15449
15480
  return !expr;
15450
15481
  }
15451
- const checkCompareValues = ([a, b]) => {
15452
- if (typeof a !== typeof b) {
15453
- throw new Error('Values have different types.');
15454
- }
15455
- };
15456
15482
  function notEqual([a, b]) {
15457
- checkCompareValues([a, b]);
15458
15483
  return a !== b;
15459
15484
  }
15460
15485
  function lessThan([left, right]) {
15461
- checkCompareValues([left, right]);
15462
15486
  return left < right;
15463
15487
  }
15464
15488
  function lessThanOrEqual([left, right]) {
15465
- checkCompareValues([left, right]);
15466
15489
  return left <= right;
15467
15490
  }
15468
15491
  function equal([left, right]) {
15469
- checkCompareValues([left, right]);
15470
15492
  return left === right;
15471
15493
  }
15472
15494
  function greaterThan([left, right]) {
15473
- checkCompareValues([left, right]);
15474
15495
  return left > right;
15475
15496
  }
15476
15497
  function greaterThanOrEqual([left, right]) {
15477
- checkCompareValues([left, right]);
15478
15498
  return left >= right;
15479
15499
  }
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
+ };
15480
15509
  const all = (args) => {
15481
15510
  for (let i = 0; i < args.length; i++) {
15482
15511
  const arg = args[i]();
@@ -15533,6 +15562,7 @@ const decisionExpressions = {
15533
15562
  '==': evaluateArgs(equal),
15534
15563
  '>': evaluateArgs(greaterThan),
15535
15564
  '>=': evaluateArgs(greaterThanOrEqual),
15565
+ coalesce,
15536
15566
  all,
15537
15567
  any,
15538
15568
  case: caseFunc,