@nextgis/ngw-leaflet 1.18.6 → 1.18.10

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.6; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.10; 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;
@@ -15332,46 +15339,46 @@ const array = (args) => {
15332
15339
  return value;
15333
15340
  };
15334
15341
  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)
15342
+ array: evaluateArgs(array),
15343
+ boolean: evaluateArgs(fallback((arg) => (typeof arg === 'boolean' ? arg : undefined))),
15344
+ literal: evaluateArgs(([arg]) => arg),
15345
+ number: evaluateArgs(fallback((arg) => (typeof arg === 'number' ? arg : undefined))),
15346
+ object: evaluateArgs(fallback((arg) => arg !== null && typeof arg === 'object' && !Array.isArray(arg)
15340
15347
  ? 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]) => typeof arg,
15348
+ : undefined)),
15349
+ string: evaluateArgs(fallback((arg) => (typeof arg === 'string' ? arg : undefined))),
15350
+ 'to-boolean': evaluateArgs(fallback(Boolean)),
15351
+ 'to-number': evaluateArgs(fallback(Number)),
15352
+ 'to-string': evaluateArgs(fallback(String)),
15353
+ typeof: evaluateArgs(([arg]) => typeof arg),
15347
15354
  };
15348
15355
 
15349
15356
  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]),
15357
+ '+': evaluateArgs((args) => args.reduce((a, b) => a + b, 0)),
15358
+ '-': evaluateArgs((args) => args.reduce((a, b) => a - b)),
15359
+ '*': evaluateArgs((args) => args.reduce((a, b) => a * b, 1)),
15360
+ '/': evaluateArgs((args) => args.reduce((a, b) => a / b)),
15361
+ '%': evaluateArgs((args) => args[0] % args[1]),
15362
+ '^': evaluateArgs((args) => Math.pow(args[0], args[1])),
15363
+ abs: evaluateArgs((args) => Math.abs(args[0])),
15364
+ acos: evaluateArgs((args) => Math.acos(args[0])),
15365
+ asin: evaluateArgs((args) => Math.asin(args[0])),
15366
+ atan: evaluateArgs((args) => Math.atan(args[0])),
15367
+ ceil: evaluateArgs((args) => Math.ceil(args[0])),
15368
+ cos: evaluateArgs((args) => Math.cos(args[0])),
15362
15369
  e: () => Math.E,
15363
- floor: (args) => Math.floor(args[0]),
15364
- ln: (args) => Math.log(args[0]),
15370
+ floor: evaluateArgs((args) => Math.floor(args[0])),
15371
+ ln: evaluateArgs((args) => Math.log(args[0])),
15365
15372
  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),
15373
+ log10: evaluateArgs((args) => Math.log10(args[0])),
15374
+ log2: evaluateArgs((args) => Math.log2(args[0])),
15375
+ max: evaluateArgs((args) => Math.max(...args)),
15376
+ min: evaluateArgs((args) => Math.min(...args)),
15370
15377
  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]),
15378
+ round: evaluateArgs((args) => Math.round(args[0])),
15379
+ sin: evaluateArgs((args) => Math.sin(args[0])),
15380
+ sqrt: evaluateArgs((args) => Math.sqrt(args[0])),
15381
+ tan: evaluateArgs((args) => Math.tan(args[0])),
15375
15382
  };
15376
15383
 
15377
15384
  function get([key, objExp], data) {
@@ -15423,19 +15430,19 @@ function slice(args) {
15423
15430
  throw new Error(`Invalid input type for 'slice'. Expected string or array, got ${typeof input}.`);
15424
15431
  }
15425
15432
  const lookupExpressions = {
15426
- get,
15427
- length,
15428
- at,
15429
- has,
15430
- in: inFunc,
15431
- 'index-of': indexOf,
15432
- slice,
15433
+ get: evaluateArgs(get),
15434
+ length: evaluateArgs(length),
15435
+ at: evaluateArgs(at),
15436
+ has: evaluateArgs(has),
15437
+ in: evaluateArgs(inFunc),
15438
+ 'index-of': evaluateArgs(indexOf),
15439
+ slice: evaluateArgs(slice),
15433
15440
  };
15434
15441
 
15435
15442
  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(),
15443
+ concat: evaluateArgs((args) => args.reduce((a, b) => String(a) + String(b), '')),
15444
+ downcase: evaluateArgs((args) => String(args[0]).toLowerCase()),
15445
+ upcase: evaluateArgs((args) => String(args[0]).toUpperCase()),
15439
15446
  };
