@emuanalytics/flow-rdf-core 4.0.0-preview.2 → 4.0.0-preview.3
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 +173 -176
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +174 -177
- package/dist/lib/map/plugins/index.cjs +276 -86
- package/dist/lib/map/plugins/index.d.cts +39 -3
- package/dist/lib/map/plugins/index.d.mts +39 -3
- package/dist/lib/map/plugins/index.d.ts +39 -3
- package/dist/lib/map/plugins/index.mjs +276 -87
- package/dist/shared/{flow-rdf-core.42d7cda4.d.cts → flow-rdf-core.2f79285b.d.cts} +69 -4
- package/dist/shared/{flow-rdf-core.42d7cda4.d.mts → flow-rdf-core.2f79285b.d.mts} +69 -4
- package/dist/shared/{flow-rdf-core.42d7cda4.d.ts → flow-rdf-core.2f79285b.d.ts} +69 -4
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as mobx from 'mobx';
|
|
2
|
-
import { isObservable, isComputed, isObservableArray, isObservableSet, isObservableMap, configure, makeObservable, observable as observable$1, computed as computed$1, action, runInAction, onBecomeObserved, onBecomeUnobserved, reaction, trace } from 'mobx';
|
|
2
|
+
import { isObservable, isComputed, isObservableArray, isObservableSet, isObservableMap, configure, makeObservable, observable as observable$1, computed as computed$1, action, runInAction, onBecomeObserved, onBecomeUnobserved, reaction, toJS, trace } from 'mobx';
|
|
3
3
|
export { makeAutoObservable, makeObservable } from 'mobx';
|
|
4
4
|
import Debug from 'debug';
|
|
5
5
|
import { Client } from '@emuanalytics/flow-engine-client';
|
|
@@ -9,12 +9,13 @@ import maplibre from '@emuanalytics/maplibre-gl';
|
|
|
9
9
|
import EventEmitter from 'eventemitter3';
|
|
10
10
|
import { toStream } from 'mobx-utils';
|
|
11
11
|
import { t as throttle, a as debounceWithArgs } from './shared/flow-rdf-core.2e456f93.mjs';
|
|
12
|
+
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string';
|
|
12
13
|
import '@emuanalytics/maplibre-gl-style-spec';
|
|
13
14
|
import 'parsimmon';
|
|
14
15
|
import 'colorbrewer';
|
|
15
16
|
import 'nanoid';
|
|
16
17
|
|
|
17
|
-
const version = "4.0.0-preview.
|
|
18
|
+
const version = "4.0.0-preview.3";
|
|
18
19
|
|
|
19
20
|
const CONSOLE_HIGHLIGHT_STYLE$1 = `
|
|
20
21
|
padding: 2px 4px;
|
|
@@ -50,10 +51,10 @@ function deferred() {
|
|
|
50
51
|
return Object.assign(promise, methods);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
var __defProp$
|
|
54
|
-
var __defNormalProp$
|
|
55
|
-
var __publicField$
|
|
56
|
-
__defNormalProp$
|
|
54
|
+
var __defProp$c = Object.defineProperty;
|
|
55
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
56
|
+
var __publicField$c = (obj, key, value) => {
|
|
57
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
57
58
|
return value;
|
|
58
59
|
};
|
|
59
60
|
const FLOW_GLOBAL = "FDBG";
|
|
@@ -74,8 +75,8 @@ class Debugger {
|
|
|
74
75
|
*/
|
|
75
76
|
constructor(context) {
|
|
76
77
|
this.context = context;
|
|
77
|
-
__publicField$
|
|
78
|
-
__publicField$
|
|
78
|
+
__publicField$c(this, "spyDisposer");
|
|
79
|
+
__publicField$c(this, "watchDisposers", {});
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
82
|
* Install a 'watch' for the specified context state property path.
|
|
@@ -191,6 +192,7 @@ function installGlobalDebugger(dbg) {
|
|
|
191
192
|
);
|
|
192
193
|
const g = typeof global !== "undefined" ? global : window;
|
|
193
194
|
g[FLOW_GLOBAL] = g[FLOW_GLOBAL] || {
|
|
195
|
+
context: dbg.context,
|
|
194
196
|
watch: dbg.watch.bind(dbg),
|
|
195
197
|
unwatch: dbg.unwatch.bind(dbg),
|
|
196
198
|
set: dbg.set.bind(dbg),
|
|
@@ -284,16 +286,16 @@ function toJSHelper(source, options, __alreadySeen = null) {
|
|
|
284
286
|
return res;
|
|
285
287
|
}
|
|
286
288
|
|
|
287
|
-
var __defProp$
|
|
288
|
-
var __defNormalProp$
|
|
289
|
-
var __publicField$
|
|
290
|
-
__defNormalProp$
|
|
289
|
+
var __defProp$b = Object.defineProperty;
|
|
290
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
291
|
+
var __publicField$b = (obj, key, value) => {
|
|
292
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
291
293
|
return value;
|
|
292
294
|
};
|
|
293
295
|
const debug$4 = Debug("flow:map-registry");
|
|
294
296
|
class MapRegistry {
|
|
295
297
|
constructor() {
|
|
296
|
-
__publicField$
|
|
298
|
+
__publicField$b(this, "_maps", /* @__PURE__ */ new Map());
|
|
297
299
|
}
|
|
298
300
|
/**
|
|
299
301
|
* Register a Flo.w map.
|
|
@@ -335,16 +337,16 @@ class MapRegistry {
|
|
|
335
337
|
}
|
|
336
338
|
}
|
|
337
339
|
|
|
338
|
-
var __defProp$
|
|
339
|
-
var __defNormalProp$
|
|
340
|
-
var __publicField$
|
|
341
|
-
__defNormalProp$
|
|
340
|
+
var __defProp$a = Object.defineProperty;
|
|
341
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
342
|
+
var __publicField$a = (obj, key, value) => {
|
|
343
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
342
344
|
return value;
|
|
343
345
|
};
|
|
344
346
|
const debug$3 = Debug("flow:query-registry");
|
|
345
347
|
class QueryRegistry {
|
|
346
348
|
constructor() {
|
|
347
|
-
__publicField$
|
|
349
|
+
__publicField$a(this, "_queries", /* @__PURE__ */ new Map());
|
|
348
350
|
}
|
|
349
351
|
/**
|
|
350
352
|
* Register a Flo.w reactive query.
|
|
@@ -384,10 +386,10 @@ class QueryRegistry {
|
|
|
384
386
|
}
|
|
385
387
|
}
|
|
386
388
|
|
|
387
|
-
var __defProp$
|
|
388
|
-
var __defNormalProp$
|
|
389
|
-
var __publicField$
|
|
390
|
-
__defNormalProp$
|
|
389
|
+
var __defProp$9 = Object.defineProperty;
|
|
390
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
391
|
+
var __publicField$9 = (obj, key, value) => {
|
|
392
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
391
393
|
return value;
|
|
392
394
|
};
|
|
393
395
|
const DEFAULT_FLOW_HOST = "https://flow.emu-analytics.net";
|
|
@@ -404,13 +406,13 @@ const _FlowContext = class _FlowContext {
|
|
|
404
406
|
* @param enableDebug Set to `true` to enable the debugger.
|
|
405
407
|
*/
|
|
406
408
|
constructor(options) {
|
|
407
|
-
__publicField$
|
|
408
|
-
__publicField$
|
|
409
|
-
__publicField$
|
|
410
|
-
__publicField$
|
|
411
|
-
__publicField$
|
|
409
|
+
__publicField$9(this, "_options");
|
|
410
|
+
__publicField$9(this, "flowClient");
|
|
411
|
+
__publicField$9(this, "state");
|
|
412
|
+
__publicField$9(this, "maps", new MapRegistry());
|
|
413
|
+
__publicField$9(this, "queries", new QueryRegistry());
|
|
412
414
|
/** The Flo.w debugger. Available as `window.FDBG` in the browser's web developer console. */
|
|
413
|
-
__publicField$
|
|
415
|
+
__publicField$9(this, "debugger");
|
|
414
416
|
this._options = {
|
|
415
417
|
..._FlowContext._defaultOptions,
|
|
416
418
|
...options
|
|
@@ -434,23 +436,23 @@ const _FlowContext = class _FlowContext {
|
|
|
434
436
|
return expression.value;
|
|
435
437
|
}
|
|
436
438
|
};
|
|
437
|
-
__publicField$
|
|
439
|
+
__publicField$9(_FlowContext, "_defaultOptions", {
|
|
438
440
|
id: DEFAULT_CONTEXT_ID,
|
|
439
441
|
host: DEFAULT_FLOW_HOST,
|
|
440
442
|
enableDebug: false
|
|
441
443
|
});
|
|
442
444
|
let FlowContext = _FlowContext;
|
|
443
445
|
|
|
444
|
-
var __defProp$
|
|
445
|
-
var __defNormalProp$
|
|
446
|
-
var __publicField$
|
|
447
|
-
__defNormalProp$
|
|
446
|
+
var __defProp$8 = Object.defineProperty;
|
|
447
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
448
|
+
var __publicField$8 = (obj, key, value) => {
|
|
449
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
448
450
|
return value;
|
|
449
451
|
};
|
|
450
452
|
const debug$2 = Debug("flow:context-registry");
|
|
451
453
|
const _ContextRegistry = class _ContextRegistry {
|
|
452
454
|
constructor() {
|
|
453
|
-
__publicField$
|
|
455
|
+
__publicField$8(this, "_contexts", /* @__PURE__ */ new Map());
|
|
454
456
|
}
|
|
455
457
|
/**
|
|
456
458
|
* Initialize a new Flo.w context.
|
|
@@ -493,16 +495,16 @@ const _ContextRegistry = class _ContextRegistry {
|
|
|
493
495
|
return deferredContext?.deferred;
|
|
494
496
|
}
|
|
495
497
|
};
|
|
496
|
-
__publicField$
|
|
498
|
+
__publicField$8(_ContextRegistry, "_defaultOptions", {
|
|
497
499
|
id: DEFAULT_CONTEXT_ID,
|
|
498
500
|
host: "https://flow.emu-analytics.net"
|
|
499
501
|
});
|
|
500
502
|
let ContextRegistry = _ContextRegistry;
|
|
501
503
|
|
|
502
|
-
var __defProp$
|
|
503
|
-
var __defNormalProp$
|
|
504
|
-
var __publicField$
|
|
505
|
-
__defNormalProp$
|
|
504
|
+
var __defProp$7 = Object.defineProperty;
|
|
505
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
506
|
+
var __publicField$7 = (obj, key, value) => {
|
|
507
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
506
508
|
return value;
|
|
507
509
|
};
|
|
508
510
|
class FlowRdfCoreGlobals {
|
|
@@ -514,8 +516,8 @@ class FlowRdfCoreGlobals {
|
|
|
514
516
|
*
|
|
515
517
|
* N.B: this version is unrelated to the package version.
|
|
516
518
|
*/
|
|
517
|
-
__publicField$
|
|
518
|
-
__publicField$
|
|
519
|
+
__publicField$7(this, "version", 1);
|
|
520
|
+
__publicField$7(this, "globalContextRegistry", new ContextRegistry());
|
|
519
521
|
}
|
|
520
522
|
}
|
|
521
523
|
let canMergeGlobalState = true;
|
|
@@ -563,15 +565,15 @@ function getGlobalState() {
|
|
|
563
565
|
return globalState;
|
|
564
566
|
}
|
|
565
567
|
|
|
566
|
-
var __defProp$
|
|
567
|
-
var __defNormalProp$
|
|
568
|
-
var __publicField$
|
|
569
|
-
__defNormalProp$
|
|
568
|
+
var __defProp$6 = Object.defineProperty;
|
|
569
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
570
|
+
var __publicField$6 = (obj, key, value) => {
|
|
571
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
570
572
|
return value;
|
|
571
573
|
};
|
|
572
574
|
class MapLayerStyleBuilder {
|
|
573
575
|
constructor() {
|
|
574
|
-
__publicField$
|
|
576
|
+
__publicField$6(this, "_styles", /* @__PURE__ */ new Map());
|
|
575
577
|
}
|
|
576
578
|
static registerStyleBuilder(layerType, builder) {
|
|
577
579
|
this._styleBuilders.set(layerType, builder);
|
|
@@ -629,11 +631,11 @@ class MapLayerStyleBuilder {
|
|
|
629
631
|
}
|
|
630
632
|
}
|
|
631
633
|
}
|
|
632
|
-
__publicField$
|
|
634
|
+
__publicField$6(MapLayerStyleBuilder, "_styleBuilders", /* @__PURE__ */ new Map());
|
|
633
635
|
class StyleExpression {
|
|
634
636
|
constructor(_expr) {
|
|
635
637
|
this._expr = _expr;
|
|
636
|
-
__publicField$
|
|
638
|
+
__publicField$6(this, "__styleExpression", "styleexpression");
|
|
637
639
|
}
|
|
638
640
|
toString() {
|
|
639
641
|
return this._expr;
|
|
@@ -1950,19 +1952,19 @@ function layerStyle(layerType) {
|
|
|
1950
1952
|
return MapLayerStyleBuilder.createStyleBuilder(layerType);
|
|
1951
1953
|
}
|
|
1952
1954
|
|
|
1953
|
-
var __defProp$
|
|
1954
|
-
var __defNormalProp$
|
|
1955
|
-
var __publicField$
|
|
1956
|
-
__defNormalProp$
|
|
1955
|
+
var __defProp$5 = Object.defineProperty;
|
|
1956
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1957
|
+
var __publicField$5 = (obj, key, value) => {
|
|
1958
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1957
1959
|
return value;
|
|
1958
1960
|
};
|
|
1959
1961
|
const _MapStyle = class _MapStyle {
|
|
1960
1962
|
constructor() {
|
|
1961
|
-
__publicField$
|
|
1962
|
-
__publicField$
|
|
1963
|
-
__publicField$
|
|
1964
|
-
__publicField$
|
|
1965
|
-
__publicField$
|
|
1963
|
+
__publicField$5(this, "_state", null);
|
|
1964
|
+
__publicField$5(this, "_baseStyle");
|
|
1965
|
+
__publicField$5(this, "_sources", {});
|
|
1966
|
+
__publicField$5(this, "_layers", {});
|
|
1967
|
+
__publicField$5(this, "_layerOrder", []);
|
|
1966
1968
|
this._baseStyle = _MapStyle._defaultBaseStyle;
|
|
1967
1969
|
makeObservable(
|
|
1968
1970
|
this,
|
|
@@ -2114,7 +2116,7 @@ const _MapStyle = class _MapStyle {
|
|
|
2114
2116
|
return insertionIndex;
|
|
2115
2117
|
}
|
|
2116
2118
|
};
|
|
2117
|
-
__publicField$
|
|
2119
|
+
__publicField$5(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
2118
2120
|
version: 8,
|
|
2119
2121
|
id: "default",
|
|
2120
2122
|
name: "Default base style",
|
|
@@ -2123,18 +2125,18 @@ __publicField$6(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
|
2123
2125
|
}));
|
|
2124
2126
|
let MapStyle = _MapStyle;
|
|
2125
2127
|
|
|
2126
|
-
var __defProp$
|
|
2127
|
-
var __defNormalProp$
|
|
2128
|
-
var __publicField$
|
|
2129
|
-
__defNormalProp$
|
|
2128
|
+
var __defProp$4 = Object.defineProperty;
|
|
2129
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2130
|
+
var __publicField$4 = (obj, key, value) => {
|
|
2131
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2130
2132
|
return value;
|
|
2131
2133
|
};
|
|
2132
2134
|
Debug("flow:image-registry");
|
|
2133
2135
|
const unknownImageSVG = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' class='flowicon'%3E%3C!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--%3E%3Cpath d='M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256 256-114.6 256-256S397.4 0 256 0zm0 400c-18 0-32-14-32-32s13.1-32 32-32c17.1 0 32 14 32 32s-14.9 32-32 32zm69.1-142L280 286v2c0 13-11 24-24 24s-24-11-24-24v-16c0-8 4-16 12-21l57-34c7-4 11-11 11-19 0-12-10.9-22-22.9-22H238c-12.9 0-22 10-22 22 0 13-11 24-24 24s-24-11-24-24c0-39 31-70 69.1-70h51.1c40.8 0 71.8 31 71.8 70 0 24-13 47-34.9 60z'/%3E%3C/svg%3E`;
|
|
2134
2136
|
class ImageRegistry {
|
|
2135
2137
|
constructor() {
|
|
2136
|
-
__publicField$
|
|
2137
|
-
__publicField$
|
|
2138
|
+
__publicField$4(this, "_registry", /* @__PURE__ */ new Map());
|
|
2139
|
+
__publicField$4(this, "_unknownImage", null);
|
|
2138
2140
|
}
|
|
2139
2141
|
get unknownImage() {
|
|
2140
2142
|
if (!this._unknownImage) {
|
|
@@ -2202,10 +2204,10 @@ class ImageRegistry {
|
|
|
2202
2204
|
}
|
|
2203
2205
|
}
|
|
2204
2206
|
|
|
2205
|
-
var __defProp$
|
|
2206
|
-
var __defNormalProp$
|
|
2207
|
-
var __publicField$
|
|
2208
|
-
__defNormalProp$
|
|
2207
|
+
var __defProp$3 = Object.defineProperty;
|
|
2208
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2209
|
+
var __publicField$3 = (obj, key, value) => {
|
|
2210
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2209
2211
|
return value;
|
|
2210
2212
|
};
|
|
2211
2213
|
const debug$1 = Debug("flow:map");
|
|
@@ -2213,24 +2215,24 @@ const MOUSE_MOVE_THROTTLE_DURATION = 100;
|
|
|
2213
2215
|
const _FlowMap = class _FlowMap extends EventEmitter {
|
|
2214
2216
|
constructor(options) {
|
|
2215
2217
|
super();
|
|
2216
|
-
__publicField$
|
|
2217
|
-
__publicField$
|
|
2218
|
-
__publicField$
|
|
2219
|
-
__publicField$
|
|
2220
|
-
__publicField$
|
|
2221
|
-
__publicField$
|
|
2222
|
-
__publicField$
|
|
2223
|
-
__publicField$
|
|
2218
|
+
__publicField$3(this, "_context");
|
|
2219
|
+
__publicField$3(this, "_initialized");
|
|
2220
|
+
__publicField$3(this, "_loading", true);
|
|
2221
|
+
__publicField$3(this, "_debouncedEmitSourceEvent");
|
|
2222
|
+
__publicField$3(this, "_imageRegistry", new ImageRegistry());
|
|
2223
|
+
__publicField$3(this, "_options");
|
|
2224
|
+
__publicField$3(this, "_pluginManager");
|
|
2225
|
+
__publicField$3(this, "_resolveInitialized", () => {
|
|
2224
2226
|
});
|
|
2225
|
-
__publicField$
|
|
2226
|
-
__publicField$
|
|
2227
|
-
__publicField$
|
|
2227
|
+
__publicField$3(this, "_style");
|
|
2228
|
+
__publicField$3(this, "_styleUpdateSubscription", null);
|
|
2229
|
+
__publicField$3(this, "_throttledMouseMove", throttle(this.handleMouseMove, {
|
|
2228
2230
|
delay: MOUSE_MOVE_THROTTLE_DURATION,
|
|
2229
2231
|
noLeading: true,
|
|
2230
2232
|
context: this
|
|
2231
2233
|
}));
|
|
2232
|
-
__publicField$
|
|
2233
|
-
__publicField$
|
|
2234
|
+
__publicField$3(this, "maplibreMap");
|
|
2235
|
+
__publicField$3(this, "updateMapStyle", (style) => {
|
|
2234
2236
|
const oldStyle = this.maplibreMap.getStyle();
|
|
2235
2237
|
const beforeEvent = new MapStyleChangeEvent("beforeStyleChanged", this, oldStyle, style);
|
|
2236
2238
|
style = this._pluginManager.forwardStyleChangeEvent(
|
|
@@ -2273,6 +2275,14 @@ const _FlowMap = class _FlowMap extends EventEmitter {
|
|
|
2273
2275
|
get styleSpecification() {
|
|
2274
2276
|
return this._style.styleSpecification;
|
|
2275
2277
|
}
|
|
2278
|
+
/**
|
|
2279
|
+
* @internal
|
|
2280
|
+
*
|
|
2281
|
+
* Used by map export to get images added to map.
|
|
2282
|
+
*/
|
|
2283
|
+
get imageRegistry() {
|
|
2284
|
+
return this._imageRegistry;
|
|
2285
|
+
}
|
|
2276
2286
|
addLayer(layerOrOptions) {
|
|
2277
2287
|
const layer = isPlainObject(layerOrOptions) ? new MapLayer(layerOrOptions) : layerOrOptions;
|
|
2278
2288
|
this._style.addLayer(layer);
|
|
@@ -2433,9 +2443,9 @@ const _FlowMap = class _FlowMap extends EventEmitter {
|
|
|
2433
2443
|
}
|
|
2434
2444
|
const options = {
|
|
2435
2445
|
center: lngLat,
|
|
2436
|
-
...center.zoom && { zoom: center.zoom },
|
|
2437
|
-
...center.bearing && { bearing: center.bearing },
|
|
2438
|
-
...center.pitch && { pitch: center.pitch },
|
|
2446
|
+
...isDefined(center.zoom) && { zoom: center.zoom },
|
|
2447
|
+
...isDefined(center.bearing) && { bearing: center.bearing },
|
|
2448
|
+
...isDefined(center.pitch) && { pitch: center.pitch },
|
|
2439
2449
|
...animationOptions
|
|
2440
2450
|
};
|
|
2441
2451
|
method.call(this.maplibreMap, options);
|
|
@@ -2453,6 +2463,17 @@ const _FlowMap = class _FlowMap extends EventEmitter {
|
|
|
2453
2463
|
};
|
|
2454
2464
|
this.maplibreMap.fitBounds(bounds, fitBoundsOptions);
|
|
2455
2465
|
}
|
|
2466
|
+
getVisibleBounds() {
|
|
2467
|
+
const parentEl = this.container.parentElement;
|
|
2468
|
+
if (!parentEl) {
|
|
2469
|
+
return this.getBounds();
|
|
2470
|
+
}
|
|
2471
|
+
const mapRect = parentEl.getBoundingClientRect();
|
|
2472
|
+
const topLeft = this.maplibreMap.unproject([mapRect.x, mapRect.y]);
|
|
2473
|
+
const bottomRight = this.maplibreMap.unproject([mapRect.x + mapRect.width, mapRect.y + mapRect.height]);
|
|
2474
|
+
const bounds = [topLeft.lng, bottomRight.lat, bottomRight.lng, topLeft.lat];
|
|
2475
|
+
return bounds;
|
|
2476
|
+
}
|
|
2456
2477
|
/**
|
|
2457
2478
|
* Programmatically set feature state properties for a map feature.
|
|
2458
2479
|
*
|
|
@@ -2627,23 +2648,23 @@ const _FlowMap = class _FlowMap extends EventEmitter {
|
|
|
2627
2648
|
return requestParameters;
|
|
2628
2649
|
}
|
|
2629
2650
|
};
|
|
2630
|
-
__publicField$
|
|
2651
|
+
__publicField$3(_FlowMap, "_defaultOptions", {
|
|
2631
2652
|
boxZoom: false,
|
|
2632
2653
|
doubleClickZoom: false,
|
|
2633
2654
|
featureClickTolerance: 0
|
|
2634
2655
|
});
|
|
2635
2656
|
let FlowMap = _FlowMap;
|
|
2636
2657
|
|
|
2637
|
-
var __defProp$
|
|
2638
|
-
var __defNormalProp$
|
|
2639
|
-
var __publicField$
|
|
2640
|
-
__defNormalProp$
|
|
2658
|
+
var __defProp$2 = Object.defineProperty;
|
|
2659
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2660
|
+
var __publicField$2 = (obj, key, value) => {
|
|
2661
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2641
2662
|
return value;
|
|
2642
2663
|
};
|
|
2643
2664
|
class AsyncCommitter {
|
|
2644
2665
|
constructor() {
|
|
2645
|
-
__publicField$
|
|
2646
|
-
__publicField$
|
|
2666
|
+
__publicField$2(this, "_requestId", 0);
|
|
2667
|
+
__publicField$2(this, "_commitId", 0);
|
|
2647
2668
|
}
|
|
2648
2669
|
async resolve(promise) {
|
|
2649
2670
|
this._requestId += 1;
|
|
@@ -2663,10 +2684,10 @@ class AsyncCommitter {
|
|
|
2663
2684
|
}
|
|
2664
2685
|
}
|
|
2665
2686
|
|
|
2666
|
-
var __defProp$
|
|
2667
|
-
var __defNormalProp$
|
|
2668
|
-
var __publicField$
|
|
2669
|
-
__defNormalProp$
|
|
2687
|
+
var __defProp$1 = Object.defineProperty;
|
|
2688
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2689
|
+
var __publicField$1 = (obj, key, value) => {
|
|
2690
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2670
2691
|
return value;
|
|
2671
2692
|
};
|
|
2672
2693
|
const debug = Debug("flow:query");
|
|
@@ -2674,13 +2695,13 @@ const DEFAULT_DELAY = 100;
|
|
|
2674
2695
|
const _Query = class _Query {
|
|
2675
2696
|
constructor(queryFn, transformFn, options) {
|
|
2676
2697
|
this.queryFn = queryFn;
|
|
2677
|
-
__publicField$
|
|
2678
|
-
__publicField$
|
|
2679
|
-
__publicField$
|
|
2680
|
-
__publicField$
|
|
2681
|
-
__publicField$
|
|
2682
|
-
__publicField$
|
|
2683
|
-
__publicField$
|
|
2698
|
+
__publicField$1(this, "_options");
|
|
2699
|
+
__publicField$1(this, "_committer", new AsyncCommitter());
|
|
2700
|
+
__publicField$1(this, "_disposer", null);
|
|
2701
|
+
__publicField$1(this, "_transformFn", (results) => results);
|
|
2702
|
+
__publicField$1(this, "results", null);
|
|
2703
|
+
__publicField$1(this, "busy", false);
|
|
2704
|
+
__publicField$1(this, "error", null);
|
|
2684
2705
|
this._options = {
|
|
2685
2706
|
..._Query._defaultOptions,
|
|
2686
2707
|
...options
|
|
@@ -2791,7 +2812,7 @@ const _Query = class _Query {
|
|
|
2791
2812
|
}
|
|
2792
2813
|
}
|
|
2793
2814
|
};
|
|
2794
|
-
__publicField$
|
|
2815
|
+
__publicField$1(_Query, "_defaultOptions", {
|
|
2795
2816
|
fireImmediately: true,
|
|
2796
2817
|
delay: DEFAULT_DELAY
|
|
2797
2818
|
});
|
|
@@ -2877,67 +2898,59 @@ function hasProp(target, prop) {
|
|
|
2877
2898
|
|
|
2878
2899
|
const SYNC_ANNOTATION_TYPE = "state-sync-annotation";
|
|
2879
2900
|
const REACTIVE_ANNOTATION_TYPE = "state-reactive-annotation";
|
|
2880
|
-
const
|
|
2901
|
+
const serializeRaw = {
|
|
2881
2902
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2882
2903
|
serialize(val) {
|
|
2883
|
-
return val
|
|
2904
|
+
return toJS(val);
|
|
2884
2905
|
},
|
|
2885
2906
|
deserialize(val) {
|
|
2886
|
-
return val
|
|
2907
|
+
return val;
|
|
2887
2908
|
}
|
|
2888
2909
|
};
|
|
2889
|
-
const
|
|
2910
|
+
const serializeString = {
|
|
2890
2911
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2891
2912
|
serialize(val) {
|
|
2892
2913
|
return val.toString();
|
|
2893
2914
|
},
|
|
2894
2915
|
deserialize(val) {
|
|
2895
|
-
return
|
|
2916
|
+
return val;
|
|
2896
2917
|
}
|
|
2897
2918
|
};
|
|
2898
|
-
const
|
|
2919
|
+
const serializeNumber = {
|
|
2899
2920
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2900
2921
|
serialize(val) {
|
|
2901
|
-
return val.
|
|
2922
|
+
return val.toString();
|
|
2902
2923
|
},
|
|
2903
2924
|
deserialize(val) {
|
|
2904
|
-
return val
|
|
2925
|
+
return +val;
|
|
2905
2926
|
}
|
|
2906
2927
|
};
|
|
2907
|
-
const
|
|
2928
|
+
const serializeJson = {
|
|
2908
2929
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2909
2930
|
serialize(val) {
|
|
2910
|
-
return
|
|
2931
|
+
return JSON.stringify(val);
|
|
2911
2932
|
},
|
|
2912
2933
|
deserialize(val) {
|
|
2913
|
-
return
|
|
2934
|
+
return JSON.parse(val);
|
|
2914
2935
|
}
|
|
2915
2936
|
};
|
|
2916
2937
|
const serializeState = {
|
|
2917
2938
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2918
2939
|
serialize(val) {
|
|
2919
|
-
|
|
2920
|
-
const entries = Object.entries(props).map((entry) => `${entry[0]}=${entry[1]}`);
|
|
2921
|
-
return entries.join(",");
|
|
2940
|
+
return val.serialize();
|
|
2922
2941
|
},
|
|
2923
2942
|
deserialize(val, target) {
|
|
2924
|
-
|
|
2925
|
-
const parts = entry.split("=");
|
|
2926
|
-
assert(parts.length === 2);
|
|
2927
|
-
accum[parts[0]] = parts[1];
|
|
2928
|
-
return accum;
|
|
2929
|
-
}, {});
|
|
2930
|
-
target.deserialize(entries);
|
|
2943
|
+
target.deserialize(val);
|
|
2931
2944
|
return target;
|
|
2932
2945
|
}
|
|
2933
2946
|
};
|
|
2934
|
-
const serialize = {
|
|
2947
|
+
const serialize = Object.assign(createDecoratorAnnotation(serializeRaw), {
|
|
2948
|
+
raw: createDecoratorAnnotation(serializeRaw),
|
|
2935
2949
|
string: createDecoratorAnnotation(serializeString),
|
|
2936
2950
|
number: createDecoratorAnnotation(serializeNumber),
|
|
2937
|
-
|
|
2938
|
-
numberArray: createDecoratorAnnotation(serializeNumberArray),
|
|
2951
|
+
json: createDecoratorAnnotation(serializeJson),
|
|
2939
2952
|
state: createDecoratorAnnotation(serializeState)
|
|
2940
|
-
};
|
|
2953
|
+
});
|
|
2941
2954
|
function createReactiveAnnotation(mobxAnnotation) {
|
|
2942
2955
|
return createDecoratorAnnotation({
|
|
2943
2956
|
annotationType: REACTIVE_ANNOTATION_TYPE,
|
|
@@ -2945,45 +2958,15 @@ function createReactiveAnnotation(mobxAnnotation) {
|
|
|
2945
2958
|
});
|
|
2946
2959
|
}
|
|
2947
2960
|
const observable = Object.assign(createReactiveAnnotation(mobx.observable), {
|
|
2961
|
+
deep: createReactiveAnnotation(mobx.observable.deep),
|
|
2948
2962
|
ref: createReactiveAnnotation(mobx.observable.ref),
|
|
2949
|
-
struct: createReactiveAnnotation(mobx.observable.
|
|
2963
|
+
struct: createReactiveAnnotation(mobx.observable.struct),
|
|
2950
2964
|
shallow: createReactiveAnnotation(mobx.observable.shallow)
|
|
2951
2965
|
});
|
|
2952
2966
|
const computed = Object.assign(createReactiveAnnotation(mobx.computed), {
|
|
2953
2967
|
struct: createReactiveAnnotation(mobx.computed.struct)
|
|
2954
2968
|
});
|
|
2955
2969
|
|
|
2956
|
-
var __defProp$1 = Object.defineProperty;
|
|
2957
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2958
|
-
var __publicField$1 = (obj, key, value) => {
|
|
2959
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2960
|
-
return value;
|
|
2961
|
-
};
|
|
2962
|
-
class Serializer {
|
|
2963
|
-
constructor(target) {
|
|
2964
|
-
__publicField$1(this, "target");
|
|
2965
|
-
this.target = target;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
class UrlSerializer extends Serializer {
|
|
2969
|
-
constructor(target) {
|
|
2970
|
-
super(target);
|
|
2971
|
-
}
|
|
2972
|
-
serialize(vals) {
|
|
2973
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
2974
|
-
Object.keys(vals).forEach((key) => searchParams.set(key, vals[key]));
|
|
2975
|
-
const queryString = searchParams.toString();
|
|
2976
|
-
const newUrl = queryString.length ? `${location.pathname}?${queryString}` : location.pathname;
|
|
2977
|
-
window.history.replaceState(vals, "", newUrl);
|
|
2978
|
-
}
|
|
2979
|
-
deserialize() {
|
|
2980
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
2981
|
-
const values = {};
|
|
2982
|
-
searchParams.forEach((val, key) => values[key] = val);
|
|
2983
|
-
return values;
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2986
|
-
|
|
2987
2970
|
var __defProp = Object.defineProperty;
|
|
2988
2971
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2989
2972
|
var __publicField = (obj, key, value) => {
|
|
@@ -2995,7 +2978,6 @@ const StateStorCache = Symbol("FlowCoreStateStorCache");
|
|
|
2995
2978
|
class StateStore {
|
|
2996
2979
|
constructor() {
|
|
2997
2980
|
__publicField(this, "serializationAnnotations", {});
|
|
2998
|
-
__publicField(this, "serializer", new UrlSerializer(this));
|
|
2999
2981
|
__publicField(this, "id");
|
|
3000
2982
|
this.id = randomId("state");
|
|
3001
2983
|
}
|
|
@@ -3113,7 +3095,7 @@ class StateStore {
|
|
|
3113
3095
|
if (!annotations) {
|
|
3114
3096
|
annotations = {};
|
|
3115
3097
|
let current = target;
|
|
3116
|
-
while (current && !
|
|
3098
|
+
while (current && !Object.prototype.hasOwnProperty.call(current, StateStoreMarker)) {
|
|
3117
3099
|
Reflect.ownKeys(current).forEach((k) => {
|
|
3118
3100
|
annotations[k] = !overrides ? true : k in overrides ? overrides[k] : true;
|
|
3119
3101
|
});
|
|
@@ -3133,33 +3115,48 @@ class StateStore {
|
|
|
3133
3115
|
};
|
|
3134
3116
|
return mobx.makeObservable(target, annotations, { name: this.formattedName });
|
|
3135
3117
|
}
|
|
3136
|
-
serialize() {
|
|
3118
|
+
serialize(format = "raw") {
|
|
3137
3119
|
const annotations = this.serializationAnnotations;
|
|
3138
3120
|
const serializedProps = Object.keys(annotations).reduce((accum, prop) => {
|
|
3139
|
-
|
|
3121
|
+
const val = this[prop];
|
|
3122
|
+
if (isDefined(val)) {
|
|
3123
|
+
const serializedValue = annotations[prop].serialize(val);
|
|
3124
|
+
accum[prop] = serializedValue;
|
|
3125
|
+
}
|
|
3140
3126
|
return accum;
|
|
3141
3127
|
}, {});
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3128
|
+
switch (format) {
|
|
3129
|
+
case "json":
|
|
3130
|
+
return JSON.stringify(serializedProps);
|
|
3131
|
+
case "lz":
|
|
3132
|
+
return compressToEncodedURIComponent(JSON.stringify(serializedProps));
|
|
3133
|
+
default:
|
|
3134
|
+
return serializedProps;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
deserialize(value, format = "raw") {
|
|
3138
|
+
let deserializedValue;
|
|
3139
|
+
switch (format) {
|
|
3140
|
+
case "json":
|
|
3141
|
+
deserializedValue = JSON.parse(value);
|
|
3142
|
+
break;
|
|
3143
|
+
case "lz":
|
|
3144
|
+
deserializedValue = JSON.parse(decompressFromEncodedURIComponent(value));
|
|
3145
|
+
break;
|
|
3146
|
+
default:
|
|
3147
|
+
deserializedValue = value;
|
|
3148
|
+
break;
|
|
3149
|
+
}
|
|
3145
3150
|
this.transaction(() => {
|
|
3146
3151
|
const annotations = this.serializationAnnotations;
|
|
3147
|
-
Object.keys(
|
|
3152
|
+
Object.keys(deserializedValue).forEach((prop) => {
|
|
3148
3153
|
const annotation = annotations[prop];
|
|
3149
3154
|
if (annotation) {
|
|
3150
|
-
this[prop] = annotation.deserialize(
|
|
3155
|
+
this[prop] = annotation.deserialize(deserializedValue[prop], this[prop]);
|
|
3151
3156
|
}
|
|
3152
3157
|
});
|
|
3153
3158
|
});
|
|
3154
3159
|
}
|
|
3155
|
-
startSerialization() {
|
|
3156
|
-
const deserializedValues = this.serializer.deserialize();
|
|
3157
|
-
this.deserialize(deserializedValues);
|
|
3158
|
-
this.autorun(() => {
|
|
3159
|
-
const serialiedValues = this.serialize();
|
|
3160
|
-
this.serializer.serialize(serialiedValues);
|
|
3161
|
-
});
|
|
3162
|
-
}
|
|
3163
3160
|
checkInitialized() {
|
|
3164
3161
|
if (!this.initialized) {
|
|
3165
3162
|
throw new FlowError(
|