@urban-toolkit/autk-grammar 0.1.2 → 0.1.3

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/main.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UrbanSpec } from '@urban-toolkit/the-urban-grammar';
2
2
  import { FeatureCollection } from 'geojson';
3
- import { Targets } from './types';
3
+ import { Targets, GrammarEventEmitter } from './types';
4
4
  export declare class AutkGrammar {
5
5
  private dataAdapter?;
6
6
  private mapAdapter?;
@@ -9,6 +9,11 @@ export declare class AutkGrammar {
9
9
  private grammarEngine?;
10
10
  private _computeCache;
11
11
  private _data;
12
+ private _mapRegistry;
13
+ private _plotRegistry;
14
+ private _fwdCleanups;
15
+ private _plotMapLinks;
16
+ readonly interactions: GrammarEventEmitter;
12
17
  constructor(targets?: Targets);
13
18
  /**
14
19
  * The coordinate reference system used internally by the autk workspace.
@@ -21,4 +26,25 @@ export declare class AutkGrammar {
21
26
  get workspaceCrs(): string;
22
27
  get data(): Record<string, Promise<FeatureCollection>>;
23
28
  run(spec: UrbanSpec): Promise<void>;
29
+ /**
30
+ * Highlights features on the map layer identified by `layerId`.
31
+ * If that layer is linked to a plot via `mapRef`, the plot selection is updated too.
32
+ */
33
+ highlightOnMap(layerId: string, featureIds: number[]): void;
34
+ /**
35
+ * Clears highlighted features on the map layer identified by `layerId`.
36
+ * If that layer is linked to a plot via `mapRef`, the plot selection is cleared too.
37
+ */
38
+ clearHighlightOnMap(layerId: string): void;
39
+ /**
40
+ * Clears the selection on the plot identified by `plotId` (its dataRef).
41
+ * If that plot is linked to a map via `mapRef`, the map highlight is cleared too.
42
+ */
43
+ clearHighlightOnPlot(plotId: string): void;
44
+ /**
45
+ * Applies a selection to the plot identified by `plotId` (its dataRef).
46
+ * If that plot is linked to a map via `mapRef`, the map highlight is updated too.
47
+ */
48
+ setPlotSelection(plotId: string, featureIds: number[]): void;
49
+ private _rewireInteractions;
24
50
  }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { UrbanSpec } from '@urban-toolkit/the-urban-grammar';
2
2
  import { AutkMap } from '@urban-toolkit/autk-map';
3
+ import { AutkPlot } from '@urban-toolkit/autk-plot';
3
4
  import { FeatureCollection } from 'geojson';
4
5
  export type Targets = {
5
6
  compute?: string;
@@ -8,7 +9,28 @@ export type Targets = {
8
9
  plot?: string;
9
10
  };
10
11
  export type MapRegistry = Map<string, AutkMap>;
12
+ export type PlotRegistry = Map<string, AutkPlot>;
13
+ export type PlotMapLinks = Map<string, string>;
11
14
  export type GeoJsonCache = Map<string, FeatureCollection>;
12
15
  export type ComputeCache = Map<string, FeatureCollection>;
13
16
  export type AutkGrammarSpec = UrbanSpec;
17
+ export interface GrammarPickingEvent {
18
+ layerId: string;
19
+ selection: number[];
20
+ }
21
+ export interface GrammarPlotSelectionEvent {
22
+ plotId: string;
23
+ event: 'click' | 'brush' | 'brushX' | 'brushY';
24
+ selection: number[];
25
+ }
26
+ export type GrammarEventRecord = {
27
+ 'map:picking': GrammarPickingEvent;
28
+ 'plot:selection': GrammarPlotSelectionEvent;
29
+ };
30
+ export declare class GrammarEventEmitter {
31
+ private _listeners;
32
+ on<K extends keyof GrammarEventRecord>(event: K, listener: (payload: GrammarEventRecord[K]) => void): () => void;
33
+ /** @internal */
34
+ emit<K extends keyof GrammarEventRecord>(event: K, payload: GrammarEventRecord[K]): void;
35
+ }
14
36
  export { ColorMapInterpolator, NormalizationMode } from '@urban-toolkit/the-urban-grammar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urban-toolkit/autk-grammar",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Autark adapter for the urban grammar",
5
5
  "license": "MIT",
6
6
  "author": "Gustavo Moreira",