@tileflow/interactions 0.1.0-alpha.5 → 0.1.0-alpha.7

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/README.md CHANGED
@@ -114,6 +114,3 @@ Direct MapLibre consumers can use `createTileflowMapLibreDomRuntime` for annotat
114
114
  objects and schedulers are injected at attach time, so both subpath imports remain SSR-safe.
115
115
  `createTileflowMapLibreInteractionCoordinator` joins them around one controlled or uncontrolled
116
116
  popup state and commits the closing runtime before the opening runtime.
117
-
118
- See [`docs/contracts/map-interactions.md`](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/map-interactions.md) for lifecycle,
119
- accessibility, security, capture, and framework parity requirements.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TileflowInteractionState, a as TileflowInteractionAction, b as TileflowInteractionTargetRef } from './validation-Cy6Tz3lz.js';
2
- export { c as TileflowAnnotation, d as TileflowAnnotationInteractionEvent, e as TileflowAnnotationMarker, f as TileflowAnnotationSurface, g as TileflowAnnotationValidationResult, h as TileflowAnnotationViewContext, i as TileflowInteractionBinding, j as TileflowInteractionBindingValidationResult, k as TileflowInteractionContent, l as TileflowInteractionCoordinate, m as TileflowInteractionDiagnostic, n as TileflowInteractionDiagnosticCode, o as TileflowInteractionEvent, p as TileflowInteractionEventType, q as TileflowInteractionFieldContent, r as TileflowInteractionInputModality, s as TileflowInteractionJsonPrimitive, t as TileflowInteractionJsonValue, u as TileflowInteractionTarget, v as TileflowInteractionTextContent, w as TileflowInteractionViewContent, x as TileflowInteractionViewContext, y as TileflowPoiCategory, z as TileflowPoiFilterRank, A as TileflowPoiProperties, B as TileflowPoiSizeRank, C as TileflowResolvedAnnotationTarget, D as TileflowResolvedInteractionTarget, E as TileflowResolvedMapTarget, F as TileflowResolvedPoiFeature, G as TileflowResolvedPoiFeatureTarget, H as TileflowResolvedSemanticFeature, I as TileflowResolvedSemanticFeatureTarget, J as TileflowResolvedStyleFeatureTarget, K as tileflowAnnotationSchema, L as tileflowAnnotationsSchema, M as tileflowInteractionActionSchema, N as tileflowInteractionBindingSchema, O as tileflowInteractionBindingsSchema, P as tileflowInteractionContentSchema, Q as tileflowInteractionJsonValueSchema, R as tileflowInteractionLimits, S as tileflowInteractionSchemaVersion, U as tileflowInteractionStateSchema, V as tileflowInteractionTargetRefSchema, W as tileflowInteractionTargetSchema, X as tileflowPoiCategories, Y as validateTileflowAnnotations, Z as validateTileflowInteractionBindings } from './validation-Cy6Tz3lz.js';
1
+ import { T as TileflowInteractionState, a as TileflowInteractionAction, b as TileflowInteractionTargetRef } from './validation-D9zTgzna.js';
2
+ export { c as TileflowAnnotation, d as TileflowAnnotationInteractionEvent, e as TileflowAnnotationMarker, f as TileflowAnnotationSurface, g as TileflowAnnotationValidationResult, h as TileflowAnnotationViewContext, i as TileflowInteractionBinding, j as TileflowInteractionBindingValidationResult, k as TileflowInteractionContent, l as TileflowInteractionCoordinate, m as TileflowInteractionDiagnostic, n as TileflowInteractionDiagnosticCode, o as TileflowInteractionEvent, p as TileflowInteractionEventType, q as TileflowInteractionFieldContent, r as TileflowInteractionInputModality, s as TileflowInteractionJsonPrimitive, t as TileflowInteractionJsonValue, u as TileflowInteractionTarget, v as TileflowInteractionTextContent, w as TileflowInteractionViewContent, x as TileflowInteractionViewContext, y as TileflowPoiCategory, z as TileflowPoiFilterRank, A as TileflowPoiProperties, B as TileflowPoiSizeRank, C as TileflowResolvedAnnotationTarget, D as TileflowResolvedInteractionTarget, E as TileflowResolvedMapTarget, F as TileflowResolvedPoiFeature, G as TileflowResolvedPoiFeatureTarget, H as TileflowResolvedSemanticFeature, I as TileflowResolvedSemanticFeatureTarget, J as TileflowResolvedStyleFeatureTarget, K as tileflowAnnotationSchema, L as tileflowAnnotationsSchema, M as tileflowInteractionActionSchema, N as tileflowInteractionBindingSchema, O as tileflowInteractionBindingsSchema, P as tileflowInteractionContentSchema, Q as tileflowInteractionJsonValueSchema, R as tileflowInteractionLimits, S as tileflowInteractionSchemaVersion, U as tileflowInteractionStateSchema, V as tileflowInteractionTargetRefSchema, W as tileflowInteractionTargetSchema, X as tileflowPoiCategories, Y as validateTileflowAnnotations, Z as validateTileflowInteractionBindings } from './validation-D9zTgzna.js';
3
3
  import 'zod/mini';
