@vcmap/viewshed 3.0.5 → 4.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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@vcmap/viewshed",
3
- "version": "3.0.5",
4
- "description": "Tool to simulate a \"viewer\" and their field of vision from a certain standpoint in the map. It allows the user to see which areas and buildings can or can't be seen from a specific standpoint, regarding different viewing distances, viewers' sizes and orientations.Th",
3
+ "version": "4.1.0",
4
+ "description": "Tool to simulate a \"viewer\" and their field of vision from a certain standpoint in the map. It allows the user to see which areas and buildings can or can't be seen from a specific standpoint, regarding different viewing distances, viewers' sizes and orientations.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "scripts": {
8
8
  "prepublishOnly": "vcmplugin build",
9
9
  "build": "vcmplugin build",
10
10
  "bundle": "vcmplugin bundle",
11
+ "audit": "npm audit --omit=peer --omit=dev --omit=optional",
11
12
  "start": "vcmplugin serve",
12
13
  "preview": "vcmplugin preview",
13
14
  "buildStagingApp": "vcmplugin buildStagingApp",
@@ -16,7 +17,9 @@
16
17
  "lint": "npm run lint:js && npm run lint:prettier",
17
18
  "format": "prettier --write --list-different . && npm run lint:js -- --fix",
18
19
  "test": "vitest",
19
- "coverage": "vitest run --coverage"
20
+ "coverage": "vitest run --coverage",
21
+ "type-check": "vue-tsc --noEmit",
22
+ "ensure-types": "vcmplugin ensure-types"
20
23
  },
21
24
  "author": "Tobias Krauth <tkrauth@vc.systems>",
22
25
  "license": "MIT",
@@ -36,36 +39,33 @@
36
39
  ".": "./src/index.js",
37
40
  "./dist": "./dist/index.js"
38
41
  },
39
- "eslintIgnore": [
40
- "node_modules",
41
- "dist",
42
- "plugin-assets"
43
- ],
44
- "eslintConfig": {
45
- "root": true,
46
- "extends": "@vcsuite/eslint-config/vue"
47
- },
48
42
  "prettier": "@vcsuite/eslint-config/prettier.js",
49
43
  "peerDependencies": {
50
- "@vcmap-cesium/engine": "^11.0.2",
51
- "@vcmap/core": "^6.0.4",
52
- "@vcmap/ui": "^6.0.6",
53
- "ol": "^10.2.1",
44
+ "@vcmap-cesium/engine": "^11.0.5",
45
+ "@vcmap/core": "^6.3.5",
46
+ "@vcmap/ui": "^6.3.6",
47
+ "ol": "^10.4.0",
54
48
  "vue": "~3.4.38",
55
- "vuetify": "^3.7.3"
49
+ "vuetify": "~3.7.14"
50
+ },
51
+ "overrides": {
52
+ "esbuild": "^0.25.0"
56
53
  },
57
54
  "devDependencies": {
58
- "@vcmap/plugin-cli": "^4.0.1",
59
- "@vcsuite/eslint-config": "^3.0.8",
60
- "@vitest/coverage-v8": "^2.1.4",
55
+ "@vcmap/plugin-cli": "^4.2.0",
56
+ "@vcsuite/eslint-config": "^4.1.0",
57
+ "@vitest/coverage-v8": "^2.1.9",
61
58
  "jest-canvas-mock": "^2.5.2",
62
59
  "jsdom": "^22.1.0",
63
60
  "resize-observer-polyfill": "^1.5.1",
64
- "vitest": "^2.1.4"
61
+ "typescript": "^5.9.2",
62
+ "vitest": "^2.1.9",
63
+ "vue-tsc": "^2.2.12"
65
64
  },
66
65
  "dependencies": {
67
- "@vcsuite/check": "^2.1.0",
68
- "@vcsuite/parsers": "^1.0.3"
66
+ "@vcsuite/check": "^3.2.2",
67
+ "@vcsuite/logger": "^1.0.1",
68
+ "@vcsuite/parsers": "^2.0.1"
69
69
  },
70
- "mapVersion": "^6.0"
70
+ "mapVersion": "^6.3"
71
71
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <AbstractConfigEditor @submit="apply" v-bind="{ ...$attrs, ...$props }">
3
- <VcsFormSection heading="viewshed.editor.general" v-if="localConfig">
2
+ <AbstractConfigEditor v-bind="{ ...$attrs, ...$props }" @submit="apply">
3
+ <VcsFormSection v-if="localConfig" heading="viewshed.editor.general">
4
4
  <v-container class="px-1 py-0">
