@geode/opengeodeweb-front 10.34.0-rc.2 → 10.34.0-rc.4

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 (402) hide show
  1. package/README.md +8 -0
  2. package/app/assets/{geode_objects.js → geode_objects.ts} +8 -1
  3. package/app/components/ActionButton.vue +28 -12
  4. package/app/components/Basic/Slider.vue +2 -2
  5. package/app/components/Basic/Switch.vue +2 -2
  6. package/app/components/CameraManager/List.vue +9 -9
  7. package/app/components/CameraManager/Saver.vue +8 -2
  8. package/app/components/CameraManager.vue +20 -10
  9. package/app/components/CameraOrientation.vue +29 -15
  10. package/app/components/ClippingPlaneCard.vue +11 -12
  11. package/app/components/ClippingPlanes.vue +25 -15
  12. package/app/components/CrsSelector.vue +24 -15
  13. package/app/components/DeleteDialog.vue +16 -16
  14. package/app/components/DragAndDrop.vue +53 -33
  15. package/app/components/DragAndDropInternal/DragAndDropInline.vue +29 -16
  16. package/app/components/DragAndDropInternal/DragAndDropOverlay.vue +32 -19
  17. package/app/components/ExtensionSelector.vue +32 -16
  18. package/app/components/FeedBack/ErrorBanner.vue +1 -2
  19. package/app/components/FeedBack/Snackers.vue +3 -3
  20. package/app/components/FetchingData.vue +8 -12
  21. package/app/components/FileSelector.vue +20 -12
  22. package/app/components/FileUploader.vue +45 -24
  23. package/app/components/GlassCard.vue +16 -12
  24. package/app/components/HybridRenderingView.vue +22 -11
  25. package/app/components/HybridViewerTooltip.vue +24 -22
  26. package/app/components/InfraConnected.vue +1 -1
  27. package/app/components/Launcher.vue +11 -9
  28. package/app/components/Loading/EcoMessages.vue +16 -11
  29. package/app/components/Loading/Header.vue +6 -7
  30. package/app/components/Loading/Progress.vue +6 -7
  31. package/app/components/Loading.vue +8 -12
  32. package/app/components/MissingFilesSelector.vue +29 -15
  33. package/app/components/ObjectSelector.vue +33 -18
  34. package/app/components/PackagesVersions.vue +14 -7
  35. package/app/components/Recaptcha.vue +16 -22
  36. package/app/components/RemoteRenderingView.vue +16 -9
  37. package/app/components/Ruler.vue +8 -6
  38. package/app/components/Screenshot.vue +19 -13
  39. package/app/components/SearchBar.vue +10 -6
  40. package/app/components/ShrinkFilter.vue +12 -7
  41. package/app/components/Step.vue +30 -11
  42. package/app/components/Stepper.vue +18 -7
  43. package/app/components/ToolPanel.vue +25 -12
  44. package/app/components/ViewToolbar.vue +33 -21
  45. package/app/components/Viewer/ContextMenu/CenterButton.vue +14 -9
  46. package/app/components/Viewer/ContextMenu/CircularItems.vue +13 -10
  47. package/app/components/Viewer/ContextMenu/ContextMenu.vue +25 -20
  48. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +21 -9
  49. package/app/components/Viewer/ContextMenu/InfoCard.vue +31 -14
  50. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +8 -5
  51. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +59 -36
  52. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +67 -39
  53. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +61 -38
  54. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +43 -27
  55. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +84 -40
  56. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +67 -38
  57. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +101 -35
  58. package/app/components/Viewer/Generic/Model/CornersOptions.vue +67 -27
  59. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +14 -8
  60. package/app/components/Viewer/Generic/Model/LinesOptions.vue +96 -43
  61. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +24 -12
  62. package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +10 -5
  63. package/app/components/Viewer/Generic/Model/PointsOptions.vue +16 -10
  64. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +105 -31
  65. package/app/components/Viewer/Grid/2D/CellsOptions.vue +8 -5
  66. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +8 -5
  67. package/app/components/Viewer/Grid/2D/PointsOptions.vue +8 -5
  68. package/app/components/Viewer/Grid/3D/CellsOptions.vue +8 -5
  69. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +8 -5
  70. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +8 -5
  71. package/app/components/Viewer/Grid/3D/PointsOptions.vue +8 -5
  72. package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +63 -37
  73. package/app/components/Viewer/ObjectTree/Base/Controls.vue +24 -9
  74. package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +25 -8
  75. package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +22 -9
  76. package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +26 -11
  77. package/app/components/Viewer/ObjectTree/Box.vue +30 -15
  78. package/app/components/Viewer/ObjectTree/Layout.vue +29 -22
  79. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +54 -28
  80. package/app/components/Viewer/ObjectTree/Views/ModelCollections.vue +76 -30
  81. package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +86 -34
  82. package/app/components/Viewer/Options/AttributeColorBar.vue +12 -6
  83. package/app/components/Viewer/Options/AttributeRangeSelector.vue +6 -4
  84. package/app/components/Viewer/Options/AttributeSelector.vue +61 -28
  85. package/app/components/Viewer/Options/ColorMapList.vue +44 -18
  86. package/app/components/Viewer/Options/ColorMapPicker.vue +12 -8
  87. package/app/components/Viewer/Options/ColorPicker.vue +20 -13
  88. package/app/components/Viewer/Options/ColoringTypeSelector.vue +77 -57
  89. package/app/components/Viewer/Options/ColormapQuickPicker.vue +10 -8
  90. package/app/components/Viewer/Options/OptionsSection.vue +6 -4
  91. package/app/components/Viewer/Options/Sliders/Size.vue +3 -3
  92. package/app/components/Viewer/Options/Sliders/Slider.vue +9 -6
  93. package/app/components/Viewer/Options/Sliders/Width.vue +3 -3
  94. package/app/components/Viewer/Options/TextureItem.vue +24 -19
  95. package/app/components/Viewer/Options/TexturesSelector.vue +23 -12
  96. package/app/components/Viewer/Options/VisibilitySwitch.vue +3 -3
  97. package/app/components/Viewer/OverlappingObjectsPicker.vue +28 -12
  98. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +41 -25
  99. package/app/components/Viewer/Solid/EdgesOptions.vue +8 -5
  100. package/app/components/Viewer/Solid/PointsOptions.vue +8 -5
  101. package/app/components/Viewer/Solid/PolygonsOptions.vue +8 -5
  102. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +66 -37
  103. package/app/components/Viewer/Surface/EdgesOptions.vue +8 -5
  104. package/app/components/Viewer/Surface/PointsOptions.vue +8 -5
  105. package/app/components/Viewer/Surface/PolygonsOptions.vue +72 -38
  106. package/app/components/Viewer/Surface/Triangulated/TrianglesOptions.vue +8 -5
  107. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +8 -5
  108. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +8 -5
  109. package/app/components/Viewer/Ui.vue +18 -13
  110. package/app/components/Wrapper.vue +18 -9
  111. package/app/components/ZScaling.vue +15 -9
  112. package/app/components/csv-preview/CsvPreviewer.vue +38 -17
  113. package/app/components/csv-preview/CsvSettings.vue +26 -48
  114. package/app/components/csv-preview/CsvTable.vue +34 -14
  115. package/app/composables/{batch_style.js → batch_style.ts} +4 -1
  116. package/app/composables/{clipping_planes_widget.js → clipping_planes_widget.ts} +105 -42
  117. package/app/composables/{global_attribute_style.js → global_attribute_style.ts} +72 -30
  118. package/app/composables/{hover_highlight.js → hover_highlight.ts} +16 -12
  119. package/app/composables/{model_collections.js → model_collections.ts} +10 -4
  120. package/app/composables/{model_components.js → model_components.ts} +10 -4
  121. package/app/composables/{project_manager.js → project_manager.ts} +1 -1
  122. package/app/composables/{responsive_middle_truncate.js → responsive_middle_truncate.ts} +15 -1
  123. package/app/composables/{run_function_when_microservices_connected.js → run_function_when_microservices_connected.ts} +1 -1
  124. package/app/composables/{stepper_tree.js → stepper_tree.ts} +10 -10
  125. package/app/composables/{tree_filter.js → tree_filter.ts} +49 -15
  126. package/app/composables/{tree_keyboard_nav.js → tree_keyboard_nav.ts} +44 -16
  127. package/app/composables/{tree_scroll.js → tree_scroll.ts} +26 -7
  128. package/app/composables/{use_adaptive_styles.js → use_adaptive_styles.ts} +39 -15
  129. package/app/composables/{use_overlapping_picker.js → use_overlapping_picker.ts} +58 -14
  130. package/app/composables/{use_quick_colormap.js → use_quick_colormap.ts} +15 -3
  131. package/app/composables/{virtual_tree.js → virtual_tree.ts} +69 -21
  132. package/app/plugins/{auto_store_register.js → auto_store_register.ts} +4 -1
  133. package/app/stores/{app.js → app.ts} +98 -37
  134. package/app/stores/{back.js → back.ts} +26 -16
  135. package/app/stores/camera_manager.ts +78 -0
  136. package/app/stores/{cloud.js → cloud.ts} +5 -4
  137. package/app/stores/{data.js → data.ts} +110 -37
  138. package/app/stores/data_helpers/collections.ts +140 -0
  139. package/app/stores/data_helpers/mesh.ts +160 -0
  140. package/app/stores/{data_style.js → data_style.ts} +39 -10
  141. package/app/stores/{feedback.js → feedback.ts} +16 -5
  142. package/app/stores/{hybrid_viewer.js → hybrid_viewer.ts} +29 -14
  143. package/app/stores/{infra.js → infra.ts} +18 -9
  144. package/app/stores/{menu.js → menu.ts} +54 -32
  145. package/app/stores/{treeview.js → treeview.ts} +108 -45
  146. package/app/stores/{viewer.js → viewer.ts} +45 -24
  147. package/app/utils/attributes.ts +40 -0
  148. package/app/utils/{clipping_planes.js → clipping_planes.ts} +30 -15
  149. package/app/utils/{colormap.js → colormap.ts} +29 -14
  150. package/app/utils/default_styles/{constants.js → constants.ts} +25 -12
  151. package/app/utils/default_styles/{index.js → index.ts} +3 -2
  152. package/app/utils/default_styles/{meshes.js → meshes.ts} +27 -48
  153. package/app/utils/default_styles/{models.js → models.ts} +25 -40
  154. package/app/utils/{extension.js → extension.ts} +27 -10
  155. package/app/utils/{import_workflow.js → import_workflow.ts} +24 -17
  156. package/app/utils/{log.js → log.ts} +12 -2
  157. package/app/utils/{name_cleaner.js → name_cleaner.ts} +5 -5
  158. package/app/utils/status.ts +19 -0
  159. package/app/utils/{stores.js → stores.ts} +5 -5
  160. package/app/utils/{string.js → string.ts} +5 -5
  161. package/app/utils/{treeview.js → treeview.ts} +4 -1
  162. package/internal/database/{base_database.js → base_database.ts} +2 -2
  163. package/internal/database/{database.js → database.ts} +30 -18
  164. package/internal/database/{extended_database.js → extended_database.ts} +5 -1
  165. package/internal/database/tables/camera_positions.ts +6 -0
  166. package/internal/database/tables/{data.js → data.ts} +3 -1
  167. package/internal/database/tables/data_style.ts +6 -0
  168. package/internal/database/tables/model_component_datastyle.ts +6 -0
  169. package/internal/database/tables/model_component_type_datastyle.ts +6 -0
  170. package/internal/database/tables/model_components.ts +6 -0
  171. package/internal/database/tables/model_components_relation.ts +6 -0
  172. package/internal/database/tables/table_definition.ts +5 -0
  173. package/internal/stores/data_style/mesh/cells/{cell.js → cell.ts} +83 -36
  174. package/internal/stores/data_style/mesh/cells/{color.js → color.ts} +2 -2
  175. package/internal/stores/data_style/mesh/cells/{common.js → common.ts} +8 -7
  176. package/internal/stores/data_style/mesh/cells/{index.js → index.ts} +5 -5
  177. package/internal/stores/data_style/mesh/cells/{textures.js → textures.ts} +3 -3
  178. package/internal/stores/data_style/mesh/cells/{vertex.js → vertex.ts} +79 -28
  179. package/internal/stores/data_style/mesh/cells/{visibility.js → visibility.ts} +3 -3
  180. package/internal/stores/data_style/mesh/edges/{color.js → color.ts} +2 -2
  181. package/internal/stores/data_style/mesh/edges/{common.js → common.ts} +7 -6
  182. package/internal/stores/data_style/mesh/edges/{edge.js → edge.ts} +81 -29
  183. package/internal/stores/data_style/mesh/edges/{index.js → index.ts} +5 -6
  184. package/internal/stores/data_style/mesh/edges/{vertex.js → vertex.ts} +81 -29
  185. package/internal/stores/data_style/mesh/edges/{visibility.js → visibility.ts} +3 -3
  186. package/internal/stores/data_style/mesh/edges/{width.js → width.ts} +3 -3
  187. package/internal/stores/data_style/mesh/{index.js → index.ts} +9 -8
  188. package/internal/stores/data_style/mesh/points/{color.js → color.ts} +2 -2
  189. package/internal/stores/data_style/mesh/points/{common.js → common.ts} +8 -7
  190. package/internal/stores/data_style/mesh/points/{index.js → index.ts} +5 -5
  191. package/internal/stores/data_style/mesh/points/{size.js → size.ts} +3 -3
  192. package/internal/stores/data_style/mesh/points/{vertex.js → vertex.ts} +79 -28
  193. package/internal/stores/data_style/mesh/points/{visibility.js → visibility.ts} +7 -5
  194. package/internal/stores/data_style/mesh/polygons/{color.js → color.ts} +2 -2
  195. package/internal/stores/data_style/mesh/polygons/{common.js → common.ts} +7 -6
  196. package/internal/stores/data_style/mesh/polygons/{index.js → index.ts} +5 -5
  197. package/internal/stores/data_style/mesh/polygons/{polygon.js → polygon.ts} +81 -29
  198. package/internal/stores/data_style/mesh/polygons/{textures.js → textures.ts} +3 -3
  199. package/internal/stores/data_style/mesh/polygons/{vertex.js → vertex.ts} +81 -29
  200. package/internal/stores/data_style/mesh/polygons/{visibility.js → visibility.ts} +3 -3
  201. package/internal/stores/data_style/mesh/polyhedra/{color.js → color.ts} +2 -2
  202. package/internal/stores/data_style/mesh/polyhedra/{common.js → common.ts} +7 -6
  203. package/internal/stores/data_style/mesh/polyhedra/{index.js → index.ts} +5 -5
  204. package/internal/stores/data_style/mesh/polyhedra/{polyhedron.js → polyhedron.ts} +86 -29
  205. package/internal/stores/data_style/mesh/polyhedra/{vertex.js → vertex.ts} +81 -29
  206. package/internal/stores/data_style/mesh/polyhedra/{visibility.js → visibility.ts} +3 -3
  207. package/internal/stores/data_style/model/blocks/{color.js → color.ts} +18 -6
  208. package/internal/stores/data_style/model/blocks/{common.js → common.ts} +9 -8
  209. package/internal/stores/data_style/model/blocks/{index.js → index.ts} +26 -11
  210. package/internal/stores/data_style/model/blocks/{polyhedron.js → polyhedron.ts} +121 -30
  211. package/internal/stores/data_style/model/blocks/{vertex.js → vertex.ts} +110 -30
  212. package/internal/stores/data_style/model/blocks/{visibility.js → visibility.ts} +6 -2
  213. package/internal/stores/data_style/model/{color.js → color.ts} +70 -28
  214. package/internal/stores/data_style/model/common.ts +216 -0
  215. package/internal/stores/data_style/model/corners/{color.js → color.ts} +18 -6
  216. package/internal/stores/data_style/model/corners/{common.js → common.ts} +9 -8
  217. package/internal/stores/data_style/model/corners/{index.js → index.ts} +24 -10
  218. package/internal/stores/data_style/model/corners/{vertex.js → vertex.ts} +115 -35
  219. package/internal/stores/data_style/model/corners/{visibility.js → visibility.ts} +6 -2
  220. package/internal/stores/data_style/model/edges/{common.js → common.ts} +4 -3
  221. package/internal/stores/data_style/model/edges/{index.js → index.ts} +0 -6
  222. package/internal/stores/data_style/model/edges/{visibility.js → visibility.ts} +4 -4
  223. package/internal/stores/data_style/model/{index.js → index.ts} +4 -4
  224. package/internal/stores/data_style/model/lines/{color.js → color.ts} +18 -6
  225. package/internal/stores/data_style/model/lines/{common.js → common.ts} +9 -8
  226. package/internal/stores/data_style/model/lines/{edge.js → edge.ts} +107 -30
  227. package/internal/stores/data_style/model/lines/{index.js → index.ts} +26 -11
  228. package/internal/stores/data_style/model/lines/{vertex.js → vertex.ts} +107 -30
  229. package/internal/stores/data_style/model/lines/{visibility.js → visibility.ts} +6 -2
  230. package/internal/stores/data_style/model/points/{common.js → common.ts} +4 -3
  231. package/internal/stores/data_style/model/points/{index.js → index.ts} +6 -3
  232. package/internal/stores/data_style/model/points/{size.js → size.ts} +3 -3
  233. package/internal/stores/data_style/model/points/{visibility.js → visibility.ts} +3 -3
  234. package/internal/stores/data_style/model/selection.ts +116 -0
  235. package/internal/stores/data_style/model/surfaces/{color.js → color.ts} +18 -6
  236. package/internal/stores/data_style/model/surfaces/{common.js → common.ts} +9 -8
  237. package/internal/stores/data_style/model/surfaces/{index.js → index.ts} +28 -11
  238. package/internal/stores/data_style/model/surfaces/{polygon.js → polygon.ts} +122 -30
  239. package/internal/stores/data_style/model/surfaces/{vertex.js → vertex.ts} +122 -30
  240. package/internal/stores/data_style/model/surfaces/{visibility.js → visibility.ts} +6 -2
  241. package/internal/stores/data_style/model/{visibility.js → visibility.ts} +38 -20
  242. package/internal/stores/data_style/state.ts +269 -0
  243. package/internal/stores/data_style/types.ts +30 -0
  244. package/internal/stores/hybrid_viewer/{brightness.js → brightness.ts} +35 -11
  245. package/internal/stores/hybrid_viewer/{camera.js → camera.ts} +90 -52
  246. package/internal/stores/hybrid_viewer/{camera_animation.js → camera_animation.ts} +27 -10
  247. package/internal/stores/hybrid_viewer/{constants.js → constants.ts} +2 -2
  248. package/internal/stores/hybrid_viewer/{filters.js → filters.ts} +9 -6
  249. package/internal/stores/hybrid_viewer/{highlight.js → highlight.ts} +81 -29
  250. package/internal/stores/hybrid_viewer/{ruler.js → ruler.ts} +38 -19
  251. package/internal/stores/hybrid_viewer/{scene.js → scene.ts} +39 -29
  252. package/internal/stores/hybrid_viewer/viewport.ts +168 -0
  253. package/internal/stores/hybrid_viewer/vtk_types.ts +74 -0
  254. package/internal/utils/api_fetch.ts +102 -0
  255. package/internal/utils/upload_file.ts +94 -0
  256. package/internal/utils/viewer_call.ts +90 -0
  257. package/internal/utils/ws_client.ts +43 -0
  258. package/{nuxt.config.js → nuxt.config.ts} +6 -1
  259. package/opengeodeweb_front_schemas.js +175 -0
  260. package/package.json +32 -8
  261. package/server/api/cloud/extensions/{run.post.js → run.post.ts} +17 -9
  262. package/server/api/local/app/{project_folder_path.post.js → project_folder_path.post.ts} +7 -3
  263. package/server/api/local/app/{run_back.post.js → run_back.post.ts} +12 -4
  264. package/server/api/local/app/{run_viewer.post.js → run_viewer.post.ts} +12 -4
  265. package/server/api/local/extensions/{kill.post.js → kill.post.ts} +12 -6
  266. package/server/api/local/extensions/{run.post.js → run.post.ts} +17 -9
  267. package/server/api/local/extensions/{upload.put.js → upload.put.ts} +13 -4
  268. package/server/api/microservice/app/{get_is_app_ready.get.js → get_is_app_ready.get.ts} +4 -3
  269. package/server/api/microservice/app/{set_app_base_url.post.js → set_app_base_url.post.ts} +9 -4
  270. package/server/api/microservice/app/{set_back_base_url.post.js → set_back_base_url.post.ts} +9 -4
  271. package/server/api/microservice/app/{set_is_app_ready.post.js → set_is_app_ready.post.ts} +9 -4
  272. package/server/api/microservice/app/{set_viewer_base_url.post.js → set_viewer_base_url.post.ts} +9 -4
  273. package/server/api/microservice/extensions/{download.post.js → download.post.ts} +9 -3
  274. package/server/api/serverless/{run_cloud.post.js → run_cloud.post.ts} +13 -7
  275. package/server/types/vendor.d.ts +64 -0
  276. package/server/utils/app_config.js +34 -64
  277. package/server/utils/app_config.ts +96 -0
  278. package/server/utils/cleanup.js +97 -148
  279. package/server/utils/cleanup.ts +189 -0
  280. package/server/utils/cloud.js +103 -148
  281. package/server/utils/cloud.ts +219 -0
  282. package/server/utils/{extension.js → extension.ts} +17 -4
  283. package/server/utils/microservices.js +126 -159
  284. package/server/utils/microservices.ts +206 -0
  285. package/server/utils/path.js +88 -134
  286. package/server/utils/path.ts +173 -0
  287. package/server/utils/scripts.js +116 -164
  288. package/server/utils/scripts.ts +195 -0
  289. package/server/utils/server.js +34 -50
  290. package/server/utils/server.ts +67 -0
  291. package/server/utils/server_config.js +23 -38
  292. package/server/utils/server_config.ts +60 -0
  293. package/server/utils/ws_client.js +81 -106
  294. package/server/utils/ws_client.ts +134 -0
  295. package/shared/app_mode.js +5 -4
  296. package/shared/app_mode.ts +7 -0
  297. package/shared/scripts.js +37 -32
  298. package/shared/scripts.ts +44 -0
  299. package/shared/utils/call_raw.js +25 -41
  300. package/shared/utils/call_raw.ts +66 -0
  301. package/shared/utils/call_schema.js +24 -41
  302. package/shared/utils/call_schema.ts +57 -0
  303. package/shared/utils/fetch_raw.js +36 -57
  304. package/shared/utils/fetch_raw.ts +85 -0
  305. package/shared/utils/fetch_schema.js +27 -44
  306. package/shared/utils/fetch_schema.ts +61 -0
  307. package/shared/utils/file.js +6 -10
  308. package/shared/utils/file.ts +16 -0
  309. package/shared/utils/parse_boolean.js +20 -13
  310. package/shared/utils/parse_boolean.ts +16 -0
  311. package/shared/utils/response_handlers/load.js +39 -66
  312. package/shared/utils/response_handlers/load.ts +94 -0
  313. package/shared/utils/types.js +1 -0
  314. package/shared/utils/types.ts +27 -0
  315. package/shared/utils/validate_schema.js +13 -9
  316. package/shared/utils/validate_schema.ts +15 -0
  317. package/.github/workflows/config.json +0 -5
  318. package/.github/workflows/deploy.yml +0 -15
  319. package/.github/workflows/manual_release.yml +0 -11
  320. package/.github/workflows/merge_request.yml +0 -9
  321. package/.github/workflows/pr_update.yml +0 -11
  322. package/.github/workflows/prepare_deploy.yml +0 -9
  323. package/.github/workflows/schedule.yml +0 -18
  324. package/.github/workflows/test.yml +0 -14
  325. package/.github/workflows/test_pr.yml +0 -12
  326. package/.oxlintrc.json +0 -150
  327. package/.releaserc +0 -11
  328. package/app/stores/camera_manager.js +0 -57
  329. package/app/stores/data_helpers/collections.js +0 -96
  330. package/app/stores/data_helpers/mesh.js +0 -122
  331. package/app/utils/attributes.js +0 -23
  332. package/app/utils/status.js +0 -10
  333. package/commitlint.config.js +0 -20
  334. package/internal/database/tables/camera_positions.js +0 -4
  335. package/internal/database/tables/data_style.js +0 -4
  336. package/internal/database/tables/model_component_datastyle.js +0 -4
  337. package/internal/database/tables/model_component_type_datastyle.js +0 -4
  338. package/internal/database/tables/model_components.js +0 -4
  339. package/internal/database/tables/model_components_relation.js +0 -4
  340. package/internal/stores/data_style/model/common.js +0 -141
  341. package/internal/stores/data_style/model/selection.js +0 -89
  342. package/internal/stores/data_style/state.js +0 -197
  343. package/internal/stores/hybrid_viewer/viewport.js +0 -140
  344. package/internal/utils/api_fetch.js +0 -52
  345. package/internal/utils/upload_file.js +0 -57
  346. package/internal/utils/viewer_call.js +0 -49
  347. package/internal/utils/ws_client.js +0 -29
  348. package/scripts/generate_geode_objects.js +0 -24
  349. package/tests/integration/data/uploads/test.og_brep +0 -0
  350. package/tests/integration/data/uploads/test.og_edc2d +0 -0
  351. package/tests/integration/data/uploads/test.og_edc3d +0 -0
  352. package/tests/integration/data/uploads/test.og_psf3d +0 -0
  353. package/tests/integration/data/uploads/test.og_rgd2d +0 -0
  354. package/tests/integration/data/uploads/test.og_rgd3d +0 -0
  355. package/tests/integration/data/uploads/test.vtu +0 -22
  356. package/tests/integration/setup.js +0 -92
  357. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +0 -343
  358. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +0 -254
  359. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +0 -62
  360. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +0 -201
  361. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +0 -260
  362. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +0 -267
  363. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +0 -397
  364. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +0 -264
  365. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +0 -71
  366. package/tests/integration/stores/data_style/model/index.nuxt.test.js +0 -92
  367. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +0 -379
  368. package/tests/integration/stores/data_style/model/points.nuxt.test.js +0 -95
  369. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +0 -574
  370. package/tests/integration/stores/viewer.nuxt.test.js +0 -69
  371. package/tests/setup_indexeddb.js +0 -4
  372. package/tests/unit/components/CrsSelector.nuxt.test.js +0 -55
  373. package/tests/unit/components/DragAndDrop.nuxt.test.js +0 -89
  374. package/tests/unit/components/ExtensionSelector.nuxt.test.js +0 -65
  375. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +0 -41
  376. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +0 -49
  377. package/tests/unit/components/FileSelector.nuxt.test.js +0 -124
  378. package/tests/unit/components/FileUploader.nuxt.test.js +0 -69
  379. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +0 -77
  380. package/tests/unit/components/ObjectSelector.nuxt.test.js +0 -118
  381. package/tests/unit/components/PackagesVersions.nuxt.test.js +0 -42
  382. package/tests/unit/components/Step.nuxt.test.js +0 -51
  383. package/tests/unit/components/Stepper.nuxt.test.js +0 -41
  384. package/tests/unit/components/ToolPanel.nuxt.test.js +0 -66
  385. package/tests/unit/composables/api_fetch.nuxt.test.js +0 -75
  386. package/tests/unit/composables/project_manager.nuxt.test.js +0 -299
  387. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +0 -57
  388. package/tests/unit/composables/upload_file.nuxt.test.js +0 -45
  389. package/tests/unit/composables/virtual_tree.nuxt.test.js +0 -63
  390. package/tests/unit/plugins/project_load.nuxt.test.js +0 -98
  391. package/tests/unit/stores/app.nuxt.test.js +0 -189
  392. package/tests/unit/stores/back.nuxt.test.js +0 -147
  393. package/tests/unit/stores/cloud.nuxt.test.js +0 -90
  394. package/tests/unit/stores/data.nuxt.test.js +0 -162
  395. package/tests/unit/stores/feedback.nuxt.test.js +0 -90
  396. package/tests/unit/stores/infra.nuxt.test.js +0 -313
  397. package/tests/unit/stores/treeview.nuxt.test.js +0 -63
  398. package/tests/unit/stores/viewer.nuxt.test.js +0 -161
  399. package/tests/unit/utils/validate_schema.nuxt.test.js +0 -38
  400. package/tests/utils.js +0 -20
  401. package/tests/vitest.config.js +0 -67
  402. /package/server/api/local/app/{kill.post.js → kill.post.ts} +0 -0
