@vcmap/ui 6.3.4 → 6.3.6

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/dist/assets/ui.js CHANGED
@@ -1 +1 @@
1
- export * from "./ui-aafcea7d.js";
1
+ export * from "./ui-a2ca1d03.js";
@@ -1 +1 @@
1
- export * from "./vue-5cd50c79.js";
1
+ export * from "./vue-1a9cf873.js";
@@ -10,7 +10,7 @@ function loadCss(href) {
10
10
  elem.onerror = reject;
11
11
  document.head.appendChild(elem);
12
12
  });
13
- } await loadCss('./assets/vuetify-a5225009.css');import { watch as Q, onScopeDispose as Ze, effectScope as Zl, shallowRef as K, reactive as it, computed as b, watchEffect as Fe, toRefs as Yt, capitalize as Nn, unref as ot, Fragment as ie, isVNode as Rc, Comment as Nc, warn as ja, getCurrentInstance as Hc, ref as j, provide as De, inject as ye, defineComponent as zc, h as Gt, camelize as Ir, toRaw as Be, createVNode as r, mergeProps as O, onBeforeUnmount as Qe, readonly as Ql, onMounted as Ye, onDeactivated as _r, onActivated as Wc, nextTick as we, TransitionGroup as Jl, Transition as jt, isRef as Tn, toRef as $, onBeforeMount as ra, withDirectives as $e, resolveDirective as gt, vShow as Ct, onUpdated as jc, Text as Uc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Kc, cloneVNode as qc, createTextVNode as Tt, onUnmounted as Tr, onBeforeUpdate as Xc, withModifiers as Tl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Ar } from "./vue-5cd50c79.js";
13
+ } await loadCss('./assets/vuetify-e536bde6.css');import { watch as Q, onScopeDispose as Ze, effectScope as Zl, shallowRef as K, reactive as it, computed as b, watchEffect as Fe, toRefs as Yt, capitalize as Nn, unref as ot, Fragment as ie, isVNode as Rc, Comment as Nc, warn as ja, getCurrentInstance as Hc, ref as j, provide as De, inject as ye, defineComponent as zc, h as Gt, camelize as Ir, toRaw as Be, createVNode as r, mergeProps as O, onBeforeUnmount as Qe, readonly as Ql, onMounted as Ye, onDeactivated as _r, onActivated as Wc, nextTick as we, TransitionGroup as Jl, Transition as jt, isRef as Tn, toRef as $, onBeforeMount as ra, withDirectives as $e, resolveDirective as gt, vShow as Ct, onUpdated as jc, Text as Uc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Kc, cloneVNode as qc, createTextVNode as Tt, onUnmounted as Tr, onBeforeUpdate as Xc, withModifiers as Tl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Ar } from "./vue-1a9cf873.js";
14
14
  function rt(e, n) {
15
15
  let t;
16
16
  function a() {
@@ -1 +1 @@
1
- export * from "./vuetify-a5225009.js";
1
+ export * from "./vuetify-e536bde6.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/ui",
3
- "version": "6.3.4",
3
+ "version": "6.3.6",
4
4
  "author": "Virtual City Systems",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -20,10 +20,7 @@
20
20
  "format": "prettier --write --list-different . && npm run lint:js -- --fix",
21
21
  "prepack": "node build/build.js && node build/buildTypes.js",
22
22
  "postinstall": "node build/postInstall.js",
23
- "install-plugins": "cd plugins && npm i --omit peer --no-package-lock --force",
24
- "story:dev": "histoire dev",
25
- "story:build": "histoire build",
26
- "story:preview": "histoire preview"
23
+ "install-plugins": "cd plugins && npm i --omit peer --no-package-lock --force"
27
24
  },
28
25
  "repository": {
29
26
  "type": "git",
@@ -53,12 +50,12 @@
53
50
  "fast-deep-equal": "^3.1.3",
54
51
  "marked": "^15.0.7",
55
52
  "semver": "^7.6.3",
56
- "uuid": "^11.1.0",
53
+ "uuid": "^14.0.0",
57
54
  "vue-i18n": "^9.13.1"
58
55
  },
59
56
  "peerDependencies": {
60
57
  "@vcmap-cesium/engine": "^11.0.5",
61
- "@vcmap/core": "^6.3.3",
58
+ "@vcmap/core": "^6.3.5",
62
59
  "ol": "^10.4.0",
63
60
  "vue": "~3.4.38",
64
61
  "vuetify": "~3.7.14"
@@ -68,13 +65,11 @@
68
65
  "@zip.js/zip.js": "2.7.68"
69
66
  },
70
67
  "devDependencies": {
71
- "@histoire/plugin-vue": "^0.17.17",
72
68
  "@vcmap/rollup-plugin-vcs-ol": "^1.0.5",
73
69
  "@vcsuite/eslint-config": "^4.0.0",
74
- "@vitejs/plugin-vue": "^5.1.4",
75
- "@vitest/coverage-v8": "^2.1.3",
70
+ "@vitejs/plugin-vue": "^5.2.4",
71
+ "@vitest/coverage-v8": "^4.1.4",
76
72
  "@vue/test-utils": "^2.4.6",
77
- "histoire": "^0.17.17",
78
73
  "jest-canvas-mock": "^2.5.2",
79
74
  "jsdoc": "^4.0.3",
80
75
  "jsdoc-plugin-intersection": "^1.0.4",
@@ -86,9 +81,9 @@
86
81
  "sass": "^1.80.2",
87
82
  "tar": "^7.4.3",
88
83
  "typescript": "^5.4.5",
89
- "vite": "^5.4.9",
90
- "vite-plugin-vuetify": "^2.0.4",
91
- "vitest": "^2.1.3",
84
+ "vite": "^6.4.2",
85
+ "vite-plugin-vuetify": "~2.0.4",
86
+ "vitest": "^4.1.4",
92
87
  "vue-tsc": "^2.1.6"
93
88
  },
94
89
  "stylelint": {
@@ -36,7 +36,7 @@
36
36
  "@vcmap/layer-settings": "^1.0.1"
37
37
  },
38
38
  "optionalDependencies": {
39
- "@vcmap/guided-tour": "^1.0.5",
39
+ "@vcmap/guided-tour": "^1.0.6",
40
40
  "@vcmap/planning": "^7.0.0"
41
41
  }
42
42
  }
