@emuanalytics/flow-rdf-core 4.0.0-preview.3 → 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 +61 -12
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +63 -14
- package/dist/lib/map/plugins/index.d.cts +4 -4
- package/dist/lib/map/plugins/index.d.mts +4 -4
- package/dist/lib/map/plugins/index.d.ts +4 -4
- package/dist/lib/map/plugins/index.mjs +3 -3
- 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.2f79285b.d.cts → flow-rdf-core.769a4928.d.cts} +1 -1
- package/dist/shared/{flow-rdf-core.2f79285b.d.mts → flow-rdf-core.769a4928.d.mts} +1 -1
- package/dist/shared/{flow-rdf-core.2f79285b.d.ts → flow-rdf-core.769a4928.d.ts} +1 -1
- package/dist/shared/flow-rdf-core.ea06a1d3.mjs +144 -0
- package/package.json +10 -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,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
|
-
const
|
|
11
|
+
const throttle = require('./shared/flow-rdf-core.1f72b20b.cjs');
|
|
12
12
|
const lzString = require('lz-string');
|
|
13
13
|
require('@emuanalytics/maplibre-gl-style-spec');
|
|
14
14
|
require('parsimmon');
|
|
@@ -34,7 +34,7 @@ const Debug__default = /*#__PURE__*/_interopDefaultCompat(Debug);
|
|
|
34
34
|
const maplibre__default = /*#__PURE__*/_interopDefaultCompat(maplibre);
|
|
35
35
|
const EventEmitter__default = /*#__PURE__*/_interopDefaultCompat(EventEmitter);
|
|
36
36
|
|
|
37
|
-
const version = "4.0.0-preview.
|
|
37
|
+
const version = "4.0.0-preview.4";
|
|
38
38
|
|
|
39
39
|
const CONSOLE_HIGHLIGHT_STYLE$1 = `
|
|
40
40
|
padding: 2px 4px;
|
|
@@ -62,9 +62,63 @@ function getGlobal() {
|
|
|
62
62
|
return mockGlobal;
|
|
63
63
|
}
|
|
64
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
|
+
|
|
65
119
|
function deferred() {
|
|
66
120
|
let methods;
|
|
67
|
-
const promise = new
|
|
121
|
+
const promise = new WatchablePromise((resolve, reject) => {
|
|
68
122
|
methods = { resolve, reject };
|
|
69
123
|
});
|
|
70
124
|
return Object.assign(promise, methods);
|
|
@@ -183,7 +237,7 @@ class Debugger {
|
|
|
183
237
|
return Array.from(this.context.maps._maps.keys());
|
|
184
238
|
}
|
|
185
239
|
const mapPromise = this.context.maps.getMap(mapId);
|
|
186
|
-
return mapPromise?.
|
|
240
|
+
return mapPromise?.value;
|
|
187
241
|
}
|
|
188
242
|
/**
|
|
189
243
|
* Get a registered reactive query by ID.
|
|
@@ -193,7 +247,7 @@ class Debugger {
|
|
|
193
247
|
return Array.from(this.context.queries._queries.keys());
|
|
194
248
|
}
|
|
195
249
|
const queryPromise = this.context.queries.getQuery(queryId);
|
|
196
|
-
return queryPromise?.
|
|
250
|
+
return queryPromise?.value;
|
|
197
251
|
}
|
|
198
252
|
spyListener(event) {
|
|
199
253
|
console.log(`%cspy`, CONSOLE_HIGHLIGHT_STYLE, event);
|
|
@@ -2245,11 +2299,7 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2245
2299
|
});
|
|
2246
2300
|
__publicField$3(this, "_style");
|
|
2247
2301
|
__publicField$3(this, "_styleUpdateSubscription", null);
|
|
2248
|
-
__publicField$3(this, "_throttledMouseMove",
|
|
2249
|
-
delay: MOUSE_MOVE_THROTTLE_DURATION,
|
|
2250
|
-
noLeading: true,
|
|
2251
|
-
context: this
|
|
2252
|
-
}));
|
|
2302
|
+
__publicField$3(this, "_throttledMouseMove", throttle.throttle(this.handleMouseMove, MOUSE_MOVE_THROTTLE_DURATION, { context: this }));
|
|
2253
2303
|
__publicField$3(this, "maplibreMap");
|
|
2254
2304
|
__publicField$3(this, "updateMapStyle", (style) => {
|
|
2255
2305
|
const oldStyle = this.maplibreMap.getStyle();
|
|
@@ -2268,8 +2318,7 @@ const _FlowMap = class _FlowMap extends EventEmitter__default {
|
|
|
2268
2318
|
...options
|
|
2269
2319
|
};
|
|
2270
2320
|
this._style = new MapStyle();
|
|
2271
|
-
this._debouncedEmitSourceEvent =
|
|
2272
|
-
delay: 20,
|
|
2321
|
+
this._debouncedEmitSourceEvent = throttle.debounceWithArgs(this.emitEvent, 20, {
|
|
2273
2322
|
hash: (event) => event.source,
|
|
2274
2323
|
context: this
|
|
2275
2324
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Annotation, S as StateStore, F as FlowContextOptions, a as FlowContext, M as MapStyleSpecification, b as MapDataSource, c as MapLayer } from './shared/flow-rdf-core.
|
|
2
|
-
export { D as DEFAULT_CONTEXT_ID, d as FlowEngineEndpoint, y as FlowMap, r as MapAnimationOptions, s as MapCenterOptions, o as MapDataSourceOptions, p as MapDataSourceSpecification, n as MapDataSourceType, t as MapFeature, u as MapFeatureIdentifier, q as MapGeojsonData, j as MapLayerExpression, i as MapLayerOptions, m as MapLayerPropertyMetadataIndex, k as MapLayerSpecification, f as MapLayerStyleBuilder, e as MapLayerType, x as MapOptions, v as MapPaddingOptions, w as MapSourceIdentifier, U as Path, V as PathValue, Q as Query, G as QueryAttribute, L as QueryDefinition, O as QueryDefinitionFn, I as QueryExtraParams, N as QueryOptions, J as QueryOrderClause, E as QueryResultFormat, P as QueryResultTransformFn, K as QuerySampleOptions, H as QueryWhereClauses, R as ReactiveExpression, Y as SerializationFormat, X as StoreAnnotations, W as StoreConstructor, g as StyleExpression, h as expr, l as layerStyle, z as query, B as queryMany, C as queryOne, T as traceReaction } from './shared/flow-rdf-core.
|
|
1
|
+
import { A as Annotation, S as StateStore, F as FlowContextOptions, a as FlowContext, M as MapStyleSpecification, b as MapDataSource, c as MapLayer } from './shared/flow-rdf-core.769a4928.cjs';
|
|
2
|
+
export { D as DEFAULT_CONTEXT_ID, d as FlowEngineEndpoint, y as FlowMap, r as MapAnimationOptions, s as MapCenterOptions, o as MapDataSourceOptions, p as MapDataSourceSpecification, n as MapDataSourceType, t as MapFeature, u as MapFeatureIdentifier, q as MapGeojsonData, j as MapLayerExpression, i as MapLayerOptions, m as MapLayerPropertyMetadataIndex, k as MapLayerSpecification, f as MapLayerStyleBuilder, e as MapLayerType, x as MapOptions, v as MapPaddingOptions, w as MapSourceIdentifier, U as Path, V as PathValue, Q as Query, G as QueryAttribute, L as QueryDefinition, O as QueryDefinitionFn, I as QueryExtraParams, N as QueryOptions, J as QueryOrderClause, E as QueryResultFormat, P as QueryResultTransformFn, K as QuerySampleOptions, H as QueryWhereClauses, R as ReactiveExpression, Y as SerializationFormat, X as StoreAnnotations, W as StoreConstructor, g as StyleExpression, h as expr, l as layerStyle, z as query, B as queryMany, C as queryOne, T as traceReaction } from './shared/flow-rdf-core.769a4928.cjs';
|
|
3
3
|
export { IDisposer, IObservableStream, ISubscription } from 'mobx-utils';
|
|
4
4
|
export { makeAutoObservable, makeObservable } from 'mobx';
|
|
5
5
|
import '@emuanalytics/flow-engine-client';
|
|
@@ -87,4 +87,4 @@ declare const initializeContext: <TState extends StateStore = StateStore>(option
|
|
|
87
87
|
declare const uninitializeContext: (contextId?: string) => void;
|
|
88
88
|
declare const getContext: <TState extends StateStore = StateStore>(id?: string) => Promise<FlowContext<TState>>;
|
|
89
89
|
|
|
90
|
-
export { ContextRegistry, FlowContext, FlowContextOptions, FlowRdfCoreGlobals, MapDataSource, MapLayer, MapStyle, MapStyleOptions, MapStyleSpecification, StateStore, computed, getContext, getGlobalState, initializeContext, isolateGlobalState, observable, serialize, uninitializeContext };
|
|
90
|
+
export { ContextRegistry, FlowContext, FlowContextOptions, FlowRdfCoreGlobals, MapDataSource, MapLayer, MapStyle, type MapStyleOptions, MapStyleSpecification, StateStore, computed, getContext, getGlobalState, initializeContext, isolateGlobalState, observable, serialize, uninitializeContext };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Annotation, S as StateStore, F as FlowContextOptions, a as FlowContext, M as MapStyleSpecification, b as MapDataSource, c as MapLayer } from './shared/flow-rdf-core.
|
|
2
|
-
export { D as DEFAULT_CONTEXT_ID, d as FlowEngineEndpoint, y as FlowMap, r as MapAnimationOptions, s as MapCenterOptions, o as MapDataSourceOptions, p as MapDataSourceSpecification, n as MapDataSourceType, t as MapFeature, u as MapFeatureIdentifier, q as MapGeojsonData, j as MapLayerExpression, i as MapLayerOptions, m as MapLayerPropertyMetadataIndex, k as MapLayerSpecification, f as MapLayerStyleBuilder, e as MapLayerType, x as MapOptions, v as MapPaddingOptions, w as MapSourceIdentifier, U as Path, V as PathValue, Q as Query, G as QueryAttribute, L as QueryDefinition, O as QueryDefinitionFn, I as QueryExtraParams, N as QueryOptions, J as QueryOrderClause, E as QueryResultFormat, P as QueryResultTransformFn, K as QuerySampleOptions, H as QueryWhereClauses, R as ReactiveExpression, Y as SerializationFormat, X as StoreAnnotations, W as StoreConstructor, g as StyleExpression, h as expr, l as layerStyle, z as query, B as queryMany, C as queryOne, T as traceReaction } from './shared/flow-rdf-core.
|
|
1
|
+
import { A as Annotation, S as StateStore, F as FlowContextOptions, a as FlowContext, M as MapStyleSpecification, b as MapDataSource, c as MapLayer } from './shared/flow-rdf-core.769a4928.mjs';
|
|
2
|
+
export { D as DEFAULT_CONTEXT_ID, d as FlowEngineEndpoint, y as FlowMap, r as MapAnimationOptions, s as MapCenterOptions, o as MapDataSourceOptions, p as MapDataSourceSpecification, n as MapDataSourceType, t as MapFeature, u as MapFeatureIdentifier, q as MapGeojsonData, j as MapLayerExpression, i as MapLayerOptions, m as MapLayerPropertyMetadataIndex, k as MapLayerSpecification, f as MapLayerStyleBuilder, e as MapLayerType, x as MapOptions, v as MapPaddingOptions, w as MapSourceIdentifier, U as Path, V as PathValue, Q as Query, G as QueryAttribute, L as QueryDefinition, O as QueryDefinitionFn, I as QueryExtraParams, N as QueryOptions, J as QueryOrderClause, E as QueryResultFormat, P as QueryResultTransformFn, K as QuerySampleOptions, H as QueryWhereClauses, R as ReactiveExpression, Y as SerializationFormat, X as StoreAnnotations, W as StoreConstructor, g as StyleExpression, h as expr, l as layerStyle, z as query, B as queryMany, C as queryOne, T as traceReaction } from './shared/flow-rdf-core.769a4928.mjs';
|
|
3
3
|
export { IDisposer, IObservableStream, ISubscription } from 'mobx-utils';
|
|
4
4
|
export { makeAutoObservable, makeObservable } from 'mobx';
|
|
5
5
|
import '@emuanalytics/flow-engine-client';
|
|
@@ -87,4 +87,4 @@ declare const initializeContext: <TState extends StateStore = StateStore>(option
|
|
|
87
87
|
declare const uninitializeContext: (contextId?: string) => void;
|
|
88
88
|
declare const getContext: <TState extends StateStore = StateStore>(id?: string) => Promise<FlowContext<TState>>;
|
|
89
89
|
|
|
90
|
-
export { ContextRegistry, FlowContext, FlowContextOptions, FlowRdfCoreGlobals, MapDataSource, MapLayer, MapStyle, MapStyleOptions, MapStyleSpecification, StateStore, computed, getContext, getGlobalState, initializeContext, isolateGlobalState, observable, serialize, uninitializeContext };
|
|
90
|
+
export { ContextRegistry, FlowContext, FlowContextOptions, FlowRdfCoreGlobals, MapDataSource, MapLayer, MapStyle, type MapStyleOptions, MapStyleSpecification, StateStore, computed, getContext, getGlobalState, initializeContext, isolateGlobalState, observable, serialize, uninitializeContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Annotation, S as StateStore, F as FlowContextOptions, a as FlowContext, M as MapStyleSpecification, b as MapDataSource, c as MapLayer } from './shared/flow-rdf-core.
|
|
2
|
-
export { D as DEFAULT_CONTEXT_ID, d as FlowEngineEndpoint, y as FlowMap, r as MapAnimationOptions, s as MapCenterOptions, o as MapDataSourceOptions, p as MapDataSourceSpecification, n as MapDataSourceType, t as MapFeature, u as MapFeatureIdentifier, q as MapGeojsonData, j as MapLayerExpression, i as MapLayerOptions, m as MapLayerPropertyMetadataIndex, k as MapLayerSpecification, f as MapLayerStyleBuilder, e as MapLayerType, x as MapOptions, v as MapPaddingOptions, w as MapSourceIdentifier, U as Path, V as PathValue, Q as Query, G as QueryAttribute, L as QueryDefinition, O as QueryDefinitionFn, I as QueryExtraParams, N as QueryOptions, J as QueryOrderClause, E as QueryResultFormat, P as QueryResultTransformFn, K as QuerySampleOptions, H as QueryWhereClauses, R as ReactiveExpression, Y as SerializationFormat, X as StoreAnnotations, W as StoreConstructor, g as StyleExpression, h as expr, l as layerStyle, z as query, B as queryMany, C as queryOne, T as traceReaction } from './shared/flow-rdf-core.
|
|
1
|
+
import { A as Annotation, S as StateStore, F as FlowContextOptions, a as FlowContext, M as MapStyleSpecification, b as MapDataSource, c as MapLayer } from './shared/flow-rdf-core.769a4928.js';
|
|
2
|
+
export { D as DEFAULT_CONTEXT_ID, d as FlowEngineEndpoint, y as FlowMap, r as MapAnimationOptions, s as MapCenterOptions, o as MapDataSourceOptions, p as MapDataSourceSpecification, n as MapDataSourceType, t as MapFeature, u as MapFeatureIdentifier, q as MapGeojsonData, j as MapLayerExpression, i as MapLayerOptions, m as MapLayerPropertyMetadataIndex, k as MapLayerSpecification, f as MapLayerStyleBuilder, e as MapLayerType, x as MapOptions, v as MapPaddingOptions, w as MapSourceIdentifier, U as Path, V as PathValue, Q as Query, G as QueryAttribute, L as QueryDefinition, O as QueryDefinitionFn, I as QueryExtraParams, N as QueryOptions, J as QueryOrderClause, E as QueryResultFormat, P as QueryResultTransformFn, K as QuerySampleOptions, H as QueryWhereClauses, R as ReactiveExpression, Y as SerializationFormat, X as StoreAnnotations, W as StoreConstructor, g as StyleExpression, h as expr, l as layerStyle, z as query, B as queryMany, C as queryOne, T as traceReaction } from './shared/flow-rdf-core.769a4928.js';
|
|
3
3
|
export { IDisposer, IObservableStream, ISubscription } from 'mobx-utils';
|
|
4
4
|
export { makeAutoObservable, makeObservable } from 'mobx';
|
|
5
5
|
import '@emuanalytics/flow-engine-client';
|
|
@@ -87,4 +87,4 @@ declare const initializeContext: <TState extends StateStore = StateStore>(option
|
|
|
87
87
|
declare const uninitializeContext: (contextId?: string) => void;
|
|
88
88
|
declare const getContext: <TState extends StateStore = StateStore>(id?: string) => Promise<FlowContext<TState>>;
|
|
89
89
|
|
|
90
|
-
export { ContextRegistry, FlowContext, FlowContextOptions, FlowRdfCoreGlobals, MapDataSource, MapLayer, MapStyle, MapStyleOptions, MapStyleSpecification, StateStore, computed, getContext, getGlobalState, initializeContext, isolateGlobalState, observable, serialize, uninitializeContext };
|
|
90
|
+
export { ContextRegistry, FlowContext, FlowContextOptions, FlowRdfCoreGlobals, MapDataSource, MapLayer, MapStyle, type MapStyleOptions, MapStyleSpecification, StateStore, computed, getContext, getGlobalState, initializeContext, isolateGlobalState, observable, serialize, uninitializeContext };
|
package/dist/index.mjs
CHANGED
|
@@ -8,14 +8,14 @@ import { R as ReactiveExpression, F as FlowError, f as MapStyleChangeEvent, r as
|
|
|
8
8
|
import maplibre from '@emuanalytics/maplibre-gl';
|
|
9
9
|
import EventEmitter from 'eventemitter3';
|
|
10
10
|
import { toStream } from 'mobx-utils';
|
|
11
|
-
import { t as throttle, a as debounceWithArgs } from './shared/flow-rdf-core.
|
|
11
|
+
import { t as throttle, a as debounceWithArgs } from './shared/flow-rdf-core.ea06a1d3.mjs';
|
|
12
12
|
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string';
|
|
13
|
-
import '@emuanalytics/maplibre-gl-style-spec';
|
|
13
|
+
// import '@emuanalytics/maplibre-gl-style-spec';
|
|
14
14
|
import 'parsimmon';
|
|
15
15
|
import 'colorbrewer';
|
|
16
|
-
import 'nanoid';
|
|
16
|
+
// import 'nanoid';
|
|
17
17
|
|
|
18
|
-
const version = "4.0.0-preview.
|
|
18
|
+
const version = "4.0.0-preview.4";
|
|
19
19
|
|
|
20
20
|
const CONSOLE_HIGHLIGHT_STYLE$1 = `
|
|
21
21
|
padding: 2px 4px;
|
|
@@ -43,9 +43,63 @@ function getGlobal() {
|
|
|
43
43
|
return mockGlobal;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
var __accessCheck = (obj, member, msg) => {
|
|
47
|
+
if (!member.has(obj))
|
|
48
|
+
throw TypeError("Cannot " + msg);
|
|
49
|
+
};
|
|
50
|
+
var __privateGet = (obj, member, getter) => {
|
|
51
|
+
__accessCheck(obj, member, "read from private field");
|
|
52
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
53
|
+
};
|
|
54
|
+
var __privateAdd = (obj, member, value) => {
|
|
55
|
+
if (member.has(obj))
|
|
56
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
57
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
58
|
+
};
|
|
59
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
60
|
+
__accessCheck(obj, member, "write to private field");
|
|
61
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
62
|
+
return value;
|
|
63
|
+
};
|
|
64
|
+
var _value, _settled, _status;
|
|
65
|
+
class WatchablePromise extends Promise {
|
|
66
|
+
constructor(executor) {
|
|
67
|
+
super((resolve, reject) => {
|
|
68
|
+
executor(
|
|
69
|
+
(value) => {
|
|
70
|
+
resolve(value);
|
|
71
|
+
__privateSet(this, _value, value);
|
|
72
|
+
__privateSet(this, _settled, true);
|
|
73
|
+
__privateSet(this, _status, "fulfilled");
|
|
74
|
+
},
|
|
75
|
+
(reason) => {
|
|
76
|
+
reject(reason);
|
|
77
|
+
__privateSet(this, _settled, true);
|
|
78
|
+
__privateSet(this, _status, "rejected");
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
__privateAdd(this, _value, void 0);
|
|
83
|
+
__privateAdd(this, _settled, false);
|
|
84
|
+
__privateAdd(this, _status, "pending");
|
|
85
|
+
}
|
|
86
|
+
get settled() {
|
|
87
|
+
return __privateGet(this, _settled);
|
|
88
|
+
}
|
|
89
|
+
get status() {
|
|
90
|
+
return __privateGet(this, _status);
|
|
91
|
+
}
|
|
92
|
+
get value() {
|
|
93
|
+
return __privateGet(this, _value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
_value = new WeakMap();
|
|
97
|
+
_settled = new WeakMap();
|
|
98
|
+
_status = new WeakMap();
|
|
99
|
+
|
|
46
100
|
function deferred() {
|
|
47
101
|
let methods;
|
|
48
|
-
const promise = new
|
|
102
|
+
const promise = new WatchablePromise((resolve, reject) => {
|
|
49
103
|
methods = { resolve, reject };
|
|
50
104
|
});
|
|
51
105
|
return Object.assign(promise, methods);
|
|
@@ -164,7 +218,7 @@ class Debugger {
|
|
|
164
218
|
return Array.from(this.context.maps._maps.keys());
|
|
165
219
|
}
|
|
166
220
|
const mapPromise = this.context.maps.getMap(mapId);
|
|
167
|
-
return mapPromise?.
|
|
221
|
+
return mapPromise?.value;
|
|
168
222
|
}
|
|
169
223
|
/**
|
|
170
224
|
* Get a registered reactive query by ID.
|
|
@@ -174,7 +228,7 @@ class Debugger {
|
|
|
174
228
|
return Array.from(this.context.queries._queries.keys());
|
|
175
229
|
}
|
|
176
230
|
const queryPromise = this.context.queries.getQuery(queryId);
|
|
177
|
-
return queryPromise?.
|
|
231
|
+
return queryPromise?.value;
|
|
178
232
|
}
|
|
179
233
|
spyListener(event) {
|
|
180
234
|
console.log(`%cspy`, CONSOLE_HIGHLIGHT_STYLE, event);
|
|
@@ -2226,11 +2280,7 @@ const _FlowMap = class _FlowMap extends EventEmitter {
|
|
|
2226
2280
|
});
|
|
2227
2281
|
__publicField$3(this, "_style");
|
|
2228
2282
|
__publicField$3(this, "_styleUpdateSubscription", null);
|
|
2229
|
-
__publicField$3(this, "_throttledMouseMove", throttle(this.handleMouseMove, {
|
|
2230
|
-
delay: MOUSE_MOVE_THROTTLE_DURATION,
|
|
2231
|
-
noLeading: true,
|
|
2232
|
-
context: this
|
|
2233
|
-
}));
|
|
2283
|
+
__publicField$3(this, "_throttledMouseMove", throttle(this.handleMouseMove, MOUSE_MOVE_THROTTLE_DURATION, { context: this }));
|
|
2234
2284
|
__publicField$3(this, "maplibreMap");
|
|
2235
2285
|
__publicField$3(this, "updateMapStyle", (style) => {
|
|
2236
2286
|
const oldStyle = this.maplibreMap.getStyle();
|
|
@@ -2249,8 +2299,7 @@ const _FlowMap = class _FlowMap extends EventEmitter {
|
|
|
2249
2299
|
...options
|
|
2250
2300
|
};
|
|
2251
2301
|
this._style = new MapStyle();
|
|
2252
|
-
this._debouncedEmitSourceEvent = debounceWithArgs(this.emitEvent, {
|
|
2253
|
-
delay: 20,
|
|
2302
|
+
this._debouncedEmitSourceEvent = debounceWithArgs(this.emitEvent, 20, {
|
|
2254
2303
|
hash: (event) => event.source,
|
|
2255
2304
|
context: this
|
|
2256
2305
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as MapEvent, y as FlowMap, w as MapSourceIdentifier, _ as MapFeatureId, $ as MapPluginBase, a0 as PluginManager, a1 as MapSourceEvent, a2 as MapMouseEvent, a3 as MapFeatureStream, a4 as PartialBy, r as MapAnimationOptions, a5 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, u as MapFeatureIdentifier, t as MapFeature } from '../../../shared/flow-rdf-core.
|
|
2
|
-
export { a9 as EventHandlers, a8 as PluginConstructor, a7 as PluginEventsType, a6 as PluginOptionsType } from '../../../shared/flow-rdf-core.
|
|
3
|
-
import { F as Func } from '../../../shared/flow-rdf-core.
|
|
1
|
+
import { Z as MapEvent, y as FlowMap, w as MapSourceIdentifier, _ as MapFeatureId, $ as MapPluginBase, a0 as PluginManager, a1 as MapSourceEvent, a2 as MapMouseEvent, a3 as MapFeatureStream, a4 as PartialBy, r as MapAnimationOptions, a5 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, u as MapFeatureIdentifier, t as MapFeature } from '../../../shared/flow-rdf-core.769a4928.cjs';
|
|
2
|
+
export { a9 as EventHandlers, a8 as PluginConstructor, a7 as PluginEventsType, a6 as PluginOptionsType } from '../../../shared/flow-rdf-core.769a4928.cjs';
|
|
3
|
+
import { F as Func } from '../../../shared/flow-rdf-core.63162669.cjs';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import * as lit from 'lit-html';
|
|
6
6
|
import '@emuanalytics/flow-engine-client';
|
|
@@ -342,4 +342,4 @@ declare class UrlSyncPlugin extends MapPluginBase {
|
|
|
342
342
|
private hashToMapState;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
export { AnnotationEvent, AnnotationEventData, AnnotationEventType, AnnotationEventTypes, AnnotationFeature, AnnotationFeatureProps, AnnotationFeatureType, AnnotationMode, AnnotationOperation, AnnotationPlugin, AnnotationPluginOptions, AnnotationStyle, AnnotationsServiceConfig, DataJoin, DataJoinOptions, DataJoinPlugin, DrawOverlayCallback, DrawOverlayFn, ExportPlugin, ExportPluginOptions, FlowMapExportOptions, HoverEffectPlugin, MapPluginBase, PluginManager, PopupPlugin, SelectionEvent, SelectionEventType, SelectionEventTypes, SelectionMode, SelectionOptions, SelectionPlugin, UrlSyncPlugin };
|
|
345
|
+
export { AnnotationEvent, type AnnotationEventData, type AnnotationEventType, type AnnotationEventTypes, type AnnotationFeature, type AnnotationFeatureProps, type AnnotationFeatureType, type AnnotationMode, type AnnotationOperation, AnnotationPlugin, type AnnotationPluginOptions, type AnnotationStyle, type AnnotationsServiceConfig, DataJoin, type DataJoinOptions, DataJoinPlugin, type DrawOverlayCallback, type DrawOverlayFn, ExportPlugin, type ExportPluginOptions, type FlowMapExportOptions, HoverEffectPlugin, MapPluginBase, PluginManager, PopupPlugin, SelectionEvent, type SelectionEventType, type SelectionEventTypes, type SelectionMode, type SelectionOptions, SelectionPlugin, UrlSyncPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as MapEvent, y as FlowMap, w as MapSourceIdentifier, _ as MapFeatureId, $ as MapPluginBase, a0 as PluginManager, a1 as MapSourceEvent, a2 as MapMouseEvent, a3 as MapFeatureStream, a4 as PartialBy, r as MapAnimationOptions, a5 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, u as MapFeatureIdentifier, t as MapFeature } from '../../../shared/flow-rdf-core.
|
|
2
|
-
export { a9 as EventHandlers, a8 as PluginConstructor, a7 as PluginEventsType, a6 as PluginOptionsType } from '../../../shared/flow-rdf-core.
|
|
3
|
-
import { F as Func } from '../../../shared/flow-rdf-core.
|
|
1
|
+
import { Z as MapEvent, y as FlowMap, w as MapSourceIdentifier, _ as MapFeatureId, $ as MapPluginBase, a0 as PluginManager, a1 as MapSourceEvent, a2 as MapMouseEvent, a3 as MapFeatureStream, a4 as PartialBy, r as MapAnimationOptions, a5 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, u as MapFeatureIdentifier, t as MapFeature } from '../../../shared/flow-rdf-core.769a4928.mjs';
|
|
2
|
+
export { a9 as EventHandlers, a8 as PluginConstructor, a7 as PluginEventsType, a6 as PluginOptionsType } from '../../../shared/flow-rdf-core.769a4928.mjs';
|
|
3
|
+
import { F as Func } from '../../../shared/flow-rdf-core.63162669.mjs';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import * as lit from 'lit-html';
|
|
6
6
|
import '@emuanalytics/flow-engine-client';
|
|
@@ -342,4 +342,4 @@ declare class UrlSyncPlugin extends MapPluginBase {
|
|
|
342
342
|
private hashToMapState;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
export { AnnotationEvent, AnnotationEventData, AnnotationEventType, AnnotationEventTypes, AnnotationFeature, AnnotationFeatureProps, AnnotationFeatureType, AnnotationMode, AnnotationOperation, AnnotationPlugin, AnnotationPluginOptions, AnnotationStyle, AnnotationsServiceConfig, DataJoin, DataJoinOptions, DataJoinPlugin, DrawOverlayCallback, DrawOverlayFn, ExportPlugin, ExportPluginOptions, FlowMapExportOptions, HoverEffectPlugin, MapPluginBase, PluginManager, PopupPlugin, SelectionEvent, SelectionEventType, SelectionEventTypes, SelectionMode, SelectionOptions, SelectionPlugin, UrlSyncPlugin };
|
|
345
|
+
export { AnnotationEvent, type AnnotationEventData, type AnnotationEventType, type AnnotationEventTypes, type AnnotationFeature, type AnnotationFeatureProps, type AnnotationFeatureType, type AnnotationMode, type AnnotationOperation, AnnotationPlugin, type AnnotationPluginOptions, type AnnotationStyle, type AnnotationsServiceConfig, DataJoin, type DataJoinOptions, DataJoinPlugin, type DrawOverlayCallback, type DrawOverlayFn, ExportPlugin, type ExportPluginOptions, type FlowMapExportOptions, HoverEffectPlugin, MapPluginBase, PluginManager, PopupPlugin, SelectionEvent, type SelectionEventType, type SelectionEventTypes, type SelectionMode, type SelectionOptions, SelectionPlugin, UrlSyncPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as MapEvent, y as FlowMap, w as MapSourceIdentifier, _ as MapFeatureId, $ as MapPluginBase, a0 as PluginManager, a1 as MapSourceEvent, a2 as MapMouseEvent, a3 as MapFeatureStream, a4 as PartialBy, r as MapAnimationOptions, a5 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, u as MapFeatureIdentifier, t as MapFeature } from '../../../shared/flow-rdf-core.
|
|
2
|
-
export { a9 as EventHandlers, a8 as PluginConstructor, a7 as PluginEventsType, a6 as PluginOptionsType } from '../../../shared/flow-rdf-core.
|
|
3
|
-
import { F as Func } from '../../../shared/flow-rdf-core.
|
|
1
|
+
import { Z as MapEvent, y as FlowMap, w as MapSourceIdentifier, _ as MapFeatureId, $ as MapPluginBase, a0 as PluginManager, a1 as MapSourceEvent, a2 as MapMouseEvent, a3 as MapFeatureStream, a4 as PartialBy, r as MapAnimationOptions, a5 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, u as MapFeatureIdentifier, t as MapFeature } from '../../../shared/flow-rdf-core.769a4928.js';
|
|
2
|
+
export { a9 as EventHandlers, a8 as PluginConstructor, a7 as PluginEventsType, a6 as PluginOptionsType } from '../../../shared/flow-rdf-core.769a4928.js';
|
|
3
|
+
import { F as Func } from '../../../shared/flow-rdf-core.63162669.js';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import * as lit from 'lit-html';
|
|
6
6
|
import '@emuanalytics/flow-engine-client';
|
|
@@ -342,4 +342,4 @@ declare class UrlSyncPlugin extends MapPluginBase {
|
|
|
342
342
|
private hashToMapState;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
export { AnnotationEvent, AnnotationEventData, AnnotationEventType, AnnotationEventTypes, AnnotationFeature, AnnotationFeatureProps, AnnotationFeatureType, AnnotationMode, AnnotationOperation, AnnotationPlugin, AnnotationPluginOptions, AnnotationStyle, AnnotationsServiceConfig, DataJoin, DataJoinOptions, DataJoinPlugin, DrawOverlayCallback, DrawOverlayFn, ExportPlugin, ExportPluginOptions, FlowMapExportOptions, HoverEffectPlugin, MapPluginBase, PluginManager, PopupPlugin, SelectionEvent, SelectionEventType, SelectionEventTypes, SelectionMode, SelectionOptions, SelectionPlugin, UrlSyncPlugin };
|
|
345
|
+
export { AnnotationEvent, type AnnotationEventData, type AnnotationEventType, type AnnotationEventTypes, type AnnotationFeature, type AnnotationFeatureProps, type AnnotationFeatureType, type AnnotationMode, type AnnotationOperation, AnnotationPlugin, type AnnotationPluginOptions, type AnnotationStyle, type AnnotationsServiceConfig, DataJoin, type DataJoinOptions, DataJoinPlugin, type DrawOverlayCallback, type DrawOverlayFn, ExportPlugin, type ExportPluginOptions, type FlowMapExportOptions, HoverEffectPlugin, MapPluginBase, PluginManager, PopupPlugin, SelectionEvent, type SelectionEventType, type SelectionEventTypes, type SelectionMode, type SelectionOptions, SelectionPlugin, UrlSyncPlugin };
|
|
@@ -17,11 +17,11 @@ import turfDistance from '@turf/distance';
|
|
|
17
17
|
import { point } from '@turf/helpers';
|
|
18
18
|
import { autorun, toJS } from 'mobx';
|
|
19
19
|
import { saveAs } from 'file-saver';
|
|
20
|
-
import '@emuanalytics/maplibre-gl-style-spec';
|
|
21
|
-
import 'mobx-utils';
|
|
20
|
+
// import '@emuanalytics/maplibre-gl-style-spec';
|
|
21
|
+
// import 'mobx-utils';
|
|
22
22
|
import 'parsimmon';
|
|
23
23
|
import 'colorbrewer';
|
|
24
|
-
import 'nanoid';
|
|
24
|
+
// import 'nanoid';
|
|
25
25
|
import '@turf/invariant';
|
|
26
26
|
|
|
27
27
|
var __defProp$c = Object.defineProperty;
|
package/dist/lib/utils/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const stringUtils = require('../../shared/flow-rdf-core.3042be4a.cjs');
|
|
4
4
|
const featureTypeChecks = require('../../shared/flow-rdf-core.84eded74.cjs');
|
|
5
|
-
const
|
|
5
|
+
const throttle = require('../../shared/flow-rdf-core.1f72b20b.cjs');
|
|
6
6
|
const lit = require('lit-html');
|
|
7
7
|
require('@turf/invariant');
|
|
8
8
|
|
|
@@ -38,8 +38,9 @@ exports.isLineString = featureTypeChecks.isLineString;
|
|
|
38
38
|
exports.isMultiPolygon = featureTypeChecks.isMultiPolygon;
|
|
39
39
|
exports.isPoint = featureTypeChecks.isPoint;
|
|
40
40
|
exports.isPolygon = featureTypeChecks.isPolygon;
|
|
41
|
-
exports.debounce =
|
|
42
|
-
exports.debounceWithArgs =
|
|
43
|
-
exports.memoize =
|
|
44
|
-
exports.throttle =
|
|
41
|
+
exports.debounce = throttle.debounce;
|
|
42
|
+
exports.debounceWithArgs = throttle.debounceWithArgs;
|
|
43
|
+
exports.memoize = throttle.memoize;
|
|
44
|
+
exports.throttle = throttle.throttle;
|
|
45
|
+
exports.throttleWithArgs = throttle.throttleWithArgs;
|
|
45
46
|
exports.html = lit.html;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as GeoJSON from 'geojson';
|
|
2
|
-
|
|
2
|
+
import { N as NoReturn, F as Func, M as MemoizeOptions } from '../../shared/flow-rdf-core.63162669.cjs';
|
|
3
|
+
export { m as memoize } from '../../shared/flow-rdf-core.63162669.cjs';
|
|
3
4
|
export { html } from 'lit-html';
|
|
4
5
|
|
|
5
6
|
declare const isUndefined: (val: unknown) => val is undefined;
|
|
@@ -29,11 +30,130 @@ declare function isURL(val: unknown): val is string;
|
|
|
29
30
|
|
|
30
31
|
declare function ensureArray<T>(a: T | T[], ...rest: T[]): T[];
|
|
31
32
|
|
|
32
|
-
declare const isPoint: (val: unknown) => val is GeoJSON.
|
|
33
|
-
declare const isLineString: (val: any) => val is GeoJSON.
|
|
34
|
-
declare const isPolygon: (val: any) => val is GeoJSON.
|
|
35
|
-
declare const isMultiPolygon: (val: any) => val is GeoJSON.
|
|
33
|
+
declare const isPoint: (val: unknown) => val is GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point;
|
|
34
|
+
declare const isLineString: (val: any) => val is GeoJSON.Feature<GeoJSON.LineString> | GeoJSON.LineString;
|
|
35
|
+
declare const isPolygon: (val: any) => val is GeoJSON.Feature<GeoJSON.Polygon> | GeoJSON.Polygon;
|
|
36
|
+
declare const isMultiPolygon: (val: any) => val is GeoJSON.Feature<GeoJSON.MultiPolygon> | GeoJSON.MultiPolygon;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
40
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
41
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
42
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
43
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
44
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
45
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
46
|
+
* calls to the debounced function return the result of the last `func`
|
|
47
|
+
* invocation.
|
|
48
|
+
*
|
|
49
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
50
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
51
|
+
* is invoked more than once during the `wait` timeout.
|
|
52
|
+
*
|
|
53
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
54
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
55
|
+
*
|
|
56
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
57
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
58
|
+
*
|
|
59
|
+
* @static
|
|
60
|
+
* @memberOf _
|
|
61
|
+
* @since 0.1.0
|
|
62
|
+
* @category Function
|
|
63
|
+
* @param {Function} func The function to debounce.
|
|
64
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
65
|
+
* @param {Object} [options={}] The options object.
|
|
66
|
+
* @param {boolean} [options.leading=false]
|
|
67
|
+
* Specify invoking on the leading edge of the timeout.
|
|
68
|
+
* @param {number} [options.maxWait]
|
|
69
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
70
|
+
* @param {boolean} [options.trailing=true]
|
|
71
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
72
|
+
* @returns {Function} Returns the new debounced function.
|
|
73
|
+
* @example
|
|
74
|
+
*
|
|
75
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
76
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
77
|
+
*
|
|
78
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
79
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
80
|
+
* 'leading': true,
|
|
81
|
+
* 'trailing': false
|
|
82
|
+
* }));
|
|
83
|
+
*
|
|
84
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
85
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
86
|
+
* var source = new EventSource('/stream');
|
|
87
|
+
* jQuery(source).on('message', debounced);
|
|
88
|
+
*
|
|
89
|
+
* // Cancel the trailing debounced invocation.
|
|
90
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
interface CancelOptions {
|
|
94
|
+
upcomingOnly?: boolean;
|
|
95
|
+
}
|
|
96
|
+
interface Cancel {
|
|
97
|
+
cancel: (options?: CancelOptions) => void;
|
|
98
|
+
}
|
|
99
|
+
interface DebounceOptions {
|
|
100
|
+
leading?: boolean;
|
|
101
|
+
trailing?: boolean;
|
|
102
|
+
maxWait?: number;
|
|
103
|
+
context?: any;
|
|
104
|
+
}
|
|
105
|
+
declare function debounce<TFunc extends (...args: any[]) => any>(func: TFunc, wait: number, options?: DebounceOptions): NoReturn<TFunc> & Cancel;
|
|
106
|
+
type MemoizedDebounceOptions<TArgs extends any[], TKey> = DebounceOptions & MemoizeOptions<TArgs, TKey>;
|
|
107
|
+
declare function debounceWithArgs<TArgs extends any[], TKey>(fn: Func<TArgs, any>, wait: number, options: MemoizedDebounceOptions<TArgs, TKey>): Func<TArgs, void>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
111
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
112
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
113
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
114
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
115
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
116
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
117
|
+
* result of the last `func` invocation.
|
|
118
|
+
*
|
|
119
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
120
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
121
|
+
* is invoked more than once during the `wait` timeout.
|
|
122
|
+
*
|
|
123
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
124
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
125
|
+
*
|
|
126
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
127
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
128
|
+
*
|
|
129
|
+
* @static
|
|
130
|
+
* @memberOf _
|
|
131
|
+
* @since 0.1.0
|
|
132
|
+
* @category Function
|
|
133
|
+
* @param {Function} func The function to throttle.
|
|
134
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
135
|
+
* @param {Object} [options={}] The options object.
|
|
136
|
+
* @param {boolean} [options.leading=true]
|
|
137
|
+
* Specify invoking on the leading edge of the timeout.
|
|
138
|
+
* @param {boolean} [options.trailing=true]
|
|
139
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
140
|
+
* @returns {Function} Returns the new throttled function.
|
|
141
|
+
* @example
|
|
142
|
+
*
|
|
143
|
+
* // Avoid excessively updating the position while scrolling.
|
|
144
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
145
|
+
*
|
|
146
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
147
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
148
|
+
* jQuery(element).on('click', throttled);
|
|
149
|
+
*
|
|
150
|
+
* // Cancel the trailing throttled invocation.
|
|
151
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
152
|
+
*/
|
|
153
|
+
declare function throttle<TFunc extends (...args: any[]) => any>(func: TFunc, wait: number, options?: Omit<DebounceOptions, 'maxWait'>): NoReturn<TFunc> & Cancel;
|
|
154
|
+
type MemoizedThrottleOptions<TArgs extends any[], TKey> = Omit<DebounceOptions, 'maxWait'> & MemoizeOptions<TArgs, TKey>;
|
|
155
|
+
declare function throttleWithArgs<TArgs extends any[], TKey>(fn: Func<TArgs, any>, wait: number, options: MemoizedThrottleOptions<TArgs, TKey>): Func<TArgs, void>;
|
|
36
156
|
|
|
37
157
|
declare const capitalize: (str: string, lowerRest?: boolean) => string;
|
|
38
158
|
|
|
39
|
-
export { capitalize, ensureArray, hasLength, hasValue, isArray, isArrayFull, isArrayStrings, isBoolean, isDate, isDefined, isFalse, isFunction, isIn, isLineString, isMultiPolygon, isNil, isNull, isNumber, isNumeric, isObject, isObjectFull, isPlainObject, isPoint, isPolygon, isString, isStringFull, isTrue, isURL, isUndefined, isValue };
|
|
159
|
+
export { capitalize, debounce, debounceWithArgs, ensureArray, hasLength, hasValue, isArray, isArrayFull, isArrayStrings, isBoolean, isDate, isDefined, isFalse, isFunction, isIn, isLineString, isMultiPolygon, isNil, isNull, isNumber, isNumeric, isObject, isObjectFull, isPlainObject, isPoint, isPolygon, isString, isStringFull, isTrue, isURL, isUndefined, isValue, throttle, throttleWithArgs };
|