@emuanalytics/flow-rdf-core 4.0.4 → 4.0.6

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 (89) hide show
  1. package/README.md +1 -64
  2. package/dist/index.d.mts +36 -31
  3. package/dist/index.d.ts +36 -31
  4. package/dist/index.mjs +20 -3249
  5. package/dist/lib/context/context-registry.mjs +63 -0
  6. package/dist/lib/context/debugger.mjs +240 -0
  7. package/dist/lib/context/flow-context.mjs +61 -0
  8. package/dist/lib/context/global-state.mjs +70 -0
  9. package/dist/lib/context/map-registry.mjs +59 -0
  10. package/dist/lib/context/query-registry.mjs +53 -0
  11. package/dist/lib/errors/flow-error.mjs +10 -0
  12. package/dist/lib/errors/flow-expression-error.mjs +14 -0
  13. package/dist/lib/errors/flow-map-error.mjs +9 -0
  14. package/dist/lib/expressions/expression-parser.mjs +198 -0
  15. package/dist/lib/expressions/functions/from-palette.mjs +75 -0
  16. package/dist/lib/expressions/functions/regex.mjs +25 -0
  17. package/dist/lib/expressions/functions/state.mjs +25 -0
  18. package/dist/lib/expressions/parser-helpers.mjs +37 -0
  19. package/dist/lib/expressions/reactive-expression.mjs +253 -0
  20. package/dist/lib/map/flow-core-map.mjs +749 -0
  21. package/dist/lib/map/plugins/annotations/annotation-layers.mjs +163 -0
  22. package/dist/lib/map/plugins/annotations/annotation.events.mjs +27 -0
  23. package/dist/lib/map/plugins/annotations/annotation.plugin.mjs +498 -0
  24. package/dist/lib/map/plugins/annotations/maplibre-gl-draw-circle/lib/modes/DirectModeOverride.mjs +67 -0
  25. package/dist/lib/map/plugins/annotations/maplibre-gl-draw-circle/lib/modes/DragCircleMode.mjs +65 -0
  26. package/dist/lib/map/plugins/annotations/maplibre-gl-draw-circle/lib/utils/create_supplementary_points_circle.mjs +15 -0
  27. package/dist/lib/map/plugins/annotations/maplibre-gl-draw-circle/lib/utils/drag_pan.mjs +20 -0
  28. package/dist/lib/map/plugins/data-join.plugin.mjs +173 -0
  29. package/dist/lib/map/plugins/export/export.plugin.mjs +21 -0
  30. package/dist/lib/map/plugins/export/map-exporter.mjs +177 -0
  31. package/dist/lib/map/plugins/hover-effect.plugin.mjs +58 -0
  32. package/dist/lib/map/plugins/index.d.mts +37 -72
  33. package/dist/lib/map/plugins/index.d.ts +37 -72
  34. package/dist/lib/map/plugins/index.mjs +11 -1810
  35. package/dist/lib/map/plugins/keyboard-shortcut-manager.mjs +120 -0
  36. package/dist/lib/map/plugins/map-plugin-base.mjs +25 -0
  37. package/dist/lib/map/plugins/plugin-manager.mjs +135 -0
  38. package/dist/lib/map/plugins/popup.plugin.mjs +55 -0
  39. package/dist/lib/map/plugins/selection/selection.events.mjs +21 -0
  40. package/dist/lib/map/plugins/selection/selection.plugin.mjs +136 -0
  41. package/dist/lib/map/plugins/selection/source-selection.mjs +156 -0
  42. package/dist/lib/map/plugins/url-sync.plugin.mjs +55 -0
  43. package/dist/lib/map/support/image-registry.mjs +82 -0
  44. package/dist/lib/map/support/map-events.mjs +71 -0
  45. package/dist/lib/map/support/map-feature-stream.mjs +158 -0
  46. package/dist/lib/map/support/map-popup.mjs +159 -0
  47. package/dist/lib/map/types.mjs +7 -0
  48. package/dist/lib/map-style/map-data-source.mjs +192 -0
  49. package/dist/lib/map-style/map-layer-style-builder-generated.mjs +1307 -0
  50. package/dist/lib/map-style/map-layer-style-builder.mjs +86 -0
  51. package/dist/lib/map-style/map-layer.mjs +223 -0
  52. package/dist/lib/map-style/map-style.mjs +178 -0
  53. package/dist/lib/queries/async-committer.mjs +30 -0
  54. package/dist/lib/queries/query.mjs +172 -0
  55. package/dist/lib/state-store/decorators.mjs +83 -0
  56. package/dist/lib/state-store/state-store.mjs +534 -0
  57. package/dist/lib/state-store/utils.mjs +7 -0
  58. package/dist/lib/utils/announce.mjs +12 -0
  59. package/dist/lib/utils/assert.mjs +12 -0
  60. package/dist/{shared/flow-rdf-core.187cb345.mjs → lib/utils/debounce.mjs} +3 -39
  61. package/dist/lib/utils/decorators.mjs +59 -0
  62. package/dist/lib/utils/deferred.mjs +11 -0
  63. package/dist/lib/utils/ensure-array.mjs +16 -0
  64. package/dist/{shared/flow-rdf-core.1f0901c5.mjs → lib/utils/feature-type-checks.mjs} +2 -2
  65. package/dist/lib/utils/functional.mjs +22 -0
  66. package/dist/lib/utils/global.mjs +18 -0
  67. package/dist/lib/utils/index.mjs +8 -5
  68. package/dist/lib/utils/random-id.mjs +9 -0
  69. package/dist/lib/utils/string-utils.mjs +3 -0
  70. package/dist/lib/utils/throttle.mjs +20 -0
  71. package/dist/{shared/flow-rdf-core.25e5f6d7.mjs → lib/utils/type-checks.mjs} +1 -26
  72. package/dist/lib/utils/watchable-promise.mjs +55 -0
  73. package/dist/package.json.mjs +3 -0
  74. package/dist/shared/{flow-rdf-core.4dde996e.d.cts → flow-rdf-core.cef13c7e.d.mts} +1315 -172
  75. package/dist/shared/{flow-rdf-core.4dde996e.d.ts → flow-rdf-core.cef13c7e.d.ts} +1315 -172
  76. package/package.json +4 -8
  77. package/dist/index.cjs +0 -3316
  78. package/dist/index.d.cts +0 -90
  79. package/dist/lib/map/plugins/index.cjs +0 -1850
  80. package/dist/lib/map/plugins/index.d.cts +0 -345
  81. package/dist/lib/utils/index.cjs +0 -48
  82. package/dist/lib/utils/index.d.cts +0 -160
  83. package/dist/shared/flow-rdf-core.06e85a6c.cjs +0 -1394
  84. package/dist/shared/flow-rdf-core.4dde996e.d.mts +0 -1916
  85. package/dist/shared/flow-rdf-core.55c169ca.cjs +0 -150
  86. package/dist/shared/flow-rdf-core.63162669.d.cts +0 -10
  87. package/dist/shared/flow-rdf-core.65045caf.mjs +0 -1360
  88. package/dist/shared/flow-rdf-core.a82b9be4.cjs +0 -34
  89. package/dist/shared/flow-rdf-core.f50908f0.cjs +0 -102
