@emuanalytics/flow-rdf-core 4.0.0-preview.1 → 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 +196 -177
- 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 +196 -177
- package/dist/lib/map/plugins/index.cjs +284 -88
- 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 +285 -90
- package/dist/shared/{flow-rdf-core.585aa641.cjs → flow-rdf-core.1f9c0593.cjs} +5 -2
- package/dist/shared/{flow-rdf-core.0bb1e167.d.cts → flow-rdf-core.2f79285b.d.cts} +78 -5
- package/dist/shared/{flow-rdf-core.0bb1e167.d.mts → flow-rdf-core.2f79285b.d.mts} +78 -5
- package/dist/shared/{flow-rdf-core.0bb1e167.d.ts → flow-rdf-core.2f79285b.d.ts} +78 -5
- package/dist/shared/{flow-rdf-core.9f1d67b5.mjs → flow-rdf-core.ce91eb14.mjs} +5 -2
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -4,11 +4,12 @@ const mobx = require('mobx');
|
|
|
4
4
|
const Debug = require('debug');
|
|
5
5
|
const flowEngineClient = require('@emuanalytics/flow-engine-client');
|
|
6
6
|
const stringUtils = require('./shared/flow-rdf-core.3042be4a.cjs');
|
|
7
|
-
const mapFeatureStream = require('./shared/flow-rdf-core.
|
|
7
|
+
const mapFeatureStream = require('./shared/flow-rdf-core.1f9c0593.cjs');
|
|
8
8
|
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.
|
|
@@ -174,6 +175,26 @@ class Debugger {
|
|
|
174
175
|
this.spyDisposer = void 0;
|
|
175
176
|
}
|
|
176
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Get a registered map instance by ID.
|
|
180
|
+
*/
|
|
181
|
+
maps(mapId) {
|
|
182
|
+
if (!mapId) {
|
|
183
|
+
return Array.from(this.context.maps._maps.keys());
|
|
184
|
+
}
|
|
185
|
+
const mapPromise = this.context.maps.getMap(mapId);
|
|
186
|
+
return mapPromise?.__zone_symbol__value;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get a registered reactive query by ID.
|
|
190
|
+
*/
|
|
191
|
+
queries(queryId) {
|
|
192
|
+
if (!queryId) {
|
|
193
|
+
return Array.from(this.context.queries._queries.keys());
|
|
194
|
+
}
|
|
195
|
+
const queryPromise = this.context.queries.getQuery(queryId);
|
|
196
|
+
return queryPromise?.__zone_symbol__value;
|
|
197
|
+
}
|
|
177
198
|
spyListener(event) {
|
|
178
199
|
console.log(`%cspy`, CONSOLE_HIGHLIGHT_STYLE, event);
|
|
179
200
|
}
|
|
@@ -190,11 +211,14 @@ function installGlobalDebugger(dbg) {
|
|
|
190
211
|
);
|
|
191
212
|
const g = typeof global !== "undefined" ? global : window;
|
|
192
213
|
g[FLOW_GLOBAL] = g[FLOW_GLOBAL] || {
|
|
214
|
+
context: dbg.context,
|
|
193
215
|
watch: dbg.watch.bind(dbg),
|
|
194
216
|
unwatch: dbg.unwatch.bind(dbg),
|
|
195
217
|
set: dbg.set.bind(dbg),
|
|
196
218
|
get: dbg.get.bind(dbg),
|
|
197
219
|
spy: dbg.spy.bind(dbg),
|
|
220
|
+
maps: dbg.maps.bind(dbg),
|
|
221
|
+
queries: dbg.queries.bind(dbg),
|
|
198
222
|
unspy: dbg.unspy.bind(dbg)
|
|
199
223
|
};
|
|
200
224
|
}
|
|
@@ -281,16 +305,16 @@ function toJSHelper(source, options, __alreadySeen = null) {
|
|
|
281
305
|
return res;
|
|
282
306
|
}
|
|
283
307
|
|
|
284
|
-
var __defProp$
|
|
285
|
-
var __defNormalProp$
|
|
286
|
-
var __publicField$
|
|
287
|
-
__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);
|
|
288
312
|
return value;
|
|
289
313
|
};
|
|
290
314
|
const debug$4 = Debug__default("flow:map-registry");
|
|
291
315
|
class MapRegistry {
|
|
292
316
|
constructor() {
|
|
293
|
-
__publicField$
|
|
317
|
+
__publicField$b(this, "_maps", /* @__PURE__ */ new Map());
|
|
294
318
|
}
|
|
295
319
|
/**
|
|
296
320
|
* Register a Flo.w map.
|
|
@@ -332,16 +356,16 @@ class MapRegistry {
|
|
|
332
356
|
}
|
|
333
357
|
}
|
|
334
358
|
|
|
335
|
-
var __defProp$
|
|
336
|
-
var __defNormalProp$
|
|
337
|
-
var __publicField$
|
|
338
|
-
__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);
|
|
339
363
|
return value;
|
|
340
364
|
};
|
|
341
365
|
const debug$3 = Debug__default("flow:query-registry");
|
|
342
366
|
class QueryRegistry {
|
|
343
367
|
constructor() {
|
|
344
|
-
__publicField$
|
|
368
|
+
__publicField$a(this, "_queries", /* @__PURE__ */ new Map());
|
|
345
369
|
}
|
|
346
370
|
/**
|
|
347
371
|
* Register a Flo.w reactive query.
|
|
@@ -381,10 +405,10 @@ class QueryRegistry {
|
|
|
381
405
|
}
|
|
382
406
|
}
|
|
383
407
|
|
|
384
|
-
var __defProp$
|
|
385
|
-
var __defNormalProp$
|
|
386
|
-
var __publicField$
|
|
387
|
-
__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);
|
|
388
412
|
return value;
|
|
389
413
|
};
|
|
390
414
|
const DEFAULT_FLOW_HOST = "https://flow.emu-analytics.net";
|
|
@@ -401,13 +425,13 @@ const _FlowContext = class _FlowContext {
|
|
|
401
425
|
* @param enableDebug Set to `true` to enable the debugger.
|
|
402
426
|
*/
|
|
403
427
|
constructor(options) {
|
|
404
|
-
__publicField$
|
|
405
|
-
__publicField$
|
|
406
|
-
__publicField$
|
|
407
|
-
__publicField$
|
|
408
|
-
__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());
|
|
409
433
|
/** The Flo.w debugger. Available as `window.FDBG` in the browser's web developer console. */
|
|
410
|
-
__publicField$
|
|
434
|
+
__publicField$9(this, "debugger");
|
|
411
435
|
this._options = {
|
|
412
436
|
..._FlowContext._defaultOptions,
|
|
413
437
|
...options
|
|
@@ -431,23 +455,23 @@ const _FlowContext = class _FlowContext {
|
|
|
431
455
|
return expression.value;
|
|
432
456
|
}
|
|
433
457
|
};
|
|
434
|
-
__publicField$
|
|
458
|
+
__publicField$9(_FlowContext, "_defaultOptions", {
|
|
435
459
|
id: DEFAULT_CONTEXT_ID,
|
|
436
460
|
host: DEFAULT_FLOW_HOST,
|
|
437
461
|
enableDebug: false
|
|
438
462
|
});
|
|
439
463
|
let FlowContext = _FlowContext;
|
|
440
464
|
|
|
441
|
-
var __defProp$
|
|
442
|
-
var __defNormalProp$
|
|
443
|
-
var __publicField$
|
|
444
|
-
__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);
|
|
445
469
|
return value;
|
|
446
470
|
};
|
|
447
471
|
const debug$2 = Debug__default("flow:context-registry");
|
|
448
472
|
const _ContextRegistry = class _ContextRegistry {
|
|
449
473
|
constructor() {
|
|
450
|
-
__publicField$
|
|
474
|
+
__publicField$8(this, "_contexts", /* @__PURE__ */ new Map());
|
|
451
475
|
}
|
|
452
476
|
/**
|
|
453
477
|
* Initialize a new Flo.w context.
|
|
@@ -490,16 +514,16 @@ const _ContextRegistry = class _ContextRegistry {
|
|
|
490
514
|
return deferredContext?.deferred;
|
|
491
515
|
}
|
|
492
516
|
};
|
|
493
|
-
__publicField$
|
|
517
|
+
__publicField$8(_ContextRegistry, "_defaultOptions", {
|
|
494
518
|
id: DEFAULT_CONTEXT_ID,
|
|
495
519
|
host: "https://flow.emu-analytics.net"
|
|
496
520
|
});
|
|
497
521
|
let ContextRegistry = _ContextRegistry;
|
|
498
522
|
|
|
499
|
-
var __defProp$
|
|
500
|
-
var __defNormalProp$
|
|
501
|
-
var __publicField$
|
|
502
|
-
__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);
|
|
503
527
|
return value;
|
|
504
528
|
};
|
|
505
529
|
class FlowRdfCoreGlobals {
|
|
@@ -511,8 +535,8 @@ class FlowRdfCoreGlobals {
|
|
|
511
535
|
*
|
|
512
536
|
* N.B: this version is unrelated to the package version.
|
|
513
537
|
*/
|
|
514
|
-
__publicField$
|
|
515
|
-
__publicField$
|
|
538
|
+
__publicField$7(this, "version", 1);
|
|
539
|
+
__publicField$7(this, "globalContextRegistry", new ContextRegistry());
|
|
516
540
|
}
|
|
517
541
|
}
|
|
518
542
|
let canMergeGlobalState = true;
|
|
@@ -560,15 +584,15 @@ function getGlobalState() {
|
|
|
560
584
|
return globalState;
|
|
561
585
|
}
|
|
562
586
|
|
|
563
|
-
var __defProp$
|
|
564
|
-
var __defNormalProp$
|
|
565
|
-
var __publicField$
|
|
566
|
-
__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);
|
|
567
591
|
return value;
|
|
568
592
|
};
|
|
569
593
|
class MapLayerStyleBuilder {
|
|
570
594
|
constructor() {
|
|
571
|
-
__publicField$
|
|
595
|
+
__publicField$6(this, "_styles", /* @__PURE__ */ new Map());
|
|
572
596
|
}
|
|
573
597
|
static registerStyleBuilder(layerType, builder) {
|
|
574
598
|
this._styleBuilders.set(layerType, builder);
|
|
@@ -626,11 +650,11 @@ class MapLayerStyleBuilder {
|
|
|
626
650
|
}
|
|
627
651
|
}
|
|
628
652
|
}
|
|
629
|
-
__publicField$
|
|
653
|
+
__publicField$6(MapLayerStyleBuilder, "_styleBuilders", /* @__PURE__ */ new Map());
|
|
630
654
|
class StyleExpression {
|
|
631
655
|
constructor(_expr) {
|
|
632
656
|
this._expr = _expr;
|
|
633
|
-
__publicField$
|
|
657
|
+
__publicField$6(this, "__styleExpression", "styleexpression");
|
|
634
658
|
}
|
|
635
659
|
toString() {
|
|
636
660
|
return this._expr;
|
|
@@ -1947,19 +1971,19 @@ function layerStyle(layerType) {
|
|
|
1947
1971
|
return MapLayerStyleBuilder.createStyleBuilder(layerType);
|
|
1948
1972
|
}
|
|
1949
1973
|
|
|
1950
|
-
var __defProp$
|
|
1951
|
-
var __defNormalProp$
|
|
1952
|
-
var __publicField$
|
|
1953
|
-
__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);
|
|
1954
1978
|
return value;
|
|
1955
1979
|
};
|
|
1956
1980
|
const _MapStyle = class _MapStyle {
|
|
1957
1981
|
constructor() {
|
|
1958
|
-
__publicField$
|
|
1959
|
-
__publicField$
|
|
1960
|
-
__publicField$
|
|
1961
|
-
__publicField$
|
|
1962
|
-
__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", []);
|
|
1963
1987
|
this._baseStyle = _MapStyle._defaultBaseStyle;
|
|
1964
1988
|
mobx.makeObservable(
|
|
1965
1989
|
this,
|
|
@@ -2111,7 +2135,7 @@ const _MapStyle = class _MapStyle {
|
|
|
2111
2135
|
return insertionIndex;
|
|
2112
2136
|
}
|
|
2113
2137
|
};
|
|
2114
|
-
__publicField$
|
|
2138
|
+
__publicField$5(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
2115
2139
|
version: 8,
|
|
2116
2140
|
id: "default",
|
|
2117
2141
|
name: "Default base style",
|
|
@@ -2120,18 +2144,18 @@ __publicField$6(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
|
2120
2144
|
}));
|
|
2121
2145
|
let MapStyle = _MapStyle;
|
|
2122
2146
|
|
|
2123
|
-
var __defProp$
|
|
2124
|
-
var __defNormalProp$
|
|
2125
|
-
var __publicField$
|
|
2126
|
-
__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);
|
|
2127
2151
|
return value;
|
|
2128
2152
|
};
|
|
2129
2153
|
Debug__default("flow:image-registry");
|
|
2130
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`;
|
|
2131
2155
|
class ImageRegistry {
|
|
2132
2156
|
constructor() {
|
|
2133
|
-
__publicField$
|
|
2134
|
-
__publicField$
|
|
2157
|
+
__publicField$4(this, "_registry", /* @__PURE__ */ new Map());
|
|
2158
|
+
__publicField$4(this, "_unknownImage", null);
|
|
2135
2159
|
}
|
|
2136
2160
|
get unknownImage() {
|
|
2137
2161
|
if (!this._unknownImage) {
|
|
@@ -2199,10 +2223,10 @@ class ImageRegistry {
|
|
|
2199
2223
|
}
|
|
2200
2224
|
}
|
|
2201
2225
|
|
|
2202
|
-
var __defProp$
|
|
2203
|
-
var __defNormalProp$
|
|
2204
|
-
var __publicField$
|
|
2205
|
-
__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);
|
|
2206
2230
|
return value;
|
|
2207
2231
|
};
|
|
2208
2232
|
const debug$1 = Debug__default("flow:map");
|
|
@@ -2210,24 +2234,24 @@ const MOUSE_MOVE_THROTTLE_DURATION = 100;
|
|
|
2210
2234
|
const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
2211
2235
|
constructor(options) {
|
|
2212
2236
|
super();
|
|
2213
|
-
__publicField$
|
|
2214
|
-
__publicField$
|
|
2215
|
-
__publicField$
|
|
2216
|
-
__publicField$
|
|
2217
|
-
__publicField$
|
|
2218
|
-
__publicField$
|
|
2219
|
-
__publicField$
|
|
2220
|
-
__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", () => {
|
|
2221
2245
|
});
|
|
2222
|
-
__publicField$
|
|
2223
|
-
__publicField$
|
|
2224
|
-
__publicField$
|
|
2246
|
+
__publicField$3(this, "_style");
|
|
2247
|
+
__publicField$3(this, "_styleUpdateSubscription", null);
|
|
2248
|
+
__publicField$3(this, "_throttledMouseMove", functional.throttle(this.handleMouseMove, {
|
|
2225
2249
|
delay: MOUSE_MOVE_THROTTLE_DURATION,
|
|
2226
2250
|
noLeading: true,
|
|
2227
2251
|
context: this
|
|
2228
2252
|
}));
|
|
2229
|
-
__publicField$
|
|
2230
|
-
__publicField$
|
|
2253
|
+
__publicField$3(this, "maplibreMap");
|
|
2254
|
+
__publicField$3(this, "updateMapStyle", (style) => {
|
|
2231
2255
|
const oldStyle = this.maplibreMap.getStyle();
|
|
2232
2256
|
const beforeEvent = new mapFeatureStream.MapStyleChangeEvent("beforeStyleChanged", this, oldStyle, style);
|
|
2233
2257
|
style = this._pluginManager.forwardStyleChangeEvent(
|
|
@@ -2270,6 +2294,14 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2270
2294
|
get styleSpecification() {
|
|
2271
2295
|
return this._style.styleSpecification;
|
|
2272
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
|
+
}
|
|
2273
2305
|
addLayer(layerOrOptions) {
|
|
2274
2306
|
const layer = stringUtils.isPlainObject(layerOrOptions) ? new mapFeatureStream.MapLayer(layerOrOptions) : layerOrOptions;
|
|
2275
2307
|
this._style.addLayer(layer);
|
|
@@ -2430,9 +2462,9 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2430
2462
|
}
|
|
2431
2463
|
const options = {
|
|
2432
2464
|
center: lngLat,
|
|
2433
|
-
...center.zoom && { zoom: center.zoom },
|
|
2434
|
-
...center.bearing && { bearing: center.bearing },
|
|
2435
|
-
...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 },
|
|
2436
2468
|
...animationOptions
|
|
2437
2469
|
};
|
|
2438
2470
|
method.call(this.maplibreMap, options);
|
|
@@ -2450,6 +2482,17 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2450
2482
|
};
|
|
2451
2483
|
this.maplibreMap.fitBounds(bounds, fitBoundsOptions);
|
|
2452
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
|
+
}
|
|
2453
2496
|
/**
|
|
2454
2497
|
* Programmatically set feature state properties for a map feature.
|
|
2455
2498
|
*
|
|
@@ -2624,23 +2667,23 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2624
2667
|
return requestParameters;
|
|
2625
2668
|
}
|
|
2626
2669
|
};
|
|
2627
|
-
__publicField$
|
|
2670
|
+
__publicField$3(_FlowMap, "_defaultOptions", {
|
|
2628
2671
|
boxZoom: false,
|
|
2629
2672
|
doubleClickZoom: false,
|
|
2630
2673
|
featureClickTolerance: 0
|
|
2631
2674
|
});
|
|
2632
2675
|
let FlowMap = _FlowMap;
|
|
2633
2676
|
|
|
2634
|
-
var __defProp$
|
|
2635
|
-
var __defNormalProp$
|
|
2636
|
-
var __publicField$
|
|
2637
|
-
__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);
|
|
2638
2681
|
return value;
|
|
2639
2682
|
};
|
|
2640
2683
|
class AsyncCommitter {
|
|
2641
2684
|
constructor() {
|
|
2642
|
-
__publicField$
|
|
2643
|
-
__publicField$
|
|
2685
|
+
__publicField$2(this, "_requestId", 0);
|
|
2686
|
+
__publicField$2(this, "_commitId", 0);
|
|
2644
2687
|
}
|
|
2645
2688
|
async resolve(promise) {
|
|
2646
2689
|
this._requestId += 1;
|
|
@@ -2660,10 +2703,10 @@ class AsyncCommitter {
|
|
|
2660
2703
|
}
|
|
2661
2704
|
}
|
|
2662
2705
|
|
|
2663
|
-
var __defProp$
|
|
2664
|
-
var __defNormalProp$
|
|
2665
|
-
var __publicField$
|
|
2666
|
-
__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);
|
|
2667
2710
|
return value;
|
|
2668
2711
|
};
|
|
2669
2712
|
const debug = Debug__default("flow:query");
|
|
@@ -2671,13 +2714,13 @@ const DEFAULT_DELAY = 100;
|
|
|
2671
2714
|
const _Query = class _Query {
|
|
2672
2715
|
constructor(queryFn, transformFn, options) {
|
|
2673
2716
|
this.queryFn = queryFn;
|
|
2674
|
-
__publicField$
|
|
2675
|
-
__publicField$
|
|
2676
|
-
__publicField$
|
|
2677
|
-
__publicField$
|
|
2678
|
-
__publicField$
|
|
2679
|
-
__publicField$
|
|
2680
|
-
__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);
|
|
2681
2724
|
this._options = {
|
|
2682
2725
|
..._Query._defaultOptions,
|
|
2683
2726
|
...options
|
|
@@ -2788,7 +2831,7 @@ const _Query = class _Query {
|
|
|
2788
2831
|
}
|
|
2789
2832
|
}
|
|
2790
2833
|
};
|
|
2791
|
-
__publicField$
|
|
2834
|
+
__publicField$1(_Query, "_defaultOptions", {
|
|
2792
2835
|
fireImmediately: true,
|
|
2793
2836
|
delay: DEFAULT_DELAY
|
|
2794
2837
|
});
|
|
@@ -2874,67 +2917,59 @@ function hasProp(target, prop) {
|
|
|
2874
2917
|
|
|
2875
2918
|
const SYNC_ANNOTATION_TYPE = "state-sync-annotation";
|
|
2876
2919
|
const REACTIVE_ANNOTATION_TYPE = "state-reactive-annotation";
|
|
2877
|
-
const
|
|
2920
|
+
const serializeRaw = {
|
|
2878
2921
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2879
2922
|
serialize(val) {
|
|
2880
|
-
return
|
|
2923
|
+
return mobx.toJS(val);
|
|
2881
2924
|
},
|
|
2882
2925
|
deserialize(val) {
|
|
2883
|
-
return val
|
|
2926
|
+
return val;
|
|
2884
2927
|
}
|
|
2885
2928
|
};
|
|
2886
|
-
const
|
|
2929
|
+
const serializeString = {
|
|
2887
2930
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2888
2931
|
serialize(val) {
|
|
2889
2932
|
return val.toString();
|
|
2890
2933
|
},
|
|
2891
2934
|
deserialize(val) {
|
|
2892
|
-
return
|
|
2935
|
+
return val;
|
|
2893
2936
|
}
|
|
2894
2937
|
};
|
|
2895
|
-
const
|
|
2938
|
+
const serializeNumber = {
|
|
2896
2939
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2897
2940
|
serialize(val) {
|
|
2898
|
-
return val.
|
|
2941
|
+
return val.toString();
|
|
2899
2942
|
},
|
|
2900
2943
|
deserialize(val) {
|
|
2901
|
-
return val
|
|
2944
|
+
return +val;
|
|
2902
2945
|
}
|
|
2903
2946
|
};
|
|
2904
|
-
const
|
|
2947
|
+
const serializeJson = {
|
|
2905
2948
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2906
2949
|
serialize(val) {
|
|
2907
|
-
return
|
|
2950
|
+
return JSON.stringify(val);
|
|
2908
2951
|
},
|
|
2909
2952
|
deserialize(val) {
|
|
2910
|
-
return
|
|
2953
|
+
return JSON.parse(val);
|
|
2911
2954
|
}
|
|
2912
2955
|
};
|
|
2913
2956
|
const serializeState = {
|
|
2914
2957
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2915
2958
|
serialize(val) {
|
|
2916
|
-
|
|
2917
|
-
const entries = Object.entries(props).map((entry) => `${entry[0]}=${entry[1]}`);
|
|
2918
|
-
return entries.join(",");
|
|
2959
|
+
return val.serialize();
|
|
2919
2960
|
},
|
|
2920
2961
|
deserialize(val, target) {
|
|
2921
|
-
|
|
2922
|
-
const parts = entry.split("=");
|
|
2923
|
-
mapFeatureStream.assert(parts.length === 2);
|
|
2924
|
-
accum[parts[0]] = parts[1];
|
|
2925
|
-
return accum;
|
|
2926
|
-
}, {});
|
|
2927
|
-
target.deserialize(entries);
|
|
2962
|
+
target.deserialize(val);
|
|
2928
2963
|
return target;
|
|
2929
2964
|
}
|
|
2930
2965
|
};
|
|
2931
|
-
const serialize = {
|
|
2966
|
+
const serialize = Object.assign(createDecoratorAnnotation(serializeRaw), {
|
|
2967
|
+
raw: createDecoratorAnnotation(serializeRaw),
|
|
2932
2968
|
string: createDecoratorAnnotation(serializeString),
|
|
2933
2969
|
number: createDecoratorAnnotation(serializeNumber),
|
|
2934
|
-
|
|
2935
|
-
numberArray: createDecoratorAnnotation(serializeNumberArray),
|
|
2970
|
+
json: createDecoratorAnnotation(serializeJson),
|
|
2936
2971
|
state: createDecoratorAnnotation(serializeState)
|
|
2937
|
-
};
|
|
2972
|
+
});
|
|
2938
2973
|
function createReactiveAnnotation(mobxAnnotation) {
|
|
2939
2974
|
return createDecoratorAnnotation({
|
|
2940
2975
|
annotationType: REACTIVE_ANNOTATION_TYPE,
|
|
@@ -2942,45 +2977,15 @@ function createReactiveAnnotation(mobxAnnotation) {
|
|
|
2942
2977
|
});
|
|
2943
2978
|
}
|
|
2944
2979
|
const observable = Object.assign(createReactiveAnnotation(mobx__namespace.observable), {
|
|
2980
|
+
deep: createReactiveAnnotation(mobx__namespace.observable.deep),
|
|
2945
2981
|
ref: createReactiveAnnotation(mobx__namespace.observable.ref),
|
|
2946
|
-
struct: createReactiveAnnotation(mobx__namespace.observable.
|
|
2982
|
+
struct: createReactiveAnnotation(mobx__namespace.observable.struct),
|
|
2947
2983
|
shallow: createReactiveAnnotation(mobx__namespace.observable.shallow)
|
|
2948
2984
|
});
|
|
2949
2985
|
const computed = Object.assign(createReactiveAnnotation(mobx__namespace.computed), {
|
|
2950
2986
|
struct: createReactiveAnnotation(mobx__namespace.computed.struct)
|
|
2951
2987
|
});
|
|
2952
2988
|
|
|
2953
|
-
var __defProp$1 = Object.defineProperty;
|
|
2954
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2955
|
-
var __publicField$1 = (obj, key, value) => {
|
|
2956
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2957
|
-
return value;
|
|
2958
|
-
};
|
|
2959
|
-
class Serializer {
|
|
2960
|
-
constructor(target) {
|
|
2961
|
-
__publicField$1(this, "target");
|
|
2962
|
-
this.target = target;
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
|
-
class UrlSerializer extends Serializer {
|
|
2966
|
-
constructor(target) {
|
|
2967
|
-
super(target);
|
|
2968
|
-
}
|
|
2969
|
-
serialize(vals) {
|
|
2970
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
2971
|
-
Object.keys(vals).forEach((key) => searchParams.set(key, vals[key]));
|
|
2972
|
-
const queryString = searchParams.toString();
|
|
2973
|
-
const newUrl = queryString.length ? `${location.pathname}?${queryString}` : location.pathname;
|
|
2974
|
-
window.history.replaceState(vals, "", newUrl);
|
|
2975
|
-
}
|
|
2976
|
-
deserialize() {
|
|
2977
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
2978
|
-
const values = {};
|
|
2979
|
-
searchParams.forEach((val, key) => values[key] = val);
|
|
2980
|
-
return values;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
2989
|
var __defProp = Object.defineProperty;
|
|
2985
2990
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2986
2991
|
var __publicField = (obj, key, value) => {
|
|
@@ -2992,7 +2997,6 @@ const StateStorCache = Symbol("FlowCoreStateStorCache");
|
|
|
2992
2997
|
class StateStore {
|
|
2993
2998
|
constructor() {
|
|
2994
2999
|
__publicField(this, "serializationAnnotations", {});
|
|
2995
|
-
__publicField(this, "serializer", new UrlSerializer(this));
|
|
2996
3000
|
__publicField(this, "id");
|
|
2997
3001
|
this.id = mapFeatureStream.randomId("state");
|
|
2998
3002
|
}
|
|
@@ -3110,7 +3114,7 @@ class StateStore {
|
|
|
3110
3114
|
if (!annotations) {
|
|
3111
3115
|
annotations = {};
|
|
3112
3116
|
let current = target;
|
|
3113
|
-
while (current && !
|
|
3117
|
+
while (current && !Object.prototype.hasOwnProperty.call(current, StateStoreMarker)) {
|
|
3114
3118
|
Reflect.ownKeys(current).forEach((k) => {
|
|
3115
3119
|
annotations[k] = !overrides ? true : k in overrides ? overrides[k] : true;
|
|
3116
3120
|
});
|
|
@@ -3130,33 +3134,48 @@ class StateStore {
|
|
|
3130
3134
|
};
|
|
3131
3135
|
return mobx__namespace.makeObservable(target, annotations, { name: this.formattedName });
|
|
3132
3136
|
}
|
|
3133
|
-
serialize() {
|
|
3137
|
+
serialize(format = "raw") {
|
|
3134
3138
|
const annotations = this.serializationAnnotations;
|
|
3135
3139
|
const serializedProps = Object.keys(annotations).reduce((accum, prop) => {
|
|
3136
|
-
|
|
3140
|
+
const val = this[prop];
|
|
3141
|
+
if (stringUtils.isDefined(val)) {
|
|
3142
|
+
const serializedValue = annotations[prop].serialize(val);
|
|
3143
|
+
accum[prop] = serializedValue;
|
|
3144
|
+
}
|
|
3137
3145
|
return accum;
|
|
3138
3146
|
}, {});
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
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
|
+
}
|
|
3142
3169
|
this.transaction(() => {
|
|
3143
3170
|
const annotations = this.serializationAnnotations;
|
|
3144
|
-
Object.keys(
|
|
3171
|
+
Object.keys(deserializedValue).forEach((prop) => {
|
|
3145
3172
|
const annotation = annotations[prop];
|
|
3146
3173
|
if (annotation) {
|
|
3147
|
-
this[prop] = annotation.deserialize(
|
|
3174
|
+
this[prop] = annotation.deserialize(deserializedValue[prop], this[prop]);
|
|
3148
3175
|
}
|
|
3149
3176
|
});
|
|
3150
3177
|
});
|
|
3151
3178
|
}
|
|
3152
|
-
startSerialization() {
|
|
3153
|
-
const deserializedValues = this.serializer.deserialize();
|
|
3154
|
-
this.deserialize(deserializedValues);
|
|
3155
|
-
this.autorun(() => {
|
|
3156
|
-
const serialiedValues = this.serialize();
|
|
3157
|
-
this.serializer.serialize(serialiedValues);
|
|
3158
|
-
});
|
|
3159
|
-
}
|
|
3160
3179
|
checkInitialized() {
|
|
3161
3180
|
if (!this.initialized) {
|
|
3162
3181
|
throw new mapFeatureStream.FlowError(
|