4
4
 
5
5
  declare const initialTileflowInteractionState: TileflowInteractionState;
@@ -1,4 +1,4 @@
1
- import { m as TileflowInteractionDiagnostic, T as TileflowInteractionState, c as TileflowAnnotation, d as TileflowAnnotationInteractionEvent, i as TileflowInteractionBinding, G as TileflowResolvedPoiFeatureTarget, r as TileflowInteractionInputModality, o as TileflowInteractionEvent, I as TileflowResolvedSemanticFeatureTarget, k as TileflowInteractionContent } from './validation-Cy6Tz3lz.js';
1
+ import { m as TileflowInteractionDiagnostic, T as TileflowInteractionState, c as TileflowAnnotation, d as TileflowAnnotationInteractionEvent, i as TileflowInteractionBinding, G as TileflowResolvedPoiFeatureTarget, r as TileflowInteractionInputModality, o as TileflowInteractionEvent, I as TileflowResolvedSemanticFeatureTarget, k as TileflowInteractionContent } from './validation-D9zTgzna.js';
2
2
  import 'zod/mini';
3
3
 
4
4
  /**
@@ -195,6 +195,11 @@ type TileflowMapLibrePoiPointerEvent = Readonly<{
195
195
  point: unknown;
196
196
  }>;
197
197
  type TileflowMapLibrePoiMap = Readonly<{
198
+ /** A style layer's source; lets the controller keep its manifest while the style only restyles. */
199
+ getLayer?: (id: string) => Readonly<{
200
+ source?: unknown;
201
+ sourceLayer?: unknown;
202
+ }> | undefined;
198
203
  getStyle: () => unknown;
199
204
  off?: (event: string, listener: (event: unknown) => void) => unknown;
200
205
  on: (event: string, listener: (event: unknown) => void) => Readonly<{
@@ -1804,6 +1804,11 @@ function createTileflowMapLibrePoiController(options) {
1804
1804
  }
1805
1805
  options.onActivate?.(match, modality);
1806
1806
  };
