@emuanalytics/flow-rdf-core 4.0.0-preview.7 → 4.0.1

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.
Files changed (27) hide show
  1. package/dist/index.cjs +681 -670
  2. package/dist/index.d.cts +2 -2
  3. package/dist/index.d.mts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.mjs +647 -647
  6. package/dist/lib/map/plugins/index.cjs +39 -37
  7. package/dist/lib/map/plugins/index.d.cts +8 -8
  8. package/dist/lib/map/plugins/index.d.mts +8 -8
  9. package/dist/lib/map/plugins/index.d.ts +8 -8
  10. package/dist/lib/map/plugins/index.mjs +12 -10
  11. package/dist/lib/utils/index.cjs +31 -29
  12. package/dist/lib/utils/index.d.cts +10 -9
  13. package/dist/lib/utils/index.d.mts +10 -9
  14. package/dist/lib/utils/index.d.ts +10 -9
  15. package/dist/lib/utils/index.mjs +4 -3
  16. package/dist/shared/{flow-rdf-core.ea06a1d3.mjs → flow-rdf-core.187cb345.mjs} +1 -1
  17. package/dist/shared/{flow-rdf-core.bd95d618.mjs → flow-rdf-core.1f0901c5.mjs} +1 -1
  18. package/dist/shared/{flow-rdf-core.b80085b4.mjs → flow-rdf-core.25e5f6d7.mjs} +9 -1
  19. package/dist/shared/{flow-rdf-core.1f72b20b.cjs → flow-rdf-core.55c169ca.cjs} +2 -2
  20. package/dist/shared/{flow-rdf-core.1f9c0593.cjs → flow-rdf-core.9b5dad76.cjs} +26 -34
  21. package/dist/shared/{flow-rdf-core.84eded74.cjs → flow-rdf-core.a82b9be4.cjs} +4 -4
  22. package/dist/shared/{flow-rdf-core.769a4928.d.mts → flow-rdf-core.dd931ace.d.cts} +817 -818
  23. package/dist/shared/{flow-rdf-core.769a4928.d.ts → flow-rdf-core.dd931ace.d.mts} +817 -818
  24. package/dist/shared/{flow-rdf-core.769a4928.d.cts → flow-rdf-core.dd931ace.d.ts} +817 -818
  25. package/dist/shared/{flow-rdf-core.ce91eb14.mjs → flow-rdf-core.e2b1bb7f.mjs} +2 -9
  26. package/dist/shared/{flow-rdf-core.3042be4a.cjs → flow-rdf-core.f50908f0.cjs} +9 -0
  27. package/package.json +5 -1
@@ -56,10 +56,6 @@ declare const isMultiPolygon: (val: any) => val is GeoJSON.Feature<GeoJSON.Multi
56
56
  * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
57
57
  * for details over the differences between `_.debounce` and `_.throttle`.
58
58
  *
59
- * @static
60
- * @memberOf _
61
- * @since 0.1.0
62
- * @category Function
63
59
  * @param {Function} func The function to debounce.
64
60
  * @param {number} [wait=0] The number of milliseconds to delay.
65
61
  * @param {Object} [options={}] The options object.
