septima-widget-vue 0.1.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/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Septima Widget Vue
2
+
3
+ Vue 3 component for [Septima Widget](https://www.npmjs.com/package/septima-widget). See documentation at [widget.cdn.septima.dk](https://widget.cdn.septima.dk/latest/vue.html).
4
+
5
+ Septima Widget is a commercial API for interactive maps. Contact us at kontakt@septima.dk for more information.
6
+
7
+ ## Installation
8
+
9
+ ```
10
+ npm install septima-widget-vue
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```vue
16
+ <script setup>
17
+ import { ref } from 'vue'
18
+ import SeptimaWidget from 'septima-widget-vue'
19
+
20
+ const mapRef = ref(null)
21
+
22
+ function zoomToAddress() {
23
+ mapRef.value?.widget?.setView({ x: 724413, y: 6175985, zoom: 14 })
24
+ }
25
+ </script>
26
+
27
+ <template>
28
+ <div style="height: 500px">
29
+ <SeptimaWidget
30
+ ref="mapRef"
31
+ :config="{
32
+ map: {
33
+ view: { zoomLevel: 10, x: 724413, y: 6175985 },
34
+ layer: [{ namedlayer: '#septima_standard' }]
35
+ }
36
+ }"
37
+ />
38
+ </div>
39
+ <button @click="zoomToAddress">Zoom</button>
40
+ </template>
41
+ ```
42
+
43
+ The config can also be specified as a URL to a JSON file:
44
+
45
+ ```vue
46
+ <SeptimaWidget ref="mapRef" config="https://example.com/my-widget-config.json" />
47
+ ```
package/index.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import type { DefineComponent } from 'vue'
2
+
3
+ declare class WidgetAPI {
4
+ isReady: boolean
5
+ VERSION: string
6
+ on(event: string, listener: (...args: unknown[]) => void): object
7
+ off(eventRef: object): void
8
+ setConfig(config: object | string): void
9
+ addData(geojson: object, options?: object): void
10
+ removeData(layerID: string): void
11
+ setView(options: object): void
12
+ getView(crs?: string): object | null
13
+ addLayer(layerConfig: object): void
14
+ removeLayer(layerID: string): void
15
+ showLayer(layerID: string): void
16
+ hideLayer(layerID: string): void
17
+ setLayerOpacity(layerID: string, opacity: number): void
18
+ setLayerZIndex(layerID: string, zIndex: number): void
19
+ reloadLayer(layerID: string): void
20
+ getLayers(): object[]
21
+ updateLayerParams(layerID: string, params: object): void
22
+ selectFeatureInLayer(
23
+ layerID: string,
24
+ filterFunction?: ((properties: object) => boolean) | null,
25
+ zoomOptions?: object,
26
+ silent?: boolean
27
+ ): void
28
+ deselectFeature(silent?: boolean): void
29
+ showPopup(geojson: object, html: string): void
30
+ hidePopup(): void
31
+ draw(options: object): void
32
+ unDraw(): void
33
+ createMapImage(options: object, callback: (result: unknown) => void): void
34
+ transform(geojson: object, options: { from?: string; to: string }, callback: () => void): void
35
+ }
36
+
37
+ export interface SeptimaWidgetExpose {
38
+ widget: WidgetAPI | null
39
+ }
40
+
41
+ export interface SeptimaWidgetProps {
42
+ config: object | string
43
+ }
44
+
45
+ declare const SeptimaWidget: DefineComponent<SeptimaWidgetProps, SeptimaWidgetExpose, object>
46
+
47
+ export { SeptimaWidget }
48
+ export default SeptimaWidget
package/index.mjs ADDED
@@ -0,0 +1,28 @@
1
+ import { createElementBlock as e, defineComponent as t, onMounted as n, openBlock as r, ref as i, toRaw as a, watch as o } from "vue";
2
+ import s from "septima-widget";
3
+ //#endregion
4
+ //#region components/vue/src/SeptimaWidget.vue
5
+ var c = /*#__PURE__*/ ((e, t) => {
6
+ let n = e.__vccOpts || e;
7
+ for (let [e, r] of t) n[e] = r;
8
+ return n;
9
+ })(/* @__PURE__ */ t({
10
+ __name: "SeptimaWidget",
11
+ props: { config: {} },
12
+ setup(t, { expose: c }) {
13
+ let l = t, u = i(null), d = i(null);
14
+ return n(() => {
15
+ u.value && (d.value = new s(u.value, structuredClone(a(l.config))));
16
+ }), o(() => l.config, (e) => {
17
+ d.value?.setConfig(structuredClone(a(e)));
18
+ }, { deep: !0 }), c({ get widget() {
19
+ return d.value;
20
+ } }), (t, n) => (r(), e("div", {
21
+ ref_key: "container",
22
+ ref: u,
23
+ class: "septima-widget"
24
+ }, null, 512));
25
+ }
26
+ }), [["__scopeId", "data-v-9d3c905d"]]);
27
+ //#endregion
28
+ export { c as SeptimaWidget, c as default };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "septima-widget-vue",
3
+ "version": "0.1.0",
4
+ "description": "Vue 3 component for Septima Widget",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.mjs",
9
+ "types": "./index.d.ts"
10
+ }
11
+ },
12
+ "module": "./index.mjs",
13
+ "types": "./index.d.ts",
14
+ "dependencies": {
15
+ "septima-widget": ">=3.0.0"
16
+ },
17
+ "peerDependencies": {
18
+ "vue": "^3.0.0"
19
+ },
20
+ "license": "LICENSED"
21
+ }
package/widget3.css ADDED
@@ -0,0 +1,2 @@
1
+ .septima-widget[data-v-9d3c905d]{width:100%;height:100%}
2
+ /*$vite$:1*/