@@ -55,19 +55,51 @@
55
55
  :stroke-miterlimit="row.stroke?.miterLimit"
56
56
  :stroke-width="row.stroke?.width"
57
57
  />
58
- <rect
59
- v-else-if="row.type === StyleRowType.Fill"
60
- width="32"
61
- height="24"
62
- :stroke="getColor(row.stroke?.color)"
63
- :stroke-linecap="row.stroke?.lineCap"
64
- :stroke-linejoin="row.stroke?.lineJoin"
65
- :stroke-dasharray="row.stroke?.lineDash"
66
- :stroke-dashoffset="row.stroke?.lineDashOffset"
67
- :stroke-miterlimit="row.stroke?.miterLimit"
68
- :stroke-width="row.stroke?.width"
69
- :fill="getColor(row.fill?.color) || 'rgba(255,255,255,0)'"
70
- />
58
+ <template v-else-if="row.type === StyleRowType.Fill">
59
+ <defs v-if="row.fill?.pattern">
60
+ <pattern
61
+ :id="`legend-fill-pattern-${idx}`"
62
+ x="0"
63
+ y="0"
64
+ :width="patterns[idx].size"
65
+ :height="patterns[idx].size"
66
+ patternUnits="userSpaceOnUse"
67
+ >
68
+ <rect
69
+ :width="patterns[idx].size"
70
+ :height="patterns[idx].size"
71
+ :fill="patterns[idx].bgColor"
72
+ />
73
+ <line
74
+ v-for="(line, lineIdx) in patterns[idx].lines"
75
+ :key="lineIdx"
76
+ :x1="line.x1"
77
+ :y1="line.y1"
78
+ :x2="line.x2"
79
+ :y2="line.y2"
80
+ :stroke="patterns[idx].lineColor"
81
+ :stroke-width="patterns[idx].lineWidth"
82
+ stroke-linecap="square"
83
+ />
84
+ </pattern>
85
+ </defs>
86
+ <rect
87
+ width="32"
88
+ height="24"
89
+ :stroke="getColor(row.stroke?.color)"
90
+ :stroke-linecap="row.stroke?.lineCap"
91
+ :stroke-linejoin="row.stroke?.lineJoin"
92
+ :stroke-dasharray="row.stroke?.lineDash"
93
+ :stroke-dashoffset="row.stroke?.lineDashOffset"
94
+ :stroke-miterlimit="row.stroke?.miterLimit"
95
+ :stroke-width="row.stroke?.width"
96
+ :fill="
97
+ row.fill?.pattern
98
+ ? `url(#legend-fill-pattern-${idx})`
99
+ : getColor(row.fill?.color) || 'rgba(255,255,255,0)'
100
+ "
101
+ />
102
+ </template>
71
103
  <circle
