@geode/opengeodeweb-front 10.34.0-rc.8 → 10.34.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.
Files changed (282) hide show
  1. package/{server → .build/server}/utils/app_config.js +10 -9
  2. package/{server → .build/server}/utils/cleanup.js +31 -17
  3. package/{server → .build/server}/utils/cloud.js +1 -4
  4. package/{server → .build/server}/utils/microservices.js +21 -9
  5. package/{server → .build/server}/utils/path.js +4 -4
  6. package/{server → .build/server}/utils/scripts.js +9 -9
  7. package/.build/server/utils/server_config.js +51 -0
  8. package/.build/server/utils/stream.js +6 -0
  9. package/{server → .build/server}/utils/ws_client.js +18 -3
  10. package/{shared → .build/shared}/scripts.js +10 -10
  11. package/.build/shared/utils/call_raw.js +31 -0
  12. package/{shared → .build/shared}/utils/call_schema.js +2 -2
  13. package/.build/shared/utils/fetch_raw.js +52 -0
  14. package/{shared → .build/shared}/utils/fetch_schema.js +2 -2
  15. package/{shared → .build/shared}/utils/file.js +3 -1
  16. package/{shared → .build/shared}/utils/response_handlers/load.js +10 -7
  17. package/{shared → .build/shared}/utils/validate_schema.js +1 -1
  18. package/app/components/ActionButton.vue +6 -6
  19. package/app/components/CameraManager/List.vue +5 -5
  20. package/app/components/CameraManager/Saver.vue +3 -5
  21. package/app/components/CameraManager.vue +6 -4
  22. package/app/components/CameraOrientation.vue +12 -12
  23. package/app/components/ClippingPlaneCard.vue +4 -2
  24. package/app/components/ClippingPlanes.vue +8 -8
  25. package/app/components/CrsSelector.vue +9 -10
  26. package/app/components/DeleteDialog.vue +4 -2
  27. package/app/components/DragAndDrop.vue +10 -12
  28. package/app/components/DragAndDropInternal/DragAndDropInline.vue +4 -2
  29. package/app/components/ExtensionSelector.vue +4 -4
  30. package/app/components/FeedBack/ErrorBanner.vue +3 -1
  31. package/app/components/FeedBack/Snackers.vue +4 -3
  32. package/app/components/FileSelector.vue +10 -8
  33. package/app/components/FileUploader.vue +11 -11
  34. package/app/components/GlassCard.vue +1 -1
  35. package/app/components/HybridRenderingView.vue +7 -5
  36. package/app/components/HybridViewerTooltip.vue +7 -7
  37. package/app/components/Launcher.vue +1 -1
  38. package/app/components/Loading/EcoMessages.vue +9 -3
  39. package/app/components/Loading.vue +2 -2
  40. package/app/components/MissingFilesSelector.vue +12 -10
  41. package/app/components/ObjectSelector.vue +10 -9
  42. package/app/components/PackagesVersions.vue +6 -5
  43. package/app/components/Recaptcha.vue +3 -3
  44. package/app/components/RemoteRenderingView.vue +6 -7
  45. package/app/components/Ruler.vue +3 -3
  46. package/app/components/Screenshot.vue +6 -6
  47. package/app/components/SearchBar.vue +4 -2
  48. package/app/components/ShrinkFilter.vue +7 -7
  49. package/app/components/Step.vue +6 -5
  50. package/app/components/Stepper.vue +4 -3
  51. package/app/components/ToolPanel.vue +6 -3
  52. package/app/components/ViewToolbar.vue +25 -28
  53. package/app/components/Viewer/ContextMenu/CenterButton.vue +7 -5
  54. package/app/components/Viewer/ContextMenu/CircularItems.vue +3 -3
  55. package/app/components/Viewer/ContextMenu/ContextMenu.vue +22 -19
  56. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -8
  57. package/app/components/Viewer/ContextMenu/InfoCard.vue +11 -12
  58. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +13 -17
  59. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +11 -15
  60. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +12 -16
  61. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +8 -12
  62. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +11 -15
  63. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +11 -15
  64. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +67 -38
  65. package/app/components/Viewer/Generic/Model/CornersOptions.vue +53 -23
  66. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +1 -3
  67. package/app/components/Viewer/Generic/Model/LinesOptions.vue +67 -38
  68. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +31 -15
  69. package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +2 -3
  70. package/app/components/Viewer/Generic/Model/PointsOptions.vue +6 -6
  71. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +69 -38
  72. package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +64 -46
  73. package/app/components/Viewer/ObjectTree/Base/Controls.vue +5 -5
  74. package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +13 -9
  75. package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +5 -5
  76. package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +10 -10
  77. package/app/components/Viewer/ObjectTree/Box.vue +6 -4
  78. package/app/components/Viewer/ObjectTree/Layout.vue +23 -21
  79. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +14 -14
  80. package/app/components/Viewer/ObjectTree/Views/{ModelCollections.vue → ModelTree.vue} +59 -24
  81. package/app/components/Viewer/Options/AttributeColorBar.vue +4 -2
  82. package/app/components/Viewer/Options/AttributeRangeSelector.vue +4 -2
  83. package/app/components/Viewer/Options/AttributeSelector.vue +7 -9
  84. package/app/components/Viewer/Options/ColorMapList.vue +15 -13
  85. package/app/components/Viewer/Options/ColorMapPicker.vue +4 -4
  86. package/app/components/Viewer/Options/ColorPicker.vue +223 -41
  87. package/app/components/Viewer/Options/ColoringTypeSelector.vue +16 -16
  88. package/app/components/Viewer/Options/ColormapQuickPicker.vue +7 -5
  89. package/app/components/Viewer/Options/OptionsSection.vue +1 -1
  90. package/app/components/Viewer/Options/TextureItem.vue +8 -6
  91. package/app/components/Viewer/Options/TexturesSelector.vue +1 -1
  92. package/app/components/Viewer/OverlappingObjectsPicker.vue +8 -9
  93. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +2 -6
  94. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +12 -16
  95. package/app/components/Viewer/Surface/PolygonsOptions.vue +12 -16
  96. package/app/components/Viewer/Ui.vue +2 -2
  97. package/app/components/Wrapper.vue +1 -4
  98. package/app/components/ZScaling.vue +5 -3
  99. package/app/components/csv-preview/CsvPreviewer.vue +38 -37
  100. package/app/components/csv-preview/CsvSettings.vue +6 -4
  101. package/app/components/csv-preview/CsvTable.vue +1 -1
  102. package/app/composables/batch_style.ts +5 -6
  103. package/app/composables/clipping_planes_widget.ts +73 -181
  104. package/app/composables/clipping_planes_widget_entries.ts +189 -0
  105. package/app/composables/copy_to_clipboard.ts +7 -0
  106. package/app/composables/global_attribute_style.ts +163 -83
  107. package/app/composables/hover_highlight.ts +46 -14
  108. package/app/composables/model_collections.ts +26 -13
  109. package/app/composables/model_components.ts +26 -13
  110. package/app/composables/project_manager.ts +76 -19
  111. package/app/composables/responsive_middle_truncate.ts +13 -13
  112. package/app/composables/stepper_tree.ts +34 -11
  113. package/app/composables/tree_filter.ts +66 -44
  114. package/app/composables/tree_keyboard_nav.ts +25 -11
  115. package/app/composables/tree_scroll.ts +44 -14
  116. package/app/composables/use_adaptive_styles.ts +66 -23
  117. package/app/composables/use_overlapping_picker.ts +66 -16
  118. package/app/composables/use_quick_colormap.ts +16 -5
  119. package/app/composables/virtual_tree.ts +75 -43
  120. package/app/composables/vtk_implicit_plane_widget.d.ts +2 -0
  121. package/app/plugins/auto_store_register.ts +2 -7
  122. package/app/plugins/click_outside_ignore_snackbars.client.ts +39 -0
  123. package/app/stores/app.ts +57 -192
  124. package/app/stores/app_helpers/extension.ts +179 -0
  125. package/app/stores/back.ts +37 -21
  126. package/app/stores/camera_manager.ts +22 -20
  127. package/app/stores/cloud.ts +17 -13
  128. package/app/stores/data.ts +88 -47
  129. package/app/stores/data_helpers/collections.ts +36 -38
  130. package/app/stores/data_helpers/mesh.ts +45 -36
  131. package/app/stores/data_style.ts +50 -28
  132. package/app/stores/feedback.ts +6 -6
  133. package/app/stores/hybrid_viewer.ts +41 -52
  134. package/app/stores/infra.ts +39 -37
  135. package/app/stores/menu.ts +23 -14
  136. package/app/stores/treeview.ts +72 -42
  137. package/app/stores/viewer.ts +39 -27
  138. package/app/utils/attributes.ts +3 -3
  139. package/app/utils/clipping_planes.ts +111 -14
  140. package/app/utils/color_picker.ts +57 -0
  141. package/app/utils/colormap.ts +58 -35
  142. package/app/utils/default_styles/index.ts +2 -2
  143. package/app/utils/default_styles/meshes.ts +107 -13
  144. package/app/utils/default_styles/models.ts +83 -14
  145. package/app/utils/extension.ts +47 -20
  146. package/app/utils/import_workflow.ts +21 -13
  147. package/app/utils/name_cleaner.ts +1 -1
  148. package/app/utils/string.ts +1 -1
  149. package/app/utils/treeview.ts +2 -2
  150. package/internal/database/base_database.ts +7 -3
  151. package/internal/database/database.ts +36 -26
  152. package/internal/database/extended_database.ts +1 -1
  153. package/internal/stores/data_style/mesh/cells/cell.ts +70 -34
  154. package/internal/stores/data_style/mesh/cells/color.ts +12 -6
  155. package/internal/stores/data_style/mesh/cells/common.ts +18 -8
  156. package/internal/stores/data_style/mesh/cells/index.ts +122 -42
  157. package/internal/stores/data_style/mesh/cells/textures.ts +12 -6
  158. package/internal/stores/data_style/mesh/cells/vertex.ts +75 -34
  159. package/internal/stores/data_style/mesh/cells/visibility.ts +15 -4
  160. package/internal/stores/data_style/mesh/edges/color.ts +12 -6
  161. package/internal/stores/data_style/mesh/edges/common.ts +14 -6
  162. package/internal/stores/data_style/mesh/edges/edge.ts +71 -39
  163. package/internal/stores/data_style/mesh/edges/index.ts +117 -42
  164. package/internal/stores/data_style/mesh/edges/vertex.ts +76 -39
  165. package/internal/stores/data_style/mesh/edges/visibility.ts +15 -4
  166. package/internal/stores/data_style/mesh/edges/width.ts +12 -4
  167. package/internal/stores/data_style/mesh/index.ts +30 -11
  168. package/internal/stores/data_style/mesh/points/color.ts +12 -6
  169. package/internal/stores/data_style/mesh/points/common.ts +21 -8
  170. package/internal/stores/data_style/mesh/points/index.ts +101 -50
  171. package/internal/stores/data_style/mesh/points/size.ts +12 -4
  172. package/internal/stores/data_style/mesh/points/vertex.ts +75 -34
  173. package/internal/stores/data_style/mesh/points/visibility.ts +17 -7
  174. package/internal/stores/data_style/mesh/polygons/color.ts +12 -6
  175. package/internal/stores/data_style/mesh/polygons/common.ts +23 -6
  176. package/internal/stores/data_style/mesh/polygons/index.ts +130 -70
  177. package/internal/stores/data_style/mesh/polygons/polygon.ts +77 -43
  178. package/internal/stores/data_style/mesh/polygons/textures.ts +12 -6
  179. package/internal/stores/data_style/mesh/polygons/vertex.ts +79 -39
  180. package/internal/stores/data_style/mesh/polygons/visibility.ts +16 -6
  181. package/internal/stores/data_style/mesh/polyhedra/color.ts +12 -6
  182. package/internal/stores/data_style/mesh/polyhedra/common.ts +14 -6
  183. package/internal/stores/data_style/mesh/polyhedra/index.ts +115 -56
  184. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +80 -39
  185. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +79 -39
  186. package/internal/stores/data_style/mesh/polyhedra/visibility.ts +16 -6
  187. package/internal/stores/data_style/model/blocks/color.ts +43 -13
  188. package/internal/stores/data_style/model/blocks/common.ts +21 -6
  189. package/internal/stores/data_style/model/blocks/index.ts +89 -59
  190. package/internal/stores/data_style/model/blocks/polyhedron.ts +101 -44
  191. package/internal/stores/data_style/model/blocks/vertex.ts +107 -42
  192. package/internal/stores/data_style/model/blocks/visibility.ts +17 -4
  193. package/internal/stores/data_style/model/color.ts +171 -83
  194. package/internal/stores/data_style/model/common.ts +70 -21
  195. package/internal/stores/data_style/model/corners/color.ts +43 -11
  196. package/internal/stores/data_style/model/corners/common.ts +25 -6
  197. package/internal/stores/data_style/model/corners/index.ts +66 -41
  198. package/internal/stores/data_style/model/corners/vertex.ts +105 -74
  199. package/internal/stores/data_style/model/corners/visibility.ts +19 -4
  200. package/internal/stores/data_style/model/edges/common.ts +12 -4
  201. package/internal/stores/data_style/model/edges/index.ts +2 -1
  202. package/internal/stores/data_style/model/edges/visibility.ts +24 -7
  203. package/internal/stores/data_style/model/index.ts +24 -11
  204. package/internal/stores/data_style/model/lines/color.ts +41 -11
  205. package/internal/stores/data_style/model/lines/common.ts +17 -6
  206. package/internal/stores/data_style/model/lines/edge.ts +105 -42
  207. package/internal/stores/data_style/model/lines/index.ts +86 -59
  208. package/internal/stores/data_style/model/lines/vertex.ts +105 -42
  209. package/internal/stores/data_style/model/lines/visibility.ts +17 -4
  210. package/internal/stores/data_style/model/points/common.ts +8 -4
  211. package/internal/stores/data_style/model/points/index.ts +10 -3
  212. package/internal/stores/data_style/model/points/size.ts +12 -4
  213. package/internal/stores/data_style/model/points/visibility.ts +16 -6
  214. package/internal/stores/data_style/model/selection.ts +80 -58
  215. package/internal/stores/data_style/model/surfaces/color.ts +41 -11
  216. package/internal/stores/data_style/model/surfaces/common.ts +23 -6
  217. package/internal/stores/data_style/model/surfaces/index.ts +89 -59
  218. package/internal/stores/data_style/model/surfaces/polygon.ts +107 -67
  219. package/internal/stores/data_style/model/surfaces/vertex.ts +111 -67
  220. package/internal/stores/data_style/model/surfaces/visibility.ts +18 -5
  221. package/internal/stores/data_style/model/visibility.ts +82 -20
  222. package/internal/stores/data_style/state.ts +77 -65
  223. package/internal/stores/hybrid_viewer/brightness.ts +49 -31
  224. package/internal/stores/hybrid_viewer/camera.ts +191 -177
  225. package/internal/stores/hybrid_viewer/camera_animation.ts +11 -10
  226. package/internal/stores/hybrid_viewer/core.ts +64 -0
  227. package/internal/stores/hybrid_viewer/filters.ts +10 -16
  228. package/internal/stores/hybrid_viewer/highlight.ts +91 -130
  229. package/internal/stores/hybrid_viewer/ruler.ts +24 -15
  230. package/internal/stores/hybrid_viewer/scene.ts +96 -117
  231. package/internal/stores/hybrid_viewer/viewport.ts +74 -65
  232. package/internal/stores/hybrid_viewer/vtk_types.ts +13 -29
  233. package/internal/utils/api_fetch.ts +54 -23
  234. package/internal/utils/upload_file.ts +74 -53
  235. package/internal/utils/viewer_call.ts +22 -13
  236. package/internal/utils/ws_client.ts +24 -13
  237. package/nuxt.config.ts +58 -1
  238. package/package.json +20 -8
  239. package/server/api/cloud/extensions/run.post.ts +6 -10
  240. package/server/api/local/app/project_folder_path.post.ts +4 -4
  241. package/server/api/local/app/run_back.post.ts +5 -7
  242. package/server/api/local/app/run_viewer.post.ts +5 -7
  243. package/server/api/local/extensions/kill.post.ts +4 -3
  244. package/server/api/local/extensions/run.post.ts +7 -10
  245. package/server/api/local/extensions/upload.put.ts +44 -54
  246. package/server/api/microservice/app/get_is_app_ready.get.ts +4 -5
  247. package/server/api/microservice/app/set_app_base_url.post.ts +5 -6
  248. package/server/api/microservice/app/set_back_base_url.post.ts +5 -6
  249. package/server/api/microservice/app/set_is_app_ready.post.ts +5 -6
  250. package/server/api/microservice/app/set_viewer_base_url.post.ts +5 -6
  251. package/server/api/microservice/extensions/download.post.ts +5 -4
  252. package/server/api/serverless/run_cloud.post.ts +53 -11
  253. package/server/utils/app_config.ts +29 -22
  254. package/server/utils/cleanup.ts +60 -30
  255. package/server/utils/cloud.ts +9 -8
  256. package/server/utils/extension.ts +23 -9
  257. package/server/utils/microservices.ts +33 -24
  258. package/server/utils/path.ts +4 -4
  259. package/server/utils/scripts.ts +26 -23
  260. package/server/utils/server.ts +2 -2
  261. package/server/utils/server_config.ts +41 -27
  262. package/server/utils/stream.ts +6 -0
  263. package/server/utils/ws_client.ts +42 -8
  264. package/shared/scripts.ts +15 -10
  265. package/shared/utils/call_raw.ts +23 -16
  266. package/shared/utils/call_schema.ts +5 -8
  267. package/shared/utils/fetch_raw.ts +87 -47
  268. package/shared/utils/fetch_schema.ts +6 -9
  269. package/shared/utils/file.ts +8 -2
  270. package/shared/utils/response_handlers/load.ts +26 -11
  271. package/shared/utils/types.ts +9 -9
  272. package/shared/utils/validate_schema.ts +1 -1
  273. package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +0 -276
  274. package/server/types/vendor.d.ts +0 -64
  275. package/server/utils/server_config.js +0 -43
  276. package/shared/utils/call_raw.js +0 -30
  277. package/shared/utils/fetch_raw.js +0 -40
  278. /package/{opengeodeweb_front_schemas.js → .build/opengeodeweb_front_schemas.js} +0 -0
  279. /package/{server → .build/server}/utils/server.js +0 -0
  280. /package/{shared → .build/shared}/app_mode.js +0 -0
  281. /package/{shared → .build/shared}/utils/parse_boolean.js +0 -0
  282. /package/{shared → .build/shared}/utils/types.js +0 -0
