forked from MelihAltintas/vue3-openlayers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
73 lines (67 loc) · 2.02 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import "ol/ol.css";
import "ol-ext/dist/ol-ext.css";
import "ol-contextmenu/ol-contextmenu.css";
import "./assets/style.css";
import feature from "ol/Feature";
import * as geom from "ol/geom";
import * as format from "ol/format";
import * as loadingstrategy from "ol/loadingstrategy";
import * as selectconditions from "ol/events/condition";
import * as extent from "ol/extent";
import * as animations from "ol/easing";
import {
Map,
Layers,
Sources,
MapControls,
Geometries,
Styles,
Interactions,
Animations,
} from "./components";
import type { App, Plugin } from "vue";
type Vue3OpenlayersGlobalOptions = {
debug: boolean;
};
const install: Plugin = (app: App, options?: Vue3OpenlayersGlobalOptions) => {
app.use(Map.install);
app.use(Layers.install);
app.use(Sources.install);
app.use(MapControls.install);
app.use(Geometries.install);
app.use(Styles.install);
app.use(Interactions.install);
app.use(Animations.install);
app.provide("ol-options", options);
app.provide("ol-feature", feature);
app.provide("ol-geom", geom);
app.provide("ol-animations", animations);
app.provide("ol-format", format);
app.provide("ol-loadingstrategy", loadingstrategy);
app.provide("ol-selectconditions", selectconditions);
app.provide("ol-extent", extent);
};
declare module "@vue/runtime-core" {
export function inject(key: "ol-options"): Vue3OpenlayersGlobalOptions;
export function inject(key: "ol-feature"): feature;
export function inject(key: "ol-geom"): typeof geom;
export function inject(key: "ol-animations"): typeof animations;
export function inject(key: "ol-format"): typeof format;
export function inject(key: "ol-loadingstrategy"): typeof loadingstrategy;
export function inject(key: "ol-selectconditions"): typeof selectconditions;
export function inject(key: "ol-extent"): typeof extent;
}
const plugin = { install };
export default plugin;
export {
install,
Map,
Layers,
Sources,
MapControls,
Geometries,
Styles,
Interactions,
Animations,
type Vue3OpenlayersGlobalOptions,
};