@octostar/map-component 0.2.18 → 0.2.20

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.
Files changed (32) hide show
  1. package/README.md +4 -1
  2. package/dist/index.cjs +807 -310
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.mjs +834 -336
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/styles.css +2 -0
  7. package/dist/types/components/layers-panel.d.ts +2 -2
  8. package/dist/types/components/layers-panel.d.ts.map +1 -1
  9. package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
  10. package/dist/types/index.d.ts +4 -0
  11. package/dist/types/index.d.ts.map +1 -1
  12. package/dist/types/lib/feature-cap.d.ts +83 -0
  13. package/dist/types/lib/feature-cap.d.ts.map +1 -0
  14. package/dist/types/lib/geojson-serialize.d.ts +22 -8
  15. package/dist/types/lib/geojson-serialize.d.ts.map +1 -1
  16. package/dist/types/lib/ingest-pipeline.d.ts +12 -0
  17. package/dist/types/lib/ingest-pipeline.d.ts.map +1 -1
  18. package/dist/types/lib/ingest-progress.d.ts +5 -1
  19. package/dist/types/lib/ingest-progress.d.ts.map +1 -1
  20. package/dist/types/lib/layer-features.d.ts +25 -3
  21. package/dist/types/lib/layer-features.d.ts.map +1 -1
  22. package/dist/types/lib/map-editor-api.d.ts +40 -1
  23. package/dist/types/lib/map-editor-api.d.ts.map +1 -1
  24. package/dist/types/lib/temporal-ingest.d.ts +11 -1
  25. package/dist/types/lib/temporal-ingest.d.ts.map +1 -1
  26. package/dist/types/lib/trace-groups.d.ts +82 -0
  27. package/dist/types/lib/trace-groups.d.ts.map +1 -0
  28. package/dist/types/lib/trace-timeline.d.ts +75 -0
  29. package/dist/types/lib/trace-timeline.d.ts.map +1 -0
  30. package/dist/types/lib/yield-to-main.d.ts +2 -0
  31. package/dist/types/lib/yield-to-main.d.ts.map +1 -0
  32. package/package.json +1 -1
@@ -0,0 +1,75 @@
1
+ import type { GeoJSONSourceDiff } from 'maplibre-gl';
2
+ import type { SelectionPaintCache, UpdatableGeoJSONSource } from './selection-diff';
3
+ import { type TraceGroup } from './trace-groups';
4
+ /**
5
+ * Timeline fast path for trace layers.
6
+ *
7
+ * With the trace index filter-independent (trace-groups.ts), a timeline tick
8
+ * changes exactly two things about a visible trace layer: which point of
9
+ * each group is its ENDPOINT — the last visible one, painted larger and, when
10
+ * grouped, carrying the group label at trace-endpoint label priority — and
11
+ * which consecutive visible pairs the segment source connects. Everything
12
+ * else about a trace point (group colour, the small non-endpoint radius) is
13
+ * painted the same whether the timeline hides it or not, so the generic
14
+ * opacity flip (timeline-diff.ts) reveals it correctly.
15
+ *
16
+ * The full sync records the groups it painted and, per trace point, the
17
+ * paint variants it can take. A tick then derives the painted state from the
18
+ * paint cache's `appliedHiddenIds` (the visibility as painted), diffs it
19
+ * against the next visible set, and emits O(moved endpoints) point updates
20
+ * plus O(reconnected pairs) segment adds/removes — never a source rebuild.
21
+ * The endpoint paint below mirrors the full sync's trace branch; both read
22
+ * these constants.
23
+ *
24
+ * maplibre reports an unusable diff ASYNCHRONOUSLY (an ErrorEvent, as the
25
+ * other fast paths note), so correctness rests on construction, not on the
26
+ * catch: every segment carries a positional id unique across groups, and the
27
+ * point updates only name ids the full sync painted.
28
+ */
29
+ export declare const TRACE_ENDPOINT_LABEL_PRIORITY = 5;
30
+ export declare const TRACE_POINT_RADIUS = 2;
31
+ export declare const TRACE_ENDPOINT_MIN_RADIUS = 8;
32
+ export interface TracePointPaint {
33
+ /** Label text the point paints when it is not the endpoint (visualConfig-resolved). */
34
+ name: string;
35
+ /** Radius it paints as the endpoint: `max(size-config radius, TRACE_ENDPOINT_MIN_RADIUS)`. */
36
+ endpointRadius: number;
37
+ /** Label priority it paints when it is not a labelled endpoint (the full sync's non-trace ranking). */
38
+ basePriority: number;
39
+ }
40
+ export interface TracePaintCache {
41
+ /** Every group of every visible trace layer, in paint order (= the segment ids' group index). */
42
+ groups: readonly TraceGroup[];
43
+ pointPaint: Map<string, TracePointPaint>;
44
+ }
45
+ export interface TraceTimelineDiff {
46
+ pointUpdates: NonNullable<GeoJSONSourceDiff['update']>;
47
+ segmentAdd: GeoJSON.Feature[];
48
+ segmentRemove: string[];
49
+ /** `basePriorityById` entries to commit once the updates are applied. */
50
+ basePriorities: [string, number][];
51
+ }
52
+ type PaintState = Pick<SelectionPaintCache, 'appliedHiddenIds' | 'appliedSelectedIds'>;
53
+ /**
54
+ * Pure diff from the painted visibility (`paint.appliedHiddenIds`) to
55
+ * `nextVisibleSet`. Build it BEFORE the generic timeline path advances that
56
+ * set, apply it after.
57
+ */
58
+ export declare function buildTraceTimelineDiff(trace: TracePaintCache, paint: PaintState, nextVisibleSet: ReadonlySet<string> | null): TraceTimelineDiff;
59
+ /**
60
+ * Consecutive pairs of two ascending index lists, merged in (from, to)
61
+ * order: a pair only in `prev` is removed, one only in `next` is added.
62
+ */
63
+ export declare function diffConsecutivePairs(prev: readonly number[], next: readonly number[], onRemove: (from: number, to: number) => void, onAdd: (from: number, to: number) => void): void;
64
+ /**
65
+ * Apply a built diff: endpoint property updates on the point source, segment
66
+ * adds/removes on the trace source. A synchronous throw (a source gone
67
+ * between the diff being built and applied, or a diff maplibre rejects up
68
+ * front) is logged and reported as false so the caller falls back to the
69
+ * full sync, which repaints everything, cache included; the diff itself is
70
+ * cheap to lose. On success the endpoint priorities are committed to the
71
+ * paint cache so the selection fast path restores them correctly on deselect.
72
+ */
73
+ export declare function applyTraceTimelineDiff(diff: TraceTimelineDiff, paint: Pick<SelectionPaintCache, 'basePriorityById'>, pointSource: UpdatableGeoJSONSource, segmentSource: UpdatableGeoJSONSource): boolean;
74
+ export {};
75
+ //# sourceMappingURL=trace-timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-timeline.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,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AAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,EAC5C,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,GACxC,IAAI,CAmBN;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,EACpD,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,sBAAsB,GACpC,OAAO,CAYT"}
@@ -0,0 +1,2 @@
1
+ export declare function yieldToMain(): Promise<void>;
2
+ //# sourceMappingURL=yield-to-main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yield-to-main.d.ts","sourceRoot":"","sources":["../../../client/src/lib/yield-to-main.ts"],"names":[],"mappings":"AAeA,wBAAgB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAmB3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octostar/map-component",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "description": "MapLibre-based map editor component",