@emuanalytics/flow-rdf-core 4.0.0-preview.2 → 4.0.0-preview.4
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 +232 -186
- package/dist/index.d.cts +7 -6
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.mjs +235 -189
- package/dist/lib/map/plugins/index.cjs +276 -86
- package/dist/lib/map/plugins/index.d.cts +40 -4
- package/dist/lib/map/plugins/index.d.mts +40 -4
- package/dist/lib/map/plugins/index.d.ts +40 -4
- package/dist/lib/map/plugins/index.mjs +279 -90
- package/dist/lib/utils/index.cjs +6 -5
- package/dist/lib/utils/index.d.cts +126 -6
- package/dist/lib/utils/index.d.mts +126 -6
- package/dist/lib/utils/index.d.ts +126 -6
- package/dist/lib/utils/index.mjs +1 -1
- package/dist/shared/flow-rdf-core.1f72b20b.cjs +150 -0
- package/dist/shared/flow-rdf-core.63162669.d.cts +10 -0
- package/dist/shared/flow-rdf-core.63162669.d.mts +10 -0
- package/dist/shared/flow-rdf-core.63162669.d.ts +10 -0
- package/dist/shared/{flow-rdf-core.42d7cda4.d.cts → flow-rdf-core.769a4928.d.cts} +69 -4
- package/dist/shared/{flow-rdf-core.42d7cda4.d.mts → flow-rdf-core.769a4928.d.mts} +69 -4
- package/dist/shared/{flow-rdf-core.42d7cda4.d.ts → flow-rdf-core.769a4928.d.ts} +69 -4
- package/dist/shared/flow-rdf-core.ea06a1d3.mjs +144 -0
- package/package.json +13 -7
- package/dist/shared/flow-rdf-core.08975378.d.cts +0 -68
- package/dist/shared/flow-rdf-core.08975378.d.mts +0 -68
- package/dist/shared/flow-rdf-core.08975378.d.ts +0 -68
- package/dist/shared/flow-rdf-core.2e456f93.mjs +0 -83
- package/dist/shared/flow-rdf-core.c44cf082.cjs +0 -88
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,8 @@ 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
|
-
const
|
|
11
|
+
const throttle = require('./shared/flow-rdf-core.1f72b20b.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.4";
|
|
37
38
|
|
|
38
39
|
const CONSOLE_HIGHLIGHT_STYLE$1 = `
|
|
39
40
|
padding: 2px 4px;
|
|
@@ -61,18 +62,72 @@ function getGlobal() {
|
|
|
61
62
|
return mockGlobal;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
var __accessCheck = (obj, member, msg) => {
|
|
66
|
+
if (!member.has(obj))
|
|
67
|
+
throw TypeError("Cannot " + msg);
|
|
68
|
+
};
|
|
69
|
+
var __privateGet = (obj, member, getter) => {
|
|
70
|
+
__accessCheck(obj, member, "read from private field");
|
|
71
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
72
|
+
};
|
|
73
|
+
var __privateAdd = (obj, member, value) => {
|
|
74
|
+
if (member.has(obj))
|
|
75
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
76
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
77
|
+
};
|
|
78
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
79
|
+
__accessCheck(obj, member, "write to private field");
|
|
80
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
81
|
+
return value;
|
|
82
|
+
};
|
|
83
|
+
var _value, _settled, _status;
|
|
84
|
+
class WatchablePromise extends Promise {
|
|
85
|
+
constructor(executor) {
|
|
86
|
+
super((resolve, reject) => {
|
|
87
|
+
executor(
|
|
88
|
+
(value) => {
|
|
89
|
+
resolve(value);
|
|
90
|
+
__privateSet(this, _value, value);
|
|
91
|
+
__privateSet(this, _settled, true);
|
|
92
|
+
__privateSet(this, _status, "fulfilled");
|
|
93
|
+
},
|
|
94
|
+
(reason) => {
|
|
95
|
+
reject(reason);
|
|
96
|
+
__privateSet(this, _settled, true);
|
|
97
|
+
__privateSet(this, _status, "rejected");
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
__privateAdd(this, _value, void 0);
|
|
102
|
+
__privateAdd(this, _settled, false);
|
|
103
|
+
__privateAdd(this, _status, "pending");
|
|
104
|
+
}
|
|
105
|
+
get settled() {
|
|
106
|
+
return __privateGet(this, _settled);
|
|
107
|
+
}
|
|
108
|
+
get status() {
|
|
109
|
+
return __privateGet(this, _status);
|
|
110
|
+
}
|
|
111
|
+
get value() {
|
|
112
|
+
return __privateGet(this, _value);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
_value = new WeakMap();
|
|
116
|
+
_settled = new WeakMap();
|
|
117
|
+
_status = new WeakMap();
|
|
118
|
+
|
|
64
119
|
function deferred() {
|
|
65
120
|
let methods;
|
|
66
|
-
const promise = new
|
|
121
|
+
const promise = new WatchablePromise((resolve, reject) => {
|
|
67
122
|
methods = { resolve, reject };
|
|
68
123
|
});
|
|
69
124
|
return Object.assign(promise, methods);
|
|
70
125
|
}
|
|
71
126
|
|
|
72
|
-
var __defProp$
|
|
73
|
-
var __defNormalProp$
|
|
74
|
-
var __publicField$
|
|
75
|
-
__defNormalProp$
|
|
127
|
+
var __defProp$c = Object.defineProperty;
|
|
128
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
129
|
+
var __publicField$c = (obj, key, value) => {
|
|
130
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
76
131
|
return value;
|
|
77
132
|
};
|
|
78
133
|
const FLOW_GLOBAL = "FDBG";
|
|
@@ -93,8 +148,8 @@ class Debugger {
|
|
|
93
148
|
*/
|
|
94
149
|
constructor(context) {
|
|
95
150
|
this.context = context;
|
|
96
|
-
__publicField$
|
|
97
|
-
__publicField$
|
|
151
|
+
__publicField$c(this, "spyDisposer");
|
|
152
|
+
__publicField$c(this, "watchDisposers", {});
|
|
98
153
|
}
|
|
99
154
|
/**
|
|
100
155
|
* Install a 'watch' for the specified context state property path.
|
|
@@ -182,7 +237,7 @@ class Debugger {
|
|
|
182
237
|
return Array.from(this.context.maps._maps.keys());
|
|
183
238
|
}
|
|
184
239
|
const mapPromise = this.context.maps.getMap(mapId);
|
|
185
|
-
return mapPromise?.
|
|
240
|
+
return mapPromise?.value;
|
|
186
241
|
}
|
|
187
242
|
/**
|
|
188
243
|
* Get a registered reactive query by ID.
|
|
@@ -192,7 +247,7 @@ class Debugger {
|
|
|
192
247
|
return Array.from(this.context.queries._queries.keys());
|
|
193
248
|
}
|
|
194
249
|
const queryPromise = this.context.queries.getQuery(queryId);
|
|
195
|
-
return queryPromise?.
|
|
250
|
+
return queryPromise?.value;
|
|
196
251
|
}
|
|
197
252
|
spyListener(event) {
|
|
198
253
|
console.log(`%cspy`, CONSOLE_HIGHLIGHT_STYLE, event);
|
|
@@ -210,6 +265,7 @@ function installGlobalDebugger(dbg) {
|
|
|
210
265
|
);
|
|
211
266
|
const g = typeof global !== "undefined" ? global : window;
|
|
212
267
|
g[FLOW_GLOBAL] = g[FLOW_GLOBAL] || {
|
|
268
|
+
context: dbg.context,
|
|
213
269
|
watch: dbg.watch.bind(dbg),
|
|
214
270
|
unwatch: dbg.unwatch.bind(dbg),
|
|
215
271
|
set: dbg.set.bind(dbg),
|
|
@@ -303,16 +359,16 @@ function toJSHelper(source, options, __alreadySeen = null) {
|
|
|
303
359
|
return res;
|
|
304
360
|
}
|
|
305
361
|
|
|
306
|
-
var __defProp$
|
|
307
|
-
var __defNormalProp$
|
|
308
|
-
var __publicField$
|
|
309
|
-
__defNormalProp$
|
|
362
|
+
var __defProp$b = Object.defineProperty;
|
|
363
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
364
|
+
var __publicField$b = (obj, key, value) => {
|
|
365
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
310
366
|
return value;
|
|
311
367
|
};
|
|
312
368
|
const debug$4 = Debug__default("flow:map-registry");
|
|
313
369
|
class MapRegistry {
|
|
314
370
|
constructor() {
|
|
315
|
-
__publicField$
|
|
371
|
+
__publicField$b(this, "_maps", /* @__PURE__ */ new Map());
|
|
316
372
|
}
|
|
317
373
|
/**
|
|
318
374
|
* Register a Flo.w map.
|
|
@@ -354,16 +410,16 @@ class MapRegistry {
|
|
|
354
410
|
}
|
|
355
411
|
}
|
|
356
412
|
|
|
357
|
-
var __defProp$
|
|
358
|
-
var __defNormalProp$
|
|
359
|
-
var __publicField$
|
|
360
|
-
__defNormalProp$
|
|
413
|
+
var __defProp$a = Object.defineProperty;
|
|
414
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
415
|
+
var __publicField$a = (obj, key, value) => {
|
|
416
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
361
417
|
return value;
|
|
362
418
|
};
|
|
363
419
|
const debug$3 = Debug__default("flow:query-registry");
|
|
364
420
|
class QueryRegistry {
|
|
365
421
|
constructor() {
|
|
366
|
-
__publicField$
|
|
422
|
+
__publicField$a(this, "_queries", /* @__PURE__ */ new Map());
|
|
367
423
|
}
|
|
368
424
|
/**
|
|
369
425
|
* Register a Flo.w reactive query.
|
|
@@ -403,10 +459,10 @@ class QueryRegistry {
|
|
|
403
459
|
}
|
|
404
460
|
}
|
|
405
461
|
|
|
406
|
-
var __defProp$
|
|
407
|
-
var __defNormalProp$
|
|
408
|
-
var __publicField$
|
|
409
|
-
__defNormalProp$
|
|
462
|
+
var __defProp$9 = Object.defineProperty;
|
|
463
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
464
|
+
var __publicField$9 = (obj, key, value) => {
|
|
465
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
410
466
|
return value;
|
|
411
467
|
};
|
|
412
468
|
const DEFAULT_FLOW_HOST = "https://flow.emu-analytics.net";
|
|
@@ -423,13 +479,13 @@ const _FlowContext = class _FlowContext {
|
|
|
423
479
|
* @param enableDebug Set to `true` to enable the debugger.
|
|
424
480
|
*/
|
|
425
481
|
constructor(options) {
|
|
426
|
-
__publicField$
|
|
427
|
-
__publicField$
|
|
428
|
-
__publicField$
|
|
429
|
-
__publicField$
|
|
430
|
-
__publicField$
|
|
482
|
+
__publicField$9(this, "_options");
|
|
483
|
+
__publicField$9(this, "flowClient");
|
|
484
|
+
__publicField$9(this, "state");
|
|
485
|
+
__publicField$9(this, "maps", new MapRegistry());
|
|
486
|
+
__publicField$9(this, "queries", new QueryRegistry());
|
|
431
487
|
/** The Flo.w debugger. Available as `window.FDBG` in the browser's web developer console. */
|
|
432
|
-
__publicField$
|
|
488
|
+
__publicField$9(this, "debugger");
|
|
433
489
|
this._options = {
|
|
434
490
|
..._FlowContext._defaultOptions,
|
|
435
491
|
...options
|
|
@@ -453,23 +509,23 @@ const _FlowContext = class _FlowContext {
|
|
|
453
509
|
return expression.value;
|
|
454
510
|
}
|
|
455
511
|
};
|
|
456
|
-
__publicField$
|
|
512
|
+
__publicField$9(_FlowContext, "_defaultOptions", {
|
|
457
513
|
id: DEFAULT_CONTEXT_ID,
|
|
458
514
|
host: DEFAULT_FLOW_HOST,
|
|
459
515
|
enableDebug: false
|
|
460
516
|
});
|
|
461
517
|
let FlowContext = _FlowContext;
|
|
462
518
|
|
|
463
|
-
var __defProp$
|
|
464
|
-
var __defNormalProp$
|
|
465
|
-
var __publicField$
|
|
466
|
-
__defNormalProp$
|
|
519
|
+
var __defProp$8 = Object.defineProperty;
|
|
520
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
521
|
+
var __publicField$8 = (obj, key, value) => {
|
|
522
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
467
523
|
return value;
|
|
468
524
|
};
|
|
469
525
|
const debug$2 = Debug__default("flow:context-registry");
|
|
470
526
|
const _ContextRegistry = class _ContextRegistry {
|
|
471
527
|
constructor() {
|
|
472
|
-
__publicField$
|
|
528
|
+
__publicField$8(this, "_contexts", /* @__PURE__ */ new Map());
|
|
473
529
|
}
|
|
474
530
|
/**
|
|
475
531
|
* Initialize a new Flo.w context.
|
|
@@ -512,16 +568,16 @@ const _ContextRegistry = class _ContextRegistry {
|
|
|
512
568
|
return deferredContext?.deferred;
|
|
513
569
|
}
|
|
514
570
|
};
|
|
515
|
-
__publicField$
|
|
571
|
+
__publicField$8(_ContextRegistry, "_defaultOptions", {
|
|
516
572
|
id: DEFAULT_CONTEXT_ID,
|
|
517
573
|
host: "https://flow.emu-analytics.net"
|
|
518
574
|
});
|
|
519
575
|
let ContextRegistry = _ContextRegistry;
|
|
520
576
|
|
|
521
|
-
var __defProp$
|
|
522
|
-
var __defNormalProp$
|
|
523
|
-
var __publicField$
|
|
524
|
-
__defNormalProp$
|
|
577
|
+
var __defProp$7 = Object.defineProperty;
|
|
578
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
579
|
+
var __publicField$7 = (obj, key, value) => {
|
|
580
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
525
581
|
return value;
|
|
526
582
|
};
|
|
527
583
|
class FlowRdfCoreGlobals {
|
|
@@ -533,8 +589,8 @@ class FlowRdfCoreGlobals {
|
|
|
533
589
|
*
|
|
534
590
|
* N.B: this version is unrelated to the package version.
|
|
535
591
|
*/
|
|
536
|
-
__publicField$
|
|
537
|
-
__publicField$
|
|
592
|
+
__publicField$7(this, "version", 1);
|
|
593
|
+
__publicField$7(this, "globalContextRegistry", new ContextRegistry());
|
|
538
594
|
}
|
|
539
595
|
}
|
|
540
596
|
let canMergeGlobalState = true;
|
|
@@ -582,15 +638,15 @@ function getGlobalState() {
|
|
|
582
638
|
return globalState;
|
|
583
639
|
}
|
|
584
640
|
|
|
585
|
-
var __defProp$
|
|
586
|
-
var __defNormalProp$
|
|
587
|
-
var __publicField$
|
|
588
|
-
__defNormalProp$
|
|
641
|
+
var __defProp$6 = Object.defineProperty;
|
|
642
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
643
|
+
var __publicField$6 = (obj, key, value) => {
|
|
644
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
589
645
|
return value;
|
|
590
646
|
};
|
|
591
647
|
class MapLayerStyleBuilder {
|
|
592
648
|
constructor() {
|
|
593
|
-
__publicField$
|
|
649
|
+
__publicField$6(this, "_styles", /* @__PURE__ */ new Map());
|
|
594
650
|
}
|
|
595
651
|
static registerStyleBuilder(layerType, builder) {
|
|
596
652
|
this._styleBuilders.set(layerType, builder);
|
|
@@ -648,11 +704,11 @@ class MapLayerStyleBuilder {
|
|
|
648
704
|
}
|
|
649
705
|
}
|
|
650
706
|
}
|
|
651
|
-
__publicField$
|
|
707
|
+
__publicField$6(MapLayerStyleBuilder, "_styleBuilders", /* @__PURE__ */ new Map());
|
|
652
708
|
class StyleExpression {
|
|
653
709
|
constructor(_expr) {
|
|
654
710
|
this._expr = _expr;
|
|
655
|
-
__publicField$
|
|
711
|
+
__publicField$6(this, "__styleExpression", "styleexpression");
|
|
656
712
|
}
|
|
657
713
|
toString() {
|
|
658
714
|
return this._expr;
|
|
@@ -1969,19 +2025,19 @@ function layerStyle(layerType) {
|
|
|
1969
2025
|
return MapLayerStyleBuilder.createStyleBuilder(layerType);
|
|
1970
2026
|
}
|
|
1971
2027
|
|
|
1972
|
-
var __defProp$
|
|
1973
|
-
var __defNormalProp$
|
|
1974
|
-
var __publicField$
|
|
1975
|
-
__defNormalProp$
|
|
2028
|
+
var __defProp$5 = Object.defineProperty;
|
|
2029
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2030
|
+
var __publicField$5 = (obj, key, value) => {
|
|
2031
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1976
2032
|
return value;
|
|
1977
2033
|
};
|
|
1978
2034
|
const _MapStyle = class _MapStyle {
|
|
1979
2035
|
constructor() {
|
|
1980
|
-
__publicField$
|
|
1981
|
-
__publicField$
|
|
1982
|
-
__publicField$
|
|
1983
|
-
__publicField$
|
|
1984
|
-
__publicField$
|
|
2036
|
+
__publicField$5(this, "_state", null);
|
|
2037
|
+
__publicField$5(this, "_baseStyle");
|
|
2038
|
+
__publicField$5(this, "_sources", {});
|
|
2039
|
+
__publicField$5(this, "_layers", {});
|
|
2040
|
+
__publicField$5(this, "_layerOrder", []);
|
|
1985
2041
|
this._baseStyle = _MapStyle._defaultBaseStyle;
|
|
1986
2042
|
mobx.makeObservable(
|
|
1987
2043
|
this,
|
|
@@ -2133,7 +2189,7 @@ const _MapStyle = class _MapStyle {
|
|
|
2133
2189
|
return insertionIndex;
|
|
2134
2190
|
}
|
|
2135
2191
|
};
|
|
2136
|
-
__publicField$
|
|
2192
|
+
__publicField$5(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
2137
2193
|
version: 8,
|
|
2138
2194
|
id: "default",
|
|
2139
2195
|
name: "Default base style",
|
|
@@ -2142,18 +2198,18 @@ __publicField$6(_MapStyle, "_defaultBaseStyle", Object.freeze({
|
|
|
2142
2198
|
}));
|
|
2143
2199
|
let MapStyle = _MapStyle;
|
|
2144
2200
|
|
|
2145
|
-
var __defProp$
|
|
2146
|
-
var __defNormalProp$
|
|
2147
|
-
var __publicField$
|
|
2148
|
-
__defNormalProp$
|
|
2201
|
+
var __defProp$4 = Object.defineProperty;
|
|
2202
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2203
|
+
var __publicField$4 = (obj, key, value) => {
|
|
2204
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2149
2205
|
return value;
|
|
2150
2206
|
};
|
|
2151
2207
|
Debug__default("flow:image-registry");
|
|
2152
2208
|
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
2209
|
class ImageRegistry {
|
|
2154
2210
|
constructor() {
|
|
2155
|
-
__publicField$
|
|
2156
|
-
__publicField$
|
|
2211
|
+
__publicField$4(this, "_registry", /* @__PURE__ */ new Map());
|
|
2212
|
+
__publicField$4(this, "_unknownImage", null);
|
|
2157
2213
|
}
|
|
2158
2214
|
get unknownImage() {
|
|
2159
2215
|
if (!this._unknownImage) {
|
|
@@ -2221,10 +2277,10 @@ class ImageRegistry {
|
|
|
2221
2277
|
}
|
|
2222
2278
|
}
|
|
2223
2279
|
|
|
2224
|
-
var __defProp$
|
|
2225
|
-
var __defNormalProp$
|
|
2226
|
-
var __publicField$
|
|
2227
|
-
__defNormalProp$
|
|
2280
|
+
var __defProp$3 = Object.defineProperty;
|
|
2281
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2282
|
+
var __publicField$3 = (obj, key, value) => {
|
|
2283
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2228
2284
|
return value;
|
|
2229
2285
|
};
|
|
2230
2286
|
const debug$1 = Debug__default("flow:map");
|
|
@@ -2232,24 +2288,20 @@ const MOUSE_MOVE_THROTTLE_DURATION = 100;
|
|
|
2232
2288
|
const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
2233
2289
|
constructor(options) {
|
|
2234
2290
|
super();
|
|
2235
|
-
__publicField$
|
|
2236
|
-
__publicField$
|
|
2237
|
-
__publicField$
|
|
2238
|
-
__publicField$
|
|
2239
|
-
__publicField$
|
|
2240
|
-
__publicField$
|
|
2241
|
-
__publicField$
|
|
2242
|
-
__publicField$
|
|
2291
|
+
__publicField$3(this, "_context");
|
|
2292
|
+
__publicField$3(this, "_initialized");
|
|
2293
|
+
__publicField$3(this, "_loading", true);
|
|
2294
|
+
__publicField$3(this, "_debouncedEmitSourceEvent");
|
|
2295
|
+
__publicField$3(this, "_imageRegistry", new ImageRegistry());
|
|
2296
|
+
__publicField$3(this, "_options");
|
|
2297
|
+
__publicField$3(this, "_pluginManager");
|
|
2298
|
+
__publicField$3(this, "_resolveInitialized", () => {
|
|
2243
2299
|
});
|
|
2244
|
-
__publicField$
|
|
2245
|
-
__publicField$
|
|
2246
|
-
__publicField$
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
context: this
|
|
2250
|
-
}));
|
|
2251
|
-
__publicField$4(this, "maplibreMap");
|
|
2252
|
-
__publicField$4(this, "updateMapStyle", (style) => {
|
|
2300
|
+
__publicField$3(this, "_style");
|
|
2301
|
+
__publicField$3(this, "_styleUpdateSubscription", null);
|
|
2302
|
+
__publicField$3(this, "_throttledMouseMove", throttle.throttle(this.handleMouseMove, MOUSE_MOVE_THROTTLE_DURATION, { context: this }));
|
|
2303
|
+
__publicField$3(this, "maplibreMap");
|
|
2304
|
+
__publicField$3(this, "updateMapStyle", (style) => {
|
|
2253
2305
|
const oldStyle = this.maplibreMap.getStyle();
|
|
2254
2306
|
const beforeEvent = new mapFeatureStream.MapStyleChangeEvent("beforeStyleChanged", this, oldStyle, style);
|
|
2255
2307
|
style = this._pluginManager.forwardStyleChangeEvent(
|
|
@@ -2266,8 +2318,7 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2266
2318
|
...options
|
|
2267
2319
|
};
|
|
2268
2320
|
this._style = new MapStyle();
|
|
2269
|
-
this._debouncedEmitSourceEvent =
|
|
2270
|
-
delay: 20,
|
|
2321
|
+
this._debouncedEmitSourceEvent = throttle.debounceWithArgs(this.emitEvent, 20, {
|
|
2271
2322
|
hash: (event) => event.source,
|
|
2272
2323
|
context: this
|
|
2273
2324
|
});
|
|
@@ -2292,6 +2343,14 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2292
2343
|
get styleSpecification() {
|
|
2293
2344
|
return this._style.styleSpecification;
|
|
2294
2345
|
}
|
|
2346
|
+
/**
|
|
2347
|
+
* @internal
|
|
2348
|
+
*
|
|
2349
|
+
* Used by map export to get images added to map.
|
|
2350
|
+
*/
|
|
2351
|
+
get imageRegistry() {
|
|
2352
|
+
return this._imageRegistry;
|
|
2353
|
+
}
|
|
2295
2354
|
addLayer(layerOrOptions) {
|
|
2296
2355
|
const layer = stringUtils.isPlainObject(layerOrOptions) ? new mapFeatureStream.MapLayer(layerOrOptions) : layerOrOptions;
|
|
2297
2356
|
this._style.addLayer(layer);
|
|
@@ -2452,9 +2511,9 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2452
2511
|
}
|
|
2453
2512
|
const options = {
|
|
2454
2513
|
center: lngLat,
|
|
2455
|
-
...center.zoom && { zoom: center.zoom },
|
|
2456
|
-
...center.bearing && { bearing: center.bearing },
|
|
2457
|
-
...center.pitch && { pitch: center.pitch },
|
|
2514
|
+
...stringUtils.isDefined(center.zoom) && { zoom: center.zoom },
|
|
2515
|
+
...stringUtils.isDefined(center.bearing) && { bearing: center.bearing },
|
|
2516
|
+
...stringUtils.isDefined(center.pitch) && { pitch: center.pitch },
|
|
2458
2517
|
...animationOptions
|
|
2459
2518
|
};
|
|
2460
2519
|
method.call(this.maplibreMap, options);
|
|
@@ -2472,6 +2531,17 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2472
2531
|
};
|
|
2473
2532
|
this.maplibreMap.fitBounds(bounds, fitBoundsOptions);
|
|
2474
2533
|
}
|
|
2534
|
+
getVisibleBounds() {
|
|
2535
|
+
const parentEl = this.container.parentElement;
|
|
2536
|
+
if (!parentEl) {
|
|
2537
|
+
return this.getBounds();
|
|
2538
|
+
}
|
|
2539
|
+
const mapRect = parentEl.getBoundingClientRect();
|
|
2540
|
+
const topLeft = this.maplibreMap.unproject([mapRect.x, mapRect.y]);
|
|
2541
|
+
const bottomRight = this.maplibreMap.unproject([mapRect.x + mapRect.width, mapRect.y + mapRect.height]);
|
|
2542
|
+
const bounds = [topLeft.lng, bottomRight.lat, bottomRight.lng, topLeft.lat];
|
|
2543
|
+
return bounds;
|
|
2544
|
+
}
|
|
2475
2545
|
/**
|
|
2476
2546
|
* Programmatically set feature state properties for a map feature.
|
|
2477
2547
|
*
|
|
@@ -2646,23 +2716,23 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2646
2716
|
return requestParameters;
|
|
2647
2717
|
}
|
|
2648
2718
|
};
|
|
2649
|
-
__publicField$
|
|
2719
|
+
__publicField$3(_FlowMap, "_defaultOptions", {
|
|
2650
2720
|
boxZoom: false,
|
|
2651
2721
|
doubleClickZoom: false,
|
|
2652
2722
|
featureClickTolerance: 0
|
|
2653
2723
|
});
|
|
2654
2724
|
let FlowMap = _FlowMap;
|
|
2655
2725
|
|
|
2656
|
-
var __defProp$
|
|
2657
|
-
var __defNormalProp$
|
|
2658
|
-
var __publicField$
|
|
2659
|
-
__defNormalProp$
|
|
2726
|
+
var __defProp$2 = Object.defineProperty;
|
|
2727
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2728
|
+
var __publicField$2 = (obj, key, value) => {
|
|
2729
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2660
2730
|
return value;
|
|
2661
2731
|
};
|
|
2662
2732
|
class AsyncCommitter {
|
|
2663
2733
|
constructor() {
|
|
2664
|
-
__publicField$
|
|
2665
|
-
__publicField$
|
|
2734
|
+
__publicField$2(this, "_requestId", 0);
|
|
2735
|
+
__publicField$2(this, "_commitId", 0);
|
|
2666
2736
|
}
|
|
2667
2737
|
async resolve(promise) {
|
|
2668
2738
|
this._requestId += 1;
|
|
@@ -2682,10 +2752,10 @@ class AsyncCommitter {
|
|
|
2682
2752
|
}
|
|
2683
2753
|
}
|
|
2684
2754
|
|
|
2685
|
-
var __defProp$
|
|
2686
|
-
var __defNormalProp$
|
|
2687
|
-
var __publicField$
|
|
2688
|
-
__defNormalProp$
|
|
2755
|
+
var __defProp$1 = Object.defineProperty;
|
|
2756
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2757
|
+
var __publicField$1 = (obj, key, value) => {
|
|
2758
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2689
2759
|
return value;
|
|
2690
2760
|
};
|
|
2691
2761
|
const debug = Debug__default("flow:query");
|
|
@@ -2693,13 +2763,13 @@ const DEFAULT_DELAY = 100;
|
|
|
2693
2763
|
const _Query = class _Query {
|
|
2694
2764
|
constructor(queryFn, transformFn, options) {
|
|
2695
2765
|
this.queryFn = queryFn;
|
|
2696
|
-
__publicField$
|
|
2697
|
-
__publicField$
|
|
2698
|
-
__publicField$
|
|
2699
|
-
__publicField$
|
|
2700
|
-
__publicField$
|
|
2701
|
-
__publicField$
|
|
2702
|
-
__publicField$
|
|
2766
|
+
__publicField$1(this, "_options");
|
|
2767
|
+
__publicField$1(this, "_committer", new AsyncCommitter());
|
|
2768
|
+
__publicField$1(this, "_disposer", null);
|
|
2769
|
+
__publicField$1(this, "_transformFn", (results) => results);
|
|
2770
|
+
__publicField$1(this, "results", null);
|
|
2771
|
+
__publicField$1(this, "busy", false);
|
|
2772
|
+
__publicField$1(this, "error", null);
|
|
2703
2773
|
this._options = {
|
|
2704
2774
|
..._Query._defaultOptions,
|
|
2705
2775
|
...options
|
|
@@ -2810,7 +2880,7 @@ const _Query = class _Query {
|
|
|
2810
2880
|
}
|
|
2811
2881
|
}
|
|
2812
2882
|
};
|
|
2813
|
-
__publicField$
|
|
2883
|
+
__publicField$1(_Query, "_defaultOptions", {
|
|
2814
2884
|
fireImmediately: true,
|
|
2815
2885
|
delay: DEFAULT_DELAY
|
|
2816
2886
|
});
|
|
@@ -2896,67 +2966,59 @@ function hasProp(target, prop) {
|
|
|
2896
2966
|
|
|
2897
2967
|
const SYNC_ANNOTATION_TYPE = "state-sync-annotation";
|
|
2898
2968
|
const REACTIVE_ANNOTATION_TYPE = "state-reactive-annotation";
|
|
2899
|
-
const
|
|
2969
|
+
const serializeRaw = {
|
|
2900
2970
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2901
2971
|
serialize(val) {
|
|
2902
|
-
return
|
|
2972
|
+
return mobx.toJS(val);
|
|
2903
2973
|
},
|
|
2904
2974
|
deserialize(val) {
|
|
2905
|
-
return val
|
|
2975
|
+
return val;
|
|
2906
2976
|
}
|
|
2907
2977
|
};
|
|
2908
|
-
const
|
|
2978
|
+
const serializeString = {
|
|
2909
2979
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2910
2980
|
serialize(val) {
|
|
2911
2981
|
return val.toString();
|
|
2912
2982
|
},
|
|
2913
2983
|
deserialize(val) {
|
|
2914
|
-
return
|
|
2984
|
+
return val;
|
|
2915
2985
|
}
|
|
2916
2986
|
};
|
|
2917
|
-
const
|
|
2987
|
+
const serializeNumber = {
|
|
2918
2988
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2919
2989
|
serialize(val) {
|
|
2920
|
-
return val.
|
|
2990
|
+
return val.toString();
|
|
2921
2991
|
},
|
|
2922
2992
|
deserialize(val) {
|
|
2923
|
-
return val
|
|
2993
|
+
return +val;
|
|
2924
2994
|
}
|
|
2925
2995
|
};
|
|
2926
|
-
const
|
|
2996
|
+
const serializeJson = {
|
|
2927
2997
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2928
2998
|
serialize(val) {
|
|
2929
|
-
return
|
|
2999
|
+
return JSON.stringify(val);
|
|
2930
3000
|
},
|
|
2931
3001
|
deserialize(val) {
|
|
2932
|
-
return
|
|
3002
|
+
return JSON.parse(val);
|
|
2933
3003
|
}
|
|
2934
3004
|
};
|
|
2935
3005
|
const serializeState = {
|
|
2936
3006
|
annotationType: SYNC_ANNOTATION_TYPE,
|
|
2937
3007
|
serialize(val) {
|
|
2938
|
-
|
|
2939
|
-
const entries = Object.entries(props).map((entry) => `${entry[0]}=${entry[1]}`);
|
|
2940
|
-
return entries.join(",");
|
|
3008
|
+
return val.serialize();
|
|
2941
3009
|
},
|
|
2942
3010
|
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);
|
|
3011
|
+
target.deserialize(val);
|
|
2950
3012
|
return target;
|
|
2951
3013
|
}
|
|
2952
3014
|
};
|
|
2953
|
-
const serialize = {
|
|
3015
|
+
const serialize = Object.assign(createDecoratorAnnotation(serializeRaw), {
|
|
3016
|
+
raw: createDecoratorAnnotation(serializeRaw),
|
|
2954
3017
|
string: createDecoratorAnnotation(serializeString),
|
|
2955
3018
|
number: createDecoratorAnnotation(serializeNumber),
|
|
2956
|
-
|
|
2957
|
-
numberArray: createDecoratorAnnotation(serializeNumberArray),
|
|
3019
|
+
json: createDecoratorAnnotation(serializeJson),
|
|
2958
3020
|
state: createDecoratorAnnotation(serializeState)
|
|
2959
|
-
};
|
|
3021
|
+
});
|
|
2960
3022
|
function createReactiveAnnotation(mobxAnnotation) {
|
|
2961
3023
|
return createDecoratorAnnotation({
|
|
2962
3024
|
annotationType: REACTIVE_ANNOTATION_TYPE,
|
|
@@ -2964,45 +3026,15 @@ function createReactiveAnnotation(mobxAnnotation) {
|
|
|
2964
3026
|
});
|
|
2965
3027
|
}
|
|
2966
3028
|
const observable = Object.assign(createReactiveAnnotation(mobx__namespace.observable), {
|
|
3029
|
+
deep: createReactiveAnnotation(mobx__namespace.observable.deep),
|
|
2967
3030
|
ref: createReactiveAnnotation(mobx__namespace.observable.ref),
|
|
2968
|
-
struct: createReactiveAnnotation(mobx__namespace.observable.
|
|
3031
|
+
struct: createReactiveAnnotation(mobx__namespace.observable.struct),
|
|
2969
3032
|
shallow: createReactiveAnnotation(mobx__namespace.observable.shallow)
|
|
2970
3033
|
});
|
|
2971
3034
|
const computed = Object.assign(createReactiveAnnotation(mobx__namespace.computed), {
|
|
2972
3035
|
struct: createReactiveAnnotation(mobx__namespace.computed.struct)
|
|
2973
3036
|
});
|
|
2974
3037
|
|
|
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
3038
|
var __defProp = Object.defineProperty;
|
|
3007
3039
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3008
3040
|
var __publicField = (obj, key, value) => {
|
|
@@ -3014,7 +3046,6 @@ const StateStorCache = Symbol("FlowCoreStateStorCache");
|
|
|
3014
3046
|
class StateStore {
|
|
3015
3047
|
constructor() {
|
|
3016
3048
|
__publicField(this, "serializationAnnotations", {});
|
|
3017
|
-
__publicField(this, "serializer", new UrlSerializer(this));
|
|
3018
3049
|
__publicField(this, "id");
|
|
3019
3050
|
this.id = mapFeatureStream.randomId("state");
|
|
3020
3051
|
}
|
|
@@ -3132,7 +3163,7 @@ class StateStore {
|
|
|
3132
3163
|
if (!annotations) {
|
|
3133
3164
|
annotations = {};
|
|
3134
3165
|
let current = target;
|
|
3135
|
-
while (current && !
|
|
3166
|
+
while (current && !Object.prototype.hasOwnProperty.call(current, StateStoreMarker)) {
|
|
3136
3167
|
Reflect.ownKeys(current).forEach((k) => {
|
|
3137
3168
|
annotations[k] = !overrides ? true : k in overrides ? overrides[k] : true;
|
|
3138
3169
|
});
|
|
@@ -3152,33 +3183,48 @@ class StateStore {
|
|
|
3152
3183
|
};
|
|
3153
3184
|
return mobx__namespace.makeObservable(target, annotations, { name: this.formattedName });
|
|
3154
3185
|
}
|
|
3155
|
-
serialize() {
|
|
3186
|
+
serialize(format = "raw") {
|
|
3156
3187
|
const annotations = this.serializationAnnotations;
|
|
3157
3188
|
const serializedProps = Object.keys(annotations).reduce((accum, prop) => {
|
|
3158
|
-
|
|
3189
|
+
const val = this[prop];
|
|
3190
|
+
if (stringUtils.isDefined(val)) {
|
|
3191
|
+
const serializedValue = annotations[prop].serialize(val);
|
|
3192
|
+
accum[prop] = serializedValue;
|
|
3193
|
+
}
|
|
3159
3194
|
return accum;
|
|
3160
3195
|
}, {});
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3196
|
+
switch (format) {
|
|
3197
|
+
case "json":
|
|
3198
|
+
return JSON.stringify(serializedProps);
|
|
3199
|
+
case "lz":
|
|
3200
|
+
return lzString.compressToEncodedURIComponent(JSON.stringify(serializedProps));
|
|
3201
|
+
default:
|
|
3202
|
+
return serializedProps;
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
deserialize(value, format = "raw") {
|
|
3206
|
+
let deserializedValue;
|
|
3207
|
+
switch (format) {
|
|
3208
|
+
case "json":
|
|
3209
|
+
deserializedValue = JSON.parse(value);
|
|
3210
|
+
break;
|
|
3211
|
+
case "lz":
|
|
3212
|
+
deserializedValue = JSON.parse(lzString.decompressFromEncodedURIComponent(value));
|
|
3213
|
+
break;
|
|
3214
|
+
default:
|
|
3215
|
+
deserializedValue = value;
|
|
3216
|
+
break;
|
|
3217
|
+
}
|
|
3164
3218
|
this.transaction(() => {
|
|
3165
3219
|
const annotations = this.serializationAnnotations;
|
|
3166
|
-
Object.keys(
|
|
3220
|
+
Object.keys(deserializedValue).forEach((prop) => {
|
|
3167
3221
|
const annotation = annotations[prop];
|
|
3168
3222
|
if (annotation) {
|
|
3169
|
-
this[prop] = annotation.deserialize(
|
|
3223
|
+
this[prop] = annotation.deserialize(deserializedValue[prop], this[prop]);
|
|
3170
3224
|
}
|
|
3171
3225
|
});
|
|
3172
3226
|
});
|
|
3173
3227
|
}
|
|
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
3228
|
checkInitialized() {
|
|
3183
3229
|
if (!this.initialized) {
|
|
3184
3230
|
throw new mapFeatureStream.FlowError(
|