@@ -3,7 +3,6 @@ import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants
3
3
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
4
4
 
5
5
  // Local imports
6
- import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
7
6
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
7
  import { useMeshPolygonsCommonStyle } from "./common";
9
8
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -51,14 +50,39 @@ function isMeshPolygonsPolygonAttributeValid({
51
50
  }
52
51
 
53
52
  // oxlint-disable-next-line max-lines-per-function
54
- function useMeshPolygonsPolygonAttributeStyle() {
53
+ function useMeshPolygonsPolygonAttributeStyle(): {
54
+ meshPolygonsPolygonAttributeName: (id: string) => string | undefined;
55
+ meshPolygonsPolygonAttributeItem: (id: string) => number;
56
+ meshPolygonsPolygonAttributeRange: (id: string) => [number | undefined, number | undefined];
57
+ meshPolygonsPolygonAttributeColorMap: (id: string) => string | undefined;
58
+ meshPolygonsPolygonAttributeStoredConfig: (
59
+ id: string,
60
+ name: string | undefined,
61
+ item: number | undefined,
62
+ ) => AttributeStoredConfig;
63
+ setMeshPolygonsPolygonAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
64
+ setMeshPolygonsPolygonAttributeName: (id: string, name: string) => Promise<unknown>;
65
+ setMeshPolygonsPolygonAttributeItem: (id: string, item: number) => Promise<unknown>;
66
+ setMeshPolygonsPolygonAttributeRange: (
67
+ id: string,
68
+ minimum: number,
69
+ maximum: number,
70
+ ) => Promise<unknown>;
71
+ setMeshPolygonsPolygonAttributeColorMap: (
72
+ id: string,
73
+ colorMap: string | undefined,
74
+ ) => Promise<unknown>;
75
+ meshPolygonsPolygonAttributeNoDataColor: (id: string) => unknown;
76
+ setMeshPolygonsPolygonAttributeNoDataColor: (
77
+ id: string,
78
+ no_data_color: unknown,
79
+ ) => Promise<unknown>;
80
+ } {
55
81
  const viewerStore = useViewerStore();
56
82
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
57
- function meshPolygonsColoring(id: string): StyleValues {
58
- return meshPolygonsCommonStyle.meshPolygonsStyle(id).coloring as StyleValues;
59
- }
60
83
  function meshPolygonsPolygonAttribute(id: string): AttributeState {
61
- return meshPolygonsColoring(id).polygon as AttributeState;
84
+ // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polygon shape is defined by the data style schema.
85
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).polygon as AttributeState;
62
86
  }
63
87
  function meshPolygonsPolygonAttributeStoredConfig(
64
88
  id: string,
@@ -66,14 +90,10 @@ function useMeshPolygonsPolygonAttributeStyle() {
66
90
  item: number | undefined,
67
91
  ): AttributeStoredConfig {
68
92
  const { storedConfigs } = meshPolygonsPolygonAttribute(id);
69
- if (
70
- storedConfigs &&
71
- name !== undefined &&
72
- name in storedConfigs &&
73
- item !== undefined &&
74
- item in storedConfigs[name]!
75
- ) {
76
- return storedConfigs[name]![item]!;
93
+ const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
94
+ const itemConfig = item === undefined ? undefined : nameConfig?.[item];
95
+ if (itemConfig !== undefined) {
96
+ return itemConfig;
77
97
  }
78
98
  return {
79
99
  minimum: undefined,
@@ -82,35 +102,37 @@ function useMeshPolygonsPolygonAttributeStyle() {
82
102
  no_data_color: DEFAULT_NO_DATA_COLOR,
83
103
  };
84
104
  }
85
- function mutateMeshPolygonsPolygonStyle(id: string, values: Record<string, unknown>) {
86
- return meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
87
- coloring: {
88
- polygon: values,
89
- },
90
- });
105
+ async function mutateMeshPolygonsPolygonStyle(
106
+ id: string,
107
+ values: Record<string, unknown>,
108
+ ): Promise<string> {
109
+ const result = await meshPolygonsCommonStyle.mutateMeshPolygonsPolygonStyle(id, values);
110
+ return result;
91
111
  }
92
- function setMeshPolygonsPolygonAttributeStoredConfig(
112
+ async function setMeshPolygonsPolygonAttributeStoredConfig(
93
113
  id: string,
94
114
  name: string | undefined,
95
115
  item: number | undefined,
96
116
  config: Partial<AttributeStoredConfig>,
97
- ) {
98
- return mutateMeshPolygonsPolygonStyle(id, {
117
+ ): Promise<string> {
118
+ const result = await mutateMeshPolygonsPolygonStyle(id, {
99
119
  storedConfigs: {
100
- [name as string]: {
120
+ [name ?? ""]: {
101
121
  lastItem: item,
102
- [item as number]: config,
122
+ [item ?? 0]: config,
103
123
  },
104
124
  },
105
125
  });
126
+ return result;
106
127
  }
107
128
  function meshPolygonsPolygonAttributeName(id: string): string | undefined {
108
129
  return meshPolygonsPolygonAttribute(id).name;
109
130
  }
110
131
  function meshPolygonsPolygonAttributeLastItem(id: string, name: string | undefined): number {
111
132
  const { storedConfigs } = meshPolygonsPolygonAttribute(id);
112
- if (storedConfigs && name !== undefined && name in storedConfigs) {
113
- return storedConfigs[name]!.lastItem;
133
+ const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
134
+ if (nameConfig !== undefined) {
135
+ return nameConfig.lastItem;
114
136
  }
115
137
  return 0;
116
138
  }
@@ -118,7 +140,7 @@ function useMeshPolygonsPolygonAttributeStyle() {
118
140
  const { item, name } = meshPolygonsPolygonAttribute(id);
119
141
  return item ?? meshPolygonsPolygonAttributeLastItem(id, name);
120
142
  }
121
- function setMeshPolygonsPolygonAttribute(
143
+ async function setMeshPolygonsPolygonAttribute(
122
144
  id: string,
123
145
  {
124
146
  name,
@@ -128,18 +150,18 @@ function useMeshPolygonsPolygonAttributeStyle() {
128
150
  colorMap,
129
151
  no_data_color = DEFAULT_NO_DATA_COLOR,
130
152
  }: AttributeInput,
131
- ) {
132
- mutateMeshPolygonsPolygonStyle(id, {
153
+ ): Promise<unknown> {
154
+ await mutateMeshPolygonsPolygonStyle(id, {
133
155
  name,
134
156
  item,
135
157
  });
136
- setMeshPolygonsPolygonAttributeStoredConfig(id, name, item, {
158
+ await setMeshPolygonsPolygonAttributeStoredConfig(id, name, item, {
137
159
  minimum,
138
160
  maximum,
139
161
  colorMap,
140
162
  no_data_color,
141
163
  });
142
- const points = getRGBPointsFromPreset(colorMap as string);
164
+ const points = getRGBPointsFromPreset(colorMap ?? "");
143
165
  const schema = meshPolygonsPolygonAttributeSchemas.attribute;
144
166
  const params = {
145
167
  id,
@@ -155,7 +177,7 @@ function useMeshPolygonsPolygonAttributeStyle() {
155
177
  params,
156
178
  });
157
179
  }
158
- function applyPolygonAttribute(id: string) {
180
+ async function applyPolygonAttribute(id: string): Promise<unknown> {
159
181
  const name = meshPolygonsPolygonAttributeName(id);
160
182
  const item = meshPolygonsPolygonAttributeItem(id);
161
183
  const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name, item);
@@ -168,19 +190,21 @@ function useMeshPolygonsPolygonAttributeStyle() {
168
190
  no_data_color: storedConfig.no_data_color,
169
191
  };
170
192
  if (isMeshPolygonsPolygonAttributeValid(attribute)) {
171
- return setMeshPolygonsPolygonAttribute(id, attribute);
193
+ const result = await setMeshPolygonsPolygonAttribute(id, attribute);
194
+ return result;
172
195
  }
196
+ return undefined;
173
197
  }
174
- function setMeshPolygonsPolygonAttributeName(id: string, name: string) {
198
+ async function setMeshPolygonsPolygonAttributeName(id: string, name: string): Promise<unknown> {
175
199
  const item = meshPolygonsPolygonAttributeLastItem(id, name);
176
- mutateMeshPolygonsPolygonStyle(id, {
200
+ await mutateMeshPolygonsPolygonStyle(id, {
177
201
  name,
178
202
  item,
179
203
  });
180
204
  return applyPolygonAttribute(id);
181
205
  }
182
- function setMeshPolygonsPolygonAttributeItem(id: string, item: number) {
183
- mutateMeshPolygonsPolygonStyle(id, {
206
+ async function setMeshPolygonsPolygonAttributeItem(id: string, item: number): Promise<unknown> {
207
+ await mutateMeshPolygonsPolygonStyle(id, {
184
208
  item,
185
209
  });
186
210
  return applyPolygonAttribute(id);
@@ -191,10 +215,14 @@ function useMeshPolygonsPolygonAttributeStyle() {
191
215
  const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name, item);
192
216
  return [storedConfig.minimum, storedConfig.maximum];
193
217
  }
194
- function setMeshPolygonsPolygonAttributeRange(id: string, minimum: number, maximum: number) {
218
+ async function setMeshPolygonsPolygonAttributeRange(
219
+ id: string,
220
+ minimum: number,
221
+ maximum: number,
222
+ ): Promise<unknown> {
195
223
  const name = meshPolygonsPolygonAttributeName(id);
196
224
  const item = meshPolygonsPolygonAttributeItem(id);
197
- setMeshPolygonsPolygonAttributeStoredConfig(id, name, item, {
225
+ await setMeshPolygonsPolygonAttributeStoredConfig(id, name, item, {
198
226
  minimum,
199
227
  maximum,
200
228
  });
@@ -206,10 +234,13 @@ function useMeshPolygonsPolygonAttributeStyle() {
206
234
  const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name, item);
207
235
  return storedConfig.colorMap;
208
236
  }
209
- function setMeshPolygonsPolygonAttributeColorMap(id: string, colorMap: string | undefined) {
237
+ async function setMeshPolygonsPolygonAttributeColorMap(
238
+ id: string,
239
+ colorMap: string | undefined,
240
+ ): Promise<unknown> {
210
241
  const name = meshPolygonsPolygonAttributeName(id);
211
242
  const item = meshPolygonsPolygonAttributeItem(id);
212
- setMeshPolygonsPolygonAttributeStoredConfig(id, name, item, {
243
+ await setMeshPolygonsPolygonAttributeStoredConfig(id, name, item, {
213
244
  colorMap,
214
245
  });
215
246
  return applyPolygonAttribute(id);
@@ -220,7 +251,10 @@ function useMeshPolygonsPolygonAttributeStyle() {
220
251
  const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name, item);
221
252
  return storedConfig.no_data_color;
222
253
  }
223
- async function setMeshPolygonsPolygonAttributeNoDataColor(id: string, no_data_color: unknown) {
254
+ async function setMeshPolygonsPolygonAttributeNoDataColor(
255
+ id: string,
256
+ no_data_color: unknown,
257
+ ): Promise<unknown> {
224
258
  const name = meshPolygonsPolygonAttributeName(id);
225
259
  const item = meshPolygonsPolygonAttributeItem(id);
226
260
  const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name, item);
@@ -8,27 +8,33 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
8
8
  // Local constants
9
9
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.apply_textures;
10
10
 
11
- export function useMeshPolygonsTexturesStyle() {
11
+ export function useMeshPolygonsTexturesStyle(): {
12
+ meshPolygonsTextures: (id: string) => unknown;
13
+ setMeshPolygonsTextures: (id: string, textures: unknown) => Promise<unknown>;
14
+ } {
12
15
  const viewerStore = useViewerStore();
13
16
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
14
17
 
15
18
  function meshPolygonsTextures(id: string): unknown {
16
19
  return meshPolygonsCommonStyle.meshPolygonsColoring(id).textures;
17
20
  }
18
- function setMeshPolygonsTextures(id: string, textures: unknown) {
21
+ async function setMeshPolygonsTextures(id: string, textures: unknown): Promise<unknown> {
19
22
  const params = { id, textures };
20
- return viewerStore.request(
23
+ const result = await viewerStore.request(
21
24
  {
22
25
  schema,
23
26
  params,
24
27
  },
25
28
  {
26
- response_function: () =>
27
- meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
29
+ response_function: async () => {
30
+ const mutateResult = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
28
31
  coloring: { textures },
29
- }),
32
+ });
33
+ return mutateResult;
34
+ },
30
35
  },
31
36
  );
37
+ return result;
32
38
  }
33
39
 
34
40
  return {
@@ -3,7 +3,6 @@ import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants
3
3
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
4
4
 
5
5
  // Local imports
6
- import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
7
6
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
7
  import { useMeshPolygonsCommonStyle } from "./common";
9
8
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -50,15 +49,42 @@ function isMeshPolygonsVertexAttributeValid({
50
49
  );
51
50
  }
52
51
 
52
+ interface UseMeshPolygonsVertexAttributeStyleReturn {
53
+ meshPolygonsVertexAttributeName: (id: string) => string | undefined;
54
+ meshPolygonsVertexAttributeItem: (id: string) => number;
55
+ meshPolygonsVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
56
+ meshPolygonsVertexAttributeColorMap: (id: string) => string | undefined;
57
+ meshPolygonsVertexAttributeStoredConfig: (
58
+ id: string,
59
+ name: string | undefined,
60
+ item: number | undefined,
61
+ ) => AttributeStoredConfig;
62
+ setMeshPolygonsVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
63
+ setMeshPolygonsVertexAttributeName: (id: string, name: string) => Promise<unknown>;
64
+ setMeshPolygonsVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
65
+ setMeshPolygonsVertexAttributeRange: (
66
+ id: string,
67
+ minimum: number,
68
+ maximum: number,
69
+ ) => Promise<unknown>;
70
+ setMeshPolygonsVertexAttributeColorMap: (
71
+ id: string,
72
+ colorMap: string | undefined,
73
+ ) => Promise<unknown>;
74
+ meshPolygonsVertexAttributeNoDataColor: (id: string) => unknown;
75
+ setMeshPolygonsVertexAttributeNoDataColor: (
76
+ id: string,
77
+ no_data_color: unknown,
78
+ ) => Promise<unknown>;
79
+ }
80
+
53
81
  // oxlint-disable-next-line max-lines-per-function
54
- function useMeshPolygonsVertexAttributeStyle() {
82
+ function useMeshPolygonsVertexAttributeStyle(): UseMeshPolygonsVertexAttributeStyleReturn {
55
83
  const viewerStore = useViewerStore();
56
84
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
57
- function meshPolygonsColoring(id: string): StyleValues {
58
- return meshPolygonsCommonStyle.meshPolygonsStyle(id).coloring as StyleValues;
59
- }
60
85
  function meshPolygonsVertexAttribute(id: string): AttributeState {
61
- return meshPolygonsColoring(id).vertex as AttributeState;
86
+ // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
87
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).vertex as AttributeState;
62
88
  }
63
89
  function meshPolygonsVertexAttributeStoredConfig(
64
90
  id: string,
@@ -66,14 +92,10 @@ function useMeshPolygonsVertexAttributeStyle() {
66
92
  item: number | undefined,
67
93
  ): AttributeStoredConfig {
68
94
  const { storedConfigs } = meshPolygonsVertexAttribute(id);
69
- if (
70
- storedConfigs &&
71
- name !== undefined &&
72
- name in storedConfigs &&
73
- item !== undefined &&
74
- item in storedConfigs[name]!
75
- ) {
76
- return storedConfigs[name]![item]!;
95
+ const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
96
+ const itemConfig = item === undefined ? undefined : nameConfig?.[item];
97
+ if (itemConfig !== undefined) {
98
+ return itemConfig;
77
99
  }
78
100
  return {
79
101
  minimum: undefined,
@@ -82,35 +104,41 @@ function useMeshPolygonsVertexAttributeStyle() {
82
104
  no_data_color: DEFAULT_NO_DATA_COLOR,
83
105
  };
84
106
  }
85
- function mutateMeshPolygonsVertexStyle(id: string, values: Record<string, unknown>) {
86
- return meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
107
+ async function mutateMeshPolygonsVertexStyle(
108
+ id: string,
109
+ values: Record<string, unknown>,
110
+ ): Promise<string> {
111
+ const result = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
87
112
  coloring: {
88
113
  vertex: values,
89
114
  },
90
115
  });
116
+ return result;
91
117
  }
92
- function setMeshPolygonsVertexAttributeStoredConfig(
118
+ async function setMeshPolygonsVertexAttributeStoredConfig(
93
119
  id: string,
94
120
  name: string | undefined,
95
121
  item: number | undefined,
96
122
  config: Partial<AttributeStoredConfig>,
97
- ) {
98
- return mutateMeshPolygonsVertexStyle(id, {
123
+ ): Promise<string> {
124
+ const result = await mutateMeshPolygonsVertexStyle(id, {
99
125
  storedConfigs: {
100
- [name as string]: {
126
+ [name ?? ""]: {
101
127
  lastItem: item,
102
- [item as number]: config,
128
+ [item ?? 0]: config,
103
129
  },
104
130
  },
105
131
  });
132
+ return result;
106
133
  }
107
134
  function meshPolygonsVertexAttributeName(id: string): string | undefined {
108
135
  return meshPolygonsVertexAttribute(id).name;
109
136
  }
110
137
  function meshPolygonsVertexAttributeLastItem(id: string, name: string | undefined): number {
111
138
  const { storedConfigs } = meshPolygonsVertexAttribute(id);
112
- if (storedConfigs && name !== undefined && name in storedConfigs) {
113
- return storedConfigs[name]!.lastItem;
139
+ const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
140
+ if (nameConfig !== undefined) {
141
+ return nameConfig.lastItem;
114
142
  }
115
143
  return 0;
116
144
  }
@@ -118,7 +146,7 @@ function useMeshPolygonsVertexAttributeStyle() {
118
146
  const { item, name } = meshPolygonsVertexAttribute(id);
119
147
  return item ?? meshPolygonsVertexAttributeLastItem(id, name);
120
148
  }
121
- function setMeshPolygonsVertexAttribute(
149
+ async function setMeshPolygonsVertexAttribute(
122
150
  id: string,
123
151
  {
124
152
  name,
@@ -128,18 +156,18 @@ function useMeshPolygonsVertexAttributeStyle() {
128
156
  colorMap,
129
157
  no_data_color = DEFAULT_NO_DATA_COLOR,
130
158
  }: AttributeInput,
131
- ) {
132
- mutateMeshPolygonsVertexStyle(id, {
159
+ ): Promise<unknown> {
160
+ await mutateMeshPolygonsVertexStyle(id, {
133
161
  name,
134
162
  item,
135
163
  });
136
- setMeshPolygonsVertexAttributeStoredConfig(id, name, item, {
164
+ await setMeshPolygonsVertexAttributeStoredConfig(id, name, item, {
137
165
  minimum,
138
166
  maximum,
139
167
  colorMap,
140
168
  no_data_color,
141
169
  });
142
- const points = getRGBPointsFromPreset(colorMap as string);
170
+ const points = getRGBPointsFromPreset(colorMap ?? "");
143
171
  const schema = meshPolygonsVertexAttributeSchemas.attribute;
144
172
  const params = {
145
173
  id,
@@ -155,7 +183,7 @@ function useMeshPolygonsVertexAttributeStyle() {
155
183
  params,
156
184
  });
157
185
  }
158
- function applyVertexAttribute(id: string) {
186
+ async function applyVertexAttribute(id: string): Promise<unknown> {
159
187
  const name = meshPolygonsVertexAttributeName(id);
160
188
  const item = meshPolygonsVertexAttributeItem(id);
161
189
  const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name, item);
@@ -168,19 +196,21 @@ function useMeshPolygonsVertexAttributeStyle() {
168
196
  no_data_color: storedConfig.no_data_color,
169
197
  };
170
198
  if (isMeshPolygonsVertexAttributeValid(attribute)) {
171
- return setMeshPolygonsVertexAttribute(id, attribute);
199
+ const result = await setMeshPolygonsVertexAttribute(id, attribute);
200
+ return result;
172
201
  }
202
+ return undefined;
173
203
  }
174
- function setMeshPolygonsVertexAttributeName(id: string, name: string) {
204
+ async function setMeshPolygonsVertexAttributeName(id: string, name: string): Promise<unknown> {
175
205
  const item = meshPolygonsVertexAttributeLastItem(id, name);
176
- mutateMeshPolygonsVertexStyle(id, {
206
+ await mutateMeshPolygonsVertexStyle(id, {
177
207
  name,
178
208
  item,
179
209
  });
180
210
  return applyVertexAttribute(id);
181
211
  }
182
- function setMeshPolygonsVertexAttributeItem(id: string, item: number) {
183
- mutateMeshPolygonsVertexStyle(id, {
212
+ async function setMeshPolygonsVertexAttributeItem(id: string, item: number): Promise<unknown> {
213
+ await mutateMeshPolygonsVertexStyle(id, {
184
214
  item,
185
215
  });
186
216
  return applyVertexAttribute(id);
@@ -191,10 +221,14 @@ function useMeshPolygonsVertexAttributeStyle() {
191
221
  const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name, item);
192
222
  return [storedConfig.minimum, storedConfig.maximum];
193
223
  }
194
- function setMeshPolygonsVertexAttributeRange(id: string, minimum: number, maximum: number) {
224
+ async function setMeshPolygonsVertexAttributeRange(
225
+ id: string,
226
+ minimum: number,
227
+ maximum: number,
228
+ ): Promise<unknown> {
195
229
  const name = meshPolygonsVertexAttributeName(id);
196
230
  const item = meshPolygonsVertexAttributeItem(id);
197
- setMeshPolygonsVertexAttributeStoredConfig(id, name, item, {
231
+ await setMeshPolygonsVertexAttributeStoredConfig(id, name, item, {
198
232
  minimum,
199
233
  maximum,
200
234
  });
@@ -206,10 +240,13 @@ function useMeshPolygonsVertexAttributeStyle() {
206
240
  const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name, item);
207
241
  return storedConfig.colorMap;
208
242
  }
209
- function setMeshPolygonsVertexAttributeColorMap(id: string, colorMap: string | undefined) {
243
+ async function setMeshPolygonsVertexAttributeColorMap(
244
+ id: string,
245
+ colorMap: string | undefined,
246
+ ): Promise<unknown> {
210
247
  const name = meshPolygonsVertexAttributeName(id);
211
248
  const item = meshPolygonsVertexAttributeItem(id);
212
- setMeshPolygonsVertexAttributeStoredConfig(id, name, item, {
249
+ await setMeshPolygonsVertexAttributeStoredConfig(id, name, item, {
213
250
  colorMap,
214
251
  });
215
252
  return applyVertexAttribute(id);
@@ -220,7 +257,10 @@ function useMeshPolygonsVertexAttributeStyle() {
220
257
  const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name, item);
221
258
  return storedConfig.no_data_color;
222
259
  }
223
- async function setMeshPolygonsVertexAttributeNoDataColor(id: string, no_data_color: unknown) {
260
+ async function setMeshPolygonsVertexAttributeNoDataColor(
261
+ id: string,
262
+ no_data_color: unknown,
263
+ ): Promise<unknown> {
224
264
  const name = meshPolygonsVertexAttributeName(id);
225
265
  const item = meshPolygonsVertexAttributeItem(id);
226
266
  const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name, item);
@@ -8,27 +8,37 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
8
8
  // Local constants
9
9
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.visibility;
10
10
 
11
- export function useMeshPolygonsVisibilityStyle() {
11
+ export function useMeshPolygonsVisibilityStyle(): {
12
+ meshPolygonsVisibility: (id: string) => boolean | undefined;
13
+ setMeshPolygonsVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
14
+ } {
12
15
  const viewerStore = useViewerStore();
13
16
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
14
17
 
15
18
  function meshPolygonsVisibility(id: string): boolean | undefined {
19
+ // oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
16
20
  return meshPolygonsCommonStyle.meshPolygonsStyle(id).visibility as boolean | undefined;
17
21
  }
18
- function setMeshPolygonsVisibility(id: string, visibility: boolean | undefined) {
22
+ async function setMeshPolygonsVisibility(
23
+ id: string,
24
+ visibility: boolean | undefined,
25
+ ): Promise<unknown> {
19
26
  const params = { id, visibility };
20
- return viewerStore.request(
27
+ const result = await viewerStore.request(
21
28
  {
22
29
  schema,
23
30
  params,
24
31
  },
25
32
  {
26
- response_function: () =>
27
- meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
33
+ response_function: async () => {
34
+ const mutateResult = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(id, {
28
35
  visibility,
29
- }),
36
+ });
37
+ return mutateResult;
38
+ },
30
39
  },
31
40
  );
41
+ return result;
32
42
  }
33
43
 
34
44
  return {
@@ -8,27 +8,33 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
8
8
  // Local constants
9
9
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra.color;
10
10
 
11
- export function useMeshPolyhedraColorStyle() {
11
+ export function useMeshPolyhedraColorStyle(): {
12
+ meshPolyhedraColor: (id: string) => unknown;
13
+ setMeshPolyhedraColor: (id: string, color: unknown) => Promise<unknown>;
14
+ } {
12
15
  const viewerStore = useViewerStore();
13
16
  const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
14
17
 
15
18
  function meshPolyhedraColor(id: string): unknown {
16
19
  return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).constant;
17
20
  }
18
- function setMeshPolyhedraColor(id: string, color: unknown) {
21
+ async function setMeshPolyhedraColor(id: string, color: unknown): Promise<unknown> {
19
22
  const params = { id, color };
20
- return viewerStore.request(
23
+ const result = await viewerStore.request(
21
24
  {
22
25
  schema,
23
26
  params,
24
27
  },
25
28
  {
26
- response_function: () =>
27
- meshPolyhedraCommonStyle.mutateMeshPolyhedraColoring(id, {
29
+ response_function: async () => {
30
+ const mutation_result = await meshPolyhedraCommonStyle.mutateMeshPolyhedraColoring(id, {
28
31
  constant: color,
29
- }),
32
+ });
33
+ return mutation_result;
34
+ },
30
35
  },
31
36
  );
37
+ return result;
32
38
  }
33
39
 
34
40
  return {
@@ -1,27 +1,35 @@
1
1
  import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
2
2
  import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
3
3
 
4
- export function useMeshPolyhedraCommonStyle() {
4
+ export function useMeshPolyhedraCommonStyle(): {
5
+ meshPolyhedraStyle: (id: string) => StyleValues;
6
+ meshPolyhedraColoring: (id: string) => StyleValues;
7
+ mutateMeshPolyhedraStyle: (id: string, values: StyleValues) => Promise<string>;
8
+ mutateMeshPolyhedraColoring: (id: string, values: StyleValues) => Promise<string>;
9
+ } {
5
10
  const dataStyleState = useDataStyleState();
6
11
 
7
- function mutateMeshPolyhedraStyle(id: string, values: StyleValues) {
8
- return dataStyleState.mutateStyle(id, {
12
+ async function mutateMeshPolyhedraStyle(id: string, values: StyleValues): Promise<string> {
13
+ const result = await dataStyleState.mutateStyle(id, {
9
14
  polyhedra: values,
10
15
  });
16
+ return result;
11
17
  }
12
18
 
13
19
  function meshPolyhedraStyle(id: string): StyleValues {
14
- return dataStyleState.getStyle(id).polyhedra as StyleValues;
20
+ return dataStyleState.getStyle(id).polyhedra ?? {};
15
21
  }
16
22
 
17
23
  function meshPolyhedraColoring(id: string): StyleValues {
24
+ // oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
18
25
  return meshPolyhedraStyle(id).coloring as StyleValues;
19
26
  }
20
27
 
21
- function mutateMeshPolyhedraColoring(id: string, values: StyleValues) {
22
- return mutateMeshPolyhedraStyle(id, {
28
+ async function mutateMeshPolyhedraColoring(id: string, values: StyleValues): Promise<string> {
29
+ const result = await mutateMeshPolyhedraStyle(id, {
23
30
  coloring: values,
24
31
  });
32
+ return result;
25
33
  }
26
34
 
27
35
  return {