1807
+ let loaded;
1808
+ const sourcesOf = (layers) => options.map.getLayer ? layers.map(({ layerId }) => {
1809
+ const layer = options.map.getLayer(layerId);
1810
+ return layer ? `${String(layer.source)}/${String(layer.sourceLayer)}` : "";
1811
+ }).join("\n") : void 0;
1807
1812
  const refreshManifest = () => {
1808
1813
  if (disposed) return;
1809
1814
  setHovered(null, "programmatic");
@@ -1812,6 +1817,12 @@ function createTileflowMapLibrePoiController(options) {
1812
1817
  options.onManifestChange?.(true);
1813
1818
  return;
1814
1819
  }
1820
+ if (loaded && sourcesOf(loaded.manifest.layers) === loaded.sources) {
1821
+ manifest = loaded.manifest;
1822
+ options.onManifestChange?.(true);
1823
+ return;
1824
+ }
1825
+ loaded = void 0;
1815
1826
  const style = options.map.getStyle();
1816
1827
  if (style === void 0) {
1817
1828
  manifest = null;
@@ -1819,6 +1830,8 @@ function createTileflowMapLibrePoiController(options) {
1819
1830
  return;
1820
1831
  }
1821
1832
  manifest = parsePoiManifest(style, options.onDiagnostic);
1833
+ const sources = manifest ? sourcesOf(manifest.layers) : void 0;
1834
+ if (manifest && sources !== void 0) loaded = { manifest, sources };
1822
1835
  options.onManifestChange?.(manifest !== null);
1823
1836
  };
1824
1837
  let manifestRefreshScheduled = false;
@@ -1833,6 +1846,7 @@ function createTileflowMapLibrePoiController(options) {
1833
1846
  };
1834
1847
  const handleStyleLoad = () => {
1835
1848
  manifestRefreshScheduled = false;
1849
+ loaded = void 0;
1836
1850
  refreshManifest();
1837
1851
  };
1838
1852
  try {
@@ -427,10 +427,10 @@ declare const tileflowInteractionTargetRefSchema: z.ZodMiniDiscriminatedUnion<[z
427
427
  kind: z.ZodMiniLiteral<"annotation">;
428
428
  }, z.core.$strict>, z.ZodMiniObject<{
429
429
  domain: z.ZodMiniString<string>;
430
- featureId: z.ZodMiniUnion<readonly [z.ZodMiniNumberFormat, z.ZodMiniString<string>]>;
430
+ featureId: z.ZodMiniUnion<readonly [z.ZodMiniInt, z.ZodMiniString<string>]>;
431
431
  kind: z.ZodMiniLiteral<"semantic-feature">;
432
432
  }, z.core.$strict>, z.ZodMiniObject<{
433
- featureId: z.ZodMiniUnion<readonly [z.ZodMiniNumberFormat, z.ZodMiniString<string>]>;
433
+ featureId: z.ZodMiniUnion<readonly [z.ZodMiniInt, z.ZodMiniString<string>]>;
434
434
  kind: z.ZodMiniLiteral<"style-feature">;
435
435
  layerId: z.ZodMiniString<string>;
436
436
  }, z.core.$strict>, z.ZodMiniObject<{
@@ -443,10 +443,10 @@ declare const tileflowInteractionStateSchema: z.ZodMiniObject<{
443
443
  kind: z.ZodMiniLiteral<"annotation">;
444
444
  }, z.core.$strict>, z.ZodMiniObject<{
445
445
  domain: z.ZodMiniString<string>;
446
- featureId: z.ZodMiniUnion<readonly [z.ZodMiniNumberFormat, z.ZodMiniString<string>]>;
446
+ featureId: z.ZodMiniUnion<readonly [z.ZodMiniInt, z.ZodMiniString<string>]>;
447
447
  kind: z.ZodMiniLiteral<"semantic-feature">;
448
448
  }, z.core.$strict>, z.ZodMiniObject<{
449
- featureId: z.ZodMiniUnion<readonly [z.ZodMiniNumberFormat, z.ZodMiniString<string>]>;
449
+ featureId: z.ZodMiniUnion<readonly [z.ZodMiniInt, z.ZodMiniString<string>]>;
450
450
  kind: z.ZodMiniLiteral<"style-feature">;
451
451
  layerId: z.ZodMiniString<string>;
452
452
  }, z.core.$strict>, z.ZodMiniObject<{
@@ -460,10 +460,10 @@ declare const tileflowInteractionActionSchema: z.ZodMiniDiscriminatedUnion<[z.Zo
460
460
  kind: z.ZodMiniLiteral<"annotation">;
461
461
  }, z.core.$strict>, z.ZodMiniObject<{
462
462
  domain: z.ZodMiniString<string>;
463
- featureId: z.ZodMiniUnion<readonly [z.ZodMiniNumberFormat, z.ZodMiniString<string>]>;
463
+ featureId: z.ZodMiniUnion<readonly [z.ZodMiniInt, z.ZodMiniString<string>]>;
464
464
  kind: z.ZodMiniLiteral<"semantic-feature">;
465
465
  }, z.core.$strict>, z.ZodMiniObject<{
466
- featureId: z.ZodMiniUnion<readonly [z.ZodMiniNumberFormat, z.ZodMiniString<string>]>;
466
+ featureId: z.ZodMiniUnion<readonly [z.ZodMiniInt, z.ZodMiniString<string>]>;
467
467
  kind: z.ZodMiniLiteral<"style-feature">;
468
468
  layerId: z.ZodMiniString<string>;
469
469
  }, z.core.$strict>, z.ZodMiniObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/interactions",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Portable annotation and interaction contracts for Tileflow maps.",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "zod": "^4.4.3"
46
+ "zod": "^4.6.7"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "maplibre-gl": ">=6.4.1 <7"