72
104
  v-else-if="row.type === StyleRowType.Circle"
73
105
  cx="16"
@@ -110,7 +142,11 @@
110
142
  VListItemTitle,
111
143
  } from 'vuetify/components';
112
144
  import { computed } from 'vue';
113
- import { StyleRowType, getImageSrcFromShape } from './legendHelper.js';
145
+ import {
146
+ StyleRowType,
147
+ getImageSrcFromShape,
148
+ getPatternSvgData,
149
+ } from './legendHelper.js';
114
150
 
115
151
  /**
116
152
  * @description A component rendering vector styles as list using {@link https://vuetifyjs.com/en/api/v-list-row v-list-row}
@@ -150,6 +186,17 @@
150
186
  }
151
187
  return '';
152
188
  }
189
+
190
+ const patterns = computed(() => {
191
+ const cache = {};
192
+ props.item.rows.forEach((row, idx) => {
193
+ if (row.fill?.pattern) {
194
+ cache[idx] = getPatternSvgData(row.fill);
195
+ }
196
+ });
197
+ return cache;
198
+ });
199
+
153
200
  return {
154
201
  StyleRowType,
155
202
  getImageSrcFromShape,
@@ -160,6 +207,7 @@
160
207
  return null;
161
208
  },
162
209
  determineInnerPadding,
210
+ patterns,
163
211
  cols: computed(() => {
164
212
  return props.item.colNr === 1 ? 12 : 6;
165
213
  }),
@@ -15,6 +15,7 @@ declare const _default: import("vue").DefineComponent<{
15
15
  getImageSrcFromShape: typeof getImageSrcFromShape;
16
16
  getColor(color: any): string | null;
17
17
  determineInnerPadding: (index: number) => string;
18
+ patterns: import("vue").ComputedRef<{}>;
18
19
  cols: import("vue").ComputedRef<6 | 12>;
19
20
  }, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
21
  item: {
@@ -29,7 +29,7 @@
29
29
  */
30
30
  /**
31
31
  * @typedef {StyleLegendRow & {
32
- * fill: import("ol/style/Fill.js").Options,
32
+ * fill: import("ol/style/Fill.js").Options | import("@vcmap/core").VectorStyleItemFill,
33
33
  * stroke?: import("ol/style/Stroke.js").Options
34
34
  * }} FillLegendRow
35
35
  */
@@ -50,6 +50,18 @@
50
50
  * @property {import("ol/style/Text.js").Options} text
51
51
  * @property {string} [label='Text']
52
52
  */