@@ -0,0 +1,59 @@
1
+ import { die } from './assert.mjs';
2
+
3
+ const storedAnnotationsSymbol = Symbol("flow-rdf-annotations");
4
+ function createDecoratorAnnotation(annotation) {
5
+ function decorator(target, property) {
6
+ storeAnnotation(target, property, annotation);
7
+ }
8
+ return Object.assign(decorator, annotation);
9
+ }
10
+ function createDecoratorAnnotationWithArg(annotation) {
11
+ function decorator(target, property) {
12
+ storeAnnotation(target, property, annotation);
13
+ }
14
+ return (arg) => {
15
+ annotation = Object.assign({}, annotation, { arg });
16
+ return Object.assign(decorator, annotation);
17
+ };
18
+ }
19
+ function storeAnnotation(prototype, key, annotation) {
20
+ var _a, _b;
21
+ if (!hasProp(prototype, storedAnnotationsSymbol)) {
22
+ addHiddenProp(prototype, storedAnnotationsSymbol, {
23
+ // Inherit annotations
24
+ ...prototype[storedAnnotationsSymbol]
25
+ });
26
+ }
27
+ (_a = prototype[storedAnnotationsSymbol])[_b = annotation.annotationType] ?? (_a[_b] = {});
28
+ assertNotDecorated(prototype, annotation, key);
29
+ prototype[storedAnnotationsSymbol][annotation.annotationType][key] = annotation;
30
+ }
31
+ function assertNotDecorated(prototype, annotation, key) {
32
+ if (hasProp(prototype[storedAnnotationsSymbol][annotation.annotationType], key)) {
33
+ const fieldName = `${prototype.constructor.name}.prototype.${key.toString()}`;
34
+ const currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;
35
+ const requestedAnnotationType = annotation.annotationType;
36
+ die(
37
+ `Cannot apply '@${requestedAnnotationType}' to '${fieldName}':
38
+ The field is already decorated with '@${currentAnnotationType}'.
39
+ Re-decorating fields is not allowed.
40
+ Use '@override' decorator for methods overridden by subclass.`
41
+ );
42
+ }
43
+ }
44
+ function collectStoredAnnotations(target, annotationType) {
45
+ return target[storedAnnotationsSymbol]?.[annotationType] ?? {};
46
+ }
47
+ function addHiddenProp(object, propName, value) {
48
+ Object.defineProperty(object, propName, {
49
+ enumerable: false,
50
+ writable: true,
51
+ configurable: true,
52
+ value
53
+ });
54
+ }
55
+ function hasProp(target, prop) {
56
+ return Object.hasOwnProperty.call(target, prop);
57
+ }
58
+
59
+ export { addHiddenProp, collectStoredAnnotations, createDecoratorAnnotation, createDecoratorAnnotationWithArg, hasProp, storeAnnotation, storedAnnotationsSymbol };
@@ -0,0 +1,11 @@
1
+ import { WatchablePromise } from './watchable-promise.mjs';
2
+
3
+ function deferred() {
4
+ let methods;
5
+ const promise = new WatchablePromise((resolve, reject) => {
6
+ methods = { resolve, reject };
7
+ });
8
+ return Object.assign(promise, methods);
9
+ }
10
+
11
+ export { deferred };
@@ -0,0 +1,16 @@
1
+ function ensureArray(a, ...rest) {
2
+ if (arguments.length === 0) {
3
+ return [];
4
+ }
5
+ if (arguments.length === 1) {
6
+ if (a === void 0 || a === null) {
7
+ return [];
8
+ }
9
+ if (Array.isArray(a)) {
10
+ return a;
11
+ }
12
+ }
13
+ return Array.prototype.slice.call(arguments);
14
+ }
15
+
16
+ export { ensureArray };
@@ -1,5 +1,5 @@
1
1
  import { getType } from '@turf/invariant';
