@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.cjs
CHANGED
|
@@ -9,6 +9,7 @@ const maplibre = require('@emuanalytics/maplibre-gl');
|
|
|
9
9
|
const EventEmitter = require('eventemitter3');
|
|
10
10
|
const mobxUtils = require('mobx-utils');
|
|
11
11
|
const functional = require('./shared/flow-rdf-core.c44cf082.cjs');
|
|
12
|
+
const lzString = require('lz-string');
|
|
12
13
|
require('@emuanalytics/maplibre-gl-style-spec');
|
|
13
14
|
require('parsimmon');
|
|
14
15
|
require('colorbrewer');
|
|
@@ -33,7 +34,7 @@ const Debug__default = /*#__PURE__*/_interopDefaultCompat(Debug);
|
|
|
33
34
|
const maplibre__default = /*#__PURE__*/_interopDefaultCompat(maplibre);
|
|
34
35
|
const EventEmitter__default = /*#__PURE__*/_interopDefaultCompat(EventEmitter);
|
|
35
36
|
|
|
36
|
-
const version = "4.0.0-preview.
|
|
37
|
+
const version = "4.0.0-preview.3";
|
|
37
38
|
|
|
38
39
|
const CONSOLE_HIGHLIGHT_STYLE$1 = `
|
|
39
40
|
padding: 2px 4px;
|
|
@@ -69,10 +70,10 @@ function deferred() {
|
|
|
69
70
|
return Object.assign(promise, methods);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
var __defProp$
|
|
73
|
-
var __defNormalProp$
|
|
74
|
-
var __publicField$
|
|
75
|
-
__defNormalProp$
|
|
73
|
+
var __defProp$c = Object.defineProperty;
|
|
74
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
75
|
+
var __publicField$c = (obj, key, value) => {
|
|
76
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
76
77
|
return value;
|
|
77
78
|
};
|
|
78
79
|
const FLOW_GLOBAL = "FDBG";
|
|
@@ -93,8 +94,8 @@ class Debugger {
|
|
|
93
94
|
*/
|
|
94
95
|
constructor(context) {
|
|
95
96
|
this.context = context;
|
|
96
|
-
__publicField$
|
|
97
|
-
__publicField$
|
|
97
|
+
__publicField$c(this, "spyDisposer");
|
|
98
|
+
__publicField$c(this, "watchDisposers", {});
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
101
|
* Install a 'watch' for the specified context state property path.
|
|
@@ -210,6 +211,7 @@ function installGlobalDebugger(dbg) {
|
|
|
210
211
|
);
|
|
211
212
|
const g = typeof global !== "undefined" ? global : window;
|
|
212
213
|
g[FLOW_GLOBAL] = g[FLOW_GLOBAL] || {
|
|
214
|
+
context: dbg.context,
|
|
213
215
|
watch: dbg.watch.bind(dbg),
|
|
214
216
|
unwatch: dbg.unwatch.bind(dbg),
|
|
215
217
|
set: dbg.set.bind(dbg),
|
|
@@ -303,16 +305,16 @@ function toJSHelper(source, options, __alreadySeen = null) {
|
|
|
303
305
|
return res;
|
|
304
306
|
}
|
|
305
307
|
|
|
306
|
-
var __defProp$
|
|
307
|
-
var __defNormalProp$
|
|
308
|
-
var __publicField$
|
|
309
|
-
__defNormalProp$
|
|
308
|
+
var __defProp$b = Object.defineProperty;
|
|
309
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
310
|
+
var __publicField$b = (obj, key, value) => {
|
|
311
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
310
312
|
return value;
|
|
311
313
|
};
|
|
312
314
|
const debug$4 = Debug__default("flow:map-registry");
|
|
313
315
|
class MapRegistry {
|
|
314
316
|
constructor() {
|
|
315
|
-
__publicField$
|
|
317
|
+
__publicField$b(this, "_maps", /* @__PURE__ */ new Map());
|
|
316
318
|
}
|
|
317
319
|
/**
|
|
318
320
|
* Register a Flo.w map.
|
|
@@ -354,16 +356,16 @@ class MapRegistry {
|
|
|
354
356
|
}
|
|
355
357
|
}
|
|
356
358
|
|
|
357
|
-
var __defProp$
|
|
358
|
-
var __defNormalProp$
|
|
359
|
-
var __publicField$
|
|
360
|
-
__defNormalProp$
|
|
359
|
+
var __defProp$a = Object.defineProperty;
|
|
360
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
361
|
+
var __publicField$a = (obj, key, value) => {
|
|
362
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
361
363
|
return value;
|
|
362
364
|
};
|
|
363
365
|
const debug$3 = Debug__default("flow:query-registry");
|
|
364
366
|
class QueryRegistry {
|
|
365
367
|
constructor() {
|
|
366
|
-
__publicField$
|
|
368
|
+
__publicField$a(this, "_queries", /* @__PURE__ */ new Map());
|
|
367
369
|
}
|
|
368
370
|
/**
|
|
369
371
|
* Register a Flo.w reactive query.
|
|
@@ -403,10 +405,10 @@ class QueryRegistry {
|
|
|
403
405
|
}
|
|
404
406
|
}
|
|
405
407
|
|
|
406
|
-
var __defProp$
|
|
407
|
-
var __defNormalProp$
|
|
408
|
-
var __publicField$
|
|
409
|
-
__defNormalProp$
|
|
408
|
+
var __defProp$9 = Object.defineProperty;
|
|
409
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
410
|
+
var __publicField$9 = (obj, key, value) => {
|
|
411
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
410
412
|
return value;
|
|
411
413
|
};
|
|
412
414
|
const DEFAULT_FLOW_HOST = "https://flow.emu-analytics.net";
|
|
@@ -423,13 +425,13 @@ const _FlowContext = class _FlowContext {
|
|
|
423
425
|
* @param enableDebug Set to `true` to enable the debugger.
|
|
424
426
|
*/
|
|
425
427
|
constructor(options) {
|
|
426
|
-
__publicField$
|
|
427
|
-
__publicField$
|
|
428
|
-
__publicField$
|
|
429
|
-
__publicField$
|
|
430
|
-
__publicField$
|
|
428
|
+
__publicField$9(this, "_options");
|
|
429
|
+
__publicField$9(this, "flowClient");
|
|
430
|
+
__publicField$9(this, "state");
|
|
431
|
+
__publicField$9(this, "maps", new MapRegistry());
|
|
432
|
+
__publicField$9(this, "queries", new QueryRegistry());
|
|
431
433
|
/** The Flo.w debugger. Available as `window.FDBG` in the browser's web developer console. */
|
|
432
|
-
__publicField$
|
|
434
|
+
__publicField$9(this, "debugger");
|
|
433
435
|
this._options = {
|
|
434
436
|
..._FlowContext._defaultOptions,
|
|
435
437
|
...options
|
|
@@ -453,23 +455,23 @@ const _FlowContext = class _FlowContext {
|
|
|
453
455
|
return expression.value;
|
|
454
456
|
}
|
|
455
457
|
};
|
|
456
|
-
__publicField$
|
|
458
|
+
__publicField$9(_FlowContext, "_defaultOptions", {
|
|
457
459
|
id: DEFAULT_CONTEXT_ID,
|
|
458
460
|
host: DEFAULT_FLOW_HOST,
|
|
459
461
|
enableDebug: false
|
|
460
462
|
});
|
|
461
463
|
let FlowContext = _FlowContext;
|
|
462
464
|
|
|
463
|
-
var __defProp$
|
|
464
|
-
var __defNormalProp$
|
|
465
|
-
var __publicField$
|
|
466
|
-
__defNormalProp$
|
|
465
|
+
var __defProp$8 = Object.defineProperty;
|
|
466
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
467
|
+
var __publicField$8 = (obj, key, value) => {
|
|
468
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
467
469
|
return value;
|
|
468
470
|
};
|
|
469
471
|
const debug$2 = Debug__default("flow:context-registry");
|
|
470
472
|
const _ContextRegistry = class _ContextRegistry {
|
|
471
473
|
constructor() {
|
|
472
|
-
__publicField$
|
|
474
|
+
__publicField$8(this, "_contexts", /* @__PURE__ */ new Map());
|
|
473
475
|
}
|
|
474
476
|
/**
|
|
475
477
|
* Initialize a new Flo.w context.
|
|
@@ -512,16 +514,16 @@ const _ContextRegistry = class _ContextRegistry {
|
|
|
512
514
|
return deferredContext?.deferred;
|
|
513
515
|
}
|
|
514
516
|
};
|
|
515
|
-
__publicField$
|
|
517
|
+
__publicField$8(_ContextRegistry, "_defaultOptions", {
|
|
516
518
|
id: DEFAULT_CONTEXT_ID,
|
|
517
519
|
host: "https://flow.emu-analytics.net"
|
|
518
520
|
});
|
|
519
521
|
let ContextRegistry = _ContextRegistry;
|
|
520
522
|
|
|
521
|
-
var __defProp$
|
|
522
|
-
var __defNormalProp$
|
|
523
|
-
var __publicField$
|
|
524
|
-
__defNormalProp$
|
|
523
|
+
var __defProp$7 = Object.defineProperty;
|
|
524
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
525
|
+
var __publicField$7 = (obj, key, value) => {
|
|
526
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
525
527
|
return value;
|
|
526
528
|
};
|
|
527
529
|
class FlowRdfCoreGlobals {
|
|
@@ -533,8 +535,8 @@ class FlowRdfCoreGlobals {
|
|
|
533
535
|
*
|
|
534
536
|
* N.B: this version is unrelated to the package version.
|
|
535
537
|
*/
|
|
536
|
-
__publicField$
|
|
537
|
-
__publicField$
|
|
538
|
+
__publicField$7(this, "version", 1);
|
|
539
|
+
__publicField$7(this, "globalContextRegistry", new ContextRegistry());
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
542
|
let canMergeGlobalState = true;
|
|
@@ -582,15 +584,15 @@ function getGlobalState() {
|
|
|
582
584
|
return globalState;
|
|
583
585
|
}
|
|
584
586
|
|
|
585
|
-
var __defProp$
|
|
586
|
-
var __defNormalProp$
|
|
587
|
-
var __publicField$
|
|
588
|
-
__defNormalProp$
|
|
587
|
+
var __defProp$6 = Object.defineProperty;
|
|
588
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
589
|
+
var __publicField$6 = (obj, key, value) => {
|
|
590
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
589
591
|
return value;
|
|
590
592
|
};
|
|
591
593
|
class MapLayerStyleBuilder {
|
|
592
594
|
constructor() {
|
|
593
|
-
__publicField$
|
|
595
|
+
__publicField$6(this, "_styles", /* @__PURE__ */ new Map());
|
|
594
596
|
}
|
|
595
597
|
static registerStyleBuilder(layerType, builder) {
|
|
596
598
|
this._styleBuilders.set(layerType, builder);
|
|
@@ -648,11 +650,11 @@ class MapLayerStyleBuilder {
|
|
|
648
650
|
}
|
|
649
651
|
}
|
|
650
652
|
}
|
|
651
|
-
__publicField$
|
|
653
|
+
__publicField$6(MapLayerStyleBuilder, "_styleBuilders", /* @__PURE__ */ new Map());
|
|
652
654
|
class StyleExpression {
|
|
653
655
|
constructor(_expr) {
|
|
654
656
|
this._expr = _expr;
|
|
655
|
-
__publicField$
|
|
657
|
+
__publicField$6(this, "__styleExpression", "styleexpression");
|
|
656
658
|
}
|
|
657
659
|
toString() {
|
|
658
660
|
return this._expr;
|
|
@@ -1969,19 +1971,19 @@ function layerStyle(layerType) {
|
|
|
1969
1971
|
return MapLayerStyleBuilder.createStyleBuilder(layerType);
|
|
1970
1972
|
}
|
|
1971
1973
|
|
|
1972
|
-
var __defProp$
|
|
1973
|
-
var __defNormalProp$
|
|
1974
|
-
var __publicField$
|
|
1975
|
-
__defNormalProp$
|
|
1974
|
+
var __defProp$5 = Object.defineProperty;
|
|
1975
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1976
|
+
var __publicField$5 = (obj, key, value) => {
|
|
1977
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1976
1978
|
return value;
|
|
1977
1979
|
};
|
|
1978
1980
|
const _MapStyle = class _MapStyle {
|
|
1979
1981
|
constructor() {
|
|
1980
|
-
__publicField$
|
|
1981
|
-
__publicField$
|
|
1982
|
-
__publicField$
|
|
1983
|
-
__publicField$
|
|
1984
|
-
__publicField$
|
|
1982
|
+
__publicField$5(this, "_state", null);
|
|
1983
|
+
__publicField$5(this, "_baseStyle");
|
|
1984
|
+
__publicField$5(this, "_sources", {});
|
|
1985
|
+
__publicField$5(this, "_layers", {});
|
|
1986
|
+
__publicField$5(this, "_layerOrder", []);
|
|
1985
1987
|
this._baseStyle = _MapStyle._defaultBaseStyle;
|
|
1986
1988
|
mobx.makeObservable(
|
|
1987
1989
|
this,
|
|
@@ -2133,7 +2135,7 @@ const _MapStyle = class _MapStyle {
|
|
|
2133
2135
|
return insertionIndex;
|
|
2134
2136
|
}
|
|
2135
2137
|
};
|
|
2136
|
-
__publicField$
|
|
2138
|
+
__publicField$5(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
2137
2139
|
version: 8,
|
|
2138
2140
|
id: "default",
|
|
2139
2141
|
name: "Default base style",
|
|
@@ -2142,18 +2144,18 @@ __publicField$6(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
|
2142
2144
|
}));
|
|
2143
2145
|
let MapStyle = _MapStyle;
|
|
2144
2146
|
|
|
2145
|
-
var __defProp$
|
|
2146
|
-
var __defNormalProp$
|
|
2147
|
-
var __publicField$
|
|
2148
|
-
__defNormalProp$
|
|
2147
|
+
var __defProp$4 = Object.defineProperty;
|
|
2148
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2149
|
+
var __publicField$4 = (obj, key, value) => {
|
|
2150
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2149
2151
|
return value;
|
|
2150
2152
|
};
|
|
2151
2153
|
Debug__default("flow:image-registry");
|
|
2152
2154
|
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`;
|
|
2153
2155
|
class ImageRegistry {
|
|
2154
2156
|
constructor() {
|
|
2155
|
-
__publicField$
|
|
2156
|
-
__publicField$
|
|
2157
|
+
__publicField$4(this, "_registry", /* @__PURE__ */ new Map());
|
|
2158
|
+
__publicField$4(this, "_unknownImage", null);
|
|
2157
2159
|
}
|
|
2158
2160
|
get unknownImage() {
|
|
2159
2161
|
if (!this._unknownImage) {
|
|
@@ -2221,10 +2223,10 @@ class ImageRegistry {
|
|
|
2221
2223
|
}
|
|
2222
2224
|
}
|
|
2223
2225
|
|
|
2224
|
-
var __defProp$
|
|
2225
|
-
var __defNormalProp$
|
|
2226
|
-
var __publicField$
|
|
2227
|
-
__defNormalProp$
|
|
2226
|
+
var __defProp$3 = Object.defineProperty;
|
|
2227
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2228
|
+
var __publicField$3 = (obj, key, value) => {
|
|
2229
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2228
2230
|
return value;
|
|
2229
2231
|
};
|
|
2230
2232
|
const debug$1 = Debug__default("flow:map");
|
|
@@ -2232,24 +2234,24 @@ const MOUSE_MOVE_THROTTLE_DURATION = 100;
|
|
|
2232
2234
|
const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
2233
2235
|
constructor(options) {
|
|
2234
2236
|
super();
|
|
2235
|
-
__publicField$
|
|
2236
|
-
__publicField$
|
|
2237
|
-
__publicField$
|
|
2238
|
-
__publicField$
|
|
2239
|
-
__publicField$
|
|
2240
|
-
__publicField$
|
|
2241
|
-
__publicField$
|
|
2242
|
-
__publicField$
|
|
2237
|
+
__publicField$3(this, "_context");
|
|
2238
|
+
__publicField$3(this, "_initialized");
|
|
2239
|
+
__publicField$3(this, "_loading", true);
|
|
2240
|
+
__publicField$3(this, "_debouncedEmitSourceEvent");
|
|
2241
|
+
__publicField$3(this, "_imageRegistry", new ImageRegistry());
|
|
2242
|
+
__publicField$3(this, "_options");
|
|
2243
|
+
__publicField$3(this, "_pluginManager");
|
|
2244
|
+
__publicField$3(this, "_resolveInitialized", () => {
|
|
2243
2245
|
});
|
|
2244
|
-
__publicField$
|
|
2245
|
-
__publicField$
|
|
2246
|
-
__publicField$
|
|
2246
|
+
__publicField$3(this, "_style");
|
|
2247
|
+
__publicField$3(this, "_styleUpdateSubscription", null);
|
|
2248
|
+
__publicField$3(this, "_throttledMouseMove", functional.throttle(this.handleMouseMove, {
|
|
2247
2249
|
delay: MOUSE_MOVE_THROTTLE_DURATION,
|
|
2248
2250
|
noLeading: true,
|
|
2249
2251
|
context: this
|
|
2250
2252
|
}));
|
|
2251
|
-
__publicField$
|
|
2252
|
-
__publicField$
|
|
2253
|
+
__publicField$3(this, "maplibreMap");
|
|
2254
|
+
__publicField$3(this, "updateMapStyle", (style) => {
|
|
2253
2255
|
const oldStyle = this.maplibreMap.getStyle();
|
|
2254
2256
|
const beforeEvent = new mapFeatureStream.MapStyleChangeEvent("beforeStyleChanged", this, oldStyle, style);
|
|
2255
2257
|
style = this._pluginManager.forwardStyleChangeEvent(
|
|
@@ -2292,6 +2294,14 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2292
2294
|
get styleSpecification() {
|
|
2293
2295
|
return this._style.styleSpecification;
|
|
2294
2296
|
}
|
|
2297
|
+
/**
|
|
2298
|
+
* @internal
|
|
2299
|
+
*
|
|
2300
|
+
* Used by map export to get images added to map.
|
|
2301
|
+
*/
|
|
2302
|
+
get imageRegistry() {
|
|
2303
|
+
return this._imageRegistry;
|
|
2304
|
+
}
|
|
2295
2305
|
addLayer(layerOrOptions) {
|
|
2296
2306
|
const layer = stringUtils.isPlainObject(layerOrOptions) ? new mapFeatureStream.MapLayer(layerOrOptions) : layerOrOptions;
|
|
2297
2307
|
this._style.addLayer(layer);
|
|
@@ -2452,9 +2462,9 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2452
2462
|
}
|
|
2453
2463
|
const options = {
|
|
2454
2464
|
center: lngLat,
|
|
2455
|
-
...center.zoom && { zoom: center.zoom },
|
|
2456
|
-
...center.bearing && { bearing: center.bearing },
|
|
2457
|
-
...center.pitch && { pitch: center.pitch },
|
|
2465
|
+
...stringUtils.isDefined(center.zoom) && { zoom: center.zoom },
|
|
2466
|
+
...stringUtils.isDefined(center.bearing) && { bearing: center.bearing },
|
|
2467
|
+
...stringUtils.isDefined(center.pitch) && { pitch: center.pitch },
|
|
2458
2468
|
...animationOptions
|
|
2459
2469
|
};
|
|
2460
2470
|
method.call(this.maplibreMap, options);
|
|
@@ -2472,6 +2482,17 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2472
2482
|
};
|
|
2473
2483
|
this.maplibreMap.fitBounds(bounds, fitBoundsOptions);
|
|
2474
2484
|
}
|
|
2485
|
+
getVisibleBounds() {
|
|
2486
|
+
const parentEl = this.container.parentElement;
|
|
2487
|
+
if (!parentEl) {
|
|
2488
|
+
return this.getBounds();
|
|
2489
|
+
}
|
|
2490
|
+
const mapRect = parentEl.getBoundingClientRect();
|
|
2491
|
+
const topLeft = this.maplibreMap.unproject([mapRect.x, mapRect.y]);
|
|
2492
|
+
const bottomRight = this.maplibreMap.unproject([mapRect.x + mapRect.width, mapRect.y + mapRect.height]);
|
|
2493
|
+
const bounds = [topLeft.lng, bottomRight.lat, bottomRight.lng, topLeft.lat];
|
|
2494
|
+
return bounds;
|
|
2495
|
+
}
|
|
2475
2496
|
/**
|
|
2476
2497
|
* Programmatically set feature state properties for a map feature.
|
|
2477
2498
|
*
|
|
@@ -2646,23 +2667,23 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2646
2667
|
return requestParameters;
|
|
2647
2668
|
}
|
|
2648
2669
|
};
|
|
2649
|
-
__publicField$
|
|
2670
|
+
__publicField$3(_FlowMap, "_defaultOptions", {
|
|
2650
2671
|
boxZoom: false,
|
|
2651
2672
|
doubleClickZoom: false,
|
|
2652
2673
|
featureClickTolerance: 0
|
|
2653
2674
|
});
|
|
2654
2675
|
let FlowMap = _FlowMap;
|
|
2655
2676
|
|
|
2656
|
-
var __defProp$
|
|
2657
|
-
var __defNormalProp$
|
|
2658
|
-
var __publicField$
|
|
2659
|
-
__defNormalProp$
|
|
2677
|
+
var __defProp$2 = Object.defineProperty;
|
|
2678
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2679
|
+
var __publicField$2 = (obj, key, value) => {
|
|
2680
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2660
2681
|
return value;
|
|
2661
2682
|
};
|
|
2662
2683
|
class AsyncCommitter {
|
|
2663
2684
|
constructor() {
|
|
2664
|
-
__publicField$
|
|
2665
|
-
__publicField$
|
|
2685
|
+
__publicField$2(this, "_requestId", 0);
|
|
2686
|
+
__publicField$2(this, "_commitId", 0);
|
|
2666
2687
|
}
|
|
2667
2688
|
async resolve(promise) {
|
|
2668
2689
|
this._requestId += 1;
|
|
@@ -2682,10 +2703,10 @@ class AsyncCommitter {
|
|
|
2682
2703
|
}
|
|
2683
2704
|
}
|
|
2684
2705
|
|
|
2685
|
-
var __defProp$
|
|
2686
|
-
var __defNormalProp$
|
|
2687
|
-
var __publicField$
|
|
2688
|
-
__defNormalProp$
|
|
2706
|
+
var __defProp$1 = Object.defineProperty;
|
|
2707
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2708
|
+
var __publicField$1 = (obj, key, value) => {
|
|
2709
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2689
2710
|
return value;
|
|
2690
2711
|
};
|
|
2691
2712
|
const debug = Debug__default("flow:query");
|
|
@@ -2693,13 +2714,13 @@ const DEFAULT_DELAY = 100;
|
|
|
2693
2714
|
const _Query = class _Query {
|
|
2694
2715
|
constructor(queryFn, transformFn, options) {
|
|
2695
2716
|
this.queryFn = queryFn;
|
|
2696
|
-
__publicField$
|
|
2697
|
-
__publicField$
|
|
2698
|
-
__publicField$
|
|
2699
|
-
__publicField$
|
|
2700
|
-
__publicField$
|
|
2701
|
-
__publicField$
|
|
2702
|
-
__publicField$
|
|
2717
|
+
__publicField$1(this, "_options");
|
|
2718
|
+
__publicField$1(this, "_committer", new AsyncCommitter());
|
|
2719
|
+
__publicField$1(this, "_disposer", null);
|
|
2720
|
+
__publicField$1(this, "_transformFn", (results) => results);
|
|
2721
|
+
__publicField$1(this, "results", null);
|
|
2722
|
+
__publicField$1(this, "busy", false);
|
|
2723
|
+
__publicField$1(this, "error", null);
|
|
2703
2724
|
this._options = {
|
|
2704
2725
|
..._Query._defaultOptions,
|
|
2705
2726
|
...options
|
|
@@ -2810,7 +2831,7 @@ const _Query = class _Query {
|
|
|
2810
2831
|
}
|
|
2811
2832
|
}
|
|
2812
2833
|
};
|
|
2813
|
-
__publicField$
|
|
2834
|
+
__publicField$1(_Query, "_defaultOptions", {
|
|
2814
2835
|
fireImmediately: true,
|
|
2815
2836
|
delay: DEFAULT_DELAY
|
|
2816
2837
|
});
|
|
@@ -2896,67 +2917,59 @@ function hasProp(target, prop) {
|
|
|
2896
2917
|
|
|
2897
2918
|
const SYNC_ANNOTATION_TYPE = "state-sync-annotation";
|
|
2898
2919
|
const REACTIVE_ANNOTATION_TYPE = "state-reactive-annotation";
|
|
2899
|
-
const
|
|
2920
|
+
const serializeRaw = {
|
|
2900
2921
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2901
2922
|
serialize(val) {
|
|
2902
|
-
return
|
|
2923
|
+
return mobx.toJS(val);
|
|
2903
2924
|
},
|
|
2904
2925
|
deserialize(val) {
|
|
2905
|
-
return val
|
|
2926
|
+
return val;
|
|
2906
2927
|
}
|
|
2907
2928
|
};
|
|
2908
|
-
const
|
|
2929
|
+
const serializeString = {
|
|
2909
2930
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2910
2931
|
serialize(val) {
|
|
2911
2932
|
return val.toString();
|
|
2912
2933
|
},
|
|
2913
2934
|
deserialize(val) {
|
|
2914
|
-
return
|
|
2935
|
+
return val;
|
|
2915
2936
|
}
|
|
2916
2937
|
};
|
|
2917
|
-
const
|
|
2938
|
+
const serializeNumber = {
|
|
2918
2939
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2919
2940
|
serialize(val) {
|
|
2920
|
-
return val.
|
|
2941
|
+
return val.toString();
|
|
2921
2942
|
},
|
|
2922
2943
|
deserialize(val) {
|
|
2923
|
-
return val
|
|
2944
|
+
return +val;
|
|
2924
2945
|
}
|
|
2925
2946
|
};
|
|
2926
|
-
const
|
|
2947
|
+
const serializeJson = {
|
|
2927
2948
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2928
2949
|
serialize(val) {
|
|
2929
|
-
return
|
|
2950
|
+
return JSON.stringify(val);
|
|
2930
2951
|
},
|
|
2931
2952
|
deserialize(val) {
|
|
2932
|
-
return
|
|
2953
|
+
return JSON.parse(val);
|
|
2933
2954
|
}
|
|
2934
2955
|
};
|
|
2935
2956
|
const serializeState = {
|
|
2936
2957
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2937
2958
|
serialize(val) {
|
|
2938
|
-
|
|
2939
|
-
const entries = Object.entries(props).map((entry) => `${entry[0]}=${entry[1]}`);
|
|
2940
|
-
return entries.join(",");
|
|
2959
|
+
return val.serialize();
|
|
2941
2960
|
},
|
|
2942
2961
|
deserialize(val, target) {
|
|
2943
|
-
|
|
2944
|
-
const parts = entry.split("=");
|
|
2945
|
-
mapFeatureStream.assert(parts.length === 2);
|
|
2946
|
-
accum[parts[0]] = parts[1];
|
|
2947
|
-
return accum;
|
|
2948
|
-
}, {});
|
|
2949
|
-
target.deserialize(entries);
|
|
2962
|
+
target.deserialize(val);
|
|
2950
2963
|
return target;
|
|
2951
2964
|
}
|
|
2952
2965
|
};
|
|
2953
|
-
const serialize = {
|
|
2966
|
+
const serialize = Object.assign(createDecoratorAnnotation(serializeRaw), {
|
|
2967
|
+
raw: createDecoratorAnnotation(serializeRaw),
|
|
2954
2968
|
string: createDecoratorAnnotation(serializeString),
|
|
2955
2969
|
number: createDecoratorAnnotation(serializeNumber),
|
|
2956
|
-
|
|
2957
|
-
numberArray: createDecoratorAnnotation(serializeNumberArray),
|
|
2970
|
+
json: createDecoratorAnnotation(serializeJson),
|
|
2958
2971
|
state: createDecoratorAnnotation(serializeState)
|
|
2959
|
-
};
|
|
2972
|
+
});
|
|
2960
2973
|
function createReactiveAnnotation(mobxAnnotation) {
|
|
2961
2974
|
return createDecoratorAnnotation({
|
|
2962
2975
|
annotationType: REACTIVE_ANNOTATION_TYPE,
|
|
@@ -2964,45 +2977,15 @@ function createReactiveAnnotation(mobxAnnotation) {
|
|
|
2964
2977
|
});
|
|
2965
2978
|
}
|
|
2966
2979
|
const observable = Object.assign(createReactiveAnnotation(mobx__namespace.observable), {
|
|
2980
|
+
deep: createReactiveAnnotation(mobx__namespace.observable.deep),
|
|
2967
2981
|
ref: createReactiveAnnotation(mobx__namespace.observable.ref),
|
|
2968
|
-
struct: createReactiveAnnotation(mobx__namespace.observable.
|
|
2982
|
+
struct: createReactiveAnnotation(mobx__namespace.observable.struct),
|
|
2969
2983
|
shallow: createReactiveAnnotation(mobx__namespace.observable.shallow)
|
|
2970
2984
|
});
|
|
2971
2985
|
const computed = Object.assign(createReactiveAnnotation(mobx__namespace.computed), {
|
|
2972
2986
|
struct: createReactiveAnnotation(mobx__namespace.computed.struct)
|
|
2973
2987
|
});
|
|
2974
2988
|
|
|
2975
|
-
var __defProp$1 = Object.defineProperty;
|
|
2976
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2977
|
-
var __publicField$1 = (obj, key, value) => {
|
|
2978
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2979
|
-
return value;
|
|
2980
|
-
};
|
|
2981
|
-
class Serializer {
|
|
2982
|
-
constructor(target) {
|
|
2983
|
-
__publicField$1(this, "target");
|
|
2984
|
-
this.target = target;
|
|
2985
|
-
}
|
|
2986
|
-
}
|
|
2987
|
-
class UrlSerializer extends Serializer {
|
|
2988
|
-
constructor(target) {
|
|
2989
|
-
super(target);
|
|
2990
|
-
}
|
|
2991
|
-
serialize(vals) {
|
|
2992
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
2993
|
-
Object.keys(vals).forEach((key) => searchParams.set(key, vals[key]));
|
|
2994
|
-
const queryString = searchParams.toString();
|
|
2995
|
-
const newUrl = queryString.length ? `${location.pathname}?${queryString}` : location.pathname;
|
|
2996
|
-
window.history.replaceState(vals, "", newUrl);
|
|
2997
|
-
}
|
|
2998
|
-
deserialize() {
|
|
2999
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
3000
|
-
const values = {};
|
|
3001
|
-
searchParams.forEach((val, key) => values[key] = val);
|
|
3002
|
-
return values;
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
2989
|
var __defProp = Object.defineProperty;
|
|
3007
2990
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3008
2991
|
var __publicField = (obj, key, value) => {
|
|
@@ -3014,7 +2997,6 @@ const StateStorCache = Symbol("FlowCoreStateStorCache");
|
|
|
3014
2997
|
class StateStore {
|
|
3015
2998
|
constructor() {
|
|
3016
2999
|
__publicField(this, "serializationAnnotations", {});
|
|
3017
|
-
__publicField(this, "serializer", new UrlSerializer(this));
|
|
3018
3000
|
__publicField(this, "id");
|
|
3019
3001
|
this.id = mapFeatureStream.randomId("state");
|
|
3020
3002
|
}
|
|
@@ -3132,7 +3114,7 @@ class StateStore {
|
|
|
3132
3114
|
if (!annotations) {
|
|
3133
3115
|
annotations = {};
|
|
3134
3116
|
let current = target;
|
|
3135
|
-
while (current && !
|
|
3117
|
+
while (current && !Object.prototype.hasOwnProperty.call(current, StateStoreMarker)) {
|
|
3136
3118
|
Reflect.ownKeys(current).forEach((k) => {
|
|
3137
3119
|
annotations[k] = !overrides ? true : k in overrides ? overrides[k] : true;
|
|
3138
3120
|
});
|
|
@@ -3152,33 +3134,48 @@ class StateStore {
|
|
|
3152
3134
|
};
|
|
3153
3135
|
return mobx__namespace.makeObservable(target, annotations, { name: this.formattedName });
|
|
3154
3136
|
}
|
|
3155
|
-
serialize() {
|
|
3137
|
+
serialize(format = "raw") {
|
|
3156
3138
|
const annotations = this.serializationAnnotations;
|
|
3157
3139
|
const serializedProps = Object.keys(annotations).reduce((accum, prop) => {
|
|
3158
|
-
|
|
3140
|
+
const val = this[prop];
|
|
3141
|
+
if (stringUtils.isDefined(val)) {
|
|
3142
|
+
const serializedValue = annotations[prop].serialize(val);
|
|
3143
|
+
accum[prop] = serializedValue;
|
|
3144
|
+
}
|
|
3159
3145
|
return accum;
|
|
3160
3146
|
}, {});
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3147
|
+
switch (format) {
|
|
3148
|
+
case "json":
|
|
3149
|
+
return JSON.stringify(serializedProps);
|
|
3150
|
+
case "lz":
|
|
3151
|
+
return lzString.compressToEncodedURIComponent(JSON.stringify(serializedProps));
|
|
3152
|
+
default:
|
|
3153
|
+
return serializedProps;
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
deserialize(value, format = "raw") {
|
|
3157
|
+
let deserializedValue;
|
|
3158
|
+
switch (format) {
|
|
3159
|
+
case "json":
|
|
3160
|
+
deserializedValue = JSON.parse(value);
|
|
3161
|
+
break;
|
|
3162
|
+
case "lz":
|
|
3163
|
+
deserializedValue = JSON.parse(lzString.decompressFromEncodedURIComponent(value));
|
|
3164
|
+
break;
|
|
3165
|
+
default:
|
|
3166
|
+
deserializedValue = value;
|
|
3167
|
+
break;
|
|
3168
|
+
}
|
|
3164
3169
|
this.transaction(() => {
|
|
3165
3170
|
const annotations = this.serializationAnnotations;
|
|
3166
|
-
Object.keys(
|
|
3171
|
+
Object.keys(deserializedValue).forEach((prop) => {
|
|
3167
3172
|
const annotation = annotations[prop];
|
|
3168
3173
|
if (annotation) {
|
|
3169
|
-
this[prop] = annotation.deserialize(
|
|
3174
|
+
this[prop] = annotation.deserialize(deserializedValue[prop], this[prop]);
|
|
3170
3175
|
}
|
|
3171
3176
|
});
|
|
3172
3177
|
});
|
|
3173
3178
|
}
|
|
3174
|
-
startSerialization() {
|
|
3175
|
-
const deserializedValues = this.serializer.deserialize();
|
|
3176
|
-
this.deserialize(deserializedValues);
|
|
3177
|
-
this.autorun(() => {
|
|
3178
|
-
const serialiedValues = this.serialize();
|
|
3179
|
-
this.serializer.serialize(serialiedValues);
|
|
3180
|
-
});
|
|
3181
|
-
}
|
|
3182
3179
|
checkInitialized() {
|
|
3183
3180
|
if (!this.initialized) {
|
|
3184
3181
|
throw new mapFeatureStream.FlowError(
|