15440
15447
 
15441
15448
  function not([expr]) {
@@ -15470,85 +15477,87 @@ function greaterThanOrEqual([left, right]) {
15470
15477
  checkCompareValues([left, right]);
15471
15478
  return left >= right;
15472
15479
  }
15473
- function all(args) {
15480
+ const all = (args) => {
15474
15481
  for (let i = 0; i < args.length; i++) {
15475
- const arg = args[i];
15482
+ const arg = args[i]();
15476
15483
  if (!arg) {
15477
15484
  return false;
15478
15485
  }
15479
15486
  }
15480
15487
  return true;
15481
- }
15482
- function any(args) {
15488
+ };
15489
+ const any = (args) => {
15483
15490
  for (let i = 0; i < args.length; i++) {
15484
- const arg = args[i];
15491
+ const arg = args[i]();
15485
15492
  if (arg) {
15486
15493
  return true;
15487
15494
  }
15488
15495
  }
15489
15496
  return false;
15490
- }
15491
- function match(args) {
15492
- const [lookup, ...cases] = args;
15497
+ };
15498
+ const match = (args) => {
15499
+ const [lookupFn, ...cases] = args;
15500
+ const lookup = lookupFn();
15493
15501
  // remove last odd item from cases array
15494
15502
  const defValue = cases.splice(-1, cases.length % 2)[0];
15495
15503
  for (let fry = 0; fry < cases.length - 1; fry += 2) {
15496
- const key = cases[fry];
15504
+ const key = cases[fry]();
15497
15505
  if (key === lookup) {
15498
- return cases[fry + 1];
15506
+ return cases[fry + 1]();
15499
15507
  }
15500
15508
  }
15501
- return defValue;
15502
- }
15503
- function caseFunc(args) {
15509
+ return defValue();
15510
+ };
15511
+ const caseFunc = (args) => {
15504
15512
  if (args.length < 2) {
15505
15513
  throw new Error('The "case" function requires at least a condition and a corresponding output.');
15506
15514
  }
15507
- const fallback = args[args.length - 1];
15508
15515
  if (args.length % 2 === 0) {
15509
15516
  throw new Error('Missing a fallback value or unmatched condition-output pair.');
15510
15517
  }
15511
15518
  for (let i = 0; i < args.length - 1; i += 2) {
15512
- const condition = args[i];
15513
- const value = args[i + 1];
15519
+ const condition = args[i]();
15520
+ const value = args[i + 1]();
15514
15521
  if (condition) {
15515
15522
  return value;
15516
15523
  }
15517
15524
  }
15518
- return fallback;
15519
- }
15525
+ const fallback = args[args.length - 1];
15526
+ return fallback();
15527
+ };
15520
15528
  const decisionExpressions = {
15521
- '!': not,
15522
- '!=': notEqual,
15523
- '<': lessThan,
15524
- '<=': lessThanOrEqual,
15525
- '==': equal,
15526
- '>': greaterThan,
15527
- '>=': greaterThanOrEqual,
15528
- all: all,
15529
- any: any,
15529
+ '!': evaluateArgs(not),
15530
+ '!=': evaluateArgs(notEqual),
15531
+ '<': evaluateArgs(lessThan),
15532
+ '<=': evaluateArgs(lessThanOrEqual),
15533
+ '==': evaluateArgs(equal),
15534
+ '>': evaluateArgs(greaterThan),
15535
+ '>=': evaluateArgs(greaterThanOrEqual),
15536
+ all,
15537
+ any,
15530
15538
  case: caseFunc,
15531
15539
  match,
15532
15540
  };
15533
15541
 
15534
- function step(args) {
15535
- const [input, defaultValue, ...stops] = args;
15542
+ const step = (args) => {
15543
+ const [inputFn, defaultValue, ...stops] = args;
15544
+ const input = inputFn();
15536
15545
  if (typeof input !== 'number') {
15537
- return defaultValue;
15546
+ return defaultValue();
15538
15547
  }
15539
15548
  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];
15549
+ const stopInput = stops[i]();
15550
+ const stopOutput = stops[i + 1]();
15551
+ const nextStopInput = stops[i + 2]();
15543
15552
  if (input >= stopInput && input < nextStopInput) {
15544
15553
  return stopOutput;
15545
15554
  }
15546
15555
  }
15547
- if (input >= stops[stops.length - 2]) {
15548
- return stops[stops.length - 1];
15556
+ if (input >= stops[stops.length - 2]()) {
15557
+ return stops[stops.length - 1]();
15549
15558
  }
15550
- return defaultValue;
15551
- }
15559
+ return defaultValue();
15560
+ };
15552
15561
 
