@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.
- package/dist/index.cjs +681 -670
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +647 -647
- package/dist/lib/map/plugins/index.cjs +39 -37
- package/dist/lib/map/plugins/index.d.cts +8 -8
- package/dist/lib/map/plugins/index.d.mts +8 -8
- package/dist/lib/map/plugins/index.d.ts +8 -8
- package/dist/lib/map/plugins/index.mjs +12 -10
- package/dist/lib/utils/index.cjs +31 -29
- package/dist/lib/utils/index.d.cts +10 -9
- package/dist/lib/utils/index.d.mts +10 -9
- package/dist/lib/utils/index.d.ts +10 -9
- package/dist/lib/utils/index.mjs +4 -3
- package/dist/shared/{flow-rdf-core.ea06a1d3.mjs → flow-rdf-core.187cb345.mjs} +1 -1
- package/dist/shared/{flow-rdf-core.bd95d618.mjs → flow-rdf-core.1f0901c5.mjs} +1 -1
- package/dist/shared/{flow-rdf-core.b80085b4.mjs → flow-rdf-core.25e5f6d7.mjs} +9 -1
- package/dist/shared/{flow-rdf-core.1f72b20b.cjs → flow-rdf-core.55c169ca.cjs} +2 -2
- package/dist/shared/{flow-rdf-core.1f9c0593.cjs → flow-rdf-core.9b5dad76.cjs} +26 -34
- package/dist/shared/{flow-rdf-core.84eded74.cjs → flow-rdf-core.a82b9be4.cjs} +4 -4
- package/dist/shared/{flow-rdf-core.769a4928.d.mts → flow-rdf-core.dd931ace.d.cts} +817 -818
- package/dist/shared/{flow-rdf-core.769a4928.d.ts → flow-rdf-core.dd931ace.d.mts} +817 -818
- package/dist/shared/{flow-rdf-core.769a4928.d.cts → flow-rdf-core.dd931ace.d.ts} +817 -818
- package/dist/shared/{flow-rdf-core.ce91eb14.mjs → flow-rdf-core.e2b1bb7f.mjs} +2 -9
- package/dist/shared/{flow-rdf-core.3042be4a.cjs → flow-rdf-core.f50908f0.cjs} +9 -0
- package/package.json +5 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const mapFeatureStream = require('../../../shared/flow-rdf-core.
|
|
3
|
+
const mapFeatureStream = require('../../../shared/flow-rdf-core.9b5dad76.cjs');
|
|
4
4
|
const MapboxDraw = require('@emuanalytics/mapbox-gl-draw');
|
|
5
5
|
const turfArea = require('@turf/area');
|
|
6
6
|
const turfBBox = require('@turf/bbox');
|
|
@@ -8,11 +8,11 @@ const turfBooleanEqual = require('@turf/boolean-equal');
|
|
|
8
8
|
const turfBuffer = require('@turf/buffer');
|
|
9
9
|
const turfLength = require('@turf/length');
|
|
10
10
|
const Debug = require('debug');
|
|
11
|
-
const featureTypeChecks = require('../../../shared/flow-rdf-core.
|
|
11
|
+
const featureTypeChecks = require('../../../shared/flow-rdf-core.a82b9be4.cjs');
|
|
12
|
+
const randomId = require('../../../shared/flow-rdf-core.f50908f0.cjs');
|
|
12
13
|
const EventEmitter = require('eventemitter3');
|
|
13
|
-
const stringUtils = require('../../../shared/flow-rdf-core.3042be4a.cjs');
|
|
14
|
-
const lit = require('lit-html');
|
|
15
14
|
const maplibre = require('@emuanalytics/maplibre-gl');
|
|
15
|
+
const lit = require('lit-html');
|
|
16
16
|
const turfCircle = require('@turf/circle');
|
|
17
17
|
const turfDistance = require('@turf/distance');
|
|
18
18
|
const helpers = require('@turf/helpers');
|
|
@@ -22,8 +22,8 @@ require('@emuanalytics/maplibre-gl-style-spec');
|
|
|
22
22
|
require('mobx-utils');
|
|
23
23
|
require('parsimmon');
|
|
24
24
|
require('colorbrewer');
|
|
25
|
-
require('nanoid');
|
|
26
25
|
require('@turf/invariant');
|
|
26
|
+
require('nanoid');
|
|
27
27
|
|
|
28
28
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
29
29
|
|
|
@@ -47,8 +47,8 @@ const turfBuffer__default = /*#__PURE__*/_interopDefaultCompat(turfBuffer);
|
|
|
47
47
|
const turfLength__default = /*#__PURE__*/_interopDefaultCompat(turfLength);
|
|
48
48
|
const Debug__default = /*#__PURE__*/_interopDefaultCompat(Debug);
|
|
49
49
|
const EventEmitter__default = /*#__PURE__*/_interopDefaultCompat(EventEmitter);
|
|
50
|
-
const lit__namespace = /*#__PURE__*/_interopNamespaceCompat(lit);
|
|
51
50
|
const maplibre__default = /*#__PURE__*/_interopDefaultCompat(maplibre);
|
|
51
|
+
const lit__namespace = /*#__PURE__*/_interopNamespaceCompat(lit);
|
|
52
52
|
const turfCircle__default = /*#__PURE__*/_interopDefaultCompat(turfCircle);
|
|
53
53
|
const turfDistance__default = /*#__PURE__*/_interopDefaultCompat(turfDistance);
|
|
54
54
|
const saveAs__default = /*#__PURE__*/_interopDefaultCompat(saveAs);
|
|
@@ -100,7 +100,7 @@ class MapPluginBase extends EventEmitter.EventEmitter {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
function isFeatureWithId(f) {
|
|
103
|
-
return
|
|
103
|
+
return randomId.isDefined(f) && randomId.isDefined(f.source) && randomId.isDefined(f.id);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
var __defProp$a = Object.defineProperty;
|
|
@@ -164,7 +164,7 @@ class MapPopup extends EventEmitter__default {
|
|
|
164
164
|
if (this._maplibrePopup) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
if (!
|
|
167
|
+
if (!randomId.isArray(eventOrLngLat)) {
|
|
168
168
|
if (isFeatureWithId(eventOrLngLat.features[0])) {
|
|
169
169
|
feature = eventOrLngLat.features[0];
|
|
170
170
|
}
|
|
@@ -206,7 +206,7 @@ class MapPopup extends EventEmitter__default {
|
|
|
206
206
|
}
|
|
207
207
|
cssClasses() {
|
|
208
208
|
const classes = ["flow-map-popup"];
|
|
209
|
-
if (
|
|
209
|
+
if (randomId.isStringFull(this.options.class)) {
|
|
210
210
|
classes.push(this.options.class);
|
|
211
211
|
}
|
|
212
212
|
if (this.options.closeButton) {
|
|
@@ -241,8 +241,8 @@ class MapPopup extends EventEmitter__default {
|
|
|
241
241
|
}
|
|
242
242
|
renderContent(feature) {
|
|
243
243
|
const state = this.map.context.state;
|
|
244
|
-
const content =
|
|
245
|
-
if (
|
|
244
|
+
const content = randomId.isFunction(this.options.content) ? this.options.content(feature, state) : this.options.content;
|
|
245
|
+
if (randomId.isString(content)) {
|
|
246
246
|
this._contentContainer.innerHTML = content;
|
|
247
247
|
} else if (content instanceof Node) {
|
|
248
248
|
this._contentContainer.innerHTML = "";
|
|
@@ -279,7 +279,7 @@ class PopupPlugin extends MapPluginBase {
|
|
|
279
279
|
popup.once("closed", () => {
|
|
280
280
|
this._popups.delete(popup);
|
|
281
281
|
});
|
|
282
|
-
if (
|
|
282
|
+
if (randomId.isArray(eventOrLngLat)) {
|
|
283
283
|
popup.open(eventOrLngLat, feature);
|
|
284
284
|
} else {
|
|
285
285
|
popup.open(eventOrLngLat);
|
|
@@ -291,7 +291,7 @@ class PopupPlugin extends MapPluginBase {
|
|
|
291
291
|
this._popups.clear();
|
|
292
292
|
}
|
|
293
293
|
closePopupsForSources(sources) {
|
|
294
|
-
sources =
|
|
294
|
+
sources = randomId.ensureArray(sources);
|
|
295
295
|
this._popups.forEach((popup) => {
|
|
296
296
|
if (popup.feature?.source && sources.indexOf(popup.feature?.source) >= 0) {
|
|
297
297
|
popup.close();
|
|
@@ -350,7 +350,7 @@ class SourceSelection {
|
|
|
350
350
|
});
|
|
351
351
|
if (options.selectionState) {
|
|
352
352
|
this._stateSubscription = this._map.context.state.toStream(options.selectionState, true).subscribe((val) => {
|
|
353
|
-
val = new Set(
|
|
353
|
+
val = new Set(randomId.ensureArray(val));
|
|
354
354
|
this.updateSelection(val);
|
|
355
355
|
});
|
|
356
356
|
}
|
|
@@ -456,7 +456,7 @@ class SourceSelection {
|
|
|
456
456
|
);
|
|
457
457
|
}
|
|
458
458
|
updateStateStore() {
|
|
459
|
-
if (
|
|
459
|
+
if (randomId.isStringFull(this._options.selectionState)) {
|
|
460
460
|
const selectedIds = Array.from(this._selectedFeatureIds);
|
|
461
461
|
if (this._options.mode === "single") {
|
|
462
462
|
this._map.context.state.set(this._options.selectionState, selectedIds[0]);
|
|
@@ -496,7 +496,7 @@ class SelectionPlugin extends MapPluginBase {
|
|
|
496
496
|
if (!sourceSelection) {
|
|
497
497
|
return;
|
|
498
498
|
}
|
|
499
|
-
features =
|
|
499
|
+
features = randomId.ensureArray(features);
|
|
500
500
|
const currentSelection = new Set(sourceSelection.selectedFeatureIds);
|
|
501
501
|
switch (sourceSelection.options.mode) {
|
|
502
502
|
case "single":
|
|
@@ -546,7 +546,7 @@ class SelectionPlugin extends MapPluginBase {
|
|
|
546
546
|
if (!sourceSelection) {
|
|
547
547
|
return;
|
|
548
548
|
}
|
|
549
|
-
features =
|
|
549
|
+
features = randomId.ensureArray(features);
|
|
550
550
|
if (features.length === 0) {
|
|
551
551
|
this.clearSelection(source);
|
|
552
552
|
return;
|
|
@@ -562,7 +562,7 @@ class SelectionPlugin extends MapPluginBase {
|
|
|
562
562
|
sourceSelection.updateSelection(currentSelection);
|
|
563
563
|
break;
|
|
564
564
|
}
|
|
565
|
-
if (sourceSelection.selectedFeatureIds.size &&
|
|
565
|
+
if (sourceSelection.selectedFeatureIds.size && randomId.isStringFull(sourceSelection.options.group)) {
|
|
566
566
|
this._sourceSelections.forEach((s) => {
|
|
567
567
|
if (s != sourceSelection && s.options.clear === "group" && s.options.group == sourceSelection.options.group) {
|
|
568
568
|
s.updateSelection(/* @__PURE__ */ new Set());
|
|
@@ -1278,10 +1278,10 @@ const _AnnotationPlugin = class _AnnotationPlugin extends MapPluginBase {
|
|
|
1278
1278
|
return feature;
|
|
1279
1279
|
}
|
|
1280
1280
|
generateFeatureId(feature) {
|
|
1281
|
-
if (
|
|
1281
|
+
if (randomId.isNumber(feature.id) || randomId.isStringFull(feature.id)) {
|
|
1282
1282
|
return feature.id.toString();
|
|
1283
1283
|
} else {
|
|
1284
|
-
return
|
|
1284
|
+
return randomId.randomId("feature");
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
1287
|
generateFeatureName(feature) {
|
|
@@ -1405,15 +1405,15 @@ const _DataJoin = class _DataJoin {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
start() {
|
|
1407
1407
|
this.stop();
|
|
1408
|
-
if (
|
|
1409
|
-
if (
|
|
1408
|
+
if (randomId.isString(this.options.data)) {
|
|
1409
|
+
if (randomId.isURL(this.options.data))
|
|
1410
1410
|
this.options.data = `'${this.options.data}'`;
|
|
1411
1411
|
this.dataExpression = new mapFeatureStream.ReactiveExpression(this.options.data);
|
|
1412
1412
|
this.dataExpression.bindState(this.map.context.state);
|
|
1413
1413
|
} else {
|
|
1414
1414
|
this.dataExpression = null;
|
|
1415
1415
|
}
|
|
1416
|
-
if (
|
|
1416
|
+
if (randomId.isArrayFull(this.options.parameters)) {
|
|
1417
1417
|
this.parameterExpressions = this.options.parameters.reduce((accum, param) => {
|
|
1418
1418
|
const expr = new mapFeatureStream.ReactiveExpression(param.value.toString());
|
|
1419
1419
|
expr.bindState(this.map.context.state);
|
|
@@ -1424,19 +1424,21 @@ const _DataJoin = class _DataJoin {
|
|
|
1424
1424
|
this.autorunDisposer = mobx.autorun(
|
|
1425
1425
|
async () => {
|
|
1426
1426
|
let data = this.dataExpression ? mobx.toJS(this.dataExpression.value) : this.options.data;
|
|
1427
|
-
const missingParams = this.options.parameters.map(
|
|
1428
|
-
|
|
1429
|
-
).filter((p) => !!p);
|
|
1430
|
-
if (stringUtils.isNull(data)) {
|
|
1427
|
+
const missingParams = this.options.parameters.map((p) => p.required && randomId.isNil(this.parameterExpressions[p.name].value) ? p.name : void 0).filter((p) => !!p);
|
|
1428
|
+
if (randomId.isNull(data)) {
|
|
1431
1429
|
debug$1(`FlowMap<${this.map.id}>: Skipping data join '${this.id}' (null data)`);
|
|
1432
1430
|
return;
|
|
1433
1431
|
}
|
|
1434
1432
|
if (missingParams.length) {
|
|
1435
|
-
debug$1(
|
|
1433
|
+
debug$1(
|
|
1434
|
+
`FlowMap<${this.map.id}>: Skipping data join '${this.id}' (null required parameters: ${missingParams.join(
|
|
1435
|
+
", "
|
|
1436
|
+
)})`
|
|
1437
|
+
);
|
|
1436
1438
|
return;
|
|
1437
1439
|
}
|
|
1438
1440
|
debug$1(`FlowMap<${this.map.id}>: Performing data join '${this.id}'`);
|
|
1439
|
-
if (
|
|
1441
|
+
if (randomId.isString(data)) {
|
|
1440
1442
|
try {
|
|
1441
1443
|
data = await this.loadData(data);
|
|
1442
1444
|
} catch (e) {
|
|
@@ -1468,10 +1470,10 @@ const _DataJoin = class _DataJoin {
|
|
|
1468
1470
|
this.map.setFeatureStateBulk({ source: source.id, sourceLayer }, featureData);
|
|
1469
1471
|
}
|
|
1470
1472
|
loadData(datasetOrUrl) {
|
|
1471
|
-
if (
|
|
1473
|
+
if (randomId.isURL(datasetOrUrl)) {
|
|
1472
1474
|
const url = new URL(datasetOrUrl);
|
|
1473
1475
|
const params = new URLSearchParams(url.searchParams);
|
|
1474
|
-
if (
|
|
1476
|
+
if (randomId.isArrayFull(this.options.parameters)) {
|
|
1475
1477
|
this.options.parameters.forEach((p) => {
|
|
1476
1478
|
params.append(p.name, this.parameterExpressions[p.name].value);
|
|
1477
1479
|
});
|
|
@@ -1492,7 +1494,7 @@ const _DataJoin = class _DataJoin {
|
|
|
1492
1494
|
});
|
|
1493
1495
|
} else {
|
|
1494
1496
|
const params = {};
|
|
1495
|
-
if (
|
|
1497
|
+
if (randomId.isArrayFull(this.options.parameters)) {
|
|
1496
1498
|
this.options.parameters.forEach((p) => {
|
|
1497
1499
|
params[p.name] = this.parameterExpressions[p.name].value;
|
|
1498
1500
|
});
|
|
@@ -1588,7 +1590,7 @@ const _MapExporter = class _MapExporter {
|
|
|
1588
1590
|
const mapImage = new Image();
|
|
1589
1591
|
mapImage.onload = () => {
|
|
1590
1592
|
exportContext.drawImage(mapImage, 0, 0);
|
|
1591
|
-
if (
|
|
1593
|
+
if (randomId.isFunction(options.drawOverlayFn)) {
|
|
1592
1594
|
options.drawOverlayFn(
|
|
1593
1595
|
exportContext,
|
|
1594
1596
|
exportCanvas.width,
|
|
@@ -1627,7 +1629,7 @@ const _MapExporter = class _MapExporter {
|
|
|
1627
1629
|
const pixelRatio = exportWidth / copyWidth;
|
|
1628
1630
|
this.setDevicePixelRatio(pixelRatio);
|
|
1629
1631
|
const container = document.createElement("div");
|
|
1630
|
-
container.id =
|
|
1632
|
+
container.id = randomId.randomId("export");
|
|
1631
1633
|
container.classList.add("maplibregl-export-container");
|
|
1632
1634
|
container.style.width = `${copyWidth}px`;
|
|
1633
1635
|
container.style.height = `${copyHeight}px`;
|
|
@@ -1664,7 +1666,7 @@ const _MapExporter = class _MapExporter {
|
|
|
1664
1666
|
createExportCanvas(container, mapCanvas) {
|
|
1665
1667
|
const canvasContainer = container.getElementsByClassName("maplibregl-canvas-container")[0];
|
|
1666
1668
|
const overlayCanvas = document.createElement("canvas");
|
|
1667
|
-
overlayCanvas.id =
|
|
1669
|
+
overlayCanvas.id = randomId.randomId("overlay");
|
|
1668
1670
|
overlayCanvas.width = mapCanvas.width;
|
|
1669
1671
|
overlayCanvas.height = mapCanvas.height;
|
|
1670
1672
|
overlayCanvas.style.position = "absolute";
|
|
@@ -1752,7 +1754,7 @@ class HoverEffectPlugin extends MapPluginBase {
|
|
|
1752
1754
|
}
|
|
1753
1755
|
if (!this.compareFeatures(hoveredFeature, this.hoveredFeature)) {
|
|
1754
1756
|
this.clearHover();
|
|
1755
|
-
if (isFeatureWithId(hoveredFeature) &&
|
|
1757
|
+
if (isFeatureWithId(hoveredFeature) && randomId.isDefined(this.map.getSource(hoveredFeature.source)?.featureId)) {
|
|
1756
1758
|
this.map.setFeatureState(hoveredFeature, { hover: true }, false);
|
|
1757
1759
|
this.hoveredFeature = hoveredFeature;
|
|
1758
1760
|
}
|
|
@@ -1771,7 +1773,7 @@ class HoverEffectPlugin extends MapPluginBase {
|
|
|
1771
1773
|
if (f1 === f2) {
|
|
1772
1774
|
return true;
|
|
1773
1775
|
}
|
|
1774
|
-
if (
|
|
1776
|
+
if (randomId.isObject(f1) && randomId.isObject(f2)) {
|
|
1775
1777
|
return f1.id == f2.id && f1.source === f2.source && f1.sourceLayer == f2.sourceLayer;
|
|
1776
1778
|
}
|
|
1777
1779
|
return false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a8 as MapEvent, K as FlowCoreMap, I as MapSourceIdentifier, a9 as MapFeatureId, aa as MapPluginBase, ab as PluginManager, ac as MapSourceEvent, ad as MapMouseEvent, ae as MapFeatureStream, af as PartialBy, x as MapAnimationOptions, ag as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, E as MapFeatureIdentifier, z as MapFeature } from '../../../shared/flow-rdf-core.dd931ace.cjs';
|
|
2
|
+
export { ak as EventHandlers, aj as PluginConstructor, ai as PluginEventsType, ah as PluginOptionsType } from '../../../shared/flow-rdf-core.dd931ace.cjs';
|
|
3
3
|
import { F as Func } from '../../../shared/flow-rdf-core.63162669.cjs';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import * as lit from 'lit-html';
|
|
@@ -61,7 +61,7 @@ declare class AnnotationEvent extends MapEvent<AnnotationEventType> {
|
|
|
61
61
|
activeFeatureId: string | null;
|
|
62
62
|
activeFeatureType: AnnotationFeatureType | null;
|
|
63
63
|
features: AnnotationFeature[];
|
|
64
|
-
constructor(type: AnnotationEventType, map:
|
|
64
|
+
constructor(type: AnnotationEventType, map: FlowCoreMap, data: AnnotationEventData);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
type SelectionEventType = 'selectionChanged';
|
|
@@ -72,7 +72,7 @@ declare class SelectionEvent extends MapEvent<SelectionEventType> implements Map
|
|
|
72
72
|
source: string;
|
|
73
73
|
sourceLayer?: string;
|
|
74
74
|
features: MapFeatureId[];
|
|
75
|
-
constructor(type: SelectionEventType, map:
|
|
75
|
+
constructor(type: SelectionEventType, map: FlowCoreMap, sourceIdentifier: MapSourceIdentifier, features: MapFeatureId[]);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
type SelectionMode = 'single' | 'multi' | 'none';
|
|
@@ -182,13 +182,13 @@ interface DataJoinParameter {
|
|
|
182
182
|
}
|
|
183
183
|
declare class DataJoin {
|
|
184
184
|
readonly id: string;
|
|
185
|
-
readonly map:
|
|
185
|
+
readonly map: FlowCoreMap;
|
|
186
186
|
private static defaultOptions;
|
|
187
187
|
private autorunDisposer;
|
|
188
188
|
private dataExpression;
|
|
189
189
|
private options;
|
|
190
190
|
private parameterExpressions;
|
|
191
|
-
constructor(id: string, map:
|
|
191
|
+
constructor(id: string, map: FlowCoreMap, options: DataJoinOptions);
|
|
192
192
|
get source(): string;
|
|
193
193
|
start(): void;
|
|
194
194
|
stop(): void;
|
|
@@ -281,7 +281,7 @@ interface MapPopupOptions {
|
|
|
281
281
|
* @noInheritDoc
|
|
282
282
|
*/
|
|
283
283
|
declare class MapPopup extends EventEmitter<MapPopupEvents> {
|
|
284
|
-
readonly map:
|
|
284
|
+
readonly map: FlowCoreMap;
|
|
285
285
|
readonly options: MapPopupOptions;
|
|
286
286
|
private _feature?;
|
|
287
287
|
private _contentContainer;
|
|
@@ -296,7 +296,7 @@ declare class MapPopup extends EventEmitter<MapPopupEvents> {
|
|
|
296
296
|
* @param map Parent Flo.w map.
|
|
297
297
|
* @param options Popup options.
|
|
298
298
|
*/
|
|
299
|
-
constructor(map:
|
|
299
|
+
constructor(map: FlowCoreMap, options: MapPopupOptions);
|
|
300
300
|
get feature(): MapFeatureIdentifier | undefined;
|
|
301
301
|
/**
|
|
302
302
|
* Close the popup.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a8 as MapEvent, K as FlowCoreMap, I as MapSourceIdentifier, a9 as MapFeatureId, aa as MapPluginBase, ab as PluginManager, ac as MapSourceEvent, ad as MapMouseEvent, ae as MapFeatureStream, af as PartialBy, x as MapAnimationOptions, ag as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, E as MapFeatureIdentifier, z as MapFeature } from '../../../shared/flow-rdf-core.dd931ace.mjs';
|
|
2
|
+
export { ak as EventHandlers, aj as PluginConstructor, ai as PluginEventsType, ah as PluginOptionsType } from '../../../shared/flow-rdf-core.dd931ace.mjs';
|
|
3
3
|
import { F as Func } from '../../../shared/flow-rdf-core.63162669.mjs';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import * as lit from 'lit-html';
|
|
@@ -61,7 +61,7 @@ declare class AnnotationEvent extends MapEvent<AnnotationEventType> {
|
|
|
61
61
|
activeFeatureId: string | null;
|
|
62
62
|
activeFeatureType: AnnotationFeatureType | null;
|
|
63
63
|
features: AnnotationFeature[];
|
|
64
|
-
constructor(type: AnnotationEventType, map:
|
|
64
|
+
constructor(type: AnnotationEventType, map: FlowCoreMap, data: AnnotationEventData);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
type SelectionEventType = 'selectionChanged';
|
|
@@ -72,7 +72,7 @@ declare class SelectionEvent extends MapEvent<SelectionEventType> implements Map
|
|
|
72
72
|
source: string;
|
|
73
73
|
sourceLayer?: string;
|
|
74
74
|
features: MapFeatureId[];
|
|
75
|
-
constructor(type: SelectionEventType, map:
|
|
75
|
+
constructor(type: SelectionEventType, map: FlowCoreMap, sourceIdentifier: MapSourceIdentifier, features: MapFeatureId[]);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
type SelectionMode = 'single' | 'multi' | 'none';
|
|
@@ -182,13 +182,13 @@ interface DataJoinParameter {
|
|
|
182
182
|
}
|
|
183
183
|
declare class DataJoin {
|
|
184
184
|
readonly id: string;
|
|
185
|
-
readonly map:
|
|
185
|
+
readonly map: FlowCoreMap;
|
|
186
186
|
private static defaultOptions;
|
|
187
187
|
private autorunDisposer;
|
|
188
188
|
private dataExpression;
|
|
189
189
|
private options;
|
|
190
190
|
private parameterExpressions;
|
|
191
|
-
constructor(id: string, map:
|
|
191
|
+
constructor(id: string, map: FlowCoreMap, options: DataJoinOptions);
|
|
192
192
|
get source(): string;
|
|
193
193
|
start(): void;
|
|
194
194
|
stop(): void;
|
|
@@ -281,7 +281,7 @@ interface MapPopupOptions {
|
|
|
281
281
|
* @noInheritDoc
|
|
282
282
|
*/
|
|
283
283
|
declare class MapPopup extends EventEmitter<MapPopupEvents> {
|
|
284
|
-
readonly map:
|
|
284
|
+
readonly map: FlowCoreMap;
|
|
285
285
|
readonly options: MapPopupOptions;
|
|
286
286
|
private _feature?;
|
|
287
287
|
private _contentContainer;
|
|
@@ -296,7 +296,7 @@ declare class MapPopup extends EventEmitter<MapPopupEvents> {
|
|
|
296
296
|
* @param map Parent Flo.w map.
|
|
297
297
|
* @param options Popup options.
|
|
298
298
|
*/
|
|
299
|
-
constructor(map:
|
|
299
|
+
constructor(map: FlowCoreMap, options: MapPopupOptions);
|
|
300
300
|
get feature(): MapFeatureIdentifier | undefined;
|
|
301
301
|
/**
|
|
302
302
|
* Close the popup.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a8 as MapEvent, K as FlowCoreMap, I as MapSourceIdentifier, a9 as MapFeatureId, aa as MapPluginBase, ab as PluginManager, ac as MapSourceEvent, ad as MapMouseEvent, ae as MapFeatureStream, af as PartialBy, x as MapAnimationOptions, ag as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, E as MapFeatureIdentifier, z as MapFeature } from '../../../shared/flow-rdf-core.dd931ace.js';
|
|
2
|
+
export { ak as EventHandlers, aj as PluginConstructor, ai as PluginEventsType, ah as PluginOptionsType } from '../../../shared/flow-rdf-core.dd931ace.js';
|
|
3
3
|
import { F as Func } from '../../../shared/flow-rdf-core.63162669.js';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import * as lit from 'lit-html';
|
|
@@ -61,7 +61,7 @@ declare class AnnotationEvent extends MapEvent<AnnotationEventType> {
|
|
|
61
61
|
activeFeatureId: string | null;
|
|
62
62
|
activeFeatureType: AnnotationFeatureType | null;
|
|
63
63
|
features: AnnotationFeature[];
|
|
64
|
-
constructor(type: AnnotationEventType, map:
|
|
64
|
+
constructor(type: AnnotationEventType, map: FlowCoreMap, data: AnnotationEventData);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
type SelectionEventType = 'selectionChanged';
|
|
@@ -72,7 +72,7 @@ declare class SelectionEvent extends MapEvent<SelectionEventType> implements Map
|
|
|
72
72
|
source: string;
|
|
73
73
|
sourceLayer?: string;
|
|
74
74
|
features: MapFeatureId[];
|
|
75
|
-
constructor(type: SelectionEventType, map:
|
|
75
|
+
constructor(type: SelectionEventType, map: FlowCoreMap, sourceIdentifier: MapSourceIdentifier, features: MapFeatureId[]);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
type SelectionMode = 'single' | 'multi' | 'none';
|
|
@@ -182,13 +182,13 @@ interface DataJoinParameter {
|
|
|
182
182
|
}
|
|
183
183
|
declare class DataJoin {
|
|
184
184
|
readonly id: string;
|
|
185
|
-
readonly map:
|
|
185
|
+
readonly map: FlowCoreMap;
|
|
186
186
|
private static defaultOptions;
|
|
187
187
|
private autorunDisposer;
|
|
188
188
|
private dataExpression;
|
|
189
189
|
private options;
|
|
190
190
|
private parameterExpressions;
|
|
191
|
-
constructor(id: string, map:
|
|
191
|
+
constructor(id: string, map: FlowCoreMap, options: DataJoinOptions);
|
|
192
192
|
get source(): string;
|
|
193
193
|
start(): void;
|
|
194
194
|
stop(): void;
|
|
@@ -281,7 +281,7 @@ interface MapPopupOptions {
|
|
|
281
281
|
* @noInheritDoc
|
|
282
282
|
*/
|
|
283
283
|
declare class MapPopup extends EventEmitter<MapPopupEvents> {
|
|
284
|
-
readonly map:
|
|
284
|
+
readonly map: FlowCoreMap;
|
|
285
285
|
readonly options: MapPopupOptions;
|
|
286
286
|
private _feature?;
|
|
287
287
|
private _contentContainer;
|
|
@@ -296,7 +296,7 @@ declare class MapPopup extends EventEmitter<MapPopupEvents> {
|
|
|
296
296
|
* @param map Parent Flo.w map.
|
|
297
297
|
* @param options Popup options.
|
|
298
298
|
*/
|
|
299
|
-
constructor(map:
|
|
299
|
+
constructor(map: FlowCoreMap, options: MapPopupOptions);
|
|
300
300
|
get feature(): MapFeatureIdentifier | undefined;
|
|
301
301
|
/**
|
|
302
302
|
* Close the popup.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MapEvent, a as assert, b as MapFeatureStream, F as FlowError, c as FlowMapError, d as MapDataSource, e as MapLayer,
|
|
2
|
-
export { P as PluginManager } from '../../../shared/flow-rdf-core.
|
|
1
|
+
import { M as MapEvent, a as assert, b as MapFeatureStream, F as FlowError, c as FlowMapError, d as MapDataSource, e as MapLayer, R as ReactiveExpression } from '../../../shared/flow-rdf-core.e2b1bb7f.mjs';
|
|
2
|
+
export { P as PluginManager } from '../../../shared/flow-rdf-core.e2b1bb7f.mjs';
|
|
3
3
|
import MapboxDraw from '@emuanalytics/mapbox-gl-draw';
|
|
4
4
|
import turfArea from '@turf/area';
|
|
5
5
|
import turfBBox from '@turf/bbox';
|
|
@@ -7,11 +7,11 @@ import turfBooleanEqual from '@turf/boolean-equal';
|
|
|
7
7
|
import turfBuffer from '@turf/buffer';
|
|
8
8
|
import turfLength from '@turf/length';
|
|
9
9
|
import Debug from 'debug';
|
|
10
|
-
import { c as isPolygon, i as isLineString, b as isPoint } from '../../../shared/flow-rdf-core.
|
|
10
|
+
import { c as isPolygon, i as isLineString, b as isPoint } from '../../../shared/flow-rdf-core.1f0901c5.mjs';
|
|
11
|
+
import { d as isDefined, j as isArray, g as isStringFull, x as isFunction, f as isString, e as ensureArray, o as isNumber, A as randomId, z as isURL, k as isArrayFull, b as isNil, a as isNull, m as isObject } from '../../../shared/flow-rdf-core.25e5f6d7.mjs';
|
|
11
12
|
import EventEmitter$1, { EventEmitter } from 'eventemitter3';
|
|
12
|
-
import { d as isDefined, j as isArray, g as isStringFull, x as isFunction, f as isString, e as ensureArray, o as isNumber, z as isURL, k as isArrayFull, b as isNil, a as isNull, m as isObject } from '../../../shared/flow-rdf-core.b80085b4.mjs';
|
|
13
|
-
import * as lit from 'lit-html';
|
|
14
13
|
import maplibre from '@emuanalytics/maplibre-gl';
|
|
14
|
+
import * as lit from 'lit-html';
|
|
15
15
|
import turfCircle from '@turf/circle';
|
|
16
16
|
import turfDistance from '@turf/distance';
|
|
17
17
|
import { point } from '@turf/helpers';
|
|
@@ -21,8 +21,8 @@ import saveAs from 'file-saver';
|
|
|
21
21
|
// import 'mobx-utils';
|
|
22
22
|
import 'parsimmon';
|
|
23
23
|
import 'colorbrewer';
|
|
24
|
-
// import 'nanoid';
|
|
25
24
|
import '@turf/invariant';
|
|
25
|
+
// import 'nanoid';
|
|
26
26
|
|
|
27
27
|
var __defProp$c = Object.defineProperty;
|
|
28
28
|
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -1395,15 +1395,17 @@ const _DataJoin = class _DataJoin {
|
|
|
1395
1395
|
this.autorunDisposer = autorun(
|
|
1396
1396
|
async () => {
|
|
1397
1397
|
let data = this.dataExpression ? toJS(this.dataExpression.value) : this.options.data;
|
|
1398
|
-
const missingParams = this.options.parameters.map(
|
|
1399
|
-
(p) => p.required && isNil(this.parameterExpressions[p.name].value) ? p.name : void 0
|
|
1400
|
-
).filter((p) => !!p);
|
|
1398
|
+
const missingParams = this.options.parameters.map((p) => p.required && isNil(this.parameterExpressions[p.name].value) ? p.name : void 0).filter((p) => !!p);
|
|
1401
1399
|
if (isNull(data)) {
|
|
1402
1400
|
debug$1(`FlowMap<${this.map.id}>: Skipping data join '${this.id}' (null data)`);
|
|
1403
1401
|
return;
|
|
1404
1402
|
}
|
|
1405
1403
|
if (missingParams.length) {
|
|
1406
|
-
debug$1(
|
|
1404
|
+
debug$1(
|
|
1405
|
+
`FlowMap<${this.map.id}>: Skipping data join '${this.id}' (null required parameters: ${missingParams.join(
|
|
1406
|
+
", "
|
|
1407
|
+
)})`
|
|
1408
|
+
);
|
|
1407
1409
|
return;
|
|
1408
1410
|
}
|
|
1409
1411
|
debug$1(`FlowMap<${this.map.id}>: Performing data join '${this.id}'`);
|
package/dist/lib/utils/index.cjs
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const featureTypeChecks = require('../../shared/flow-rdf-core.
|
|
5
|
-
const throttle = require('../../shared/flow-rdf-core.
|
|
3
|
+
const randomId = require('../../shared/flow-rdf-core.f50908f0.cjs');
|
|
4
|
+
const featureTypeChecks = require('../../shared/flow-rdf-core.a82b9be4.cjs');
|
|
5
|
+
const throttle = require('../../shared/flow-rdf-core.55c169ca.cjs');
|
|
6
6
|
const lit = require('lit-html');
|
|
7
|
+
require('nanoid');
|
|
7
8
|
require('@turf/invariant');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
exports.capitalize =
|
|
12
|
-
exports.ensureArray =
|
|
13
|
-
exports.hasLength =
|
|
14
|
-
exports.hasValue =
|
|
15
|
-
exports.isArray =
|
|
16
|
-
exports.isArrayFull =
|
|
17
|
-
exports.isArrayStrings =
|
|
18
|
-
exports.isBoolean =
|
|
19
|
-
exports.isDate =
|
|
20
|
-
exports.isDefined =
|
|
21
|
-
exports.isFalse =
|
|
22
|
-
exports.isFunction =
|
|
23
|
-
exports.isIn =
|
|
24
|
-
exports.isNil =
|
|
25
|
-
exports.isNull =
|
|
26
|
-
exports.isNumber =
|
|
27
|
-
exports.isNumeric =
|
|
28
|
-
exports.isObject =
|
|
29
|
-
exports.isObjectFull =
|
|
30
|
-
exports.isPlainObject =
|
|
31
|
-
exports.isString =
|
|
32
|
-
exports.isStringFull =
|
|
33
|
-
exports.isTrue =
|
|
34
|
-
exports.isURL =
|
|
35
|
-
exports.isUndefined =
|
|
36
|
-
exports.isValue =
|
|
12
|
+
exports.capitalize = randomId.capitalize;
|
|
13
|
+
exports.ensureArray = randomId.ensureArray;
|
|
14
|
+
exports.hasLength = randomId.hasLength;
|
|
15
|
+
exports.hasValue = randomId.hasValue;
|
|
16
|
+
exports.isArray = randomId.isArray;
|
|
17
|
+
exports.isArrayFull = randomId.isArrayFull;
|
|
18
|
+
exports.isArrayStrings = randomId.isArrayStrings;
|
|
19
|
+
exports.isBoolean = randomId.isBoolean;
|
|
20
|
+
exports.isDate = randomId.isDate;
|
|
21
|
+
exports.isDefined = randomId.isDefined;
|
|
22
|
+
exports.isFalse = randomId.isFalse;
|
|
23
|
+
exports.isFunction = randomId.isFunction;
|
|
24
|
+
exports.isIn = randomId.isIn;
|
|
25
|
+
exports.isNil = randomId.isNil;
|
|
26
|
+
exports.isNull = randomId.isNull;
|
|
27
|
+
exports.isNumber = randomId.isNumber;
|
|
28
|
+
exports.isNumeric = randomId.isNumeric;
|
|
29
|
+
exports.isObject = randomId.isObject;
|
|
30
|
+
exports.isObjectFull = randomId.isObjectFull;
|
|
31
|
+
exports.isPlainObject = randomId.isPlainObject;
|
|
32
|
+
exports.isString = randomId.isString;
|
|
33
|
+
exports.isStringFull = randomId.isStringFull;
|
|
34
|
+
exports.isTrue = randomId.isTrue;
|
|
35
|
+
exports.isURL = randomId.isURL;
|
|
36
|
+
exports.isUndefined = randomId.isUndefined;
|
|
37
|
+
exports.isValue = randomId.isValue;
|
|
38
|
+
exports.randomId = randomId.randomId;
|
|
37
39
|
exports.isLineString = featureTypeChecks.isLineString;
|
|
38
40
|
exports.isMultiPolygon = featureTypeChecks.isMultiPolygon;
|
|
39
41
|
exports.isPoint = featureTypeChecks.isPoint;
|
|
@@ -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
|
-
|
|
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 };
|
|
@@ -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
|
-
|
|
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 };
|