jpf 4.0.6 → 4.0.8

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.
@@ -2,4 +2,5 @@ export * from "./codeMirror/index";
2
2
  export * from "./html/index";
3
3
  export * from "./jsonViewAwesome/index";
4
4
  export * from "./kendo/index";
5
+ export * from "./leaflet/index";
5
6
  export * from "./user/index";
@@ -2,5 +2,6 @@ export * from "./codeMirror/index";
2
2
  export * from "./html/index";
3
3
  export * from "./jsonViewAwesome/index";
4
4
  export * from "./kendo/index";
5
+ export * from "./leaflet/index";
5
6
  export * from "./user/index";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as leaflet from "leaflet";
2
+ import { IView } from "../../../framework/View";
3
+ import { ViewModel } from "../../../framework/ViewModel";
4
+ export interface LeafletLabelControlOptions extends leaflet.ControlOptions {
5
+ content: string | IView | ViewModel;
6
+ }
7
+ export declare class LeafletLabelControl extends leaflet.Control {
8
+ constructor(options: LeafletLabelControlOptions);
9
+ private readonly content;
10
+ onAdd(map: leaflet.Map): HTMLElement;
11
+ }
@@ -0,0 +1,31 @@
1
+ import * as leaflet from "leaflet";
2
+ import { getView } from "../../../framework/View";
3
+ import { ViewModel } from "../../../framework/ViewModel";
4
+ export class LeafletLabelControl extends leaflet.Control {
5
+ constructor(options) {
6
+ super(options);
7
+ this.content = options.content;
8
+ }
9
+ content;
10
+ onAdd(map) {
11
+ const div = document.createElement("div");
12
+ let view;
13
+ if (this.content instanceof ViewModel) {
14
+ view = getView(this.content);
15
+ if (view) {
16
+ div.appendChild(view.render());
17
+ }
18
+ }
19
+ else if (typeof this.content === "string") {
20
+ div.innerText = this.content;
21
+ }
22
+ else {
23
+ view = this.content;
24
+ if (view.render) {
25
+ div.appendChild(view.render());
26
+ }
27
+ }
28
+ return div;
29
+ }
30
+ }
31
+ //# sourceMappingURL=LabelControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LabelControl.js","sourceRoot":"","sources":["../../../../src/controls/leaflet/LabelControl/LabelControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAS,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAMzD,MAAM,OAAO,mBAAoB,SAAQ,OAAO,CAAC,OAAO;IACpD,YAAY,OAAmC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnC,CAAC;IAEgB,OAAO,CAA6B;IAErD,KAAK,CAAC,GAAgB;QAClB,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,CAAC,OAAO,YAAY,SAAS,EAAE;YACnC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,IAAI,EAAE;gBACN,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAClC;SACJ;aAAM,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;YACzC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;SAChC;aAAM;YACH,IAAI,GAAG,IAAI,CAAC,OAAgB,CAAC;YAC7B,IAAI,IAAI,CAAC,MAAM,EAAE;gBACb,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAClC;SACJ;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ"}
@@ -0,0 +1,11 @@
1
+ import * as leaflet from "leaflet";
2
+ import { IView } from "../../framework/View";
3
+ import { ViewModel } from "../../framework/ViewModel";
4
+ export interface LeafletLabelControlOptions extends leaflet.ControlOptions {
5
+ content: string | IView | ViewModel;
6
+ }
7
+ export declare class LeafletLabelControl extends leaflet.Control {
8
+ constructor(options: LeafletLabelControlOptions);
9
+ private readonly content;
10
+ onAdd(map: leaflet.Map): HTMLElement;
11
+ }
@@ -0,0 +1,31 @@
1
+ import * as leaflet from "leaflet";
2
+ import { getView } from "../../framework/View";
3
+ import { ViewModel } from "../../framework/ViewModel";
4
+ export class LeafletLabelControl extends leaflet.Control {
5
+ constructor(options) {
6
+ super(options);
7
+ this.content = options.content;
8
+ }
9
+ content;
10
+ onAdd(map) {
11
+ const div = document.createElement("div");
12
+ let view;
13
+ if (this.content instanceof ViewModel) {
14
+ view = getView(this.content);
15
+ if (view) {
16
+ div.appendChild(view.render());
17
+ }
18
+ }
19
+ else if (typeof this.content === "string") {
20
+ div.innerText = this.content;
21
+ }
22
+ else {
23
+ view = this.content;
24
+ if (view.render) {
25
+ div.appendChild(view.render());
26
+ }
27
+ }
28
+ return div;
29
+ }
30
+ }
31
+ //# sourceMappingURL=LabelControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LabelControl.js","sourceRoot":"","sources":["../../../src/controls/leaflet/LabelControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAS,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAMtD,MAAM,OAAO,mBAAoB,SAAQ,OAAO,CAAC,OAAO;IACpD,YAAY,OAAmC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnC,CAAC;IAEgB,OAAO,CAA6B;IAErD,KAAK,CAAC,GAAgB;QAClB,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,CAAC,OAAO,YAAY,SAAS,EAAE;YACnC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,IAAI,EAAE;gBACN,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAClC;SACJ;aAAM,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;YACzC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;SAChC;aAAM;YACH,IAAI,GAAG,IAAI,CAAC,OAAgB,CAAC;YAC7B,IAAI,IAAI,CAAC,MAAM,EAAE;gBACb,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAClC;SACJ;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ"}
@@ -0,0 +1,46 @@
1
+ import { Observable, ObservableArray, Computed } from "knockout";
2
+ import * as leaflet from "leaflet";
3
+ import { View } from "../../../framework/View";
4
+ import { ViewModel, ViewModelOptions } from "../../../framework/ViewModel";
5
+ import { EventListeners } from "../../../framework/event";
6
+ export interface MapViewModelOptions extends ViewModelOptions {
7
+ renderer?: leaflet.Renderer;
8
+ center?: leaflet.LatLngExpression | Observable<leaflet.LatLngExpression>;
9
+ zoom?: number;
10
+ tileLayers?: Array<leaflet.TileLayer>;
11
+ layers?: Array<leaflet.Layer> | ObservableArray<leaflet.Layer> | Computed<Array<leaflet.Layer>>;
12
+ controls?: Array<leaflet.Control> | ObservableArray<leaflet.Control>;
13
+ eventListeners?: MapEventListeners;
14
+ zoomInTitle: string;
15
+ zoomOutTitle: string;
16
+ }
17
+ export declare class MapViewModel extends ViewModel implements MapViewModelOptions {
18
+ constructor(options: MapViewModelOptions);
19
+ readonly renderer?: leaflet.Renderer;
20
+ readonly center: leaflet.LatLngExpression | Observable<leaflet.LatLngExpression>;
21
+ readonly zoom: number;
22
+ readonly south: number;
23
+ readonly north: number;
24
+ readonly west: number;
25
+ readonly east: number;
26
+ readonly tileLayers: Array<leaflet.TileLayer>;
27
+ readonly layers: Array<leaflet.Layer> | ObservableArray<leaflet.Layer> | Computed<Array<leaflet.Layer>>;
28
+ readonly controls: Array<leaflet.Control> | ObservableArray<leaflet.Control>;
29
+ readonly zoomInTitle: string;
30
+ readonly zoomOutTitle: string;
31
+ }
32
+ export declare class MapView extends View<MapViewModelOptions> {
33
+ constructor(viewModel: MapViewModelOptions, designTimeOptions?: ViewModelOptions);
34
+ private map;
35
+ private layers;
36
+ private controls;
37
+ build(): void;
38
+ private setTileLayers;
39
+ private setLayers;
40
+ private setControls;
41
+ }
42
+ export declare const burtonville: leaflet.LatLngExpression;
43
+ export interface MapEventListeners extends EventListeners {
44
+ zoomend?: (event: leaflet.LeafletEvent) => void;
45
+ moveend?: (event: leaflet.LeafletEvent) => void;
46
+ }
@@ -0,0 +1,120 @@
1
+ import { isObservable, unwrap } from "knockout";
2
+ import * as leaflet from "leaflet";
3
+ import { View, registerView } from "../../../framework/View";
4
+ import { ViewModel, extendViewModel } from "../../../framework/ViewModel";
5
+ export class MapViewModel extends ViewModel {
6
+ constructor(options) {
7
+ super(options);
8
+ if (options) {
9
+ this.renderer = options.renderer;
10
+ this.center = options.center;
11
+ this.zoom = options.zoom;
12
+ this.tileLayers = options.tileLayers;
13
+ this.layers = options.layers;
14
+ this.controls = options.controls;
15
+ }
16
+ }
17
+ renderer;
18
+ center;
19
+ zoom;
20
+ south;
21
+ north;
22
+ west;
23
+ east;
24
+ tileLayers;
25
+ layers;
26
+ controls;
27
+ zoomInTitle;
28
+ zoomOutTitle;
29
+ }
30
+ export class MapView extends View {
31
+ constructor(viewModel, designTimeOptions) {
32
+ super({
33
+ tagName: "div",
34
+ viewModel: viewModel
35
+ }, extendViewModel({
36
+ viewType: "LeafletMap"
37
+ }, designTimeOptions));
38
+ }
39
+ map;
40
+ layers = new Array();
41
+ controls = new Array();
42
+ build() {
43
+ super.build();
44
+ const viewModel = this.viewModel;
45
+ if (!viewModel.center) {
46
+ viewModel.center = burtonville;
47
+ }
48
+ const options = {
49
+ renderer: viewModel.renderer,
50
+ zoomControl: false
51
+ };
52
+ setTimeout(() => {
53
+ this.map = leaflet.map(this.element, options).setView(unwrap(viewModel.center), this.viewModel.zoom);
54
+ leaflet.control.zoom({
55
+ position: "topleft",
56
+ zoomInTitle: viewModel.zoomInTitle,
57
+ zoomOutTitle: viewModel.zoomOutTitle
58
+ }).addTo(this.map);
59
+ if (this.viewModel.eventListeners) {
60
+ Object.keys(this.viewModel.eventListeners).forEach((key) => {
61
+ this.map.on(key, (event) => {
62
+ this.viewModel.eventListeners[key](event);
63
+ });
64
+ });
65
+ }
66
+ this.setTileLayers(viewModel.tileLayers);
67
+ this.setLayers(unwrap(viewModel.layers));
68
+ if (isObservable(viewModel.layers)) {
69
+ viewModel.layers.subscribe((layers) => {
70
+ this.setLayers(layers);
71
+ });
72
+ }
73
+ this.setControls(unwrap(viewModel.controls));
74
+ if (isObservable(viewModel.controls)) {
75
+ viewModel.controls.subscribe((controls) => {
76
+ this.setControls(controls);
77
+ });
78
+ }
79
+ if (isObservable(viewModel.center)) {
80
+ viewModel.center.subscribe((center) => {
81
+ this.map.panTo(center);
82
+ });
83
+ }
84
+ }, 100);
85
+ }
86
+ setTileLayers(tileLayers) {
87
+ if (tileLayers) {
88
+ tileLayers.forEach((tileLayer) => {
89
+ tileLayer.addTo(this.map);
90
+ });
91
+ }
92
+ }
93
+ setLayers(layers) {
94
+ this.layers.forEach((layer) => {
95
+ this.map.removeLayer(layer);
96
+ });
97
+ this.layers = [];
98
+ if (layers) {
99
+ layers.forEach((layer) => {
100
+ this.layers.push(layer);
101
+ layer.addTo(this.map);
102
+ });
103
+ }
104
+ }
105
+ setControls(controls) {
106
+ this.controls.forEach((control) => {
107
+ this.map.removeControl(control);
108
+ });
109
+ this.controls = [];
110
+ if (controls) {
111
+ controls.forEach((control) => {
112
+ this.controls.push(control);
113
+ control.addTo(this.map);
114
+ });
115
+ }
116
+ }
117
+ }
118
+ registerView(MapViewModel, MapView);
119
+ export const burtonville = [50.283939, 5.964070];
120
+ //# sourceMappingURL=Map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../../src/controls/leaflet/Map/Map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAyC,MAAM,UAAU,CAAC;AACvF,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAoB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAe5F,MAAM,OAAO,YAAa,SAAQ,SAAS;IACvC,YAAY,OAA4B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;YACrC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;SACpC;IAC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,YAAY,EACZ,OAAO,CACV,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAA6B,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { Observable, ObservableArray, Computed } from "knockout";
2
+ import * as leaflet from "leaflet";
3
+ import { View } from "../../framework/View";
4
+ import { ViewModel, ViewModelOptions } from "../../framework/ViewModel";
5
+ import { EventListeners } from "../../framework/event";
6
+ export interface MapViewModelOptions extends ViewModelOptions {
7
+ renderer?: leaflet.Renderer;
8
+ center?: leaflet.LatLngExpression | Observable<leaflet.LatLngExpression>;
9
+ zoom?: number;
10
+ tileLayers?: Array<leaflet.TileLayer>;
11
+ layers?: Array<leaflet.Layer> | ObservableArray<leaflet.Layer> | Computed<Array<leaflet.Layer>>;
12
+ controls?: Array<leaflet.Control> | ObservableArray<leaflet.Control>;
13
+ eventListeners?: MapEventListeners;
14
+ zoomInTitle: string;
15
+ zoomOutTitle: string;
16
+ }
17
+ export declare class MapViewModel extends ViewModel implements MapViewModelOptions {
18
+ constructor(options: MapViewModelOptions);
19
+ readonly renderer?: leaflet.Renderer;
20
+ readonly center: leaflet.LatLngExpression | Observable<leaflet.LatLngExpression>;
21
+ readonly zoom: number;
22
+ readonly south: number;
23
+ readonly north: number;
24
+ readonly west: number;
25
+ readonly east: number;
26
+ readonly tileLayers: Array<leaflet.TileLayer>;
27
+ readonly layers: Array<leaflet.Layer> | ObservableArray<leaflet.Layer> | Computed<Array<leaflet.Layer>>;
28
+ readonly controls: Array<leaflet.Control> | ObservableArray<leaflet.Control>;
29
+ readonly zoomInTitle: string;
30
+ readonly zoomOutTitle: string;
31
+ }
32
+ export declare class MapView extends View<MapViewModelOptions> {
33
+ constructor(viewModel: MapViewModelOptions, designTimeOptions?: ViewModelOptions);
34
+ private map;
35
+ private layers;
36
+ private controls;
37
+ build(): void;
38
+ private setTileLayers;
39
+ private setLayers;
40
+ private setControls;
41
+ }
42
+ export declare const burtonville: leaflet.LatLngExpression;
43
+ export interface MapEventListeners extends EventListeners {
44
+ zoomend?: (event: leaflet.LeafletEvent) => void;
45
+ moveend?: (event: leaflet.LeafletEvent) => void;
46
+ }
@@ -0,0 +1,120 @@
1
+ import { isObservable, unwrap } from "knockout";
2
+ import * as leaflet from "leaflet";
3
+ import { View, registerView } from "../../framework/View";
4
+ import { ViewModel, extendViewModel } from "../../framework/ViewModel";
5
+ export class MapViewModel extends ViewModel {
6
+ constructor(options) {
7
+ super(options);
8
+ if (options) {
9
+ this.renderer = options.renderer;
10
+ this.center = options.center;
11
+ this.zoom = options.zoom;
12
+ this.tileLayers = options.tileLayers;
13
+ this.layers = options.layers;
14
+ this.controls = options.controls;
15
+ }
16
+ }
17
+ renderer;
18
+ center;
19
+ zoom;
20
+ south;
21
+ north;
22
+ west;
23
+ east;
24
+ tileLayers;
25
+ layers;
26
+ controls;
27
+ zoomInTitle;
28
+ zoomOutTitle;
29
+ }
30
+ export class MapView extends View {
31
+ constructor(viewModel, designTimeOptions) {
32
+ super({
33
+ tagName: "div",
34
+ viewModel: viewModel
35
+ }, extendViewModel({
36
+ viewType: "LeafletMap"
37
+ }, designTimeOptions));
38
+ }
39
+ map;
40
+ layers = new Array();
41
+ controls = new Array();
42
+ build() {
43
+ super.build();
44
+ const viewModel = this.viewModel;
45
+ if (!viewModel.center) {
46
+ viewModel.center = burtonville;
47
+ }
48
+ const options = {
49
+ renderer: viewModel.renderer,
50
+ zoomControl: false
51
+ };
52
+ setTimeout(() => {
53
+ this.map = leaflet.map(this.element, options).setView(unwrap(viewModel.center), this.viewModel.zoom);
54
+ leaflet.control.zoom({
55
+ position: "topleft",
56
+ zoomInTitle: viewModel.zoomInTitle,
57
+ zoomOutTitle: viewModel.zoomOutTitle
58
+ }).addTo(this.map);
59
+ if (this.viewModel.eventListeners) {
60
+ Object.keys(this.viewModel.eventListeners).forEach((key) => {
61
+ this.map.on(key, (event) => {
62
+ this.viewModel.eventListeners[key](event);
63
+ });
64
+ });
65
+ }
66
+ this.setTileLayers(viewModel.tileLayers);
67
+ this.setLayers(unwrap(viewModel.layers));
68
+ if (isObservable(viewModel.layers)) {
69
+ viewModel.layers.subscribe((layers) => {
70
+ this.setLayers(layers);
71
+ });
72
+ }
73
+ this.setControls(unwrap(viewModel.controls));
74
+ if (isObservable(viewModel.controls)) {
75
+ viewModel.controls.subscribe((controls) => {
76
+ this.setControls(controls);
77
+ });
78
+ }
79
+ if (isObservable(viewModel.center)) {
80
+ viewModel.center.subscribe((center) => {
81
+ this.map.panTo(center);
82
+ });
83
+ }
84
+ }, 100);
85
+ }
86
+ setTileLayers(tileLayers) {
87
+ if (tileLayers) {
88
+ tileLayers.forEach((tileLayer) => {
89
+ tileLayer.addTo(this.map);
90
+ });
91
+ }
92
+ }
93
+ setLayers(layers) {
94
+ this.layers.forEach((layer) => {
95
+ this.map.removeLayer(layer);
96
+ });
97
+ this.layers = [];
98
+ if (layers) {
99
+ layers.forEach((layer) => {
100
+ this.layers.push(layer);
101
+ layer.addTo(this.map);
102
+ });
103
+ }
104
+ }
105
+ setControls(controls) {
106
+ this.controls.forEach((control) => {
107
+ this.map.removeControl(control);
108
+ });
109
+ this.controls = [];
110
+ if (controls) {
111
+ controls.forEach((control) => {
112
+ this.controls.push(control);
113
+ control.addTo(this.map);
114
+ });
115
+ }
116
+ }
117
+ }
118
+ registerView(MapViewModel, MapView);
119
+ export const burtonville = [50.283939, 5.964070];
120
+ //# sourceMappingURL=Map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../src/controls/leaflet/Map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAyC,MAAM,UAAU,CAAC;AACvF,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAoB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAezF,MA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C,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEnB,IAAI,QAAQ,EAAE;YACV,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACzB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC5B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;SACN;IACL,CAAC;CACJ;AAED,YAAY,CACR,YAAY,EACZ,OAAO,CACV,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAA6B,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { TileLayerOptions, TileLayer } from "leaflet";
2
+ export interface OpenStreetMapTileLayerOptions extends TileLayerOptions {
3
+ attribution?: string;
4
+ }
5
+ export declare class OpenStreetMapTileLayer extends TileLayer {
6
+ constructor(options?: OpenStreetMapTileLayerOptions);
7
+ }
@@ -0,0 +1,11 @@
1
+ import { TileLayer } from "leaflet";
2
+ export class OpenStreetMapTileLayer extends TileLayer {
3
+ constructor(options) {
4
+ if (!options) {
5
+ options = {};
6
+ }
7
+ options.attribution = "&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors";
8
+ super("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", options);
9
+ }
10
+ }
11
+ //# sourceMappingURL=OpenStreetMapTileLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenStreetMapTileLayer.js","sourceRoot":"","sources":["../../../../src/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,SAAS,CAAC;AAMtD,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACjD,YAAY,OAAuC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,GAAG,EAAE,CAAC;SAChB;QACD,OAAO,CAAC,WAAW,GAAG,2FAA2F,CAAC;QAClH,KAAK,CAAC,oDAAoD,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;CACJ"}
@@ -0,0 +1,7 @@
1
+ import { TileLayerOptions, TileLayer } from "leaflet";
2
+ export interface OpenStreetMapTileLayerOptions extends TileLayerOptions {
3
+ attribution?: string;
4
+ }
5
+ export declare class OpenStreetMapTileLayer extends TileLayer {
6
+ constructor(options?: OpenStreetMapTileLayerOptions);
7
+ }
@@ -0,0 +1,11 @@
1
+ import { TileLayer } from "leaflet";
2
+ export class OpenStreetMapTileLayer extends TileLayer {
3
+ constructor(options) {
4
+ if (!options) {
5
+ options = {};
6
+ }
7
+ options.attribution = "&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors";
8
+ super("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", options);
9
+ }
10
+ }
11
+ //# sourceMappingURL=OpenStreetMapTileLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenStreetMapTileLayer.js","sourceRoot":"","sources":["../../../src/controls/leaflet/OpenStreetMapTileLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,SAAS,CAAC;AAMtD,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACjD,YAAY,OAAuC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,GAAG,EAAE,CAAC;SAChB;QACD,OAAO,CAAC,WAAW,GAAG,2FAA2F,CAAC;QAClH,KAAK,CAAC,oDAAoD,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ export * from "./LabelControl/LabelControl";
2
+ export * from "./Map/Map";
3
+ export * from "./OpenStreetMapTileLayer/OpenStreetMapTileLayer";
@@ -0,0 +1,4 @@
1
+ export * from "./LabelControl/LabelControl";
2
+ export * from "./Map/Map";
3
+ export * from "./OpenStreetMapTileLayer/OpenStreetMapTileLayer";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controls/leaflet/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,iDAAiD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as Controls from "./controls/index";
2
- import * as Utilities from "./utilities/index";
3
- export { Controls };
4
- export { Utilities };
1
+ import * as controls from "./controls/index";
2
+ import * as utilities from "./utilities/index";
3
+ export { controls };
4
+ export { utilities };
5
5
  export * from "./framework/attributes";
