@geode/opengeodeweb-front 10.34.0-rc.22 → 10.34.0-rc.23

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.
@@ -75,7 +75,9 @@ function createServerWsRpcClient(baseUrl) {
75
75
  socket.close();
76
76
  }
77
77
  function getConnection() {
78
- return { getSession: () => ({ call: (rpc, [params]) => call(rpc, params) }) };
78
+ return { getSession: () => ({ call: async (rpc, [params]) => {
79
+ return await call(rpc, params);
80
+ } }) };
79
81
  }
80
82
  function isOpen() {
81
83
  return socket.readyState === WebSocket.OPEN;
@@ -16,8 +16,8 @@ async function callRaw({ rpc, params = {}, client, timeout }, { request_error_fu
16
16
  if (response_function) await response_function(response);
17
17
  return response;
18
18
  } catch (error) {
19
- if (request_error_function) request_error_function(error);
20
- if (response_error_function) response_error_function(error);
19
+ if (request_error_function) await request_error_function(error);
20
+ if (response_error_function) await response_error_function(error);
21
21
  throw error;
22
22
  }
23
23
  }
@@ -27,7 +27,7 @@ const vuetifyColor = ref({
27
27
  a: initialColor.alpha,
28
28
  });
29
29
 
30
- function updateInputTextFromColor(red: number, green: number, blue: number, alpha: number) {
30
+ function updateInputTextFromColor(red: number, green: number, blue: number, alpha: number): void {
31
31
  colorInputText.value =
32
32
  disabledAlpha || currentMode.value === "rgb"
33
33
  ? `${red}, ${green}, ${blue}`
@@ -41,12 +41,12 @@ interface VuetifyColor {
41
41
  a: number;
42
42
  }
43
43
 
44
- function commitColorToModel() {
44
+ function commitColorToModel(): void {
45
45
  const { r: red, g: green, b: blue, a: alpha } = vuetifyColor.value;
46
46
  model.value = { red, green, blue, alpha };
47
47
  }
48
48
 
49
- function onPickerUpdate(color: VuetifyColor) {
49
+ function onPickerUpdate(color: VuetifyColor): void {
50
50
  const red = Math.round(color.r);
51
51
  const green = Math.round(color.g);
52
52
  const blue = Math.round(color.b);
@@ -59,7 +59,7 @@ function onPickerUpdate(color: VuetifyColor) {
59
59
  }
60
60
  }
61
61
 
62
- function toggleMode() {
62
+ function toggleMode(): void {
63
63
  if (disabledAlpha) {
64
64
  return;
65
65
  }
@@ -68,12 +68,12 @@ function toggleMode() {
68
68
  updateInputTextFromColor(red, green, blue, alpha);
69
69
  }
70
70
 
71
- async function copyToClipboard() {
71
+ async function copyToClipboard(): Promise<void> {
72
72
  const { r: red, g: green, b: blue, a: alpha } = vuetifyColor.value;
73
73
  await copy(formatColorString({ red, green, blue, alpha }, currentMode.value));
74
74
  }
75
75
 
76
- function parseAndApplyText(text: string) {
76
+ function parseAndApplyText(text: string): boolean {
77
77
  const parsed = parseColorString(text);
78
78
  if (!parsed) {
79
79
  return false;
@@ -92,13 +92,13 @@ function parseAndApplyText(text: string) {
92
92
  return true;
93
93
  }
94
94
 
95
- function onInputPaste(event: ClipboardEvent) {
95
+ function onInputPaste(event: ClipboardEvent): void {
96
96
  event.preventDefault();
97
- const text = event.clipboardData!.getData("text/plain");
97
+ const text = event.clipboardData?.getData("text/plain") ?? "";
98
98
  parseAndApplyText(text);
99
99
  }
100
100
 
101
- function onInputCommit() {
101
+ function onInputCommit(): void {
102
102
  if (!parseAndApplyText(colorInputText.value)) {
103
103
  const { r: red, g: green, b: blue, a: alpha } = vuetifyColor.value;
104
104
  updateInputTextFromColor(red, green, blue, alpha);
@@ -1,7 +1,7 @@
1
- import { useClipboard } from "@vueuse/core";
1
+ import { type UseClipboardReturn, useClipboard } from "@vueuse/core";
2
2
 
3
3
  const COPIED_FEEDBACK_TIMEOUT = 1500;
4
4
 
5
- export function useCopyToClipboard(): ReturnType<typeof useClipboard> {
5
+ export function useCopyToClipboard(): UseClipboardReturn<false> {
6
6
  return useClipboard({ copiedDuring: COPIED_FEEDBACK_TIMEOUT });
7
7
  }
@@ -151,7 +151,7 @@ export function useTreeKeyboardNav(
151
151
  if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) {
152
152
  event.preventDefault();
153
153
  const prevIndex = focusedIndex.value;
154
- (focusedIndex as Ref<number>).value = getNextIndex(event.key);
154
+ focusedIndex.value = getNextIndex(event.key);
155
155
 
156
156
  if (focusedIndex.value !== prevIndex) {
157
157
  if (prevIndex >= 0 && prevIndex < displayItems.value.length) {
@@ -16,9 +16,12 @@ function snackbarElements(): HTMLElement[] {
16
16
  export default defineNuxtPlugin({
17
17
  name: "click-outside-ignore-snackbars",
18
18
  setup() {
19
- const originalMounted = ClickOutside.mounted;
19
+ const originalMounted = ClickOutside.mounted.bind(ClickOutside);
20
20
 
21
- ClickOutside.mounted = (element: HTMLElement, binding: DirectiveBinding<ClickOutsideValue>) => {
21
+ ClickOutside.mounted = (
22
+ element: HTMLElement,
23
+ binding: DirectiveBinding<ClickOutsideValue>,
24
+ ): void => {
22
25
  const { value } = binding;
23
26
  const handler = typeof value === "function" ? value : value.handler;
24
27
  const closeConditional = typeof value === "function" ? undefined : value.closeConditional;
@@ -27,7 +30,7 @@ export default defineNuxtPlugin({
27
30
  binding.value = {
28
31
  handler,
29
32
  closeConditional,
30
- include: () => [...(include?.() ?? []), ...snackbarElements()],
33
+ include: (): HTMLElement[] => [...(include?.() ?? []), ...snackbarElements()],
31
34
  };
32
35
 
33
36
  originalMounted(element, binding);
@@ -61,14 +61,14 @@ type ReadonlyOpenedView = Omit<OpenedView, "opened"> & {
61
61
  type ReadonlyTreeviewGroup = Omit<TreeviewGroup, "children"> & {
62
62
  readonly children: readonly TreeviewChild[];
63
63
  };
64
- type ReadonlyTreeviewSnapshot = {
64
+ interface ReadonlyTreeviewSnapshot {
65
65
  opened_views?: readonly ReadonlyOpenedView[];
66
66
  panelWidth?: number;
67
67
  additionalPanelWidth?: number;
68
68
  rowHeights?: readonly number[];
69
69
  selectionIds?: readonly string[];
70
70
  selection?: readonly (string | { id: string })[];
71
- };
71
+ }
72
72
 
73
73
  // oxlint-disable-next-line max-lines-per-function, max-statements
74
74
  export const useTreeviewStore = defineStore("treeview", () => {
@@ -1,15 +1,17 @@
1
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
+
1
3
  const RGB_MAX = 255;
2
4
  const PERCENT_MAX = 100;
3
5
 
4
- function parseComponent(val, max = RGB_MAX) {
6
+ function parseComponent(val: string, max = RGB_MAX): number {
5
7
  if (val.endsWith("%")) {
6
8
  return (Number(val.slice(0, -1)) / PERCENT_MAX) * max;
7
9
  }
8
10
  return Number(val);
9
11
  }
10
12
 
11
- function parseColorString(colorText) {
12
- if (!colorText || typeof colorText !== "string") {
13
+ function parseColorString(colorText: string): RGBAColor | undefined {
14
+ if (colorText === "") {
13
15
  return undefined;
14
16
  }
15
17
 
@@ -18,17 +20,18 @@ function parseColorString(colorText) {
18
20
  return undefined;
19
21
  }
20
22
 
21
- const rawRed = parseComponent(numbersMatch[0]);
22
- const rawGreen = parseComponent(numbersMatch[1]);
23
- const rawBlue = parseComponent(numbersMatch[2]);
23
+ const [redText = "", greenText = "", blueText = "", alphaText] = numbersMatch;
24
+ const rawRed = parseComponent(redText);
25
+ const rawGreen = parseComponent(greenText);
26
+ const rawBlue = parseComponent(blueText);
24
27
 
25
28
  const red = Math.min(RGB_MAX, Math.max(0, Math.round(rawRed)));
26
29
  const green = Math.min(RGB_MAX, Math.max(0, Math.round(rawGreen)));
27
30
  const blue = Math.min(RGB_MAX, Math.max(0, Math.round(rawBlue)));
28
31
 
29
32
  let alpha = 1;
30
- if (numbersMatch.length === 4) {
31
- const rawAlpha = parseComponent(numbersMatch[3], 1);
33
+ if (alphaText !== undefined) {
34
+ const rawAlpha = parseComponent(alphaText, 1);
32
35
  const calculatedAlpha = rawAlpha > 1 ? rawAlpha / RGB_MAX : rawAlpha;
33
36
  const roundedAlpha = Number(calculatedAlpha.toFixed(2));
34
37
  alpha = Math.min(1, Math.max(0, roundedAlpha));
@@ -41,7 +44,7 @@ function parseColorString(colorText) {
41
44
  return { red, green, blue, alpha };
42
45
  }
43
46
 
44
- function formatColorString(color, mode) {
47
+ function formatColorString(color: RGBAColor, mode: string): string {
45
48
  const { red, green, blue, alpha } = color;
46
49
  const roundRed = Math.round(red);
47
50
  const roundGreen = Math.round(green);
@@ -86,7 +86,7 @@ async function api_fetch(
86
86
  request_error_function(error: unknown) {
87
87
  microservice.stop_request();
88
88
  const typedError = toFetchErrorLike(error);
89
- if (!skip_feedback_error) {
89
+ if (skip_feedback_error !== true) {
90
90
  feedbackStore.add_error(
91
91
  typedError.code ?? 0,
92
92
  schema.$id,
@@ -95,7 +95,7 @@ async function api_fetch(
95
95
  );
96
96
  }
97
97
  if (request_error_function) {
98
- request_error_function(error);
98
+ void request_error_function(error);
99
99
  }
100
100
  },
101
101
  response_function(data: unknown) {
@@ -108,7 +108,7 @@ async function api_fetch(
108
108
  response_error_function(response: unknown) {
109
109
  microservice.stop_request();
110
110
  const typedResponse = toFetchErrorResponseLike(response);
111
- if (!skip_feedback_error) {
111
+ if (skip_feedback_error !== true) {
112
112
  feedbackStore.add_error(
113
113
  typedResponse.status ?? 0,
114
114
  schema.$id,
@@ -117,7 +117,7 @@ async function api_fetch(
117
117
  );
118
118
  }
119
119
  if (response_error_function) {
120
- response_error_function(response);
120
+ void response_error_function(response);
121
121
  }
122
122
  },
123
123
  validation_error_function({ code, name, error }) {
@@ -59,7 +59,7 @@ async function upload_file(
59
59
  typedError.stack ?? "",
60
60
  );
61
61
  if (request_error_function) {
62
- request_error_function(error);
62
+ void request_error_function(error);
63
63
  }
64
64
  }
65
65
 
@@ -73,7 +73,7 @@ async function upload_file(
73
73
  typedResponse.description ?? "",
74
74
  );
75
75
  if (response_error_function) {
76
- response_error_function(response);
76
+ void response_error_function(response);
77
77
  }
78
78
  }
79
79
 
@@ -63,7 +63,7 @@ async function viewer_call(
63
63
  typedError.message ?? "",
64
64
  );
65
65
  if (request_error_function) {
66
- request_error_function(error);
66
+ void request_error_function(error);
67
67
  }
68
68
  },
69
69
  response_function(data: unknown) {
@@ -83,7 +83,7 @@ async function viewer_call(
83
83
  typedResponse.message ?? "",
84
84
  );
85
85
  if (response_error_function) {
86
- response_error_function(response);
86
+ void response_error_function(response);
87
87
  }
88
88
  },
89
89
  validation_error_function({ code, name, error }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.34.0-rc.22",
3
+ "version": "10.34.0-rc.23",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -68,6 +68,9 @@
68
68
  "@kitware/vtk.js": "33.3.0",
69
69
  "@mdi/font": "7.4.47",
70
70
  "@pinia/nuxt": "1.0.1",
71
+ "@types/busboy": "1.5.4",
72
+ "@types/node": "22.20.3",
73
+ "@types/ws": "8.18.1",
71
74
  "@vueuse/components": "13.1.0",
72
75
  "@vueuse/core": "13.1.0",
73
76
  "@vueuse/nuxt": "13.1.0",
@@ -103,10 +106,7 @@
103
106
  "devDependencies": {
104
107
  "@nuxt/test-utils": "4.1.0",
105
108
  "@pinia/testing": "2.0.1",
106
- "@types/busboy": "1.5.4",
107
109
  "@types/lodash": "4.17.25",
108
- "@types/node": "22.20.3",
109
- "@types/ws": "8.18.1",
110
110
  "@vitejs/plugin-vue": "6.0.8",
111
111
  "@vue/test-utils": "2.4.11",
112
112
  "happy-dom": "20.0.11",
@@ -139,7 +139,10 @@ function createServerWsRpcClient(baseUrl: string): ServerWsRpcClient {
139
139
  function getConnection(): ReturnType<ServerWsRpcClient["getConnection"]> {
140
140
  return {
141
141
  getSession: () => ({
142
- call: (rpc: string, [params]: readonly [Record<string, unknown>]) => call(rpc, params),
142
+ call: async (rpc: string, [params]: readonly [Record<string, unknown>]) => {
143
+ const result = await call(rpc, params);
144
+ return result;
145
+ },
143
146
  }),
144
147
  };
145
148
  }
@@ -48,10 +48,10 @@ async function callRaw(
48
48
  return response;
49
49
  } catch (error) {
50
50
  if (request_error_function) {
51
- request_error_function(error);
51
+ await request_error_function(error);
52
52
  }
53
53
  if (response_error_function) {
54
- response_error_function(error);
54
+ await response_error_function(error);
55
55
  }
56
56
  throw error;
57
57
  }