@@ -126,10 +122,6 @@ declare function debounceWithArgs<TArgs extends any[], TKey>(fn: Func<TArgs, any
126
122
  * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
127
123
  * for details over the differences between `_.throttle` and `_.debounce`.
128
124
  *
129
- * @static
130
- * @memberOf _
131
- * @since 0.1.0
132
- * @category Function
133
125
  * @param {Function} func The function to throttle.
134
126
  * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
135
127
  * @param {Object} [options={}] The options object.
@@ -156,4 +148,13 @@ declare function throttleWithArgs<TArgs extends any[], TKey>(fn: Func<TArgs, any
156
148
 
157
149
  declare const capitalize: (str: string, lowerRest?: boolean) => string;
158
150
 
159
- export { capitalize, debounce, debounceWithArgs, ensureArray, hasLength, hasValue, isArray, isArrayFull, isArrayStrings, isBoolean, isDate, isDefined, isFalse, isFunction, isIn, isLineString, isMultiPolygon, isNil, isNull, isNumber, isNumeric, isObject, isObjectFull, isPlainObject, isPoint, isPolygon, isString, isStringFull, isTrue, isURL, isUndefined, isValue, throttle, throttleWithArgs };
151
+ /**
152
+ * Generate a random ID of `length` characters and prepending the given prefix.
153
+ *
154
+ * @param prefix Fixed prefix to prepend to the generated ID.
155
+ * @param length Number of characters in the generated ID.
156
+ *
157
+ */
158
+ declare function randomId(prefix?: string, length?: number): string;
159
+
160
+ export { capitalize, debounce, debounceWithArgs, ensureArray, hasLength, hasValue, isArray, isArrayFull, isArrayStrings, isBoolean, isDate, isDefined, isFalse, isFunction, isIn, isLineString, isMultiPolygon, isNil, isNull, isNumber, isNumeric, isObject, isObjectFull, isPlainObject, isPoint, isPolygon, isString, isStringFull, isTrue, isURL, isUndefined, isValue, randomId, throttle, throttleWithArgs };
@@ -1,5 +1,6 @@
1
- export { c as capitalize, e as ensureArray, h as hasLength, w as hasValue, j as isArray, k as isArrayFull, l as isArrayStrings, s as isBoolean, u as isDate, d as isDefined, p as isFalse, x as isFunction, r as isIn, b as isNil, a as isNull, o as isNumber, t as isNumeric, m as isObject, n as isObjectFull, y as isPlainObject, f as isString, g as isStringFull, q as isTrue, z as isURL, i as isUndefined, v as isValue } from '../../shared/flow-rdf-core.b80085b4.mjs';
2
- export { i as isLineString, a as isMultiPolygon, b as isPoint, c as isPolygon } from '../../shared/flow-rdf-core.bd95d618.mjs';
3
- export { d as debounce, a as debounceWithArgs, m as memoize, t as throttle, b as throttleWithArgs } from '../../shared/flow-rdf-core.ea06a1d3.mjs';
1
+ export { c as capitalize, e as ensureArray, h as hasLength, w as hasValue, j as isArray, k as isArrayFull, l as isArrayStrings, s as isBoolean, u as isDate, d as isDefined, p as isFalse, x as isFunction, r as isIn, b as isNil, a as isNull, o as isNumber, t as isNumeric, m as isObject, n as isObjectFull, y as isPlainObject, f as isString, g as isStringFull, q as isTrue, z as isURL, i as isUndefined, v as isValue, A as randomId } from '../../shared/flow-rdf-core.25e5f6d7.mjs';
2
+ export { i as isLineString, a as isMultiPolygon, b as isPoint, c as isPolygon } from '../../shared/flow-rdf-core.1f0901c5.mjs';
3
+ export { d as debounce, a as debounceWithArgs, m as memoize, t as throttle, b as throttleWithArgs } from '../../shared/flow-rdf-core.187cb345.mjs';
4
4
  export { html } from 'lit-html';
5
+ import 'nanoid';
5
6
  import '@turf/invariant';
@@ -1,4 +1,4 @@
1
- import { o as isNumber } from './flow-rdf-core.b80085b4.mjs';
1
+ import { o as isNumber } from './flow-rdf-core.25e5f6d7.mjs';
2
2
 
3
3
  const doNotMemoize = Symbol("Do not memoize");
4
4
  function memoize(originalFunction, options) {
@@ -1,5 +1,5 @@
1
1
  import { getType } from '@turf/invariant';
2
- import { y as isPlainObject } from './flow-rdf-core.b80085b4.mjs';
2
+ import { y as isPlainObject } from './flow-rdf-core.25e5f6d7.mjs';
3
3
 
4
4
  const isPoint = (val) => {
5
5
  if (!isPlainObject(val)) {
@@ -1,3 +1,5 @@
1
+ import { customAlphabet } from 'nanoid';
2
+
1
3
  const isUndefined = (val) => typeof val === "undefined";
2
4
  const isNull = (val) => val === null;
3
5
  const isNil = (val) => isUndefined(val) || isNull(val);
@@ -63,4 +65,10 @@ function ensureArray(a, ...rest) {
63
65
 
64
66
  const capitalize = (str, lowerRest = false) => str.slice(0, 1).toUpperCase() + (lowerRest ? str.slice(1).toLowerCase() : str.slice(1));
65
67
 
66
- export { isNull as a, isNil as b, capitalize as c, isDefined as d, ensureArray as e, isString as f, isStringFull as g, hasLength as h, isUndefined as i, isArray as j, isArrayFull as k, isArrayStrings as l, isObject as m, isObjectFull as n, isNumber as o, isFalse as p, isTrue as q, isIn as r, isBoolean as s, isNumeric as t, isDate as u, isValue as v, hasValue as w, isFunction as x, isPlainObject as y, isURL as z };
68
+ const nanoid = customAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01923456789", 10);
69
+ function randomId(prefix, length) {
70
+ const id = nanoid(length);
71
+ return prefix ? `${prefix}-${id}` : id;
72
+ }
73
+
74
+ export { randomId as A, isNull as a, isNil as b, capitalize as c, isDefined as d, ensureArray as e, isString as f, isStringFull as g, hasLength as h, isUndefined as i, isArray as j, isArrayFull as k, isArrayStrings as l, isObject as m, isObjectFull as n, isNumber as o, isFalse as p, isTrue as q, isIn as r, isBoolean as s, isNumeric as t, isDate as u, isValue as v, hasValue as w, isFunction as x, isPlainObject as y, isURL as z };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const stringUtils = require('./flow-rdf-core.3042be4a.cjs');
3
+ const randomId = require('./flow-rdf-core.f50908f0.cjs');
4
4
 
5
5
  const doNotMemoize = Symbol("Do not memoize");
6
6
  function memoize(originalFunction, options) {
@@ -32,7 +32,7 @@ function debounce(func, wait, options) {
32
32
  const leading = options.leading;
33
33
  const trailing = options.trailing;
34
34
  const maxWait = options.maxWait;
35
- const maxing = stringUtils.isNumber(maxWait);
35
+ const maxing = randomId.isNumber(maxWait);
36
36
  let lastArgs;
37
37
  let lastThis;
38
38
  let result;
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const mobx = require('mobx');
4
- const stringUtils = require('./flow-rdf-core.3042be4a.cjs');
4
+ const randomId = require('./flow-rdf-core.f50908f0.cjs');
5
5
  const maplibreSpec = require('@emuanalytics/maplibre-gl-style-spec');
6
6
  const mobxUtils = require('mobx-utils');
7
7
  const P = require('parsimmon');
8
8
  const colorbrewer = require('colorbrewer');
9
- const nanoid$1 = require('nanoid');
10
9
  const Debug = require('debug');
11
10
 
12
11
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -291,9 +290,9 @@ function fromPalette(expr, parentExpression) {
291
290
  const property = expr[2];
292
291
  let colorStops = expr.slice(3);
293
292
  let palette;
294
- if (stringUtils.isString(paletteIdOrArray)) {
293
+ if (randomId.isString(paletteIdOrArray)) {
295
294
  palette = palettes[paletteIdOrArray]?.colors || palettes["Greys"].colors;
296
- } else if (stringUtils.isArray(paletteIdOrArray) && paletteIdOrArray[0] === "literal") {
295
+ } else if (randomId.isArray(paletteIdOrArray) && paletteIdOrArray[0] === "literal") {
297
296
  palette = paletteIdOrArray[1];
298
297
  } else {
299
298
  throw new FlowExpressionError(parentExpression.expression, "evaluationError", ["from-palette requires palette id as string or custom palette array"]);
@@ -371,7 +370,7 @@ function stateCustomFunction(expr, parentExpression) {
371
370
  }
372
371
  const path = expr.slice(1).join(".");
373
372
  const val = parentExpression.store.get(path);
374
- if (stringUtils.isNil(val)) {
373
+ if (randomId.isNil(val)) {
375
374
  return null;
376
375
  } else if (typeof val === "object") {
377
376
  return ["literal", val];
@@ -406,7 +405,7 @@ const _ReactiveExpression = class _ReactiveExpression {
406
405
  { name: this.formatName(expression) }
407
406
  );
408
407
  this._expression = expression;
409
- if (stringUtils.isDefined(parsedExpression)) {
408
+ if (randomId.isDefined(parsedExpression)) {
410
409
  this.parsedResult = {
411
410
  status: true,
412
411
  value: parsedExpression
@@ -425,7 +424,7 @@ const _ReactiveExpression = class _ReactiveExpression {
425
424
  }
426
425
  static parseProgram(program) {
427
426
  const parsedProgram = this.parser.parseProgram(program);
428
- if (stringUtils.isString(program) && program.length === 0) {
427
+ if (randomId.isString(program) && program.length === 0) {
429
428
  return {};
430
429
  }
431
430
  if (parsedProgram.status) {
@@ -532,7 +531,7 @@ const _MapDataSource = class _MapDataSource {
532
531
  ..._MapDataSource.defaultOptions,
533
532
  ...options
534
533
  };
535
- if (!stringUtils.isIn(options.type, ["vector", "geojson", "raster"])) {
534
+ if (!randomId.isIn(options.type, ["vector", "geojson", "raster"])) {
536
535
  throw new FlowError(`${this.formattedName()}: unrecognized type '${options.type}'`);
537
536
  }
538
537
  this.setSrcExpression(options.src);
@@ -564,13 +563,13 @@ const _MapDataSource = class _MapDataSource {
564
563
  }
565
564
  get dataSourceSpecification() {
566
565
  let src = this._srcExpression ? mobx__namespace.toJS(this._srcExpression.value) : this._options.src;
567
- if (stringUtils.isString(src)) {
566
+ if (randomId.isString(src)) {
568
567
  src = this.expandSrc(src, this._options.type);
569
568
  }
570
569
  let ds;
571
570
  switch (this._options.type) {
572
571
  case "vector":
573
- ds = stringUtils.isStringFull(src) ? {
572
+ ds = randomId.isStringFull(src) ? {
574
573
  type: "vector",
575
574
  url: src
576
575
  } : (
@@ -585,7 +584,7 @@ const _MapDataSource = class _MapDataSource {
585
584
  }
586
585
  return ds;
587
586
  case "raster":
588
- ds = stringUtils.isStringFull(src) ? {
587
+ ds = randomId.isStringFull(src) ? {
589
588
  type: "raster",
590
589
  url: src
591
590
  } : (
@@ -628,7 +627,7 @@ const _MapDataSource = class _MapDataSource {
628
627
  this.setSrcExpression(val);
629
628
  }
630
629
  setParameter(name, expression) {
631
- if (stringUtils.isNil(expression)) {
630
+ if (randomId.isNil(expression)) {
632
631
  delete this._parameters[name];
633
632
  } else {
634
633
  const expr = new ReactiveExpression(expression);
@@ -643,8 +642,8 @@ const _MapDataSource = class _MapDataSource {
643
642
  return `MapDataSource<${id || this._options.id}>`;
644
643
  }
645
644
  setSrcExpression(src) {
646
- if (stringUtils.isString(src)) {
647
- if (stringUtils.isURL(src))
645
+ if (randomId.isString(src)) {
646
+ if (randomId.isURL(src))
648
647
  src = `'${src}'`;
649
648
  this._srcExpression = new ReactiveExpression(src);
650
649
  this._srcExpression.bindState(this._state);
@@ -662,7 +661,7 @@ const _MapDataSource = class _MapDataSource {
662
661
  expandSrc(src, type) {
663
662
  const host = this._options.flowHost;
664
663
  let isGeoJSON = false;
665
- if (!stringUtils.isURL(src)) {
664
+ if (!randomId.isURL(src)) {
666
665
  switch (type) {
667
666
  case "vector":
668
667
  case "raster":
@@ -678,7 +677,7 @@ const _MapDataSource = class _MapDataSource {
678
677
  }
679
678
  const urlObj = new URL(src);
680
679
  const combinedParams = new URLSearchParams(urlObj.searchParams);
681
- Object.entries(this._parameters).filter(([_, expr]) => !stringUtils.isNil(expr.value)).forEach(([key, expr]) => combinedParams.append(key, expr.value));
680
+ Object.entries(this._parameters).filter(([_, expr]) => !randomId.isNil(expr.value)).forEach(([key, expr]) => combinedParams.append(key, expr.value));
682
681
  if (this._options.flowHost && src.startsWith(this._options.flowHost) && !combinedParams.has("apikey") && this._options.flowApiKey) {
683
682
  combinedParams.append("apikey", this._options.flowApiKey);
684
683
  }
@@ -758,25 +757,25 @@ const _MapLayer = class _MapLayer {
758
757
  type: this._options.type,
759
758
  source: this._options.source
760
759
  };
761
- if (stringUtils.isDefined(this._options.minZoom)) {
760
+ if (randomId.isDefined(this._options.minZoom)) {
762
761
  layer.minzoom = this._options.minZoom;
763
762
  }
764
- if (stringUtils.isDefined(this._options.maxZoom)) {
763
+ if (randomId.isDefined(this._options.maxZoom)) {
765
764
  layer.maxzoom = this._options.maxZoom;
766
765
  }
767
- if (stringUtils.isDefined(this._options.sourceLayer)) {
766
+ if (randomId.isDefined(this._options.sourceLayer)) {
768
767
  layer["source-layer"] = this._options.sourceLayer;
769
768
  }
770
- if (stringUtils.isDefined(this._filter)) {
769
+ if (randomId.isDefined(this._filter)) {
771
770
  layer.filter = this._filter.maplibreExpression;
772
771
  }
773
- if (stringUtils.isObjectFull(this._paintProps)) {
772
+ if (randomId.isObjectFull(this._paintProps)) {
774
773
  layer.paint = Object.keys(this._paintProps).reduce((accum, key) => {
775
774
  accum[key] = this._paintProps[key].maplibreExpression;
776
775
  return accum;
777
776
  }, {});
778
777
  }
779
- if (stringUtils.isObjectFull(this._layoutProps)) {
778
+ if (randomId.isObjectFull(this._layoutProps)) {
780
779
  layer.layout = Object.keys(this._layoutProps).reduce((accum, key) => {
781
780
  let expr = this._layoutProps[key].maplibreExpression;
782
781
  if (key === "visibility") {
@@ -853,7 +852,7 @@ const _MapLayer = class _MapLayer {
853
852
  setStyleProperty(property, expression) {
854
853
  const metadata = this.getPropertyMetadata(property, this._options.type);
855
854
  const props = metadata.type === "paint" ? this._paintProps : this._layoutProps;
856
- if (stringUtils.isNil(expression)) {
855
+ if (randomId.isNil(expression)) {
857
856
  delete props[property];
858
857
  } else {
859
858
  const expr = new ReactiveExpression(expression).bindState(this._state);
@@ -865,7 +864,7 @@ const _MapLayer = class _MapLayer {
865
864
  }
866
865
  setFilter(expression) {
867
866
  this._filter = null;
868
- if (stringUtils.isDefined(expression)) {
867
+ if (randomId.isDefined(expression)) {
869
868
  let expr = new ReactiveExpression(expression).bindState(this._state);
870
869
  if (expr.parseError) {
871
870
  throw expr.parseError;
@@ -933,12 +932,6 @@ function die(message) {
933
932
  throw new FlowError(message);
934
933
  }
935
934
 
936
- const nanoid = nanoid$1.customAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01923456789", 10);
937
- const randomId = (prefix, length) => {
938
- const id = nanoid(length);
939
- return prefix ? `${prefix}-${id}` : id;
940
- };
941
-
942
935
  var __defProp$3 = Object.defineProperty;
943
936
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
944
937
  var __publicField$3 = (obj, key, value) => {
@@ -1102,7 +1095,7 @@ class PluginManager {
1102
1095
  getPlugin(pluginOrName) {
1103
1096
  let name;
1104
1097
  let pluginInstance;
1105
- if (stringUtils.isString(pluginOrName)) {
1098
+ if (randomId.isString(pluginOrName)) {
1106
1099
  pluginInstance = Array.from(this._plugins.values()).find((p) => p.name === pluginOrName);
1107
1100
  name = pluginOrName;
1108
1101
  } else {
@@ -1117,7 +1110,7 @@ class PluginManager {
1117
1110
  removePlugin(pluginOrName) {
1118
1111
  let pluginConstructor;
1119
1112
  let pluginInstance;
1120
- if (stringUtils.isString(pluginOrName)) {
1113
+ if (randomId.isString(pluginOrName)) {
1121
1114
  const pair = Array.from(this._plugins.entries()).find(([_, p]) => p.name === pluginOrName);
1122
1115
  pluginConstructor = pair && pair[0];
1123
1116
  pluginInstance = pair && pair[1];
@@ -1154,7 +1147,7 @@ class PluginManager {
1154
1147
  return this._keyboardShortcutManager.addListener(keyboardShortcuts, priority);
1155
1148
  }
1156
1149
  forwardEvent(eventName, ...args) {
1157
- const handlerName = `handle${stringUtils.capitalize(eventName)}`;
1150
+ const handlerName = `handle${randomId.capitalize(eventName)}`;
1158
1151
  this._plugins.forEach((plugin) => {
1159
1152
  if (this._exclusivePlugins.size && !this._exclusivePlugins.has(plugin))
1160
1153
  return;
@@ -1390,4 +1383,3 @@ exports.PluginManager = PluginManager;
1390
1383
  exports.ReactiveExpression = ReactiveExpression;
1391
1384
  exports.assert = assert;
1392
1385
  exports.die = die;
1393
- exports.randomId = randomId;
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  const invariant = require('@turf/invariant');
4
- const stringUtils = require('./flow-rdf-core.3042be4a.cjs');
4
+ const randomId = require('./flow-rdf-core.f50908f0.cjs');
5
5
 
6
6
  const isPoint = (val) => {
7
- if (!stringUtils.isPlainObject(val)) {
7
+ if (!randomId.isPlainObject(val)) {
8
8
  return false;
9
9
  }
10
10
  return invariant.getType(val) === "Point";
11
11
  };
12
12
  const isLineString = (val) => {
13
- if (!stringUtils.isPlainObject(val)) {
13
+ if (!randomId.isPlainObject(val)) {
14
14
  return false;
15
15
  }
16
16
  return invariant.getType(val) === "LineString";
17
17
  };
18
18
  const isPolygon = (val) => {
19
- if (!stringUtils.isPlainObject(val)) {
19
+ if (!randomId.isPlainObject(val)) {
20
20
  return false;
21
21
  }
22
22
  return invariant.getType(val) === "Polygon";