5
5
  <v-row no-gutters>
6
6
  <v-col>
@@ -11,8 +11,8 @@
11
11
  <v-col>
12
12
  <VcsSelect
13
13
  id="viewshed-tools"
14
- :items="toolItems"
15
14
  v-model="localConfig.tools"
15
+ :items="toolItems"
16
16
  :multiple="true"
17
17
  />
18
18
  </v-col>
@@ -42,37 +42,31 @@
42
42
  </AbstractConfigEditor>
43
43
  </template>
44
44
 
45
- <script>
46
- import { ref } from 'vue';
45
+ <script lang="ts">
46
+ import type { PropType } from 'vue';
47
+ import { defineComponent, inject, ref, toRaw } from 'vue';
47
48
  import { VCol, VColorPicker, VContainer, VRow } from 'vuetify/components';
49
+ import type { VcsUiApp } from '@vcmap/ui';
48
50
  import {
49
51
  AbstractConfigEditor,
50
52
  VcsFormSection,
51
53
  VcsLabel,
52
54
  VcsSelect,
53
55
  } from '@vcmap/ui';
54
- import Viewshed, { ViewshedTypes } from './viewshed.js';
55
-
56
- /**
57
- * @typedef {Object} ViewshedConfig
58
- * @property {string} visibleColor The color of the viewsheds visible parts.
59
- * @property {string} shadowColor The color of the viewsheds hidden parts.
60
- * @property {Array<ViewshedTypes>} tools The tools that are available in the toolbox.
61
- */
56
+ import { name } from '../package.json';
57
+ import { ViewshedTypes } from './viewshed.js';
58
+ import type { ViewshedPlugin } from './index.js';
62
59
 
63
- /**
64
- * Returns the default viewshed options.
65
- * @returns {ViewshedConfig}
66
- */
67
- export function getDefaultOptions() {
68
- return {
69
- visibleColor: Viewshed.getDefaultOptions().visibleColor,
70
- shadowColor: Viewshed.getDefaultOptions().shadowColor,
71
- tools: [...Object.values(ViewshedTypes)],
72
- };
73
- }
60
+ export type ViewshedConfig = {
61
+ /** The color of the viewsheds visible parts. */
62
+ visibleColor: string;
63
+ /** The color of the viewsheds hidden parts. */
64
+ shadowColor: string;
65
+ /** The tools that are available in the toolbox. */
66
+ tools: ViewshedTypes[];
67
+ };
74
68
 
75
- export default {
69
+ export default defineComponent({
76
70
  name: 'ViewshedConfigEditor',
77
71
  components: {
78
72
  AbstractConfigEditor,
@@ -86,22 +80,26 @@
86
80
  },
87
81
  props: {
88
82
  getConfig: {
89
- type: Function,
83
+ type: Function as PropType<() => ViewshedConfig>,
90
84
  required: true,
91
85
  },
92
86
  setConfig: {
93
- type: Function,
87
+ type: Function as PropType<(config: ViewshedConfig) => void>,
94
88
  required: true,
95
89
  },
96
90
  },
97
91
  setup(props) {
98
- /** @type {import("vue").Ref<import("./index.js").ViewshedPluginOptions>} */
99
- const config = props.getConfig();
100
- /** @type {import("vue").Ref<import("./index.js").ViewshedPluginOptions>} */
101
- const localConfig = ref({ ...getDefaultOptions(), ...config });
92
+ const app = inject<VcsUiApp>('vcsUiApp')!;
93
+ const { getDefaultOptions } = app.plugins.getByKey(
94
+ name,
95
+ ) as ViewshedPlugin;
96
+ const localConfig = ref<ViewshedConfig>({
97
+ ...getDefaultOptions?.(),
98
+ ...props.getConfig(),
99
+ });
102
100
 
103
- function apply() {
104
- props.setConfig(localConfig.value);
101
+ function apply(): void {
102
+ props.setConfig(structuredClone(toRaw(localConfig.value)));
105
103
  }
106
104
 
107
105
  return {
@@ -114,5 +112,5 @@
114
112
  })),
115
113
  };
116
114
  },
117
- };
115
+ });
118
116
  </script>