@bluehalo/ngx-leaflet-d3 21.0.0

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/CHANGES.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ ## 21.0.0
4
+ - Angular 21
5
+ - Migrated package to `@bluehalo/ngx-leaflet-d3` namespace (previously `@asymmetrik/ngx-leaflet-d3`)
6
+ - Updated peer dependency `@asymmetrik/ngx-leaflet` → `@bluehalo/ngx-leaflet@21`
7
+ - Updated peer dependency `@asymmetrik/leaflet-d3` → `@bluehalo/leaflet-d3@6`
8
+ - Converted directives to standalone (`LeafletHexbinDirective`, `LeafletPingDirective`)
9
+ - Fix: replace deprecated `Observable.create()` with `new Observable()`
10
+ - CI: replace Travis CI with GitHub Actions
11
+
12
+ ## 14.0.0
13
+ - Angular 14
14
+
15
+ ## 13.0.0
16
+ - Angular 13
17
+ - D3 7.x
18
+
19
+ ## 6.0.0
20
+ - Angular 10
21
+
22
+ ## 4.0.0
23
+ - Angular 8
24
+
25
+ ## 3.0.0
26
+ - Angular 7 support
27
+ - D3 5.x support
28
+ - Started using the HtmlWebpackPlugin to generate the index.html file in the dist dir, so you don't need to add `/src/demo` to the end of the URL to hit the demo.
29
+ - Migrated to npm scripts from gulp for build system
30
+ - Upgrade to Webpack 4.x for demo
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2007-2022 Asymmetrik Ltd, a BlueHalo Company
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # @bluehalo/ngx-leaflet-d3
2
+
3
+ [![CI](https://github.com/bluehalo/ngx-leaflet-d3/actions/workflows/ci.yml/badge.svg)](https://github.com/bluehalo/ngx-leaflet-d3/actions/workflows/ci.yml)
4
+
5
+ > [@bluehalo/leaflet-d3](https://github.com/bluehalo/leaflet-d3) extension to the [@bluehalo/ngx-leaflet](https://github.com/bluehalo/ngx-leaflet) package for Angular.
6
+ > Provides D3 visualization layer integration (hexbins, pings) into Angular projects.
7
+ > Compatible with Leaflet v1.x, @bluehalo/leaflet-d3 v6.x, and D3 v7.x
8
+
9
+ > Supports Angular v21 with standalone directives
10
+
11
+ ## Table of Contents
12
+ - [Install](#install)
13
+ - [Usage](#usage)
14
+ - [API](#api)
15
+ - [Contribute](#contribute)
16
+ - [License](#license)
17
+ - [Credits](#credits)
18
+
19
+
20
+ ## Install
21
+ Install the package and its peer dependencies via npm:
22
+ ```
23
+ npm install d3 d3-hexbin leaflet @bluehalo/leaflet-d3 @bluehalo/ngx-leaflet @bluehalo/ngx-leaflet-d3
24
+ ```
25
+
26
+ If you intend to use this library in a typescript project (utilizing the typings), you will need to also install the leaflet typings via npm:
27
+ ```
28
+ npm install @types/d3 @types/leaflet
29
+ ```
30
+
31
+ If you want to run the demo, clone the repository, perform an ```npm install```, ```npm run demo``` and then go to http://localhost:4200
32
+
33
+
34
+ ## Usage
35
+ This plugin is used with the [Angular.io Leaflet plugin](https://github.com/bluehalo/ngx-leaflet).
36
+
37
+ ### Hexbins
38
+ Hexbins allow you to aggregate data into bins with a hexagon geometry.
39
+ The hexbin layer allows you to bind characteristics of the bound data to both the size and color of the drawn bin within the bin grid element.
40
+
41
+ #### Styling
42
+ You'll want to style the hexbins at least with a stroke size/color.
43
+
44
+ ```
45
+ .hexbin-hexagon {
46
+ stroke: #000;
47
+ stroke-width: .5px;
48
+ }
49
+ ```
50
+
51
+ #### Basic Example
52
+ To create a hexbin layer on a map, use the ```leafletHexbin``` attribute directive. This directive must appear after the ```leaflet``` directive.
53
+ This attribute directive also acts as an input binding for the hexbin data array.
54
+
55
+ ```html
56
+ <div leaflet style="height: 300px;"
57
+ [leafletOptions]="options"
58
+ [leafletHexbin]="hexbinData">
59
+ </div>
60
+ ```
61
+
62
+ ```js
63
+ hexbinData: [ number, number ][] = [...];
64
+ ```
65
+
66
+ #### Multiple Hexbin Layers on the Same Map
67
+ You can also draw multiple hexbin layers on the same map (see the demo example).
68
+ In this case, you'd want to have multiple hexbin options so you can set the colors (or sizes) differently.
69
+ All you need to do is bound the ```leafletHexbin``` directive to a child div of the div with the ```leaflet``` directive.
70
+
71
+ ```html
72
+ <div leaflet style="height: 300px;"
73
+ [leafletOptions]="options">
74
+
75
+ <div [leafletHexbin]="hexbinData1" [leafletHexbinOptions]="hexbinOptions1"></div>
76
+ <div [leafletHexbin]="hexbinData2" [leafletHexbinOptions]="hexbinOptions2"></div>
77
+
78
+ </div>
79
+ ```
80
+
81
+ ```js
82
+ hexbinOptions1: L.HexbinLayerConfig = { radius: 12, radiusRange: [ 4, 11 ], colorRange: [ 'white', 'tomato' ] };
83
+ hexbinOptions2: L.HexbinLayerConfig = { radius: 12, radiusRange: [ 4, 11 ], colorRange: [ 'white', 'steelblue' ] };
84
+
85
+ hexbinData1: [ number, number ][] = [...];
86
+ hexbinData2: [ number, number ][] = [...];
87
+ ```
88
+
89
+ > It's important to note that for performance reasons, we're keeping all change detection strategies default.
90
+ > This means that all bound data structures must be treated as immutable.
91
+ > For changes to be detected, instance equality must change.
92
+
93
+ See the README for @bluehalo/leaflet-d3 for details regarding the default options and default data schema.
94
+
95
+
96
+ ### Pings
97
+ To create a ping layer on a map, use the ```leafletPing``` attribute directive. This directive must appear after the ```leaflet``` directive.
98
+
99
+ ```html
100
+ <div leaflet style="height: 300px;"
101
+ [leafletOptions]="options"
102
+ leafletPing
103
+ (leafletPingObserver)="setLeafletPingObserver($event)">
104
+ </div>
105
+ ```
106
+
107
+ The output binding for ```leafletPingObserver``` provides an Rxjs Observer that you will use to emit ping objects to the directive.
108
+
109
+
110
+ ## API
111
+ This section includes more detailed documentation of the functionality of the directives included in this library.
112
+
113
+ ### Hexbins
114
+ There are several input and output bindings for the hexbin layer.
115
+ They are documented and demonstrated below.
116
+
117
+ ```html
118
+ <div leaflet style="height: 300px;"
119
+ [leafletOptions]="options"
120
+ [leafletHexbin]="hexbinData"
121
+ [leafletHexbinOptions]="hexbinOptions"
122
+ (leafletHexbinMouseover)="mouseover($event)"
123
+ (leafletHexbinMouseout)="mouseout($event)"
124
+ (leafletHexbinClick)="click($event)"
125
+ (leafletHexbinLayerReady)="ready($event)">
126
+ </div>
127
+ ```
128
+
129
+ #### leafletHexbin
130
+ Input binding for the data array that is aggregated by the hexbins.
131
+
132
+ #### leafletHexbinOptions
133
+ Input binding for hexbin options (see [Leaflet D3's](https://github.com/bluehalo/leaflet-d3) docs).
134
+ This allows you to set some basic settings for the hexbin layer.
135
+
136
+ #### leafletHexbinMouseover
137
+ Event emitter/output binding for hexbin mouseover event (see [Leaflet D3's](https://github.com/bluehalo/leaflet-d3) docs).
138
+ This event is fired when the mouse hovers over a hexbin.
139
+
140
+ #### leafletHexbinMouseout
141
+ Event emitter/output binding for hexbin mouseout event (see [Leaflet D3's](https://github.com/bluehalo/leaflet-d3) docs).
142
+ This event is fired when the mouse leaves a hexbin.
143
+
144
+ #### leafletHexbinClick
145
+ Event emitter/output binding for hexbin click event (see [Leaflet D3's](https://github.com/bluehalo/leaflet-d3) docs).
146
+ This event is fired when the mouse clicks on a hexbin.
147
+
148
+ #### leafletHexbinLayerReady
149
+ Event emitter/output binding for hexbin layer ready event.
150
+ This event is emitted after the hexbin layer has been created and includes a reference to the layer.
151
+ This provides an opportunity to do any advanced configuration not already supported by the directive.
152
+
153
+
154
+ ### Pings
155
+ There is an input binding and an output binding for the ping layer.
156
+ They are documented and demonstrated below.
157
+
158
+ ```html
159
+ <div leaflet style="height: 300px;"
160
+ [leafletOptions]="options"
161
+ leafletPing
162
+ [leafletPingOptions]="pingOptions"
163
+ (leafletPingObserver)="setLeafletPingObserver($event)">
164
+ </div>
165
+ ```
166
+
167
+ #### leafletPing
168
+ This is the directive attribute that activates the directive.
169
+
170
+ #### leafletPingOptions
171
+ Input binding for the leaflet ping layer options (see [Leaflet D3's](https://github.com/bluehalo/leaflet-d3) docs).
172
+
173
+ #### leafletPingObserver
174
+ Event emitter/output binding for ping layer observer.
175
+ The observer is how pings are emitted to the layer.
176
+
177
+ ```js
178
+ setLeafletPingObserver(observer: Observer<any>) {
179
+
180
+ this.leafletPingObserver = observer;
181
+
182
+ // Start the ping loop
183
+ setTimeout(this.generatePings.bind(this), 100);
184
+
185
+ }
186
+
187
+ private generatePings() {
188
+
189
+ this.leafletPingObserver.next({
190
+ data: [ 40, 50 ] // [ lng, lat ]
191
+ });
192
+
193
+ setTimeout(this.generatePings.bind(this), 100);
194
+ }
195
+ ```
196
+
197
+ The data schema for pings is:
198
+ ```js
199
+ leafletPingObserver.next(pingData: LeafletPingEvent)
200
+
201
+ class LeafletPingEvent {
202
+ data: [lng, lat];
203
+ cssClass?: string;
204
+ }
205
+ ```
206
+
207
+
208
+ ## Contribute
209
+ PRs accepted. Please make contributions on feature branches and open a pull request against ```master```.
210
+
211
+
212
+ ## License
213
+ See LICENSE in repository for details.
214
+
215
+
216
+ ## Credits
217
+ **[Leaflet](http://leafletjs.com/)** Is an awesome mapping package.
218
+ **[D3](https://d3js.org)** Is an awesome visualization kernel.
@@ -0,0 +1,175 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Output, Input, Directive, NgModule } from '@angular/core';
3
+ import * as L from 'leaflet';
4
+ import '@bluehalo/leaflet-d3';
5
+ import * as i1 from '@bluehalo/ngx-leaflet';
6
+ import { LeafletDirectiveWrapper } from '@bluehalo/ngx-leaflet';
7
+ import { Observable } from 'rxjs';
8
+
9
+ class LeafletHexbinDirective {
10
+ constructor(leafletDirective, zone) {
11
+ this.zone = zone;
12
+ // Hexbin data binding
13
+ this.hexbinData = [];
14
+ // Interaction events
15
+ this.hexbinMouseover = new EventEmitter();
16
+ this.hexbinMouseout = new EventEmitter();
17
+ this.hexbinClick = new EventEmitter();
18
+ // Fired when the layer is created
19
+ this.layerReady = new EventEmitter();
20
+ this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
21
+ }
22
+ ngOnInit() {
23
+ this.leafletDirective.init();
24
+ const map = this.leafletDirective.getMap();
25
+ this.zone.runOutsideAngular(() => {
26
+ this.hexbinLayer = L.hexbinLayer(this.hexbinOptions);
27
+ });
28
+ // Fire the ready event
29
+ this.layerReady.emit(this.hexbinLayer);
30
+ // register for the hexbin events
31
+ this.hexbinLayer.dispatch().on('mouseover', (event, data) => {
32
+ this.zone.run(() => {
33
+ this.hexbinMouseover.emit({ event, data });
34
+ });
35
+ });
36
+ this.hexbinLayer.dispatch().on('mouseout', (event, data) => {
37
+ this.zone.run(() => {
38
+ this.hexbinMouseout.emit({ event, data });
39
+ });
40
+ });
41
+ this.hexbinLayer.dispatch().on('click', (event, data) => {
42
+ this.zone.run(() => {
43
+ this.hexbinClick.emit({ event, data });
44
+ });
45
+ });
46
+ this.hexbinLayer.addTo(map);
47
+ // Initialize the data (in case the data was set before the directive was initialized)
48
+ this.setHexbinData(this.hexbinData);
49
+ }
50
+ ngOnChanges(changes) {
51
+ // Set the new data
52
+ if (changes['hexbinData']) {
53
+ this.setHexbinData(changes['hexbinData'].currentValue);
54
+ }
55
+ }
56
+ setHexbinData(data) {
57
+ // Only if there is a hexbinLayer do we apply the data
58
+ if (null != this.hexbinLayer) {
59
+ this.zone.runOutsideAngular(() => {
60
+ this.hexbinLayer.data(data);
61
+ });
62
+ }
63
+ }
64
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletHexbinDirective, deps: [{ token: i1.LeafletDirective }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
65
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.8", type: LeafletHexbinDirective, isStandalone: true, selector: "[leafletHexbin]", inputs: { hexbinData: ["leafletHexbin", "hexbinData"], hexbinOptions: ["leafletHexbinOptions", "hexbinOptions"] }, outputs: { hexbinMouseover: "leafletHexbinMouseover", hexbinMouseout: "leafletHexbinMouseout", hexbinClick: "leafletHexbinClick", layerReady: "leafletHexbinLayerReady" }, usesOnChanges: true, ngImport: i0 }); }
66
+ }
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletHexbinDirective, decorators: [{
68
+ type: Directive,
69
+ args: [{
70
+ selector: '[leafletHexbin]',
71
+ standalone: true
72
+ }]
73
+ }], ctorParameters: () => [{ type: i1.LeafletDirective }, { type: i0.NgZone }], propDecorators: { hexbinData: [{
74
+ type: Input,
75
+ args: ['leafletHexbin']
76
+ }], hexbinOptions: [{
77
+ type: Input,
78
+ args: ['leafletHexbinOptions']
79
+ }], hexbinMouseover: [{
80
+ type: Output,
81
+ args: ['leafletHexbinMouseover']
82
+ }], hexbinMouseout: [{
83
+ type: Output,
84
+ args: ['leafletHexbinMouseout']
85
+ }], hexbinClick: [{
86
+ type: Output,
87
+ args: ['leafletHexbinClick']
88
+ }], layerReady: [{
89
+ type: Output,
90
+ args: ['leafletHexbinLayerReady']
91
+ }] } });
92
+
93
+ class LeafletPingDirective {
94
+ constructor(leafletDirective, zone) {
95
+ this.zone = zone;
96
+ this.pingObserverReady = new EventEmitter();
97
+ this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
98
+ }
99
+ ngOnInit() {
100
+ this.leafletDirective.init();
101
+ const map = this.leafletDirective.getMap();
102
+ this.zone.runOutsideAngular(() => {
103
+ this.pingLayer = L.pingLayer(this.pingOptions).addTo(map);
104
+ // Handle incoming ping events
105
+ this.pingSource = new Observable((observer) => {
106
+ this.pingObserver = observer;
107
+ this.pingObserverReady.emit(this.pingObserver);
108
+ });
109
+ this.pingSource.subscribe((event) => {
110
+ if (null != event) {
111
+ this.ping(event.data, event.cssClass);
112
+ }
113
+ });
114
+ });
115
+ }
116
+ /**
117
+ * Submit a ping to the ping layer.
118
+ *
119
+ * @param data Contains the lat/lon information to generate the ping
120
+ * @param cssClass Optional parameter specifying the css class to apply to the ping
121
+ */
122
+ ping(data, cssClass) {
123
+ if (null != this.pingLayer) {
124
+ this.zone.runOutsideAngular(() => {
125
+ this.pingLayer.ping(data, cssClass);
126
+ });
127
+ }
128
+ }
129
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletPingDirective, deps: [{ token: i1.LeafletDirective }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
130
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.8", type: LeafletPingDirective, isStandalone: true, selector: "[leafletPing]", inputs: { pingOptions: ["leafletPingOptions", "pingOptions"] }, outputs: { pingObserverReady: "leafletPingObserver" }, ngImport: i0 }); }
131
+ }
132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletPingDirective, decorators: [{
133
+ type: Directive,
134
+ args: [{
135
+ selector: '[leafletPing]',
136
+ standalone: true
137
+ }]
138
+ }], ctorParameters: () => [{ type: i1.LeafletDirective }, { type: i0.NgZone }], propDecorators: { pingOptions: [{
139
+ type: Input,
140
+ args: ['leafletPingOptions']
141
+ }], pingObserverReady: [{
142
+ type: Output,
143
+ args: ['leafletPingObserver']
144
+ }] } });
145
+
146
+ class LeafletD3Module {
147
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletD3Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
148
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.8", ngImport: i0, type: LeafletD3Module, imports: [LeafletHexbinDirective,
149
+ LeafletPingDirective], exports: [LeafletHexbinDirective,
150
+ LeafletPingDirective] }); }
151
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletD3Module }); }
152
+ }
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LeafletD3Module, decorators: [{
154
+ type: NgModule,
155
+ args: [{
156
+ imports: [
157
+ LeafletHexbinDirective,
158
+ LeafletPingDirective
159
+ ],
160
+ exports: [
161
+ LeafletHexbinDirective,
162
+ LeafletPingDirective
163
+ ]
164
+ }]
165
+ }] });
166
+
167
+ class LeafletPingEvent {
168
+ }
169
+
170
+ /**
171
+ * Generated bundle index. Do not edit.
172
+ */
173
+
174
+ export { LeafletD3Module, LeafletHexbinDirective, LeafletPingDirective, LeafletPingEvent };
175
+ //# sourceMappingURL=bluehalo-ngx-leaflet-d3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bluehalo-ngx-leaflet-d3.mjs","sources":["../../../projects/ngx-leaflet-d3/src/lib/hexbin/leaflet-hexbin.directive.ts","../../../projects/ngx-leaflet-d3/src/lib/ping/leaflet-ping.directive.ts","../../../projects/ngx-leaflet-d3/src/lib/leaflet-d3.module.ts","../../../projects/ngx-leaflet-d3/src/lib/ping/leaflet-ping-event.model.ts","../../../projects/ngx-leaflet-d3/src/bluehalo-ngx-leaflet-d3.ts"],"sourcesContent":["import { Directive, EventEmitter, Input, NgZone, OnChanges, OnInit, Output, SimpleChange } from '@angular/core';\n\nimport * as L from 'leaflet';\nimport '@bluehalo/leaflet-d3';\n\nimport { LeafletDirective, LeafletDirectiveWrapper } from '@bluehalo/ngx-leaflet';\n\n\n@Directive({\n selector: '[leafletHexbin]',\n standalone: true\n})\nexport class LeafletHexbinDirective\n\timplements OnChanges, OnInit {\n\n\tleafletDirective: LeafletDirectiveWrapper;\n\thexbinLayer: L.HexbinLayer;\n\n\t// Hexbin data binding\n\t@Input('leafletHexbin') hexbinData: any[] = [];\n\n\t// Options binding\n\t@Input('leafletHexbinOptions') hexbinOptions: L.HexbinLayerConfig;\n\n\t// Interaction events\n\t@Output('leafletHexbinMouseover') hexbinMouseover: EventEmitter<any> = new EventEmitter<any>();\n\t@Output('leafletHexbinMouseout') hexbinMouseout: EventEmitter<any> = new EventEmitter<any>();\n\t@Output('leafletHexbinClick') hexbinClick: EventEmitter<any> = new EventEmitter<any>();\n\n\t// Fired when the layer is created\n\t@Output('leafletHexbinLayerReady') layerReady: EventEmitter<L.HexbinLayer> = new EventEmitter<L.HexbinLayer>();\n\n\tconstructor(leafletDirective: LeafletDirective, private zone: NgZone) {\n\t\tthis.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);\n\t}\n\n\tngOnInit() {\n\n\t\tthis.leafletDirective.init();\n\n\t\tconst map = this.leafletDirective.getMap();\n\n\t\tthis.zone.runOutsideAngular(() => {\n\t\t\tthis.hexbinLayer = L.hexbinLayer(this.hexbinOptions);\n\t\t});\n\n\t\t// Fire the ready event\n\t\tthis.layerReady.emit(this.hexbinLayer);\n\n\t\t// register for the hexbin events\n\t\tthis.hexbinLayer.dispatch().on('mouseover', (event: any, data: any) => {\n\t\t\tthis.zone.run(() => {\n\t\t\t\tthis.hexbinMouseover.emit({ event, data });\n\t\t\t});\n\n\t\t});\n\t\tthis.hexbinLayer.dispatch().on('mouseout', (event: any, data: any) => {\n\t\t\tthis.zone.run(() => {\n\t\t\t\tthis.hexbinMouseout.emit({ event, data });\n\t\t\t});\n\t\t});\n\t\tthis.hexbinLayer.dispatch().on('click', (event: any, data: any) => {\n\t\t\tthis.zone.run(() => {\n\t\t\t\tthis.hexbinClick.emit({ event, data });\n\t\t\t});\n\t\t});\n\n\t\tthis.hexbinLayer.addTo(map);\n\n\t\t// Initialize the data (in case the data was set before the directive was initialized)\n\t\tthis.setHexbinData(this.hexbinData);\n\n\t}\n\n\tngOnChanges(changes: { [key: string]: SimpleChange }) {\n\n\t\t// Set the new data\n\t\tif (changes['hexbinData']) {\n\t\t\tthis.setHexbinData(changes['hexbinData'].currentValue);\n\t\t}\n\n\t}\n\n\tprivate setHexbinData(data: any[]) {\n\n\t\t// Only if there is a hexbinLayer do we apply the data\n\t\tif (null != this.hexbinLayer) {\n\t\t\tthis.zone.runOutsideAngular(() => {\n\t\t\t\tthis.hexbinLayer.data(data);\n\t\t\t});\n\t\t}\n\n\t}\n}\n","import { Directive, EventEmitter, Input, NgZone, OnInit, Output } from '@angular/core';\n\nimport { Observable, Observer } from 'rxjs';\nimport * as L from 'leaflet';\nimport '@bluehalo/leaflet-d3';\n\nimport { LeafletDirective, LeafletDirectiveWrapper } from '@bluehalo/ngx-leaflet';\nimport { LeafletPingEvent } from '../ping/leaflet-ping-event.model';\n\n@Directive({\n selector: '[leafletPing]',\n standalone: true\n})\nexport class LeafletPingDirective\n\timplements OnInit {\n\n\tleafletDirective: LeafletDirectiveWrapper;\n\n\tpingLayer: L.PingLayer;\n\n\t@Input('leafletPingOptions') pingOptions: L.PingLayerConfig;\n\n\t@Output('leafletPingObserver')\n\tpingObserverReady = new EventEmitter<Observer<LeafletPingEvent>>();\n\n\tpingSource: Observable<LeafletPingEvent>;\n\tpingObserver: Observer<LeafletPingEvent>;\n\n\tconstructor(leafletDirective: LeafletDirective, private zone: NgZone) {\n\t\tthis.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);\n\t}\n\n\tngOnInit() {\n\n\t\tthis.leafletDirective.init();\n\n\t\tconst map = this.leafletDirective.getMap();\n\n\t\tthis.zone.runOutsideAngular(() => {\n\t\t\tthis.pingLayer = L.pingLayer(this.pingOptions).addTo(map);\n\n\t\t\t// Handle incoming ping events\n\t\t\tthis.pingSource = new Observable<LeafletPingEvent>((observer: Observer<LeafletPingEvent>) => {\n\t\t\t\tthis.pingObserver = observer;\n\t\t\t\tthis.pingObserverReady.emit(this.pingObserver);\n\t\t\t});\n\n\t\t\tthis.pingSource.subscribe((event: LeafletPingEvent) => {\n\t\t\t\tif (null != event) {\n\t\t\t\t\tthis.ping(event.data, event.cssClass);\n\t\t\t\t}\n\t\t\t});\n\n\t\t});\n\n\t}\n\n\t/**\n\t * Submit a ping to the ping layer.\n\t *\n\t * @param data Contains the lat/lon information to generate the ping\n\t * @param cssClass Optional parameter specifying the css class to apply to the ping\n\t */\n\tping(data: any, cssClass?: string) {\n\n\t\tif (null != this.pingLayer) {\n\n\t\t\tthis.zone.runOutsideAngular(() => {\n\t\t\t\tthis.pingLayer.ping(data, cssClass);\n\t\t\t});\n\n\t\t}\n\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { LeafletHexbinDirective } from './hexbin/leaflet-hexbin.directive';\nimport { LeafletPingDirective } from './ping/leaflet-ping.directive';\n\n@NgModule({\n\timports: [\n\t\tLeafletHexbinDirective,\n\t\tLeafletPingDirective\n\t],\n\texports: [\n\t\tLeafletHexbinDirective,\n\t\tLeafletPingDirective\n\t]\n})\nexport class LeafletD3Module {\n\n}\n","export class LeafletPingEvent {\n\n\tdata: any;\n\tcssClass?: string;\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAYa,sBAAsB,CAAA;IAoBlC,WAAA,CAAY,gBAAkC,EAAU,IAAY,EAAA;QAAZ,IAAA,CAAA,IAAI,GAAJ,I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;sBAQC,KAAK;uBAAC,oBAAoB;;sBAE1B,MAAM;uBAAC,qBAAqB;;;MCPjB,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAR1B,sBAAsB;AACtB,YAAA,oBAAoB,aAGpB,sBAAsB;YACtB,oBAAoB,CAAA,EAAA,CAAA,CAAA;+GAGT,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAV3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE;wBACR,sBAAsB;wBACtB;AACA,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACR,sBAAsB;wBACtB;AACA;AACD,iBAAA;;;MCdY,gBAAgB,CAAA;AAK5B;;ACLD;;AAEG;;;;"}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@bluehalo/ngx-leaflet-d3",
3
+ "description": "Angular D3 visualization components for Leaflet",
4
+ "version": "21.0.0",
5
+ "author": "BlueHalo",
6
+ "copyright": "Copyright BlueHalo 2007-2026 - All Rights Reserved.",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/bluehalo/ngx-leaflet-d3.git"
11
+ },
12
+ "peerDependencies": {
13
+ "@angular/common": "21",
14
+ "@angular/core": "21",
15
+ "@bluehalo/leaflet-d3": "6",
16
+ "@bluehalo/ngx-leaflet": "21",
17
+ "d3": "7",
18
+ "d3-hexbin": "0.2",
19
+ "leaflet": "1"
20
+ },
21
+ "dependencies": {
22
+ "tslib": "^2.3.0"
23
+ },
24
+ "module": "fesm2022/bluehalo-ngx-leaflet-d3.mjs",
25
+ "typings": "types/bluehalo-ngx-leaflet-d3.d.ts",
26
+ "exports": {
27
+ "./package.json": {
28
+ "default": "./package.json"
29
+ },
30
+ ".": {
31
+ "types": "./types/bluehalo-ngx-leaflet-d3.d.ts",
32
+ "default": "./fesm2022/bluehalo-ngx-leaflet-d3.mjs"
33
+ }
34
+ },
35
+ "sideEffects": false,
36
+ "type": "module"
37
+ }
@@ -0,0 +1,60 @@
1
+ /// <reference types="@bluehalo/leaflet-d3" />
2
+ import * as i0 from '@angular/core';
3
+ import { OnChanges, OnInit, EventEmitter, NgZone, SimpleChange } from '@angular/core';
4
+ import * as L from 'leaflet';
5
+ import { LeafletDirectiveWrapper, LeafletDirective } from '@bluehalo/ngx-leaflet';
6
+ import { Observer, Observable } from 'rxjs';
7
+
8
+ declare class LeafletHexbinDirective implements OnChanges, OnInit {
9
+ private zone;
10
+ leafletDirective: LeafletDirectiveWrapper;
11
+ hexbinLayer: L.HexbinLayer;
12
+ hexbinData: any[];
13
+ hexbinOptions: L.HexbinLayerConfig;
14
+ hexbinMouseover: EventEmitter<any>;
15
+ hexbinMouseout: EventEmitter<any>;
16
+ hexbinClick: EventEmitter<any>;
17
+ layerReady: EventEmitter<L.HexbinLayer>;
18
+ constructor(leafletDirective: LeafletDirective, zone: NgZone);
19
+ ngOnInit(): void;
20
+ ngOnChanges(changes: {
21
+ [key: string]: SimpleChange;
22
+ }): void;
23
+ private setHexbinData;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<LeafletHexbinDirective, never>;
25
+ static ɵdir: i0.ɵɵDirectiveDeclaration<LeafletHexbinDirective, "[leafletHexbin]", never, { "hexbinData": { "alias": "leafletHexbin"; "required": false; }; "hexbinOptions": { "alias": "leafletHexbinOptions"; "required": false; }; }, { "hexbinMouseover": "leafletHexbinMouseover"; "hexbinMouseout": "leafletHexbinMouseout"; "hexbinClick": "leafletHexbinClick"; "layerReady": "leafletHexbinLayerReady"; }, never, never, true, never>;
26
+ }
27
+
28
+ declare class LeafletPingEvent {
29
+ data: any;
30
+ cssClass?: string;
31
+ }
32
+
33
+ declare class LeafletPingDirective implements OnInit {
34
+ private zone;
35
+ leafletDirective: LeafletDirectiveWrapper;
36
+ pingLayer: L.PingLayer;
37
+ pingOptions: L.PingLayerConfig;
38
+ pingObserverReady: EventEmitter<Observer<LeafletPingEvent>>;
39
+ pingSource: Observable<LeafletPingEvent>;
40
+ pingObserver: Observer<LeafletPingEvent>;
41
+ constructor(leafletDirective: LeafletDirective, zone: NgZone);
42
+ ngOnInit(): void;
43
+ /**
44
+ * Submit a ping to the ping layer.
45
+ *
46
+ * @param data Contains the lat/lon information to generate the ping
47
+ * @param cssClass Optional parameter specifying the css class to apply to the ping
48
+ */
49
+ ping(data: any, cssClass?: string): void;
50
+ static ɵfac: i0.ɵɵFactoryDeclaration<LeafletPingDirective, never>;
51
+ static ɵdir: i0.ɵɵDirectiveDeclaration<LeafletPingDirective, "[leafletPing]", never, { "pingOptions": { "alias": "leafletPingOptions"; "required": false; }; }, { "pingObserverReady": "leafletPingObserver"; }, never, never, true, never>;
52
+ }
53
+
54
+ declare class LeafletD3Module {
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<LeafletD3Module, never>;
56
+ static ɵmod: i0.ɵɵNgModuleDeclaration<LeafletD3Module, never, [typeof LeafletHexbinDirective, typeof LeafletPingDirective], [typeof LeafletHexbinDirective, typeof LeafletPingDirective]>;
57
+ static ɵinj: i0.ɵɵInjectorDeclaration<LeafletD3Module>;
58
+ }
59
+
60
+ export { LeafletD3Module, LeafletHexbinDirective, LeafletPingDirective, LeafletPingEvent };