@orbat-mapper/tactical-draw-adapter-maplibre 0.2.0-alpha.21 → 0.2.0-alpha.22

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.d.mts CHANGED
@@ -17,7 +17,16 @@ interface MapLibreGroupBundle {
17
17
  readonly sourceId: string;
18
18
  readonly layerIds: Map<PaintChannel, string>;
19
19
  features: readonly Feature[];
20
- featureSignature: string;
20
+ /** Unset while the stored value describes older features than `features` holds. */
21
+ featureSignature: string | undefined;
22
+ /**
23
+ * Last `FeatureGroup.revision` seen for this bundle, when the producer
24
+ * supplied one. Two consecutive groups with the same `revision` are known
25
+ * to carry byte-identical `features`, so it stands in for `featureSignature`
26
+ * without paying to re-stringify the whole group. A missing revision on
27
+ * either side falls back to the signature comparison — see `applyFeatureGroups`.
28
+ */
29
+ revision?: number;
21
30
  requiredIconIds: ReadonlySet<string>;
22
31
  }
23
32
  type MapLibreEventToken = (e: any) => void;
package/dist/index.mjs CHANGED
@@ -800,12 +800,19 @@ var MapLibreAdapter = class extends BaseMapAdapter {
800
800
  bundle = this.createGroupBundle(layerId, handle);
801
801
  handle.groupBundles.set(group.id, bundle);
802
802
  }
803
- const featureSignature = JSON.stringify(group.features);
804
- const contentChanged = isNewBundle || bundle.featureSignature !== featureSignature;
803
+ let contentChanged;
804
+ if (!isNewBundle && bundle.revision !== void 0 && group.revision !== void 0) {
805
+ contentChanged = bundle.revision !== group.revision;
806
+ if (contentChanged) bundle.featureSignature = void 0;
807
+ } else {
808
+ const featureSignature = JSON.stringify(group.features);
809
+ contentChanged = isNewBundle || bundle.featureSignature !== featureSignature;
810
+ bundle.featureSignature = featureSignature;
811
+ }
805
812
  const requiredIconIds = this.requiredIconIds(group);
806
813
  const resourcesChanged = bundle.requiredIconIds.size !== requiredIconIds.size || [...bundle.requiredIconIds].some((id) => !requiredIconIds.has(id));
807
814
  bundle.features = group.features;
808
- bundle.featureSignature = featureSignature;
815
+ bundle.revision = group.revision;
809
816
  bundle.requiredIconIds = requiredIconIds;
810
817
  if (this.reconcileGroupChannels(handle, bundle, groupPaintChannels(group.features, handle.style))) bundlesNeedingOrder.add(group.id);
811
818
  if (contentChanged || resourcesChanged) this.updateGroupBundleSource(bundle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw-adapter-maplibre",
3
- "version": "0.2.0-alpha.21",
3
+ "version": "0.2.0-alpha.22",
4
4
  "description": "MapLibre GL JS engine adapter for @orbat-mapper/tactical-draw. Draw and edit tactical control measures (MIL-STD-2525 / APP-6) on a MapLibre map.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@orbat-mapper/control-measures": "^0.2.0-alpha.26",
41
- "@orbat-mapper/tactical-draw": "^0.2.0-alpha.36"
41
+ "@orbat-mapper/tactical-draw": "^0.2.0-alpha.38"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "maplibre-gl": ">=5.8.0 <6.0.0"