@octostar/map-component 0.2.12 → 0.2.14
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 +1422 -644
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1418 -640
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +5 -0
- package/dist/types/components/cursor-coordinates-overlay.d.ts +13 -0
- package/dist/types/components/cursor-coordinates-overlay.d.ts.map +1 -0
- package/dist/types/components/debug-sidebar.d.ts.map +1 -1
- package/dist/types/components/ingest-progress-overlay.d.ts +12 -0
- package/dist/types/components/ingest-progress-overlay.d.ts.map +1 -0
- package/dist/types/components/map-drop-zone.d.ts +7 -1
- package/dist/types/components/map-drop-zone.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/draw-render-gate.d.ts +10 -0
- package/dist/types/lib/draw-render-gate.d.ts.map +1 -0
- package/dist/types/lib/geojson-crs.d.ts +10 -0
- package/dist/types/lib/geojson-crs.d.ts.map +1 -0
- package/dist/types/lib/geojson-reproject.d.ts +15 -0
- package/dist/types/lib/geojson-reproject.d.ts.map +1 -0
- package/dist/types/lib/geojson-serialize.d.ts +21 -0
- package/dist/types/lib/geojson-serialize.d.ts.map +1 -0
- package/dist/types/lib/ingest-client.d.ts +43 -0
- package/dist/types/lib/ingest-client.d.ts.map +1 -0
- package/dist/types/lib/ingest-pipeline.d.ts +125 -0
- package/dist/types/lib/ingest-pipeline.d.ts.map +1 -0
- package/dist/types/lib/ingest-progress.d.ts +21 -0
- package/dist/types/lib/ingest-progress.d.ts.map +1 -0
- package/dist/types/lib/ingest-stream.d.ts +50 -0
- package/dist/types/lib/ingest-stream.d.ts.map +1 -0
- package/dist/types/lib/ingest.worker.d.ts +2 -0
- package/dist/types/lib/ingest.worker.d.ts.map +1 -0
- package/dist/types/lib/map-editor-api.d.ts +18 -0
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/perf-log.d.ts +3 -0
- package/dist/types/lib/perf-log.d.ts.map +1 -0
- package/dist/types/lib/selection-diff.d.ts +24 -1
- package/dist/types/lib/selection-diff.d.ts.map +1 -1
- package/dist/types/lib/selection-hit-test.d.ts +25 -14
- package/dist/types/lib/selection-hit-test.d.ts.map +1 -1
- package/dist/types/lib/selection-spatial-index.d.ts +63 -0
- package/dist/types/lib/selection-spatial-index.d.ts.map +1 -0
- package/dist/types/lib/temporal-ingest.d.ts +53 -0
- package/dist/types/lib/temporal-ingest.d.ts.map +1 -0
- package/dist/types/lib/temporal-normalize.d.ts +11 -0
- package/dist/types/lib/temporal-normalize.d.ts.map +1 -0
- package/dist/types/lib/timeline-diff.d.ts +43 -0
- package/dist/types/lib/timeline-diff.d.ts.map +1 -0
- package/dist/types/lib/timeline-store.d.ts +1 -9
- package/dist/types/lib/timeline-store.d.ts.map +1 -1
- package/package.json +6 -4
|
@@ -8,6 +8,10 @@ import type { GeoJSONSourceDiff } from 'maplibre-gl';
|
|
|
8
8
|
* O(total-features) rebuild + setData re-upload. The full sync records what
|
|
9
9
|
* the painted collection contains (`SelectionPaintCache`); this builder
|
|
10
10
|
* turns "painted selection → next selection" into a `updateData` diff.
|
|
11
|
+
*
|
|
12
|
+
* The same cache also serves the timeline fast path (timeline-diff.ts),
|
|
13
|
+
* which flips the disjoint property set stroke-opacity / fill-opacity /
|
|
14
|
+
* isTimelineHidden.
|
|
11
15
|
*/
|
|
12
16
|
export interface SelectionPaintCache {
|
|
13
17
|
/** Feature ids present in the custom-features source as of the last full sync. */
|
|
@@ -16,6 +20,17 @@ export interface SelectionPaintCache {
|
|
|
16
20
|
appliedSelectedIds: Set<string>;
|
|
17
21
|
/** Per-feature `_labelPriority` computed as if unselected. */
|
|
18
22
|
basePriorityById: Map<string, number>;
|
|
23
|
+
/** Ids currently painted `isTimelineHidden: 1` (advanced by the timeline fast path). */
|
|
24
|
+
appliedHiddenIds: Set<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Painted `stroke-opacity` as if timeline-visible (0 for 3D-only-hidden
|
|
27
|
+
* features). SPARSE: holds only values that differ from
|
|
28
|
+
* `DEFAULT_VISIBLE_STROKE_OPACITY` — readers fall back to the constant, so
|
|
29
|
+
* the map stays near-empty instead of one entry per painted feature.
|
|
30
|
+
*/
|
|
31
|
+
visibleStrokeOpacityById: Map<string, number>;
|
|
32
|
+
/** Painted `fill-opacity` as if timeline-visible — sparse over `DEFAULT_VISIBLE_FILL_OPACITY`. */
|
|
33
|
+
visibleFillOpacityById: Map<string, number>;
|
|
19
34
|
/**
|
|
20
35
|
* False when the painted collection had duplicate ids: maplibre's
|
|
21
36
|
* `updateData` requires unique ids on every feature and fails
|
|
@@ -26,12 +41,20 @@ export interface SelectionPaintCache {
|
|
|
26
41
|
}
|
|
27
42
|
/** Matches the paint-side `['coalesce', ['get', '_labelPriority'], 100]` default. */
|
|
28
43
|
export declare const DEFAULT_LABEL_PRIORITY = 100;
|
|
44
|
+
/**
|
|
45
|
+
* The full sync's as-if-visible opacity defaults (feature has no explicit
|
|
46
|
+
* `stroke-opacity` / `fill-opacity` property and is not 3D-only-hidden).
|
|
47
|
+
* Recording and restoring both key off these — change them only together
|
|
48
|
+
* with the full sync's paint defaults.
|
|
49
|
+
*/
|
|
50
|
+
export declare const DEFAULT_VISIBLE_STROKE_OPACITY = 1;
|
|
51
|
+
export declare const DEFAULT_VISIBLE_FILL_OPACITY = 0.2;
|
|
29
52
|
export declare function createSelectionPaintCache(): SelectionPaintCache;
|
|
30
53
|
/**
|
|
31
54
|
* Record one painted feature during a full sync. A duplicate id makes the
|
|
32
55
|
* cache non-updatable — see `SelectionPaintCache.updatable`.
|
|
33
56
|
*/
|
|
34
|
-
export declare function recordPaintedFeature(cache: SelectionPaintCache, featureId: string, basePriority: number, isSelected: boolean): void;
|
|
57
|
+
export declare function recordPaintedFeature(cache: SelectionPaintCache, featureId: string, basePriority: number, isSelected: boolean, visibleStrokeOpacity: number, visibleFillOpacity: number, isTimelineHidden: boolean): void;
|
|
35
58
|
/** Minimal surface of maplibre's GeoJSONSource the fast path needs. */
|
|
36
59
|
export interface UpdatableGeoJSONSource {
|
|
37
60
|
updateData(diff: GeoJSONSourceDiff): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"selection-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,wFAAwF;IACxF,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,8DAA8D;IAC9D,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,wFAAwF;IACxF,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,kGAAkG;IAClG,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,wBAAgB,yBAAyB,IAAI,mBAAmB,CAU/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,oBAAoB,EAAE,MAAM,EAC5B,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,OAAO,GACxB,IAAI,CAeN;AAED,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,mBAAmB,GAAG,IAAI,EACjC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EACpC,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAChD,OAAO,CAgBT;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAMV;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,oBAAoB,GAAG,kBAAkB,CAAC,EAC1F,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,GACnC,iBAAiB,GAAG,IAAI,CAyB1B"}
|
|
@@ -1,27 +1,37 @@
|
|
|
1
|
+
import { type GroupSpatialIndex } from './selection-spatial-index';
|
|
1
2
|
/**
|
|
2
3
|
* Hit-testing for the selection gestures (rectangle / circle / lasso /
|
|
3
4
|
* shift-drag), extracted from the four copy-pasted completion loops in
|
|
4
5
|
* map-editor-canvas.
|
|
5
6
|
*
|
|
6
|
-
* A
|
|
7
|
-
*
|
|
7
|
+
* A bounding-box prefilter runs before the exact turf predicates, which
|
|
8
|
+
* matters because the loops previously ran `booleanIntersects` /
|
|
8
9
|
* `booleanPointInPolygon` against EVERY feature on the map per gesture.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Read-only layer groups carry a flatbush index (selection-spatial-index.ts)
|
|
11
|
+
* so only the candidates overlapping the selection bounds are visited at
|
|
12
|
+
* all; the draw group and un-indexed groups keep the linear scan. Bounds
|
|
13
|
+
* are raw coordinates with no antimeridian ±360 normalization — the
|
|
14
|
+
* prefilter must be exactly conservative w.r.t. the turf predicates, or
|
|
15
|
+
* indexing would change selection results.
|
|
14
16
|
*/
|
|
17
|
+
/** A hit-test group: the features plus an optional prebuilt spatial index. */
|
|
18
|
+
export interface SelectionFeatureGroup {
|
|
19
|
+
features: readonly GeoJSON.Feature[];
|
|
20
|
+
index?: GroupSpatialIndex;
|
|
21
|
+
}
|
|
15
22
|
/**
|
|
16
23
|
* Feature groups for hit-testing: draw features first, then visible
|
|
17
24
|
* read-only layers in store order — reproducing the concat order of the
|
|
18
25
|
* inline loops this module replaced, without materializing a combined copy
|
|
19
26
|
* of every feature. Layers absent from `layers` are treated as hidden.
|
|
27
|
+
* Read-only groups get the WeakMap-cached spatial index (built lazily on
|
|
28
|
+
* the first gesture after a layer snapshot changes); draw features are a
|
|
29
|
+
* fresh array per call and stay linear.
|
|
20
30
|
*/
|
|
21
31
|
export declare function collectVisibleFeatureGroups(drawFeatures: GeoJSON.Feature[] | null, readOnlyByLayer: ReadonlyMap<string, GeoJSON.Feature[]>, layers: readonly {
|
|
22
32
|
id: string;
|
|
23
33
|
visible: boolean;
|
|
24
|
-
}[]):
|
|
34
|
+
}[]): SelectionFeatureGroup[];
|
|
25
35
|
export interface SelectionHitTestOptions {
|
|
26
36
|
/**
|
|
27
37
|
* The selection polygon is an axis-aligned lng/lat rectangle. For Point
|
|
@@ -34,11 +44,12 @@ export interface SelectionHitTestOptions {
|
|
|
34
44
|
/**
|
|
35
45
|
* Ids of the features whose geometry hits the selection polygon, in
|
|
36
46
|
* encounter order (groups in order, features in order — matching the
|
|
37
|
-
* previous draw-then-read-only concat order
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
47
|
+
* previous draw-then-read-only concat order; indexed groups visit candidate
|
|
48
|
+
* positions in ascending original order, which is the same order). Ids are
|
|
49
|
+
* stringified with the previous truthiness check, so `id: 0` / `id: ''` /
|
|
50
|
+
* missing ids are skipped. GeometryCollection features are never selected
|
|
51
|
+
* (parity with the untyped fall-through this replaces), and a per-feature
|
|
52
|
+
* error skips just that feature.
|
|
42
53
|
*/
|
|
43
|
-
export declare function hitTestSelection(featureGroups: readonly
|
|
54
|
+
export declare function hitTestSelection(featureGroups: readonly SelectionFeatureGroup[], selectionPolygon: GeoJSON.Feature<GeoJSON.Polygon>, options?: SelectionHitTestOptions): string[];
|
|
44
55
|
//# sourceMappingURL=selection-hit-test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-hit-test.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-hit-test.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"selection-hit-test.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-hit-test.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,EACtC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EACvD,MAAM,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,GAClD,qBAAqB,EAAE,CAazB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AA0CD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,SAAS,qBAAqB,EAAE,EAC/C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAClD,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,EAAE,CA2BV"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Flatbush from 'flatbush';
|
|
2
|
+
/**
|
|
3
|
+
* Static packed R-tree (flatbush) over a feature array's bounding boxes, so
|
|
4
|
+
* a selection gesture queries O(log n + k) candidates instead of scanning —
|
|
5
|
+
* and re-deriving the bbox of — every feature per gesture.
|
|
6
|
+
*
|
|
7
|
+
* Bounds semantics are shared with the hit-test prefilter and are exactly
|
|
8
|
+
* conservative w.r.t. the turf predicates: raw coordinates, no ±360
|
|
9
|
+
* antimeridian normalization (deliberately unlike `visible-feature-count.ts`,
|
|
10
|
+
* which wants geographic truth for counting). NaN coordinates never extend
|
|
11
|
+
* bounds; features with no finite bounds (empty coordinates, all-NaN,
|
|
12
|
+
* GeometryCollection) are omitted from the tree — exactly the features the
|
|
13
|
+
* linear prefilter could never pass.
|
|
14
|
+
*
|
|
15
|
+
* Invalidation is array identity: read-only layer mutations are copy-on-write
|
|
16
|
+
* (`readOnlyFeatures.current.set(layerId, newArray)` — see
|
|
17
|
+
* read-only-feature-index.ts), so a WeakMap keyed by the array itself caches
|
|
18
|
+
* one index per snapshot and garbage-collects with dropped layers. Draw
|
|
19
|
+
* features get no index: `draw.getAll()` returns a fresh array per call, so
|
|
20
|
+
* an index would never cache-hit (and the draw set is small).
|
|
21
|
+
*/
|
|
22
|
+
export interface Bounds {
|
|
23
|
+
minLng: number;
|
|
24
|
+
minLat: number;
|
|
25
|
+
maxLng: number;
|
|
26
|
+
maxLat: number;
|
|
27
|
+
}
|
|
28
|
+
/** Recursive min/max walk; positions are leaf arrays whose first element is
|
|
29
|
+
* a number. NaN coordinates fail every comparison and simply don't extend
|
|
30
|
+
* the bounds. No spread anywhere — rings can exceed 100k positions. */
|
|
31
|
+
export declare function extendBounds(bounds: Bounds, coords: unknown): void;
|
|
32
|
+
export declare function computeBounds(coords: unknown): Bounds;
|
|
33
|
+
/** Strict inequalities: touching bboxes fall through to the exact test.
|
|
34
|
+
* Flatbush's inclusive search overlap is the exact complement. */
|
|
35
|
+
export declare function boundsDisjoint(a: Bounds, b: Bounds): boolean;
|
|
36
|
+
export declare function pointInBounds(lng: number, lat: number, b: Bounds): boolean;
|
|
37
|
+
export interface GroupSpatialIndex {
|
|
38
|
+
/** null when no feature produced finite bounds (flatbush needs numItems > 0). */
|
|
39
|
+
tree: Flatbush | null;
|
|
40
|
+
/** Tree item i → position in the original feature array (ascending by construction). */
|
|
41
|
+
positions: number[];
|
|
42
|
+
/** features.length at build time — defensive mismatch check before use. */
|
|
43
|
+
size: number;
|
|
44
|
+
}
|
|
45
|
+
export declare function buildGroupSpatialIndex(features: readonly GeoJSON.Feature[]): GroupSpatialIndex;
|
|
46
|
+
/**
|
|
47
|
+
* WeakMap-cached per array identity (the copy-on-write invalidation
|
|
48
|
+
* contract). Returns undefined when the build throws (cyclic coordinates, a
|
|
49
|
+
* throwing getter) — the caller falls back to the linear scan. The failure
|
|
50
|
+
* is cached too, so a pathological layer pays the failed bounds walk once
|
|
51
|
+
* per snapshot, not once per gesture. Deliberately NOT a null-tree sentinel:
|
|
52
|
+
* `tree: null` means "no indexable features" and yields zero candidates,
|
|
53
|
+
* which would silently make the whole group unselectable.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getGroupSpatialIndex(features: readonly GeoJSON.Feature[]): GroupSpatialIndex | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Candidate positions (original-array order, ascending) whose boxes overlap
|
|
58
|
+
* `bounds` inclusively. Ascending original positions ARE within-group
|
|
59
|
+
* encounter order, which keeps the hit-test's result order byte-identical
|
|
60
|
+
* to the linear scan it replaces.
|
|
61
|
+
*/
|
|
62
|
+
export declare function queryCandidatePositions(index: GroupSpatialIndex, bounds: Bounds): number[];
|
|
63
|
+
//# sourceMappingURL=selection-spatial-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-spatial-index.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-spatial-index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAIhC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;wEAEwE;AACxE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAYlE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED;mEACmE;AACnE,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,wFAAwF;IACxF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,GAAG,iBAAiB,CA2B9F;AAKD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,GACnC,iBAAiB,GAAG,SAAS,CAa/B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAM1F"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface PreparedLayerFeatures {
|
|
2
|
+
/** Always a fresh array — array identity keys cache invalidation (see selection-spatial-index.ts). */
|
|
3
|
+
features: GeoJSON.Feature[];
|
|
4
|
+
/** String id per feature, same order as `features`. */
|
|
5
|
+
featureIds: string[];
|
|
6
|
+
/** True when at least one feature carries a parseable start or end date. */
|
|
7
|
+
hasTemporal: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Assign string ids and normalize temporal properties for features headed
|
|
11
|
+
* into a read-only layer store.
|
|
12
|
+
*
|
|
13
|
+
* Contract (pinned by tests, byte-compatible with the former inline loops):
|
|
14
|
+
* - id: truthy ids are String()-coerced; falsy ids (missing, '', 0) get a
|
|
15
|
+
* UUID — the `uuid-fallback` quirk shared with the ingest pipeline.
|
|
16
|
+
* - features with no temporal property keys are shallow-copied with the id
|
|
17
|
+
* only; their `properties` object is passed through by reference.
|
|
18
|
+
* - features with temporal keys are rewritten with ISO-string-or-null
|
|
19
|
+
* `startDate`/`endDate` — even when every candidate value fails to parse
|
|
20
|
+
* (garbage dates yield explicit nulls, and do not set `hasTemporal`).
|
|
21
|
+
*
|
|
22
|
+
* Fast path: a feature that already carries a truthy string id and no
|
|
23
|
+
* temporal keys needs neither the id rewrite nor the property rewrite, so it
|
|
24
|
+
* is passed through by reference instead of shallow-copied — at 48k features
|
|
25
|
+
* this removes the dominant allocation cost of a host-API push. The shallow
|
|
26
|
+
* copy never protected callers anyway (`properties`/`geometry` were always
|
|
27
|
+
* shared by reference); the standing contract stays: don't mutate features
|
|
28
|
+
* after handing them to a host API. That now covers `id` too — the one field
|
|
29
|
+
* the old copy did shield: a host that reassigns `f.id` after handover
|
|
30
|
+
* desyncs the stored feature from `layer.featureIds` and from undo
|
|
31
|
+
* snapshots, which hold these same references. The RETURNED ARRAY is still
|
|
32
|
+
* always fresh, so array-identity cache invalidation is unaffected.
|
|
33
|
+
*/
|
|
34
|
+
export declare function prepareFeaturesForLayer(input: readonly GeoJSON.Feature[], caller?: string): PreparedLayerFeatures;
|
|
35
|
+
export interface TimelineScanEntry {
|
|
36
|
+
id: string;
|
|
37
|
+
startDate: Date | null;
|
|
38
|
+
endDate: Date | null;
|
|
39
|
+
layerId: string;
|
|
40
|
+
}
|
|
41
|
+
export interface TimelineScanOutput {
|
|
42
|
+
temporal: TimelineScanEntry[];
|
|
43
|
+
untimedIds: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Classify features for the timeline store: parseable start/end dates land in
|
|
47
|
+
* `out.temporal` (with `resolveLayerId(featureId)` attached), everything else
|
|
48
|
+
* — no temporal keys, or nothing parseable — lands in `out.untimedIds`.
|
|
49
|
+
* Accumulates into `out` so callers can scan several sources into one result.
|
|
50
|
+
* Returns true when this call contributed at least one temporal entry.
|
|
51
|
+
*/
|
|
52
|
+
export declare function scanTemporalFeatures(features: readonly GeoJSON.Feature[], resolveLayerId: (featureId: string) => string, out: TimelineScanOutput): boolean;
|
|
53
|
+
//# sourceMappingURL=temporal-ingest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal-ingest.d.ts","sourceRoot":"","sources":["../../../client/src/lib/temporal-ingest.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,qBAAqB;IACpC,sGAAsG;IACtG,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,uDAAuD;IACvD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,qBAAqB,CAuDjH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,EACpC,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,EAC7C,GAAG,EAAE,kBAAkB,GACtB,OAAO,CAuBT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function parseDate(value: unknown): Date | null;
|
|
2
|
+
/**
|
|
3
|
+
* Quick check for temporal property values without expensive Date parsing.
|
|
4
|
+
* Use this to short-circuit before calling normalizeTemporalProperties.
|
|
5
|
+
*/
|
|
6
|
+
export declare function hasAnyTemporalValue(properties: Record<string, unknown>): boolean;
|
|
7
|
+
export declare function normalizeTemporalProperties(properties: Record<string, unknown>): {
|
|
8
|
+
startDate: Date | null;
|
|
9
|
+
endDate: Date | null;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=temporal-normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal-normalize.d.ts","sourceRoot":"","sources":["../../../client/src/lib/temporal-normalize.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAQrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAShF;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAChF,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB,CAqBA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GeoJSONSourceDiff } from 'maplibre-gl';
|
|
2
|
+
import { type SelectionPaintCache, type UpdatableGeoJSONSource } from './selection-diff';
|
|
3
|
+
/**
|
|
4
|
+
* Minimal GeoJSON source diff for timeline-visibility changes.
|
|
5
|
+
*
|
|
6
|
+
* Timeline filtering never adds or removes features from the source — the
|
|
7
|
+
* full sync paints hidden features with `stroke-opacity: 0`,
|
|
8
|
+
* `fill-opacity: 0`, `isTimelineHidden: 1` (labels derive `text-opacity`
|
|
9
|
+
* from `stroke-opacity`, radius/stroke-width paint cases read
|
|
10
|
+
* `isTimelineHidden`). So a scrub/playback tick only needs to flip those
|
|
11
|
+
* three properties on the features whose hidden-state toggled, via
|
|
12
|
+
* `updateData`. The scan below is still O(present-features) per tick (a Set
|
|
13
|
+
* iteration + lookups); only the diff handed to the GPU is O(toggled) — the
|
|
14
|
+
* win over the full rebuild is skipping restyle + setData, not the scan. If
|
|
15
|
+
* the scan ever profiles hot, it can be driven from
|
|
16
|
+
* `hiddenIds ∪ appliedHiddenIds` (the caller already receives `hiddenIds`).
|
|
17
|
+
*/
|
|
18
|
+
export type TimelinePaintCache = Pick<SelectionPaintCache, 'presentIds' | 'appliedHiddenIds' | 'visibleStrokeOpacityById' | 'visibleFillOpacityById'>;
|
|
19
|
+
/**
|
|
20
|
+
* Diff between the painted hidden set and the next visible set (null means
|
|
21
|
+
* no filter — everything visible). Show entries restore the recorded
|
|
22
|
+
* as-if-visible opacities, so features hidden for other reasons (3D-only)
|
|
23
|
+
* round-trip back to 0. Returns the diff (null when nothing toggles) and
|
|
24
|
+
* the full next hidden set for the caller to store on success.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTimelineVisibilityDiff(cache: TimelinePaintCache, nextVisibleSet: ReadonlySet<string> | null): {
|
|
27
|
+
diff: GeoJSONSourceDiff | null;
|
|
28
|
+
nextHiddenIds: Set<string>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Apply a timeline-visibility change to the source as an updateData diff.
|
|
32
|
+
* Returns false when the caller must fall back to a full sync — no cache,
|
|
33
|
+
* non-updatable cache (duplicate painted ids), missing source, or a
|
|
34
|
+
* synchronous updateData throw (the cache is then left untouched; the full
|
|
35
|
+
* sync rebuilds it). Async updateData failures are pre-empted by the
|
|
36
|
+
* `updatable` gate, exactly like the selection fast path. On success the
|
|
37
|
+
* cache's applied hidden set is advanced to the painted state.
|
|
38
|
+
*/
|
|
39
|
+
export declare function applyTimelineFastPath(cache: SelectionPaintCache | null, nextVisibleSet: ReadonlySet<string> | null, source: UpdatableGeoJSONSource | null | undefined): {
|
|
40
|
+
applied: boolean;
|
|
41
|
+
toggled: number;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=timeline-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/timeline-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,mBAAmB,EACnB,YAAY,GAAG,kBAAkB,GAAG,0BAA0B,GAAG,wBAAwB,CAC1F,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,GACzC;IAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CA4BhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,GAAG,IAAI,EACjC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,EAC1C,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAChD;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAYvC"}
|
|
@@ -29,15 +29,7 @@ export interface TimelineState {
|
|
|
29
29
|
advancePlayhead: () => boolean;
|
|
30
30
|
reset: () => void;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
* Quick check for temporal property values without expensive Date parsing.
|
|
34
|
-
* Use this to short-circuit before calling normalizeTemporalProperties.
|
|
35
|
-
*/
|
|
36
|
-
export declare function hasAnyTemporalValue(properties: Record<string, unknown>): boolean;
|
|
37
|
-
export declare function normalizeTemporalProperties(properties: Record<string, unknown>): {
|
|
38
|
-
startDate: Date | null;
|
|
39
|
-
endDate: Date | null;
|
|
40
|
-
};
|
|
32
|
+
export { hasAnyTemporalValue, normalizeTemporalProperties } from './temporal-normalize';
|
|
41
33
|
export declare function isFeatureInRange(feature: TemporalFeature, rangeStart: Date | null, rangeEnd: Date | null): boolean;
|
|
42
34
|
export type TimelineStoreApi = StoreApi<TimelineState>;
|
|
43
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-store.d.ts","sourceRoot":"","sources":["../../../client/src/lib/timeline-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAqB,MAAM,SAAS,CAAC;AAG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AE,MAAM,IAAI,CAAC;CACnB;AAED,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAExF,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,IAAI,GAAG,IAAI,EACvB,QAAQ,EAAE,IAAI,GAAG,IAAI,GACpB,OAAO,CAQT;AA2LD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,kDAA+C,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAMtD;AAID;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAAC;AAClD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octostar/map-component",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "MapLibre-based map editor component",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
57
|
"date-fns": "^3.6.0",
|
|
58
58
|
"dayjs": "^1.11.19",
|
|
59
|
+
"flatbush": "^3.3.1",
|
|
59
60
|
"lucide-react": "^0.453.0",
|
|
60
61
|
"maplibre-gl": "^5.14.0",
|
|
61
62
|
"proj4": "^2.20.2",
|
|
@@ -99,6 +100,8 @@
|
|
|
99
100
|
"@tailwindcss/typography": "^0.5.15",
|
|
100
101
|
"@tailwindcss/vite": "^4.1.3",
|
|
101
102
|
"@tanstack/react-query": "^5.60.5",
|
|
103
|
+
"@testing-library/dom": "^10.4.0",
|
|
104
|
+
"@testing-library/react": "^16.1.0",
|
|
102
105
|
"@types/connect-pg-simple": "^7.0.3",
|
|
103
106
|
"@types/express": "4.17.21",
|
|
104
107
|
"@types/express-session": "^1.18.0",
|
|
@@ -124,12 +127,14 @@
|
|
|
124
127
|
"express-session": "^1.18.1",
|
|
125
128
|
"framer-motion": "^11.13.1",
|
|
126
129
|
"input-otp": "^1.4.2",
|
|
130
|
+
"jsdom": "^25.0.1",
|
|
127
131
|
"memorystore": "^1.6.7",
|
|
128
132
|
"nanoid": "^5.0.9",
|
|
129
133
|
"next-themes": "^0.4.6",
|
|
130
134
|
"passport": "^0.7.0",
|
|
131
135
|
"passport-local": "^1.0.0",
|
|
132
136
|
"pg": "^8.16.3",
|
|
137
|
+
"playwright": "^1.62.1",
|
|
133
138
|
"postcss": "^8.4.47",
|
|
134
139
|
"prism-react-renderer": "^2.4.1",
|
|
135
140
|
"react": "^18.3.1",
|
|
@@ -147,9 +152,6 @@
|
|
|
147
152
|
"vaul": "^1.1.2",
|
|
148
153
|
"vite": "^5.4.20",
|
|
149
154
|
"vitest": "^2.1.9",
|
|
150
|
-
"@testing-library/dom": "^10.4.0",
|
|
151
|
-
"@testing-library/react": "^16.1.0",
|
|
152
|
-
"jsdom": "^25.0.1",
|
|
153
155
|
"wouter": "^3.3.5",
|
|
154
156
|
"ws": "^8.18.0",
|
|
155
157
|
"zod": "^3.24.2",
|