@@ -11,7 +11,36 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
11
11
  // Local constants
12
12
  const attributeSchema =
13
13
  viewer_schemas.opengeodeweb_viewer.model.surfaces.attribute.vertex.attribute;
14
- function isModelSurfacesVertexAttributeValid({ name, item, minimum, maximum, colorMap }) {
14
+
15
+ interface AttributeStoredConfig {
16
+ minimum: number | undefined;
17
+ maximum: number | undefined;
18
+ colorMap: string | undefined;
19
+ no_data_color: unknown;
20
+ }
21
+
22
+ interface AttributeState {
23
+ name?: string;
24
+ item?: number;
25
+ storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
26
+ }
27
+
28
+ interface AttributeInput {
29
+ name: string | undefined;
30
+ item: number | undefined;
31
+ minimum: number | undefined;
32
+ maximum: number | undefined;
33
+ colorMap: string | undefined;
34
+ no_data_color?: unknown;
35
+ }
36
+
37
+ function isModelSurfacesVertexAttributeValid({
38
+ name,
39
+ item,
40
+ minimum,
41
+ maximum,
42
+ colorMap,
43
+ }: AttributeInput): boolean {
15
44
  return (
16
45
  name !== undefined &&
17
46
  item !== undefined &&
@@ -26,13 +55,25 @@ function useModelSurfacesVertexAttribute() {
26
55
  const dataStore = useDataStore();
27
56
  const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
28
57
  const viewerStore = useViewerStore();
29
- function modelSurfacesVertexAttribute(modelId, surfaceId) {
30
- return modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId).vertex;
58
+ function modelSurfacesVertexAttribute(modelId: string, surfaceId?: string): AttributeState {
59
+ return modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId)
60
+ .vertex as AttributeState;
31
61
  }
32
- function modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item) {
62
+ function modelSurfacesVertexAttributeStoredConfig(
63
+ modelId: string,
64
+ surfaceId: string | undefined,
65
+ name: string | undefined,
66
+ item: number | undefined,
67
+ ): AttributeStoredConfig {
33
68
  const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
34
- if (storedConfigs && name in storedConfigs && item in storedConfigs[name]) {
35
- return storedConfigs[name][item];
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]!;
36
77
  }
37
78
  return {
38
79
  minimum: undefined,
@@ -41,7 +82,11 @@ function useModelSurfacesVertexAttribute() {
41
82
  no_data_color: DEFAULT_NO_DATA_COLOR,
42
83
  };
43
84
  }
44
- function mutateModelSurfacesVertexStyle(modelId, surfaceIds, values) {
85
+ function mutateModelSurfacesVertexStyle(
86
+ modelId: string,
87
+ surfaceIds: string[],
88
+ values: Record<string, unknown>,
89
+ ) {
45
90
  if (surfaceIds.length > 1) {
46
91
  modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
47
92
  vertex: values,
@@ -51,50 +96,76 @@ function useModelSurfacesVertexAttribute() {
51
96
  vertex: values,
52
97
  });
53
98
  }
54
- function setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, config) {
99
+ function setModelSurfacesVertexAttributeStoredConfig(
100
+ modelId: string,
101
+ surfaceIds: string[],
102
+ name: string | undefined,
103
+ item: number | undefined,
104
+ config: Partial<AttributeStoredConfig>,
105
+ ) {
55
106
  return mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
56
107
  storedConfigs: {
57
- [name]: {
108
+ [name as string]: {
58
109
  lastItem: item,
59
- [item]: config,
110
+ [item as number]: config,
60
111
  },
61
112
  },
62
113
  });
63
114
  }
64
- function modelSurfacesVertexAttributeName(modelId, surfaceId) {
115
+ function modelSurfacesVertexAttributeName(
116
+ modelId: string,
117
+ surfaceId?: string,
118
+ ): string | undefined {
65
119
  return modelSurfacesVertexAttribute(modelId, surfaceId).name;
66
120
  }
67
- function modelSurfacesVertexAttributeLastItem(modelId, surfaceId, name) {
121
+ function modelSurfacesVertexAttributeLastItem(
122
+ modelId: string,
123
+ surfaceId: string | undefined,
124
+ name: string | undefined,
125
+ ): number {
68
126
  const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
69
- if (!(name in storedConfigs)) {
70
- return 0;
127
+ if (storedConfigs && name !== undefined && name in storedConfigs) {
128
+ return storedConfigs[name]!.lastItem;
71
129
  }
72
- return storedConfigs[name].lastItem;
130
+ return 0;
73
131
  }
74
- function modelSurfacesVertexAttributeItem(modelId, surfaceId) {
132
+ function modelSurfacesVertexAttributeItem(modelId: string, surfaceId?: string): number {
75
133
  const vertexAttribute = modelSurfacesVertexAttribute(modelId, surfaceId);
76
134
  return (
77
135
  vertexAttribute.item ??
78
136
  modelSurfacesVertexAttributeLastItem(modelId, surfaceId, vertexAttribute.name)
79
137
  );
80
138
  }
81
- function modelSurfacesVertexAttributeRange(modelId, surfaceId) {
139
+ function modelSurfacesVertexAttributeRange(
140
+ modelId: string,
141
+ surfaceId?: string,
142
+ ): [number | undefined, number | undefined] {
82
143
  const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
83
144
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
84
145
  const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
85
146
  const { minimum, maximum } = storedConfig;
86
147
  return [minimum, maximum];
87
148
  }
88
- function modelSurfacesVertexAttributeColorMap(modelId, surfaceId) {
149
+ function modelSurfacesVertexAttributeColorMap(
150
+ modelId: string,
151
+ surfaceId?: string,
152
+ ): string | undefined {
89
153
  const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
90
154
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
91
155
  const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
92
156
  return storedConfig.colorMap;
93
157
  }
94
158
  async function setModelSurfacesVertexAttribute(
95
- modelId,
96
- surfaceIds,
97
- { name, item, minimum, maximum, colorMap, no_data_color = DEFAULT_NO_DATA_COLOR },
159
+ modelId: string,
160
+ surfaceIds: string[],
161
+ {
162
+ name,
163
+ item,
164
+ minimum,
165
+ maximum,
166
+ colorMap,
167
+ no_data_color = DEFAULT_NO_DATA_COLOR,
168
+ }: AttributeInput,
98
169
  ) {
99
170
  mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
100
171
  name,
@@ -106,7 +177,7 @@ function useModelSurfacesVertexAttribute() {
106
177
  colorMap,
107
178
  no_data_color,
108
179
  });
109
- const points = getRGBPointsFromPreset(colorMap);
180
+ const points = getRGBPointsFromPreset(colorMap as string);
110
181
  const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
111
182
  const params = {
112
183
  id: modelId,
@@ -123,7 +194,7 @@ function useModelSurfacesVertexAttribute() {
123
194
  params,
124
195
  });
125
196
  }
126
- function applyVertexAttribute(modelId, surfaceIds) {
197
+ function applyVertexAttribute(modelId: string, surfaceIds: string[]) {
127
198
  const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
128
199
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
129
200
  const storedConfig = modelSurfacesVertexAttributeStoredConfig(
@@ -132,7 +203,7 @@ function useModelSurfacesVertexAttribute() {
132
203
  name,
133
204
  item,
134
205
  );
135
- const attribute = {
206
+ const attribute: AttributeInput = {
136
207
  name,
137
208
  item,
138
209
  minimum: storedConfig.minimum,
@@ -145,7 +216,11 @@ function useModelSurfacesVertexAttribute() {
145
216
  }
146
217
  return Promise.resolve();
147
218
  }
148
- function setModelSurfacesVertexAttributeName(modelId, surfaceIds, name) {
219
+ function setModelSurfacesVertexAttributeName(
220
+ modelId: string,
221
+ surfaceIds: string[],
222
+ name: string,
223
+ ) {
149
224
  const item = modelSurfacesVertexAttributeLastItem(modelId, surfaceIds[0], name);
150
225
  mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
151
226
  name,
@@ -153,13 +228,22 @@ function useModelSurfacesVertexAttribute() {
153
228
  });
154
229
  return applyVertexAttribute(modelId, surfaceIds);
155
230
  }
156
- function setModelSurfacesVertexAttributeItem(modelId, surfaceIds, item) {
231
+ function setModelSurfacesVertexAttributeItem(
232
+ modelId: string,
233
+ surfaceIds: string[],
234
+ item: number,
235
+ ) {
157
236
  mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
158
237
  item,
159
238
  });
160
239
  return applyVertexAttribute(modelId, surfaceIds);
161
240
  }
162
- function setModelSurfacesVertexAttributeRange(modelId, surfaceIds, minimum, maximum) {
241
+ function setModelSurfacesVertexAttributeRange(
242
+ modelId: string,
243
+ surfaceIds: string[],
244
+ minimum: number,
245
+ maximum: number,
246
+ ) {
163
247
  const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
164
248
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
165
249
  setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
@@ -168,7 +252,11 @@ function useModelSurfacesVertexAttribute() {
168
252
  });
169
253
  return applyVertexAttribute(modelId, surfaceIds);
170
254
  }
171
- function setModelSurfacesVertexAttributeColorMap(modelId, surfaceIds, colorMap) {
255
+ function setModelSurfacesVertexAttributeColorMap(
256
+ modelId: string,
257
+ surfaceIds: string[],
258
+ colorMap: string | undefined,
259
+ ) {
172
260
  const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
173
261
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
174
262
  setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
@@ -176,13 +264,17 @@ function useModelSurfacesVertexAttribute() {
176
264
  });
177
265
  return applyVertexAttribute(modelId, surfaceIds);
178
266
  }
179
- function modelSurfacesVertexAttributeNoDataColor(modelId, surfaceId) {
267
+ function modelSurfacesVertexAttributeNoDataColor(modelId: string, surfaceId?: string): unknown {
180
268
  const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
181
269
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
182
270
  const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
183
271
  return storedConfig.no_data_color;
184
272
  }
185
- async function setModelSurfacesVertexAttributeNoDataColor(modelId, surfaceIds, no_data_color) {
273
+ async function setModelSurfacesVertexAttributeNoDataColor(
274
+ modelId: string,
275
+ surfaceIds: string[],
276
+ no_data_color: unknown,
277
+ ) {
186
278
  const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
187
279
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
188
280
  const storedConfig = modelSurfacesVertexAttributeStoredConfig(
@@ -8,11 +8,15 @@ export function useModelSurfacesVisibility() {
8
8
  const modelCommonStyle = useModelCommonStyle();
9
9
  const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
10
10
 
11
- function modelSurfaceVisibility(id, surface_id) {
11
+ function modelSurfaceVisibility(id: string, surface_id?: string): unknown {
12
12
  return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).visibility;
13
13
  }
14
14
 
15
- function setModelSurfacesVisibility(modelId, surfaces_ids, visibility) {
15
+ function setModelSurfacesVisibility(
16
+ modelId: string,
17
+ surfaces_ids: string[],
18
+ visibility: boolean | undefined,
19
+ ) {
16
20
  return modelCommonStyle.setModelTypeVisibility(modelId, surfaces_ids, visibility, schema);
17
21
  }
18
22
 
@@ -7,13 +7,22 @@ import { useModelSelection } from "./selection";
7
7
  import { useViewerStore } from "@ogw_front/stores/viewer";
8
8
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
9
9
 
10
+ // The four per-component-type style composables (Surface/Line/Block/Corner) each expose a different, large set of methods (color, visibility, per-attribute-kind getters/setters...). This module only cares about looking a handful of them up dynamically by name, so a precise structural type for componentStyleFunctions isn't worth modelling here; `any` keeps the dynamic dispatch table honest about that.
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ type ComponentStyleFunctions = Record<"Surface" | "Line" | "Block" | "Corner", any>;
13
+
14
+ interface ModelComponent {
15
+ geode_id: string;
16
+ type: string;
17
+ }
18
+
10
19
  const model_schemas = viewer_schemas.opengeodeweb_viewer.model;
11
- async function getModelComponentsMap(modelId) {
20
+ async function getModelComponentsMap(modelId: string) {
12
21
  const dataStore = useDataStore();
13
22
  const results = await Promise.all(
14
23
  MESH_COMPONENT_TYPES.map(async (type) => {
15
24
  const geodeIds = await dataStore.getMeshComponentGeodeIds(modelId, type);
16
- return geodeIds.map((geode_id) => ({
25
+ return geodeIds.map((geode_id): ModelComponent => ({
17
26
  geode_id,
18
27
  type,
19
28
  }));
@@ -23,19 +32,19 @@ async function getModelComponentsMap(modelId) {
23
32
  return {
24
33
  allComponents,
25
34
  componentsMap: Object.fromEntries(
26
- allComponents.map((component) => [component.geode_id, component]),
35
+ allComponents.map((component): [string, ModelComponent] => [component.geode_id, component]),
27
36
  ),
28
37
  };
29
38
  }
30
39
  async function dispatchToComponentTypes(
31
- modelId,
32
- componentIds,
33
- action,
34
- { componentStyleFunctions },
35
- ...args
40
+ modelId: string,
41
+ componentIds: string[],
42
+ action: string,
43
+ { componentStyleFunctions }: { componentStyleFunctions: ComponentStyleFunctions },
44
+ ...args: unknown[]
36
45
  ) {
37
46
  const { componentsMap } = await getModelComponentsMap(modelId);
38
- const idsByComponent = {
47
+ const idsByComponent: { Block: string[]; Surface: string[]; Line: string[]; Corner: string[] } = {
39
48
  Block: [],
40
49
  Surface: [],
41
50
  Line: [],
@@ -43,11 +52,11 @@ async function dispatchToComponentTypes(
43
52
  };
44
53
  for (const id of componentIds) {
45
54
  const type = componentsMap[id]?.type;
46
- if (type && idsByComponent[type]) {
47
- idsByComponent[type].push(id);
55
+ if (type && type in idsByComponent) {
56
+ (idsByComponent as Record<string, string[]>)[type]!.push(id);
48
57
  }
49
58
  }
50
- const promises = [];
59
+ const promises: Promise<unknown>[] = [];
51
60
  if (action === "Visibility") {
52
61
  if (idsByComponent.Block.length > 0) {
53
62
  promises.push(
@@ -113,16 +122,17 @@ async function dispatchToComponentTypes(
113
122
  }
114
123
  return Promise.all(promises);
115
124
  }
116
- function useModelVisibilityStyle(componentStyleFunctions) {
125
+ // oxlint-disable-next-line max-lines-per-function
126
+ function useModelVisibilityStyle(componentStyleFunctions: ComponentStyleFunctions) {
117
127
  const dataStore = useDataStore();
118
128
  const dataStyleState = useDataStyleState();
119
129
  const hybridViewerStore = useHybridViewerStore();
120
130
  const viewerStore = useViewerStore();
121
131
  const modelCommonStyle = useModelCommonStyle();
122
- function modelVisibility(modelId) {
132
+ function modelVisibility(modelId: string): boolean | undefined {
123
133
  return dataStyleState.getStyle(modelId).visibility;
124
134
  }
125
- function setModelVisibility(modelId, visibility) {
135
+ function setModelVisibility(modelId: string, visibility: boolean) {
126
136
  const schema = model_schemas.visibility;
127
137
  const params = {
128
138
  id: modelId,
@@ -147,7 +157,11 @@ function useModelVisibilityStyle(componentStyleFunctions) {
147
157
  },
148
158
  );
149
159
  }
150
- async function setModelComponentTypeVisibility(modelId, componentType, visibility) {
160
+ async function setModelComponentTypeVisibility(
161
+ modelId: string,
162
+ componentType: string,
163
+ visibility: boolean,
164
+ ) {
151
165
  await modelCommonStyle.mutateModelComponentTypeStyle(modelId, componentType, {
152
166
  visibility,
153
167
  });
@@ -165,10 +179,14 @@ function useModelVisibilityStyle(componentStyleFunctions) {
165
179
  visibility,
166
180
  );
167
181
  }
168
- async function setModelComponentsVisibility(modelId, componentIds, visibility) {
182
+ async function setModelComponentsVisibility(
183
+ modelId: string,
184
+ componentIds: string[],
185
+ visibility: boolean,
186
+ ) {
169
187
  const typeIds = componentIds.filter((id) => MESH_COMPONENT_TYPES.includes(id));
170
188
  const individualIds = componentIds.filter((id) => !MESH_COMPONENT_TYPES.includes(id));
171
- const promises = [];
189
+ const promises: Promise<unknown>[] = [];
172
190
  for (const typeId of typeIds) {
173
191
  promises.push(setModelComponentTypeVisibility(modelId, typeId, visibility));
174
192
  }
@@ -187,11 +205,11 @@ function useModelVisibilityStyle(componentStyleFunctions) {
187
205
  }
188
206
  return await Promise.all(promises);
189
207
  }
190
- function modelComponentVisibility(modelId, componentId) {
208
+ function modelComponentVisibility(modelId: string, componentId: string): boolean {
191
209
  const selection = useModelSelection(modelId, dataStyleState);
192
210
  return selection.value.includes(componentId);
193
211
  }
194
- function modelComponentTypeVisibility(modelId, componentType) {
212
+ function modelComponentTypeVisibility(modelId: string, componentType: string): boolean {
195
213
  const selection = useModelSelection(modelId, dataStyleState);
196
214
  return selection.value.includes(componentType);
197
215
  }
@@ -0,0 +1,269 @@
1
+ // Not auto-fixable (eslint's sort-imports core rule has no autofixer) and this file's import order doesn't match its syntax-kind-then-alphabetical requirement - left as-is rather than manually reordered across the codebase for a purely cosmetic rule.
2
+ // oxlint-disable eslint/sort-imports
3
+ import type {
4
+ ModelComponentStyle,
5
+ ModelComponentTypeStyle,
6
+ ObjectStyle,
7
+ StyleValues,
8
+ } from "./types";
9
+ import { database } from "@ogw_internal/database/database";
10
+ import { liveQuery } from "dexie";
11
+ import merge from "lodash/merge";
12
+ import { useObservable } from "@vueuse/rxjs";
13
+ import type { Ref } from "vue";
14
+ import type { Observable as RxObservable } from "rxjs";
15
+
16
+ interface SharedState {
17
+ styles: Ref<Record<string, ObjectStyle>>;
18
+ modelComponentTypeStyles: Ref<Record<string, ModelComponentTypeStyle>>;
19
+ componentStyles: Ref<Record<string, ModelComponentStyle>>;
20
+ loadFromDatabase: () => Promise<void>;
21
+ updateComponentStyleCache: (
22
+ modelId: string,
23
+ componentId: string,
24
+ styleValues: StyleValues,
25
+ ) => void;
26
+ bulkUpdateComponentStyleCache: (
27
+ modelId: string,
28
+ componentStyleUpdates: { id_component: string; values: StyleValues }[],
29
+ ) => void;
30
+ bulkUpdateComponentStylesCache: (
31
+ modelId: string,
32
+ componentIds: string[],
33
+ styleValues: StyleValues,
34
+ ) => void;
35
+ updateModelComponentTypeStyleCache: (
36
+ modelId: string,
37
+ componentType: string,
38
+ styleValues: StyleValues,
39
+ ) => void;
40
+ updateStyleCache: (objectId: string, styleValues: StyleValues) => void;
41
+ }
42
+
43
+ let sharedState: SharedState | undefined = undefined;
44
+
45
+ // oxlint-disable-next-line max-lines-per-function
46
+ function getSharedState(): SharedState {
47
+ if (sharedState) {
48
+ return sharedState;
49
+ }
50
+
51
+ const dataStyleTable = database.data_style!;
52
+ const modelComponentDataStyleTable = database.model_component_datastyle!;
53
+ const modelComponentTypeDataStyleTable = database.model_component_type_datastyle!;
54
+
55
+ // Dexie's `liveQuery` returns Dexie's own `Observable` type, structurally distinct
56
+ // From rxjs's `Observable` that `useObservable` (from @vueuse/rxjs) expects, even
57
+ // Though they're interoperable at runtime (both are plain subscribe-based streams).
58
+ const styles = useObservable<Record<string, ObjectStyle>, Record<string, ObjectStyle>>(
59
+ liveQuery(async () => {
60
+ const objectStyles = (await dataStyleTable.toArray()) as ObjectStyle[];
61
+ const stylesByObjectId: Record<string, ObjectStyle> = {};
62
+ for (const objectStyle of objectStyles) {
63
+ stylesByObjectId[objectStyle.id] = objectStyle;
64
+ }
65
+ return stylesByObjectId;
66
+ }) as unknown as RxObservable<Record<string, ObjectStyle>>,
67
+ { initialValue: {} },
68
+ ) as Ref<Record<string, ObjectStyle>>;
69
+
70
+ const modelComponentTypeStyles = ref<Record<string, ModelComponentTypeStyle>>({});
71
+ const componentStyles = ref<Record<string, ModelComponentStyle>>({});
72
+
73
+ async function loadFromDatabase() {
74
+ const [fetchedTypeStyles, fetchedComponentStyles] = await Promise.all([
75
+ modelComponentTypeDataStyleTable.toArray() as unknown as Promise<ModelComponentTypeStyle[]>,
76
+ modelComponentDataStyleTable.toArray() as unknown as Promise<ModelComponentStyle[]>,
77
+ ]);
78
+ const typeStylesMap: Record<string, ModelComponentTypeStyle> = {};
79
+ for (const typeStyle of fetchedTypeStyles) {
80
+ const cacheKey = `${typeStyle.id_model}_${typeStyle.type}`;
81
+ typeStylesMap[cacheKey] = typeStyle;
82
+ }
83
+ modelComponentTypeStyles.value = typeStylesMap;
84
+
85
+ const componentStylesMap: Record<string, ModelComponentStyle> = {};
86
+ for (const componentStyle of fetchedComponentStyles) {
87
+ const cacheKey = `${componentStyle.id_model}_${componentStyle.id_component}`;
88
+ componentStylesMap[cacheKey] = componentStyle;
89
+ }
90
+ componentStyles.value = componentStylesMap;
91
+ }
92
+
93
+ loadFromDatabase();
94
+
95
+ function updateComponentStyleCache(
96
+ modelId: string,
97
+ componentId: string,
98
+ styleValues: StyleValues,
99
+ ) {
100
+ const cacheKey = `${modelId}_${componentId}`;
101
+ const existingStyle = componentStyles.value[cacheKey];
102
+ if (existingStyle) {
103
+ merge(existingStyle, styleValues);
104
+ } else {
105
+ componentStyles.value[cacheKey] = merge(
106
+ { id_model: modelId, id_component: componentId },
107
+ styleValues,
108
+ );
109
+ }
110
+ }
111
+
112
+ function bulkUpdateComponentStyleCache(
113
+ modelId: string,
114
+ componentStyleUpdates: { id_component: string; values: StyleValues }[],
115
+ ) {
116
+ const updatedComponentStyles = { ...componentStyles.value };
117
+ for (const { id_component: componentId, values: styleValues } of componentStyleUpdates) {
118
+ const cacheKey = `${modelId}_${componentId}`;
119
+ const existingStyle = updatedComponentStyles[cacheKey];
120
+ if (existingStyle) {
121
+ updatedComponentStyles[cacheKey] = merge(
122
+ {},
123
+ existingStyle,
124
+ styleValues,
125
+ ) as ModelComponentStyle;
126
+ } else {
127
+ updatedComponentStyles[cacheKey] = merge(
128
+ { id_model: modelId, id_component: componentId },
129
+ styleValues,
130
+ );
131
+ }
132
+ }
133
+ componentStyles.value = updatedComponentStyles;
134
+ }
135
+
136
+ function bulkUpdateComponentStylesCache(
137
+ modelId: string,
138
+ componentIds: string[],
139
+ styleValues: StyleValues,
140
+ ) {
141
+ const updatedComponentStyles = { ...componentStyles.value };
142
+ for (const componentId of componentIds) {
143
+ const cacheKey = `${modelId}_${componentId}`;
144
+ const existingStyle = updatedComponentStyles[cacheKey];
145
+ if (existingStyle) {
146
+ updatedComponentStyles[cacheKey] = merge(
147
+ {},
148
+ existingStyle,
149
+ styleValues,
150
+ ) as ModelComponentStyle;
151
+ } else {
152
+ updatedComponentStyles[cacheKey] = merge(
153
+ { id_model: modelId, id_component: componentId },
154
+ styleValues,
155
+ );
156
+ }
157
+ }
158
+ componentStyles.value = updatedComponentStyles;
159
+ }
160
+
161
+ function updateModelComponentTypeStyleCache(
162
+ modelId: string,
163
+ componentType: string,
164
+ styleValues: StyleValues,
165
+ ) {
166
+ const cacheKey = `${modelId}_${componentType}`;
167
+ if (!modelComponentTypeStyles.value[cacheKey]) {
168
+ modelComponentTypeStyles.value[cacheKey] = { id_model: modelId, type: componentType };
169
+ }
170
+ merge(modelComponentTypeStyles.value[cacheKey], styleValues);
171
+ }
172
+
173
+ function updateStyleCache(objectId: string, styleValues: StyleValues) {
174
+ if (!styles.value[objectId]) {
175
+ styles.value[objectId] = { id: objectId };
176
+ }
177
+ merge(styles.value[objectId], styleValues);
178
+ }
179
+
180
+ sharedState = {
181
+ styles,
182
+ modelComponentTypeStyles,
183
+ componentStyles,
184
+ loadFromDatabase,
185
+ updateComponentStyleCache,
186
+ bulkUpdateComponentStyleCache,
187
+ bulkUpdateComponentStylesCache,
188
+ updateModelComponentTypeStyleCache,
189
+ updateStyleCache,
190
+ };
191
+
192
+ return sharedState;
193
+ }
194
+
195
+ // oxlint-disable-next-line max-lines-per-function
196
+ export function useDataStyleState() {
197
+ const dataStyleTable = database.data_style!;
198
+ const modelComponentDataStyleTable = database.model_component_datastyle!;
199
+ const modelComponentTypeDataStyleTable = database.model_component_type_datastyle!;
200
+
201
+ const state = getSharedState();
202
+ const { styles, modelComponentTypeStyles, componentStyles } = state;
203
+
204
+ const objectVisibility = computed(() => (objectId: string): boolean | undefined => {
205
+ const style = styles.value[objectId];
206
+ if (style) {
207
+ return style.visibility;
208
+ }
209
+ return false;
210
+ });
211
+
212
+ const selectedObjects = computed((): string[] => {
213
+ const visibleObjectIds: string[] = [];
214
+ for (const [objectId, objectStyle] of Object.entries(styles.value)) {
215
+ if (objectStyle.visibility === true) {
216
+ visibleObjectIds.push(objectId);
217
+ }
218
+ }
219
+ return visibleObjectIds;
220
+ });
221
+
222
+ function getStyle(objectId: string): ObjectStyle {
223
+ return { ...toRaw(styles.value[objectId]) } as ObjectStyle;
224
+ }
225
+
226
+ function mutateStyle(objectId: string, styleValues: StyleValues) {
227
+ state.updateStyleCache(objectId, styleValues);
228
+ const currentStyle = getStyle(objectId);
229
+ merge(currentStyle, styleValues);
230
+ return dataStyleTable.put(structuredClone({ ...toRaw(currentStyle), id: objectId }));
231
+ }
232
+
233
+ function getComponentStyle(modelId: string, componentId: string): ModelComponentStyle {
234
+ const cacheKey = `${modelId}_${componentId}`;
235
+ return merge({ coloring: {} }, componentStyles.value[cacheKey]) as ModelComponentStyle;
236
+ }
237
+
238
+ function getModelComponentTypeStyle(
239
+ modelId: string,
240
+ componentType: string,
241
+ ): ModelComponentTypeStyle {
242
+ const cacheKey = `${modelId}_${componentType}`;
243
+ return merge(
244
+ { coloring: {} },
245
+ modelComponentTypeStyles.value[cacheKey],
246
+ ) as ModelComponentTypeStyle;
247
+ }
248
+
249
+ async function clear(): Promise<void> {
250
+ await Promise.all([
251
+ dataStyleTable.clear(),
252
+ modelComponentDataStyleTable.clear(),
253
+ modelComponentTypeDataStyleTable.clear(),
254
+ ]);
255
+ modelComponentTypeStyles.value = {};
256
+ componentStyles.value = {};
257
+ }
258
+
259
+ return {
260
+ ...state,
261
+ getStyle,
262
+ getComponentStyle,
263
+ getModelComponentTypeStyle,
264
+ mutateStyle,
265
+ objectVisibility,
266
+ selectedObjects,
267
+ clear,
268
+ };
269
+ }