2
- import { y as isPlainObject } from './flow-rdf-core.25e5f6d7.mjs';
2
+ import { isPlainObject } from './type-checks.mjs';
3
3
 
4
4
  const isPoint = (val) => {
5
5
  if (!isPlainObject(val)) {
@@ -26,4 +26,4 @@ const isMultiPolygon = (val) => {
26
26
  return getType(val) === "MultiPolygon";
27
27
  };
28
28
 
29
- export { isMultiPolygon as a, isPoint as b, isPolygon as c, isLineString as i };
29
+ export { isLineString, isMultiPolygon, isPoint, isPolygon };
@@ -0,0 +1,22 @@
1
+ const doNotMemoize = Symbol("Do not memoize");
2
+ function memoize(originalFunction, options) {
3
+ const cache = /* @__PURE__ */ new Map();
4
+ const hash = options.hash ? options.hash : (...args) => args[0];
5
+ const context = options.context;
6
+ return function memoizedFunction(...args) {
7
+ const key = hash.apply(context, args);
8
+ if (key === doNotMemoize) {
9
+ return originalFunction.apply(context, args);
10
+ }
11
+ let value;
12
+ if (!cache.has(key)) {
13
+ value = originalFunction.apply(context, args);
14
+ cache.set(key, value);
15
+ } else {
16
+ value = cache.get(key);
17
+ }
18
+ return value;
19
+ };
20
+ }
21
+
22
+ export { doNotMemoize, memoize };
@@ -0,0 +1,18 @@
1
+ const mockGlobal = {};
2
+ function getGlobal() {
3
+ if (typeof globalThis !== "undefined") {
4
+ return globalThis;
5
+ }
6
+ if (typeof window !== "undefined") {
7
+ return window;
8
+ }
9
+ if (typeof global !== "undefined") {
10
+ return global;
11
+ }
12
+ if (typeof self !== "undefined") {
13
+ return self;
14
+ }
15
+ return mockGlobal;
16
+ }
17
+
18
+ export { getGlobal };
@@ -1,6 +1,9 @@
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';
1
+ export { hasLength, hasValue, isArray, isArrayFull, isArrayStrings, isBoolean, isDate, isDefined, isFalse, isFunction, isIn, isNil, isNull, isNumber, isNumeric, isObject, isObjectFull, isPlainObject, isString, isStringFull, isTrue, isURL, isUndefined, isValue } from './type-checks.mjs';
2
+ export { ensureArray } from './ensure-array.mjs';
3
+ export { isLineString, isMultiPolygon, isPoint, isPolygon } from './feature-type-checks.mjs';
4
+ export { memoize } from './functional.mjs';
5
+ export { debounce, debounceWithArgs } from './debounce.mjs';
6
+ export { throttle, throttleWithArgs } from './throttle.mjs';
7
+ export { capitalize } from './string-utils.mjs';
8
+ export { randomId } from './random-id.mjs';
4
9
  export { html } from 'lit-html';
5
- import 'nanoid';
6
- import '@turf/invariant';
@@ -0,0 +1,9 @@
1
+ import { customAlphabet } from 'nanoid';
2
+
3
+ const nanoid = customAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01923456789", 10);
4
+ function randomId(prefix, length) {
5
+ const id = nanoid(length);
6
+ return prefix ? `${prefix}-${id}` : id;
7
+ }
8
+
9
+ export { randomId };
@@ -0,0 +1,3 @@
1
+ const capitalize = (str, lowerRest = false) => str.slice(0, 1).toUpperCase() + (lowerRest ? str.slice(1).toLowerCase() : str.slice(1));
2
+
3
+ export { capitalize };
@@ -0,0 +1,20 @@
1
+ import { debounce } from './debounce.mjs';
2
+ import { memoize } from './functional.mjs';
3
+
4
+ function throttle(func, wait, options) {
5
+ if (typeof func != "function") {
6
+ throw new TypeError("Expected a function");
7
+ }
8
+ return debounce(func, wait, { ...options, maxWait: wait });
9
+ }
10
+ function throttleWithArgs(fn, wait, options) {
11
+ const memoizedThrottleFn = memoize(
12
+ () => debounce(fn, wait, options),
13
+ options
14
+ );
15
+ return (...args) => {
16
+ memoizedThrottleFn(...args)(...args);
17
+ };
18
+ }
19
+
20
+ export { throttle as default, throttle, throttleWithArgs };
@@ -1,5 +1,3 @@
1
- import { customAlphabet } from 'nanoid';
2
-
3
1
  const isUndefined = (val) => typeof val === "undefined";
4
2
  const isNull = (val) => val === null;
5
3
  const isNil = (val) => isUndefined(val) || isNull(val);
@@ -48,27 +46,4 @@ function isURL(val) {
48
46
  return isString(val) && !!urlRegex.test(val);
49
47
  }
50
48
 
51
- function ensureArray(a, ...rest) {
52
- if (arguments.length === 0) {
53
- return [];
54
- }
55
- if (arguments.length === 1) {
56
- if (a === void 0 || a === null) {
57
- return [];
58
- }
59
- if (Array.isArray(a)) {
60
- return a;
61
- }
62
- }
63
- return Array.prototype.slice.call(arguments);
64
- }
65
-
66
- const capitalize = (str, lowerRest = false) => str.slice(0, 1).toUpperCase() + (lowerRest ? str.slice(1).toLowerCase() : str.slice(1));
67
-
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 };
49
+ export { hasLength, hasValue, isArray, isArrayFull, isArrayStrings, isBoolean, isDate, isDefined, isFalse, isFunction, isIn, isNil, isNull, isNumber, isNumeric, isObject, isObjectFull, isPlainObject, isString, isStringFull, isTrue, isURL, isUndefined, isValue };
@@ -0,0 +1,55 @@
1
+ var __accessCheck = (obj, member, msg) => {
2
+ if (!member.has(obj))
3
+ throw TypeError("Cannot " + msg);
4
+ };
5
+ var __privateGet = (obj, member, getter) => {
6
+ __accessCheck(obj, member, "read from private field");
7
+ return getter ? getter.call(obj) : member.get(obj);
8
+ };
9
+ var __privateAdd = (obj, member, value) => {
10
+ if (member.has(obj))
11
+ throw TypeError("Cannot add the same private member more than once");
12
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
+ };
14
+ var __privateSet = (obj, member, value, setter) => {
15
+ __accessCheck(obj, member, "write to private field");
16
+ setter ? setter.call(obj, value) : member.set(obj, value);
17
+ return value;
18
+ };
19
+ var _value, _settled, _status;
20
+ class WatchablePromise extends Promise {
21
+ constructor(executor) {
22
+ super((resolve, reject) => {
23
+ executor(
24
+ (value) => {
25
+ resolve(value);
26
+ __privateSet(this, _value, value);
27
+ __privateSet(this, _settled, true);
28
+ __privateSet(this, _status, "fulfilled");
29
+ },
30
+ (reason) => {
31
+ reject(reason);
32
+ __privateSet(this, _settled, true);
33
+ __privateSet(this, _status, "rejected");
34
+ }
35
+ );
36
+ });
37
+ __privateAdd(this, _value, void 0);
38
+ __privateAdd(this, _settled, false);
39
+ __privateAdd(this, _status, "pending");
40
+ }
41
+ get settled() {
42
+ return __privateGet(this, _settled);
43
+ }
44
+ get status() {
45
+ return __privateGet(this, _status);
46
+ }
47
+ get value() {
48
+ return __privateGet(this, _value);
49
+ }
50
+ }
51
+ _value = new WeakMap();
52
+ _settled = new WeakMap();
53
+ _status = new WeakMap();
54
+
55
+ export { WatchablePromise };
@@ -0,0 +1,3 @@
1
+ const version = "4.0.6";
2
+
3
+ export { version };