53
+ /**
54
+ * @typedef {{ x1: number, y1: number, x2: number, y2: number }} PatternLine
55
+ */
56
+ /**
57
+ * @typedef {{ size: number, bgColor: string, lineColor: string, lineWidth: number, lines: PatternLine[] }} PatternSvgData
58
+ */
59
+ /**
60
+ * Computes the SVG data needed to render an inline pattern for a legend row.
61
+ * @param {import("@vcmap/core").VectorStyleItemFill} fill
62
+ * @returns {PatternSvgData}
63
+ */
64
+ export function getPatternSvgData(fill: import("@vcmap/core").VectorStyleItemFill): PatternSvgData;
53
65
  /**
54
66
  * @param {import("ol/style/Image.js").Options} image
55
67
  * @returns {string}
@@ -141,7 +153,7 @@ export type StrokeLegendRow = StyleLegendRow & {
141
153
  stroke: import("ol/style/Stroke.js").Options;
142
154
  };
143
155
  export type FillLegendRow = StyleLegendRow & {
144
- fill: import("ol/style/Fill.js").Options;
156
+ fill: import("ol/style/Fill.js").Options | import("@vcmap/core").VectorStyleItemFill;
145
157
  stroke?: import("ol/style/Stroke.js").Options;
146
158
  };
147
159
  export type CircleLegendRow = StyleLegendRow & {
@@ -157,6 +169,19 @@ export type TextLegendRow = StyleLegendRow & {
157
169
  text: import("ol/style/Text.js").Options;
158
170
  label?: string;
159
171
  };
172
+ export type PatternLine = {
173
+ x1: number;
174
+ y1: number;
175
+ x2: number;
176
+ y2: number;
177
+ };
178
+ export type PatternSvgData = {
179
+ size: number;
180
+ bgColor: string;
181
+ lineColor: string;
182
+ lineWidth: number;
183
+ lines: PatternLine[];
184
+ };
160
185
  export type LegendEntry = {
161
186
  key: string;
162
187
  /**
@@ -1,4 +1,9 @@
1
- import { getShapeFromOptions } from '@vcmap/core';
1
+ import {
2
+ getShapeFromOptions,
3
+ PatternType,
4
+ parseColor,
5
+ getStringColor,
6
+ } from '@vcmap/core';
2
7
  import { reactive } from 'vue';
3
8
 
4
9
  /**
@@ -68,7 +73,7 @@ export const StyleRowType = {
68
73
 
69
74
  /**
70
75
  * @typedef {StyleLegendRow & {
71
- * fill: import("ol/style/Fill.js").Options,
76
+ * fill: import("ol/style/Fill.js").Options | import("@vcmap/core").VectorStyleItemFill,
72
77
  * stroke?: import("ol/style/Stroke.js").Options
73
78
  * }} FillLegendRow
74
79
  */
@@ -94,6 +99,64 @@ export const StyleRowType = {
94
99
  * @property {string} [label='Text']
95
100
  */
96
101
 
102
+ /**
103
+ * @typedef {{ x1: number, y1: number, x2: number, y2: number }} PatternLine
104
+ */
105
+
106
+ /**
107
+ * @typedef {{ size: number, bgColor: string, lineColor: string, lineWidth: number, lines: PatternLine[] }} PatternSvgData
108
+ */
109
+
110
+ /**
111
+ * Computes the SVG data needed to render an inline pattern for a legend row.
112
+ * @param {import("@vcmap/core").VectorStyleItemFill} fill
113
+ * @returns {PatternSvgData}
114
+ */
115
+ export function getPatternSvgData(fill) {
116
+ const size = fill.pattern.size || 10;
117
+ const bgColor = getStringColor(parseColor(fill.color));
118
+ const lineColor = getStringColor(fill.pattern.color);
119
+ const lineWidth = fill.pattern.width;
120
+
121
+ /** @type {PatternLine[]} */
122
+ const lines = [];
123
+
124
+ function addLine(x1, y1, x2, y2) {
125
+ lines.push({ x1, y1, x2, y2 });
126
+ }
127
+
128
+ switch (fill.pattern.type) {
129
+ case PatternType.NWSE:
130
+ addLine(size / 2, size, size, size / 2);
131
+ addLine(0, size / 2, size / 2, 0);
132
+ break;
133
+ case PatternType.SWNE:
134
+ addLine(size / 2, size, 0, size / 2);
135
+ addLine(size, size / 2, size / 2, 0);
136
+ break;
137
+ case PatternType.DIAGONALCROSS:
138
+ addLine(size / 2, size, size, size / 2);
139
+ addLine(0, size / 2, size / 2, 0);
140
+ addLine(size / 2, size, 0, size / 2);
141
+ addLine(size, size / 2, size / 2, 0);
142
+ break;
143
+ case PatternType.NS:
144
+ addLine(size / 2, 0, size / 2, size);
145
+ break;
146
+ case PatternType.WE:
147
+ addLine(0, size / 2, size, size / 2);
148
+ break;
149
+ case PatternType.CROSS:
150
+ addLine(size / 2, 0, size / 2, size);
151
+ addLine(0, size / 2, size, size / 2);
152
+ break;
153
+ default:
154
+ break;
155
+ }
156
+
157
+ return { size, bgColor, lineColor, lineWidth, lines };
158
+ }
159
+
97
160
  /**
98
161
  * @param {import("ol/style/Image.js").Options} image
99
162
  * @returns {string}