15553
15562
  const COLORS = {
15554
15563
  aliceblue: '#f0f8ff',
@@ -15817,21 +15826,23 @@ function linearInterpolation(input, input1, output1, input2, output2) {
15817
15826
  }
15818
15827
  throw new Error('Unsupported output type for linear interpolation.');
15819
15828
  }
15820
- function interpolate([interpolation, input, ...stops]) {
15829
+ const interpolate = ([interpolationFn, inputFn, ...stops]) => {
15821
15830
  if (stops.length < 2) {
15822
15831
  throw new Error('At least two stops are required');
15823
15832
  }
15824
- if (typeof input !== 'number') {
15825
- throw new Error('Input must be a number.');
15826
- }
15827
15833
  if (stops.length < 2 || stops.length % 2 !== 0) {
15828
15834
  throw new Error('Invalid stops provided.');
15829
15835
  }
15836
+ const input = inputFn();
15837
+ if (typeof input !== 'number') {
15838
+ throw new Error('Input must be a number.');
15839
+ }
15840
+ const interpolation = interpolationFn();
15830
15841
  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];
15842
+ const stopInput1 = stops[i]();
15843
+ const stopOutput1 = stops[i + 1]();
15844
+ const stopInput2 = stops[i + 2]();
15845
+ const stopOutput2 = stops[i + 3]();
15835
15846
  if (input >= stopInput1 && input <= stopInput2) {
15836
15847
  if (interpolation[0] === 'linear') {
15837
15848
  return linearInterpolation(input, stopInput1, stopOutput1, stopInput2, stopOutput2);
@@ -15850,7 +15861,7 @@ function interpolate([interpolation, input, ...stops]) {
15850
15861
  }
15851
15862
  }
15852
15863
  throw new Error('Invalid interpolation type.');
15853
- }
15864
+ };
15854
15865
 
15855
15866
  const interpolationExpressions = {
15856
15867
  step,
@@ -15880,7 +15891,7 @@ function evaluate(expression, data = {}) {
15880
15891
  const [name, ...args] = expression;
15881
15892
  const expressionFun = expressions[name];
15882
15893
  if (expressionFun) {
15883
- return expressionFun(args.map((arg) => (isExpression(arg) ? evaluate(arg, data) : arg)), data);
15894
+ return expressionFun(args.map((arg) => () => isExpression(arg) ? evaluate(arg, data) : arg), data);
15884
15895
  }
15885
15896
  throw new Error(`Expression "${name}" is not supported.`);
15886
15897
  }
@@ -19459,8 +19470,11 @@ function createGeoJsonFeature(item) {
19459
19470
  }
19460
19471
  function updateItemRequestParam(params, options) {
19461
19472
  const { extensions, geom, fields, srs, ilike, like } = options;
19462
- if (extensions) {
19463
- params.extensions = extensions.join(',');
19473
+ // Empty extesions by default
19474
+ let extensionsStr = extensions ? extensions.join(',') : '';
19475
+ // Use character * to set all extensions
19476
+ if (extensionsStr !== '*') {
19477
+ params.extensions = extensionsStr;
19464
19478
  }
19465
19479
  if (fields !== undefined) {
19466
19480
  params.fields = Array.isArray(fields) ? fields.join(',') : '';