6
6
  export * from "./framework/event";
7
7
  export * from "./framework/types";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import * as Controls from "./controls/index";
2
- import * as Utilities from "./utilities/index";
3
- export { Controls };
4
- export { Utilities };
1
+ import * as controls from "./controls/index";
2
+ import * as utilities from "./utilities/index";
3
+ export { controls };
4
+ export { utilities };
5
5
  export * from "./framework/attributes";
6
6
  export * from "./framework/event";
7
7
  export * from "./framework/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jpf",
3
- "version": "4.0.6",
3
+ "version": "4.0.8",
4
4
  "description": "Javascript Presentation Foundation",
5
5
  "keywords": [
6
6
  "mvvm",
@@ -35,7 +35,7 @@
35
35
  "npmAuditFix": "npm audit fix",
36
36
  "npmAuditFixForce": "npm audit fix --force",
37
37
  "npmCacheClean": "npm cache clean --force",
38
- "npmPublish": "tsc & npm publish --otp=663293",
38
+ "npmPublish": "tsc & npm publish --otp=771744",
39
39
  "npmLogin": "npm login",
40
40
  "npmWhoAmI": "npm whoami",
41
41
  "npmAddUser": "npm adduser",
@@ -55,7 +55,9 @@
55
55
  "codemirror": "6.0.1",
56
56
  "@codemirror/lang-html": "6.4.0",
57
57
  "@codemirror/lang-json": "6.0.1",
58
- "json-viewer-awesome": "1.0.15"
58
+ "json-viewer-awesome": "1.0.15",
59
+ "leaflet": "1.9.3",
60
+ "leaflet-arrowheads": "1.4.0"
59
61
  },
60
62
  "devDependencies": {
61
63
  "@types/ua-parser-js": "^0.7.36",