@octostar/map-component 0.2.4 → 0.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"map-editor-canvas.d.ts","sourceRoot":"","sources":["../../../client/src/components/map-editor-canvas.tsx"],"names":[],"mappings":"AAiMA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gDAAgD,CAAC;AAkOxD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAuG5E,eAAO,MAAM,eAAe,4GA23R1B,CAAC"}
1
+ {"version":3,"file":"map-editor-canvas.d.ts","sourceRoot":"","sources":["../../../client/src/components/map-editor-canvas.tsx"],"names":[],"mappings":"AAiMA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gDAAgD,CAAC;AAyOxD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgG5E,eAAO,MAAM,eAAe,4GA45R1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"properties-panel.d.ts","sourceRoot":"","sources":["../../../client/src/components/properties-panel.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAc,mBAAmB,EAAsB,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAkBhK,UAAU,iBAAiB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC;CAC5B;AAED,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAC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E,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC5D;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC/B;AA6SD,wBAAgB,eAAe,CAAC,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAiB,EAAE,eAAuB,EAAE,SAAS,EAAE,OAAO,EAAE,cAAsB,EAAE,kBAAkB,EAAE,mBAA2B,EAAE,qBAAsC,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,oBAAoB,sCA0xD9jB"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Pure diffing logic for the map editor's command/inverse undo engine.
3
+ *
4
+ * `saveStateForUndo` snapshots the feature + layer stores BEFORE a user
5
+ * mutation; on the next animation frame the AFTER state is captured and the
6
+ * two are diffed here. The resulting id sets scope the undo command to the
7
+ * entities that actually changed — keying commands on the union of ALL ids
8
+ * (as an earlier revision did) retained a snapshot map over every feature on
9
+ * the map per history entry (megabytes per command with a 40k-feature
10
+ * read-only layer) and cost two JSON.stringify calls per feature per capture.
11
+ *
12
+ * Scoping is safe for coalesced bursts too: every coalesce key used by the
13
+ * canvas is a per-layer config key, so all commands in a burst touch the same
14
+ * single layer record.
15
+ */
16
+ /** Which store a feature lives in (drives how undo re-adds it). */
17
+ export type HistoryStore = 'draw' | 'readOnly' | 'hidden';
18
+ /**
19
+ * Feature data captured for a scoped history diff, keyed by feature id. We
20
+ * store the feature object plus its owning layer + store so undo/redo can
21
+ * re-add it to exactly the right place by id (preserving identity).
22
+ */
23
+ export type HistoryFeatureMap = Map<string, {
24
+ feature: GeoJSON.Feature;
25
+ layerId: string;
26
+ store: HistoryStore;
27
+ }>;
28
+ /**
29
+ * Structural equality for two history layer records. `featureIds` is compared
30
+ * element-wise — `JSON.stringify` on a large (e.g. 40k-id) array builds a
31
+ * multi-megabyte string per layer per capture; the rest of the record is
32
+ * small and safe to stringify.
33
+ */
34
+ export declare function historyLayersEqual<T extends {
35
+ featureIds: string[];
36
+ }>(a: T, b: T): boolean;
37
+ /**
38
+ * Diff a BEFORE/AFTER snapshot pair and return the ids that actually changed.
39
+ * A feature counts as changed when it was added or removed, moved layer or
40
+ * store, or (for distinct object references) serializes differently.
41
+ * Identical object references short-circuit as unchanged: read-only snapshots
42
+ * hold live references, so the same object in both snapshots cannot have
43
+ * diverged (draw snapshots are fresh clones each capture and fall through to
44
+ * the serialize compare).
45
+ */
46
+ export declare function diffHistorySnapshots<L extends {
47
+ featureIds: string[];
48
+ }>(before: HistoryFeatureMap, after: HistoryFeatureMap, beforeLayers: Map<string, L>, afterLayers: Map<string, L>): {
49
+ featureIds: Set<string>;
50
+ layerIds: Set<string>;
51
+ };
52
+ //# sourceMappingURL=history-diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/history-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;AAEhH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CAQ1F;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,EACrE,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,iBAAiB,EACxB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAC1B;IAAE,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAgCpD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Lazily-rebuilt flat id index over the read-only feature store
3
+ * (`Map<layerId, Feature[]>`). A linear scan per lookup is O(features), and
4
+ * selection paths look up one id at a time — with a 40k-feature bulk layer
5
+ * that made every large selection O(ids × features).
6
+ *
7
+ * Staleness is detected by reference: every mutation of the store replaces
8
+ * the per-layer array (copy-on-write), so comparing array identities per
9
+ * layer is enough. Keep mutations copy-on-write — an in-place push into a
10
+ * stored array would go unnoticed here.
11
+ */
12
+ export interface ReadOnlyFeatureIndex {
13
+ /** Snapshot of the store's per-layer array references at build time. */
14
+ sources: Map<string, GeoJSON.Feature[]>;
15
+ /** Flat id → feature lookup. First layer wins on duplicate ids. */
16
+ byId: Map<string, GeoJSON.Feature>;
17
+ }
18
+ /** Whether a cached index still reflects the store (per-layer array identity). */
19
+ export declare function isReadOnlyIndexCurrent(cached: ReadOnlyFeatureIndex | null, store: Map<string, GeoJSON.Feature[]>): cached is ReadOnlyFeatureIndex;
20
+ /**
21
+ * Build the flat index. First layer wins on duplicate ids, matching the
22
+ * semantics of the linear scan this replaces. Features without an id are
23
+ * skipped.
24
+ */
25
+ export declare function buildReadOnlyFeatureIndex(store: Map<string, GeoJSON.Feature[]>): ReadOnlyFeatureIndex;
26
+ //# sourceMappingURL=read-only-feature-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-only-feature-index.d.ts","sourceRoot":"","sources":["../../../client/src/lib/read-only-feature-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxC,mEAAmE;IACnE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,oBAAoB,GAAG,IAAI,EACnC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,GACpC,MAAM,IAAI,oBAAoB,CAOhC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAUrG"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Cheap visible-feature counting for the auto-label threshold and the status
3
+ * text. Replaces whole-viewport `queryRenderedFeatures(undefined, ...)`
4
+ * calls — those deserialize every rendered feature from the vector tiles
5
+ * (hundreds of ms with a 40k-point layer) and used to run after every source
6
+ * sync AND every pan stop. A bounds test over the feature stores is ~1ms and
7
+ * needs no idle wait.
8
+ */
9
+ /** Viewport bounds as returned by maplibre's `getBounds()` accessors. */
10
+ export interface ViewBounds {
11
+ west: number;
12
+ east: number;
13
+ south: number;
14
+ north: number;
15
+ }
16
+ export interface CountOptions {
17
+ /**
18
+ * Counting stops at `threshold + 1`: callers only compare the result
19
+ * against the threshold, and the queryRenderedFeatures implementations
20
+ * this replaces already early-broke there.
21
+ */
22
+ threshold: number;
23
+ /** Timeline visibility filter — features whose id is absent are skipped. */
24
+ visibleSet?: Set<string> | null;
25
+ }
26
+ /**
27
+ * Count features whose Point geometry falls inside `bounds`, stopping once
28
+ * the count exceeds `threshold`. Longitudes are tested at ±360° too, since
29
+ * maplibre bounds can extend past the antimeridian. Non-point geometries
30
+ * count unconditionally — they are few (hand-drawn shapes) and over-counting
31
+ * only keeps auto-labels off.
32
+ */
33
+ export declare function countFeaturesInBounds(featureGroups: readonly GeoJSON.Feature[][], bounds: ViewBounds, options: CountOptions): number;
34
+ //# sourceMappingURL=visible-feature-count.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visible-feature-count.d.ts","sourceRoot":"","sources":["../../../client/src/lib/visible-feature-count.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,EAAE,EAC3C,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,YAAY,GACpB,MAAM,CA2BR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octostar/map-component",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "description": "MapLibre-based map editor component",