@jupytergis/base 0.14.1 → 0.16.0-alpha.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 (397) hide show
  1. package/lib/commands/BaseCommandIDs.d.ts +6 -0
  2. package/lib/commands/BaseCommandIDs.js +6 -0
  3. package/lib/commands/index.js +245 -55
  4. package/lib/commands/operationCommands.js +2 -2
  5. package/lib/constants.js +6 -1
  6. package/lib/{panelview/annotationPanel.js → features/annotations/AnnotationsPanel.js} +1 -1
  7. package/lib/{annotations → features/annotations}/index.d.ts +1 -0
  8. package/lib/{annotations → features/annotations}/index.js +1 -0
  9. package/lib/{console → features/console}/consoleview.js +1 -1
  10. package/lib/{panelview/filter-panel → features/filter}/Filter.js +4 -4
  11. package/lib/{panelview/filter-panel → features/filter}/FilterRow.d.ts +3 -2
  12. package/lib/{panelview/filter-panel → features/filter}/FilterRow.js +2 -1
  13. package/lib/{panelview/identify-panel → features/identify}/IdentifyPanel.d.ts +2 -0
  14. package/lib/features/identify/IdentifyPanel.js +102 -0
  15. package/lib/features/identify/components/FeatureCard.d.ts +17 -0
  16. package/lib/features/identify/components/FeatureCard.js +26 -0
  17. package/lib/features/identify/components/FeatureCardHeader.d.ts +11 -0
  18. package/lib/features/identify/components/FeatureCardHeader.js +30 -0
  19. package/lib/features/identify/components/FeatureFloater.d.ts +7 -0
  20. package/lib/features/identify/components/FeatureFloater.js +19 -0
  21. package/lib/features/identify/components/FeaturePropertyList.d.ts +11 -0
  22. package/lib/features/identify/components/FeaturePropertyList.js +18 -0
  23. package/lib/features/identify/components/FeatureRow.d.ts +13 -0
  24. package/lib/features/identify/components/FeatureRow.js +25 -0
  25. package/lib/features/identify/components/PropertyEditors.d.ts +44 -0
  26. package/lib/features/identify/components/PropertyEditors.js +56 -0
  27. package/lib/features/identify/hooks/useIdentifyPropertyEditor.d.ts +11 -0
  28. package/lib/features/identify/hooks/useIdentifyPropertyEditor.js +132 -0
  29. package/lib/features/identify/types/editorTypes.d.ts +21 -0
  30. package/lib/features/identify/utils/getFeatureIdentifier.d.ts +5 -0
  31. package/lib/features/identify/utils/getFeatureIdentifier.js +14 -0
  32. package/lib/features/identify/utils/highlightLayer.d.ts +11 -0
  33. package/lib/features/identify/utils/highlightLayer.js +57 -0
  34. package/lib/features/identify/utils/highlightStyle.d.ts +7 -0
  35. package/lib/features/identify/utils/highlightStyle.js +40 -0
  36. package/lib/{dialogs/layerBrowserDialog.js → features/layer-browser/index.js} +2 -2
  37. package/lib/features/layers/forms/layer/geoTiffLayerForm.d.ts +3 -0
  38. package/lib/{formbuilder/objectform/layer/webGlLayerForm.js → features/layers/forms/layer/geoTiffLayerForm.js} +5 -5
  39. package/lib/{formbuilder/objectform → features/layers/forms}/layer/heatmapLayerForm.js +4 -4
  40. package/lib/{formbuilder/objectform → features/layers/forms}/layer/hillshadeLayerForm.js +4 -4
  41. package/lib/{formbuilder/objectform → features/layers/forms}/layer/index.d.ts +1 -1
  42. package/lib/{formbuilder/objectform → features/layers/forms}/layer/index.js +1 -1
  43. package/lib/{formbuilder/objectform → features/layers/forms}/layer/layerform.d.ts +1 -1
  44. package/lib/{formbuilder/objectform → features/layers/forms}/layer/layerform.js +4 -4
  45. package/lib/features/layers/forms/layer/storySegmentLayerForm.js +150 -0
  46. package/lib/{formbuilder/objectform → features/layers/forms}/layer/vectorlayerform.js +4 -4
  47. package/lib/{formbuilder/objectform → features/layers/forms}/source/geojsonsource.js +5 -5
  48. package/lib/features/layers/forms/source/geopackagesource.d.ts +3 -0
  49. package/lib/features/layers/forms/source/geopackagesource.js +93 -0
  50. package/lib/{formbuilder/objectform → features/layers/forms}/source/geotiffsource.js +5 -5
  51. package/lib/{formbuilder/objectform → features/layers/forms}/source/index.d.ts +2 -0
  52. package/lib/{formbuilder/objectform → features/layers/forms}/source/index.js +2 -0
  53. package/lib/{formbuilder/objectform → features/layers/forms}/source/pathbasedsource.js +5 -5
  54. package/lib/{formbuilder/objectform → features/layers/forms}/source/sourceform.d.ts +1 -1
  55. package/lib/{formbuilder/objectform → features/layers/forms}/source/sourceform.js +4 -4
  56. package/lib/{formbuilder/objectform → features/layers/forms}/source/tilesourceform.js +4 -4
  57. package/lib/features/layers/forms/source/wmsTileSource.d.ts +4 -0
  58. package/lib/features/layers/forms/source/wmsTileSource.js +78 -0
  59. package/lib/{dialogs → features/layers}/layerCreationFormDialog.d.ts +1 -1
  60. package/lib/{dialogs → features/layers}/layerCreationFormDialog.js +1 -1
  61. package/lib/features/layers/symbology/Grammar.d.ts +11 -0
  62. package/lib/features/layers/symbology/Grammar.js +235 -0
  63. package/lib/{dialogs/symbology/vector_layer/types → features/layers/symbology}/Heatmap.d.ts +1 -1
  64. package/lib/{dialogs/symbology/vector_layer/types → features/layers/symbology}/Heatmap.js +30 -10
  65. package/lib/{dialogs → features/layers}/symbology/classificationModes.d.ts +6 -6
  66. package/lib/{dialogs → features/layers}/symbology/classificationModes.js +57 -57
  67. package/lib/features/layers/symbology/colorRampUtils.d.ts +65 -0
  68. package/lib/features/layers/symbology/colorRampUtils.js +242 -0
  69. package/lib/features/layers/symbology/components/MappingRow.d.ts +40 -0
  70. package/lib/features/layers/symbology/components/MappingRow.js +516 -0
  71. package/lib/features/layers/symbology/components/NumericInput.d.ts +20 -0
  72. package/lib/features/layers/symbology/components/NumericInput.js +44 -0
  73. package/lib/features/layers/symbology/components/ScaleEditor.d.ts +33 -0
  74. package/lib/features/layers/symbology/components/ScaleEditor.js +221 -0
  75. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampControls.d.ts +1 -1
  76. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampControls.js +3 -2
  77. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelector.d.ts +2 -1
  78. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelector.js +12 -15
  79. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelectorEntry.d.ts +2 -2
  80. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelectorEntry.js +3 -11
  81. package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ModeSelectRow.d.ts +1 -1
  82. package/lib/features/layers/symbology/components/color_ramp/RgbaColorPicker.d.ts +13 -0
  83. package/lib/features/layers/symbology/components/color_ramp/RgbaColorPicker.js +128 -0
  84. package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopContainer.js +3 -1
  85. package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopRow.d.ts +2 -2
  86. package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopRow.js +12 -7
  87. package/lib/features/layers/symbology/grammarToOLLayer.d.ts +27 -0
  88. package/lib/features/layers/symbology/grammarToOLLayer.js +145 -0
  89. package/lib/features/layers/symbology/grammarToOLStyle.d.ts +32 -0
  90. package/lib/features/layers/symbology/grammarToOLStyle.js +467 -0
  91. package/lib/{dialogs → features/layers}/symbology/hooks/useGetBandInfo.d.ts +1 -1
  92. package/lib/{dialogs → features/layers}/symbology/hooks/useGetBandInfo.js +1 -1
  93. package/lib/{dialogs → features/layers}/symbology/hooks/useGetProperties.js +1 -1
  94. package/lib/{dialogs → features/layers}/symbology/hooks/useGetSymbology.js +4 -2
  95. package/lib/features/layers/symbology/styleBuilder.d.ts +21 -0
  96. package/lib/features/layers/symbology/styleBuilder.js +145 -0
  97. package/lib/{dialogs → features/layers}/symbology/symbologyDialog.d.ts +3 -2
  98. package/lib/{dialogs → features/layers}/symbology/symbologyDialog.js +12 -12
  99. package/lib/features/layers/symbology/symbologyUtils.d.ts +41 -0
  100. package/lib/features/layers/symbology/symbologyUtils.js +114 -0
  101. package/lib/{panelview/objectproperties.d.ts → features/objectproperties/index.d.ts} +1 -1
  102. package/lib/{panelview/objectproperties.js → features/objectproperties/index.js} +5 -10
  103. package/lib/{dialogs → features/processing}/ProcessingFormDialog.d.ts +1 -1
  104. package/lib/{dialogs → features/processing}/ProcessingFormDialog.js +28 -14
  105. package/lib/features/processing/forms/MapExtentToggle.d.ts +13 -0
  106. package/lib/features/processing/forms/MapExtentToggle.js +20 -0
  107. package/lib/features/processing/forms/clipRasterByExtentForm.d.ts +10 -0
  108. package/lib/features/processing/forms/clipRasterByExtentForm.js +99 -0
  109. package/lib/{formbuilder/objectform/process → features/processing/forms}/dissolveProcessForm.js +5 -5
  110. package/lib/{formbuilder/objectform → features/processing/forms}/processingForm.d.ts +1 -1
  111. package/lib/{formbuilder/objectform → features/processing/forms}/processingForm.js +6 -6
  112. package/lib/features/processing/forms/rasterizeForm.d.ts +10 -0
  113. package/lib/features/processing/forms/rasterizeForm.js +75 -0
  114. package/lib/features/processing/forms/useMapExtent.d.ts +22 -0
  115. package/lib/features/processing/forms/useMapExtent.js +57 -0
  116. package/lib/{processing → features/processing}/index.d.ts +19 -2
  117. package/lib/features/processing/index.js +1246 -0
  118. package/lib/{processing → features/processing}/processingCommands.d.ts +1 -1
  119. package/lib/features/processing/processingCommands.js +168 -0
  120. package/lib/features/processing/serverProcessing.d.ts +51 -0
  121. package/lib/features/processing/serverProcessing.js +99 -0
  122. package/lib/{stacBrowser → features/stac-browser}/components/StacPanel.js +2 -2
  123. package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableComboBox.js +64 -21
  124. package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableRow.js +1 -1
  125. package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacFilterExtensionPanel.js +2 -2
  126. package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacQueryableFilters.js +1 -1
  127. package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacFilterSection.js +3 -3
  128. package/lib/{stacBrowser → features/stac-browser}/components/shared/StacPanelResults.js +3 -3
  129. package/lib/{stacBrowser → features/stac-browser}/components/shared/StacSpatialExtent.js +1 -1
  130. package/lib/{stacBrowser → features/stac-browser}/components/shared/StacTemporalExtent.js +1 -1
  131. package/lib/{stacBrowser → features/stac-browser}/context/StacResultsContext.js +2 -2
  132. package/lib/{stacBrowser → features/stac-browser}/hooks/useGeodesSearch.js +2 -2
  133. package/lib/{stacBrowser → features/stac-browser}/hooks/useStacFilterExtension.d.ts +1 -1
  134. package/lib/{stacBrowser → features/stac-browser}/hooks/useStacFilterExtension.js +198 -114
  135. package/lib/{stacBrowser → features/stac-browser}/hooks/useStacSearch.d.ts +1 -0
  136. package/lib/{stacBrowser → features/stac-browser}/hooks/useStacSearch.js +19 -11
  137. package/lib/features/stac-browser/types/types.js +1 -0
  138. package/lib/{panelview/story-maps → features/story}/SpectaPanel.d.ts +4 -1
  139. package/lib/{panelview/story-maps → features/story}/SpectaPanel.js +3 -4
  140. package/lib/{panelview/story-maps → features/story}/StoryEditorPanel.js +1 -1
  141. package/lib/{panelview/story-maps → features/story}/StoryViewerPanel.d.ts +12 -11
  142. package/lib/features/story/StoryViewerPanel.js +64 -0
  143. package/lib/features/story/__tests__/fixtures/listStoryTestItems.d.ts +9 -0
  144. package/lib/features/story/__tests__/fixtures/listStoryTestItems.js +21 -0
  145. package/lib/features/story/components/ListStoryMapOverlayPanel.d.ts +10 -0
  146. package/lib/features/story/components/ListStoryMapOverlayPanel.js +11 -0
  147. package/lib/features/story/components/ListStoryMarkdownMeasurePane.d.ts +11 -0
  148. package/lib/features/story/components/ListStoryMarkdownMeasurePane.js +55 -0
  149. package/lib/features/story/components/ListStoryOverlayMarkdown.d.ts +15 -0
  150. package/lib/features/story/components/ListStoryOverlayMarkdown.js +93 -0
  151. package/lib/features/story/components/ListStoryStageOverlay.d.ts +12 -0
  152. package/lib/features/story/components/ListStoryStageOverlay.js +132 -0
  153. package/lib/features/story/components/ListStoryVirtualScrollTrack.d.ts +6 -0
  154. package/lib/features/story/components/ListStoryVirtualScrollTrack.js +7 -0
  155. package/lib/{panelview/story-maps → features/story}/components/SpectaDesktopView.d.ts +4 -2
  156. package/lib/features/story/components/SpectaDesktopView.js +67 -0
  157. package/lib/{panelview/story-maps → features/story}/components/SpectaMobileView.d.ts +2 -4
  158. package/lib/{panelview/story-maps → features/story}/components/SpectaMobileView.js +3 -3
  159. package/lib/features/story/components/SpectaSingleModeContent.d.ts +18 -0
  160. package/lib/features/story/components/SpectaSingleModeContent.js +8 -0
  161. package/lib/features/story/context/ListStoryScrollTrackContext.d.ts +15 -0
  162. package/lib/features/story/context/ListStoryScrollTrackContext.js +142 -0
  163. package/lib/features/story/hooks/useCurrentSegmentIndex.d.ts +3 -0
  164. package/lib/features/story/hooks/useCurrentSegmentIndex.js +17 -0
  165. package/lib/features/story/hooks/useListStoryScroll.d.ts +15 -0
  166. package/lib/features/story/hooks/useListStoryScroll.js +107 -0
  167. package/lib/features/story/hooks/useQueuedMarkdownHeightMeasure.d.ts +19 -0
  168. package/lib/features/story/hooks/useQueuedMarkdownHeightMeasure.js +56 -0
  169. package/lib/features/story/hooks/useStoryImagePreload.d.ts +1 -0
  170. package/lib/features/story/hooks/useStoryImagePreload.js +24 -0
  171. package/lib/{panelview/story-maps → features/story}/hooks/useStoryMap.d.ts +2 -7
  172. package/lib/{panelview/story-maps → features/story}/hooks/useStoryMap.js +20 -44
  173. package/lib/features/story/hooks/useStoryScrollState.d.ts +21 -0
  174. package/lib/features/story/hooks/useStoryScrollState.js +39 -0
  175. package/lib/features/story/hooks/useStorySegmentSync.d.ts +8 -0
  176. package/lib/features/story/hooks/useStorySegmentSync.js +51 -0
  177. package/lib/features/story/types/types.d.ts +38 -0
  178. package/lib/features/story/types/types.js +1 -0
  179. package/lib/features/story/utils/computeListStoryScrollState.d.ts +12 -0
  180. package/lib/features/story/utils/computeListStoryScrollState.js +70 -0
  181. package/lib/features/story/utils/listStoryMeasureQueue.d.ts +11 -0
  182. package/lib/features/story/utils/listStoryMeasureQueue.js +14 -0
  183. package/lib/features/story/utils/listStoryScrollTrack.d.ts +17 -0
  184. package/lib/features/story/utils/listStoryScrollTrack.js +72 -0
  185. package/lib/features/story/utils/spectaPresentation.d.ts +9 -0
  186. package/lib/features/story/utils/spectaPresentation.js +37 -0
  187. package/lib/features/story/utils/storySegmentViewItems.d.ts +5 -0
  188. package/lib/features/story/utils/storySegmentViewItems.js +30 -0
  189. package/lib/index.d.ts +11 -9
  190. package/lib/index.js +11 -9
  191. package/lib/keybindings.json +5 -0
  192. package/lib/mainview/OpenEOTileLayer.d.ts +49 -0
  193. package/lib/mainview/OpenEOTileLayer.js +179 -0
  194. package/lib/mainview/TemporalSlider.js +11 -9
  195. package/lib/mainview/geoJsonFeaturePatch.d.ts +9 -0
  196. package/lib/mainview/geoJsonFeaturePatch.js +43 -0
  197. package/lib/mainview/mainView.d.ts +93 -8
  198. package/lib/mainview/mainView.js +1286 -529
  199. package/lib/mainview/mainviewwidget.d.ts +5 -1
  200. package/lib/mainview/mainviewwidget.js +4 -2
  201. package/lib/shared/components/Button.d.ts +1 -1
  202. package/lib/shared/components/DropdownMenu.d.ts +1 -0
  203. package/lib/shared/components/DropdownMenu.js +3 -2
  204. package/lib/shared/components/NativeSelect.d.ts +8 -0
  205. package/lib/shared/components/NativeSelect.js +29 -0
  206. package/lib/shared/components/Tabs.d.ts +3 -3
  207. package/lib/shared/components/Tabs.js +5 -5
  208. package/lib/{formbuilder → shared/formbuilder}/creationform.js +71 -4
  209. package/lib/{formbuilder → shared/formbuilder}/editform.js +1 -1
  210. package/lib/{formbuilder → shared/formbuilder}/formselectors.d.ts +2 -2
  211. package/lib/{formbuilder → shared/formbuilder}/formselectors.js +13 -4
  212. package/lib/shared/formbuilder/index.d.ts +4 -0
  213. package/lib/shared/formbuilder/index.js +4 -0
  214. package/lib/{formbuilder → shared/formbuilder}/objectform/SchemaForm.d.ts +1 -1
  215. package/lib/{formbuilder → shared/formbuilder}/objectform/StoryEditorForm.d.ts +1 -1
  216. package/lib/{formbuilder → shared/formbuilder}/objectform/StoryEditorForm.js +1 -1
  217. package/lib/{formbuilder → shared/formbuilder}/objectform/components/LayerSelect.js +1 -1
  218. package/lib/{formbuilder → shared/formbuilder}/objectform/components/SegmentFormSymbology.js +4 -4
  219. package/lib/{formbuilder → shared/formbuilder}/objectform/components/SourcePropertiesField.js +1 -1
  220. package/lib/{formbuilder → shared/formbuilder}/objectform/components/StorySegmentReset.js +1 -1
  221. package/lib/shared/formbuilder/objectform/components/WmsTileSourceUrlInput.d.ts +3 -0
  222. package/lib/shared/formbuilder/objectform/components/WmsTileSourceUrlInput.js +84 -0
  223. package/lib/{formbuilder → shared/formbuilder}/objectform/fileselectorwidget.js +8 -1
  224. package/lib/{formbuilder → shared/formbuilder}/objectform/schemaUtils.d.ts +3 -1
  225. package/lib/{formbuilder → shared/formbuilder}/objectform/schemaUtils.js +11 -0
  226. package/lib/{formbuilder → shared/formbuilder}/objectform/useSchemaFormState.d.ts +2 -2
  227. package/lib/{formbuilder → shared/formbuilder}/objectform/useSchemaFormState.js +1 -1
  228. package/lib/{icons.d.ts → shared/icons.d.ts} +2 -0
  229. package/lib/{icons.js → shared/icons.js} +28 -18
  230. package/lib/tools.d.ts +3 -1
  231. package/lib/tools.js +140 -6
  232. package/lib/types.d.ts +12 -1
  233. package/lib/types.js +6 -1
  234. package/lib/{menus.js → workspace/menus.js} +14 -2
  235. package/lib/workspace/panels/components/TabbedPanel.d.ts +17 -0
  236. package/lib/workspace/panels/components/TabbedPanel.js +19 -0
  237. package/lib/{panelview → workspace/panels}/components/layers.js +82 -20
  238. package/lib/workspace/panels/components/legendItem.js +680 -0
  239. package/lib/workspace/panels/hooks/useLayerTree.d.ts +19 -0
  240. package/lib/workspace/panels/hooks/useLayerTree.js +103 -0
  241. package/lib/workspace/panels/hooks/useRightPanelOptions.d.ts +27 -0
  242. package/lib/workspace/panels/hooks/useRightPanelOptions.js +72 -0
  243. package/lib/workspace/panels/hooks/useUIState.d.ts +2 -0
  244. package/lib/workspace/panels/hooks/useUIState.js +25 -0
  245. package/lib/{panelview → workspace/panels}/index.d.ts +1 -1
  246. package/lib/{panelview → workspace/panels}/index.js +1 -1
  247. package/lib/{panelview → workspace/panels}/leftpanel.d.ts +1 -1
  248. package/lib/workspace/panels/leftpanel.js +70 -0
  249. package/lib/{panelview/rightpanel.d.ts → workspace/panels/mergedpanel.d.ts} +6 -5
  250. package/lib/workspace/panels/mergedpanel.js +166 -0
  251. package/lib/workspace/panels/rightpanel.d.ts +25 -0
  252. package/lib/{panelview → workspace/panels}/rightpanel.js +53 -63
  253. package/lib/{statusbar → workspace/statusbar}/StatusBar.js +5 -4
  254. package/lib/{toolbar → workspace/toolbar}/widget.d.ts +2 -0
  255. package/lib/{toolbar → workspace/toolbar}/widget.js +33 -5
  256. package/lib/{widget.d.ts → workspace/widget.d.ts} +7 -5
  257. package/lib/{widget.js → workspace/widget.js} +16 -7
  258. package/package.json +19 -4
  259. package/style/base.css +109 -1
  260. package/style/icons/geopackage.svg +95 -0
  261. package/style/icons/pencil_solid.svg +7 -0
  262. package/style/identify.css +95 -0
  263. package/style/layerBrowser.css +28 -0
  264. package/style/leftPanel.css +25 -0
  265. package/style/shared/button.css +12 -0
  266. package/style/shared/dropdownMenu.css +9 -0
  267. package/style/shared/nativeSelect.css +75 -0
  268. package/style/shared/tabs.css +3 -3
  269. package/style/spectaProgressBar.css +0 -1
  270. package/style/storyPanel.css +142 -9
  271. package/style/storySpectaArticleOverlay.css +129 -0
  272. package/style/symbologyDialog.css +330 -28
  273. package/lib/dialogs/symbology/colorRampUtils.d.ts +0 -20
  274. package/lib/dialogs/symbology/colorRampUtils.js +0 -132
  275. package/lib/dialogs/symbology/symbologyUtils.d.ts +0 -33
  276. package/lib/dialogs/symbology/symbologyUtils.js +0 -180
  277. package/lib/dialogs/symbology/tiff_layer/TiffRendering.d.ts +0 -4
  278. package/lib/dialogs/symbology/tiff_layer/TiffRendering.js +0 -42
  279. package/lib/dialogs/symbology/tiff_layer/components/BandRow.d.ts +0 -23
  280. package/lib/dialogs/symbology/tiff_layer/components/BandRow.js +0 -59
  281. package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.d.ts +0 -4
  282. package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.js +0 -92
  283. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.d.ts +0 -5
  284. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +0 -301
  285. package/lib/dialogs/symbology/vector_layer/VectorRendering.d.ts +0 -4
  286. package/lib/dialogs/symbology/vector_layer/VectorRendering.js +0 -112
  287. package/lib/dialogs/symbology/vector_layer/components/ValueSelect.d.ts +0 -8
  288. package/lib/dialogs/symbology/vector_layer/components/ValueSelect.js +0 -9
  289. package/lib/dialogs/symbology/vector_layer/types/Canonical.d.ts +0 -4
  290. package/lib/dialogs/symbology/vector_layer/types/Canonical.js +0 -65
  291. package/lib/dialogs/symbology/vector_layer/types/Categorized.d.ts +0 -4
  292. package/lib/dialogs/symbology/vector_layer/types/Categorized.js +0 -196
  293. package/lib/dialogs/symbology/vector_layer/types/Graduated.d.ts +0 -4
  294. package/lib/dialogs/symbology/vector_layer/types/Graduated.js +0 -250
  295. package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.d.ts +0 -4
  296. package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.js +0 -105
  297. package/lib/formbuilder/index.d.ts +0 -4
  298. package/lib/formbuilder/index.js +0 -4
  299. package/lib/formbuilder/objectform/layer/storySegmentLayerForm.js +0 -95
  300. package/lib/formbuilder/objectform/layer/webGlLayerForm.d.ts +0 -3
  301. package/lib/formbuilder/objectform/process/index.d.ts +0 -1
  302. package/lib/formbuilder/objectform/process/index.js +0 -1
  303. package/lib/panelview/components/legendItem.js +0 -200
  304. package/lib/panelview/identify-panel/IdentifyPanel.js +0 -102
  305. package/lib/panelview/leftpanel.js +0 -139
  306. package/lib/panelview/story-maps/StoryViewerPanel.js +0 -116
  307. package/lib/panelview/story-maps/components/SpectaDesktopView.js +0 -49
  308. package/lib/processing/index.js +0 -200
  309. package/lib/processing/processingCommands.js +0 -67
  310. /package/lib/{panelview/annotationPanel.d.ts → features/annotations/AnnotationsPanel.d.ts} +0 -0
  311. /package/lib/{annotations → features/annotations}/components/Annotation.d.ts +0 -0
  312. /package/lib/{annotations → features/annotations}/components/Annotation.js +0 -0
  313. /package/lib/{annotations → features/annotations}/components/AnnotationFloater.d.ts +0 -0
  314. /package/lib/{annotations → features/annotations}/components/AnnotationFloater.js +0 -0
  315. /package/lib/{annotations → features/annotations}/components/Message.d.ts +0 -0
  316. /package/lib/{annotations → features/annotations}/components/Message.js +0 -0
  317. /package/lib/{annotations → features/annotations}/model.d.ts +0 -0
  318. /package/lib/{annotations → features/annotations}/model.js +0 -0
  319. /package/lib/{console → features/console}/consoleview.d.ts +0 -0
  320. /package/lib/{console → features/console}/index.d.ts +0 -0
  321. /package/lib/{console → features/console}/index.js +0 -0
  322. /package/lib/{panelview/filter-panel → features/filter}/Filter.d.ts +0 -0
  323. /package/lib/{stacBrowser/types/types.js → features/identify/types/editorTypes.js} +0 -0
  324. /package/lib/{dialogs/layerBrowserDialog.d.ts → features/layer-browser/index.d.ts} +0 -0
  325. /package/lib/{formbuilder/objectform → features/layers/forms}/layer/heatmapLayerForm.d.ts +0 -0
  326. /package/lib/{formbuilder/objectform → features/layers/forms}/layer/hillshadeLayerForm.d.ts +0 -0
  327. /package/lib/{formbuilder/objectform → features/layers/forms}/layer/storySegmentLayerForm.d.ts +0 -0
  328. /package/lib/{formbuilder/objectform → features/layers/forms}/layer/vectorlayerform.d.ts +0 -0
  329. /package/lib/{formbuilder/objectform → features/layers/forms}/source/geojsonsource.d.ts +0 -0
  330. /package/lib/{formbuilder/objectform → features/layers/forms}/source/geotiffsource.d.ts +0 -0
  331. /package/lib/{formbuilder/objectform → features/layers/forms}/source/pathbasedsource.d.ts +0 -0
  332. /package/lib/{formbuilder/objectform → features/layers/forms}/source/tilesourceform.d.ts +0 -0
  333. /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ModeSelectRow.js +0 -0
  334. /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/cmocean.json +0 -0
  335. /package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopContainer.d.ts +0 -0
  336. /package/lib/{dialogs → features/layers}/symbology/hooks/useEffectiveSymbologyParams.d.ts +0 -0
  337. /package/lib/{dialogs → features/layers}/symbology/hooks/useEffectiveSymbologyParams.js +0 -0
  338. /package/lib/{dialogs → features/layers}/symbology/hooks/useGetProperties.d.ts +0 -0
  339. /package/lib/{dialogs → features/layers}/symbology/hooks/useGetSymbology.d.ts +0 -0
  340. /package/lib/{dialogs → features/layers}/symbology/hooks/useOkSignal.d.ts +0 -0
  341. /package/lib/{dialogs → features/layers}/symbology/hooks/useOkSignal.js +0 -0
  342. /package/lib/{formbuilder/objectform/process → features/processing/forms}/dissolveProcessForm.d.ts +0 -0
  343. /package/lib/{processing → features/processing}/processingFormToParam.d.ts +0 -0
  344. /package/lib/{processing → features/processing}/processingFormToParam.js +0 -0
  345. /package/lib/{stacBrowser → features/stac-browser}/components/StacPanel.d.ts +0 -0
  346. /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableComboBox.d.ts +0 -0
  347. /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableRow.d.ts +0 -0
  348. /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacFilterExtensionPanel.d.ts +0 -0
  349. /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacQueryableFilters.d.ts +0 -0
  350. /package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacFilterSection.d.ts +0 -0
  351. /package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacGeodesFilterPanel.d.ts +0 -0
  352. /package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacGeodesFilterPanel.js +0 -0
  353. /package/lib/{stacBrowser → features/stac-browser}/components/shared/StacPanelResults.d.ts +0 -0
  354. /package/lib/{stacBrowser → features/stac-browser}/components/shared/StacSpatialExtent.d.ts +0 -0
  355. /package/lib/{stacBrowser → features/stac-browser}/components/shared/StacTemporalExtent.d.ts +0 -0
  356. /package/lib/{stacBrowser → features/stac-browser}/constants.d.ts +0 -0
  357. /package/lib/{stacBrowser → features/stac-browser}/constants.js +0 -0
  358. /package/lib/{stacBrowser → features/stac-browser}/context/StacResultsContext.d.ts +0 -0
  359. /package/lib/{stacBrowser → features/stac-browser}/hooks/useGeodesSearch.d.ts +0 -0
  360. /package/lib/{stacBrowser → features/stac-browser}/index.d.ts +0 -0
  361. /package/lib/{stacBrowser → features/stac-browser}/index.js +0 -0
  362. /package/lib/{stacBrowser → features/stac-browser}/types/types.d.ts +0 -0
  363. /package/lib/{panelview/story-maps → features/story}/StoryEditorPanel.d.ts +0 -0
  364. /package/lib/{panelview/story-maps → features/story}/components/PreviewModeSwitch.d.ts +0 -0
  365. /package/lib/{panelview/story-maps → features/story}/components/PreviewModeSwitch.js +0 -0
  366. /package/lib/{panelview/story-maps → features/story}/components/StoryContentSection.d.ts +0 -0
  367. /package/lib/{panelview/story-maps → features/story}/components/StoryContentSection.js +0 -0
  368. /package/lib/{panelview/story-maps → features/story}/components/StoryImageSection.d.ts +0 -0
  369. /package/lib/{panelview/story-maps → features/story}/components/StoryImageSection.js +0 -0
  370. /package/lib/{panelview/story-maps → features/story}/components/StoryNavBar.d.ts +0 -0
  371. /package/lib/{panelview/story-maps → features/story}/components/StoryNavBar.js +0 -0
  372. /package/lib/{panelview/story-maps → features/story}/components/StorySubtitleSection.d.ts +0 -0
  373. /package/lib/{panelview/story-maps → features/story}/components/StorySubtitleSection.js +0 -0
  374. /package/lib/{panelview/story-maps → features/story}/components/StoryTitleSection.d.ts +0 -0
  375. /package/lib/{panelview/story-maps → features/story}/components/StoryTitleSection.js +0 -0
  376. /package/lib/{formbuilder → shared/formbuilder}/creationform.d.ts +0 -0
  377. /package/lib/{formbuilder → shared/formbuilder}/editform.d.ts +0 -0
  378. /package/lib/{formbuilder → shared/formbuilder}/objectform/SchemaForm.js +0 -0
  379. /package/lib/{formbuilder → shared/formbuilder}/objectform/components/LayerSelect.d.ts +0 -0
  380. /package/lib/{formbuilder → shared/formbuilder}/objectform/components/OpacitySlider.d.ts +0 -0
  381. /package/lib/{formbuilder → shared/formbuilder}/objectform/components/OpacitySlider.js +0 -0
  382. /package/lib/{formbuilder → shared/formbuilder}/objectform/components/SegmentFormSymbology.d.ts +0 -0
  383. /package/lib/{formbuilder → shared/formbuilder}/objectform/components/SourcePropertiesField.d.ts +0 -0
  384. /package/lib/{formbuilder → shared/formbuilder}/objectform/components/StorySegmentReset.d.ts +0 -0
  385. /package/lib/{formbuilder → shared/formbuilder}/objectform/fileselectorwidget.d.ts +0 -0
  386. /package/lib/{store.d.ts → shared/store.d.ts} +0 -0
  387. /package/lib/{store.js → shared/store.js} +0 -0
  388. /package/lib/{menus.d.ts → workspace/menus.d.ts} +0 -0
  389. /package/lib/{panelview → workspace/panels}/components/layers.d.ts +0 -0
  390. /package/lib/{panelview → workspace/panels}/components/legendItem.d.ts +0 -0
  391. /package/lib/{panelview → workspace/panels}/header.d.ts +0 -0
  392. /package/lib/{panelview → workspace/panels}/header.js +0 -0
  393. /package/lib/{statusbar → workspace/statusbar}/SpectaPresentationProgressBar.d.ts +0 -0
  394. /package/lib/{statusbar → workspace/statusbar}/SpectaPresentationProgressBar.js +0 -0
  395. /package/lib/{statusbar → workspace/statusbar}/StatusBar.d.ts +0 -0
  396. /package/lib/{toolbar → workspace/toolbar}/index.d.ts +0 -0
  397. /package/lib/{toolbar → workspace/toolbar}/index.js +0 -0
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Grammar → OL layer compiler.
3
+ *
4
+ * grammarToOLLayer compiles an IGrammarSymbologyState into a single OL layer:
5
+ *
6
+ * • one non-KDE grammar layer → VectorImageLayer
7
+ * • one KDE grammar layer → HeatmapLayer
8
+ * • multiple grammar layers → LayerGroup containing the above
9
+ *
10
+ * All multi-layer and transform decisions are encapsulated here; callers
11
+ * treat the result as an opaque OL Layer.
12
+ */
13
+ import { Heatmap as HeatmapLayer, VectorImage as VectorImageLayer, WebGLTile as WebGLTileLayer, } from 'ol/layer';
14
+ import LayerGroup from 'ol/layer/Group';
15
+ import { getColorMap } from './colorRampUtils';
16
+ import { grammarToOLStyle } from './grammarToOLStyle';
17
+ import { DEFAULT_FLAT_STYLE } from './styleBuilder';
18
+ // Default OL heatmap gradient (cool → warm).
19
+ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
20
+ // ---------------------------------------------------------------------------
21
+ // Public API
22
+ // ---------------------------------------------------------------------------
23
+ /**
24
+ * Compile a Grammar symbology state into a single OL layer.
25
+ *
26
+ * isRaster=true: each grammar layer → WebGLTile (pixel-color channel → color
27
+ * style), $band-N fields → ['band', N] expressions.
28
+ * isRaster=false (default): non-KDE → VectorImageLayer, KDE → HeatmapLayer.
29
+ *
30
+ * When the state contains multiple grammar layers a LayerGroup is returned;
31
+ * otherwise the appropriate single layer type is returned directly.
32
+ */
33
+ export function grammarToOLLayer(state, source, opacity, visible, featureValues = [], isRaster = false) {
34
+ var _a;
35
+ const grammarLayers = (_a = state.layers) !== null && _a !== void 0 ? _a : [];
36
+ if (isRaster) {
37
+ const subLayers = grammarLayers.map(grammarLayer => compileRasterLayer(grammarLayer, source, opacity, visible, featureValues));
38
+ if (subLayers.length === 1) {
39
+ return subLayers[0];
40
+ }
41
+ // Empty or multi-layer: wrap in a group (empty group renders nothing).
42
+ return new LayerGroup({ opacity, visible, layers: subLayers });
43
+ }
44
+ if (grammarLayers.length === 0) {
45
+ // No grammar layers defined yet — return an empty vector layer so the map
46
+ // has a valid layer object to call setVisible/setOpacity on.
47
+ return new VectorImageLayer({ opacity, visible, source });
48
+ }
49
+ const subLayers = grammarLayers.map(grammarLayer => compileGrammarLayer(grammarLayer, source, opacity, visible, featureValues));
50
+ if (subLayers.length === 1) {
51
+ return subLayers[0];
52
+ }
53
+ return new LayerGroup({ opacity, visible, layers: subLayers });
54
+ }
55
+ // ---------------------------------------------------------------------------
56
+ // Per grammar-layer compilation
57
+ // ---------------------------------------------------------------------------
58
+ function compileGrammarLayer(grammarLayer, source, opacity, visible, featureValues) {
59
+ var _a;
60
+ const kdeTransform = (_a = grammarLayer.preprocess) === null || _a === void 0 ? void 0 : _a.find((t) => t.type === 'kde');
61
+ if (kdeTransform) {
62
+ return compileKDELayer(grammarLayer, kdeTransform, source, opacity, visible);
63
+ }
64
+ return compileVectorLayer(grammarLayer, source, opacity, visible, featureValues);
65
+ }
66
+ // ---------------------------------------------------------------------------
67
+ // Raster → WebGLTileLayer
68
+ // ---------------------------------------------------------------------------
69
+ /**
70
+ * Compile a single Grammar layer to an OL WebGLTile layer.
71
+ * The pixel-color channel of the compiled style becomes the WebGL tile
72
+ * `color` expression. $band-N fields compile to ['band', N] in the style
73
+ * compiler; normalized GeoTIFF bands cover [0, 1] so featureValues [0, 1]
74
+ * produces sensible colorRamp stops by default.
75
+ */
76
+ function compileRasterLayer(grammarLayer, source, opacity, visible, featureValues) {
77
+ const singleLayerState = {
78
+ layers: [grammarLayer],
79
+ };
80
+ // Use [0, 1] as fallback values so colorRamp stops span the normalized
81
+ // band range when no explicit featureValues are provided.
82
+ const values = featureValues.length > 0 ? featureValues : [0, 1];
83
+ const flatStyle = grammarToOLStyle(singleLayerState, values);
84
+ const colorExpr = flatStyle['pixel-color'];
85
+ return new WebGLTileLayer(Object.assign({ opacity,
86
+ visible,
87
+ source }, (colorExpr !== undefined ? { style: { color: colorExpr } } : {})));
88
+ }
89
+ // ---------------------------------------------------------------------------
90
+ // KDE → HeatmapLayer
91
+ // ---------------------------------------------------------------------------
92
+ function compileKDELayer(grammarLayer, kdeTransform, source, opacity, visible) {
93
+ var _a, _b, _c;
94
+ const gradient = (_a = extractGradient(grammarLayer.rules)) !== null && _a !== void 0 ? _a : DEFAULT_GRADIENT;
95
+ const { weightField } = kdeTransform;
96
+ return new HeatmapLayer(Object.assign({ opacity,
97
+ visible,
98
+ source, blur: (_b = kdeTransform.blur) !== null && _b !== void 0 ? _b : 15, radius: (_c = kdeTransform.radius) !== null && _c !== void 0 ? _c : 10, gradient }, (weightField
99
+ ? {
100
+ weight: (feature) => {
101
+ const val = feature.get(weightField);
102
+ return typeof val === 'number' && isFinite(val) ? val : 1;
103
+ },
104
+ }
105
+ : {})));
106
+ }
107
+ /**
108
+ * Look for a pixel-color colorRamp mapping in the rules and convert it to an
109
+ * OL HeatmapLayer gradient string array. Returns undefined when absent.
110
+ */
111
+ function extractGradient(rules) {
112
+ for (const rule of rules) {
113
+ for (const mapping of rule.mappings) {
114
+ const isPixelChannel = mapping.channels.some(ch => ch === 'pixel-color' || ch.startsWith('pixel-'));
115
+ if (!isPixelChannel || mapping.scale.scheme !== 'colorRamp') {
116
+ continue;
117
+ }
118
+ const colorMap = getColorMap(mapping.scale.params.name);
119
+ if (!colorMap || colorMap.colors.length === 0) {
120
+ continue;
121
+ }
122
+ // Sample 5 evenly spaced stops from the 255-entry color array.
123
+ const n = 5;
124
+ const colors = colorMap.colors;
125
+ const step = (colors.length - 1) / (n - 1);
126
+ const gradient = Array.from({ length: n }, (_, i) => colors[Math.round(i * step)]);
127
+ return mapping.scale.params.reverse ? [...gradient].reverse() : gradient;
128
+ }
129
+ }
130
+ return undefined;
131
+ }
132
+ // ---------------------------------------------------------------------------
133
+ // Non-KDE → VectorImageLayer
134
+ // ---------------------------------------------------------------------------
135
+ function compileVectorLayer(grammarLayer, source, opacity, visible, featureValues) {
136
+ const singleLayerState = {
137
+ layers: [grammarLayer],
138
+ };
139
+ const flatStyle = grammarToOLStyle(singleLayerState, featureValues);
140
+ // If no rules produced output (e.g. empty rules list or all expressions dropped),
141
+ // fall back to the default style so the layer is visible rather than invisible.
142
+ const style = Object.keys(flatStyle).length === 0 ? DEFAULT_FLAT_STYLE : flatStyle;
143
+ const rule = { style };
144
+ return new VectorImageLayer({ opacity, visible, source, style: [rule] });
145
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Grammar → OL FlatStyle compiler.
3
+ *
4
+ * grammarToOLStyle(state) compiles an IGrammarSymbologyState into an OL
5
+ * FlatStyle object ready to be applied to a VectorLayer or VectorTileLayer.
6
+ *
7
+ * Compilation steps:
8
+ * 1. Expand rules into per-channel entries (guard + expression).
9
+ * 2. Build a case expression per channel (conditional entries first,
10
+ * last unconditional entry as the else branch).
11
+ * 3. Assemble sub-channels (fill-red/green/blue/alpha) into a composite
12
+ * fill-color ['array', r, g, b, a] expression.
13
+ */
14
+ import { IGrammarSymbologyState } from '@jupytergis/schema';
15
+ import { ExpressionValue } from 'ol/expr/expression';
16
+ export declare const DENSITY_FIELD = "$density";
17
+ /**
18
+ * Compile a Grammar symbology state to an OL FlatStyle object.
19
+ * Sub-channels (fill-red/green/blue/alpha) are assembled into fill-color.
20
+ *
21
+ * @param featureValues Feature attribute values for the rule field(s).
22
+ * Required for categorical and colorRamp scales so the compiler can
23
+ * enumerate unique values / compute classification breaks at render time,
24
+ * mirroring how buildVectorFlatStyle works.
25
+ */
26
+ export declare function grammarToOLStyle(state: IGrammarSymbologyState, featureValues?: unknown[]): Record<string, ExpressionValue>;
27
+ /**
28
+ * Extract the encoding field column from feature property rows.
29
+ * colorRamp and categorical scales take a single input field; this returns
30
+ * all values for that field so the compiler can compute classification breaks.
31
+ */
32
+ export declare function extractEncodingFieldValues(state: IGrammarSymbologyState, rows: Record<string, unknown>[]): unknown[];
@@ -0,0 +1,467 @@
1
+ /**
2
+ * Grammar → OL FlatStyle compiler.
3
+ *
4
+ * grammarToOLStyle(state) compiles an IGrammarSymbologyState into an OL
5
+ * FlatStyle object ready to be applied to a VectorLayer or VectorTileLayer.
6
+ *
7
+ * Compilation steps:
8
+ * 1. Expand rules into per-channel entries (guard + expression).
9
+ * 2. Build a case expression per channel (conditional entries first,
10
+ * last unconditional entry as the else branch).
11
+ * 3. Assemble sub-channels (fill-red/green/blue/alpha) into a composite
12
+ * fill-color ['array', r, g, b, a] expression.
13
+ */
14
+ import { computeCategorizedColorStops, computeGraduatedColorStops, } from './styleBuilder';
15
+ // '$density' is the pseudo-field produced by a kde transform (KDE density raster).
16
+ // Encoding rules referencing it are compiled only when a kde transform is present;
17
+ // the actual OL HeatmapLayer instantiation happens outside this compiler.
18
+ export const DENSITY_FIELD = '$density';
19
+ // ---------------------------------------------------------------------------
20
+ // Field expression helpers
21
+ // ---------------------------------------------------------------------------
22
+ /**
23
+ * Convert a field name to an OL expression.
24
+ * $band-N (raster pseudo-fields) → ['band', N]
25
+ * everything else → ['get', field]
26
+ */
27
+ function fieldExpr(field) {
28
+ const m = field.match(/^\$band-(\d+)$/);
29
+ if (m) {
30
+ return ['band', parseInt(m[1], 10)];
31
+ }
32
+ return ['get', field];
33
+ }
34
+ /** Band pseudo-fields always exist; vector feature properties may not. */
35
+ function fieldAlwaysPresent(field) {
36
+ return /^\$band-\d+$/.test(field) || field === DENSITY_FIELD;
37
+ }
38
+ // ---------------------------------------------------------------------------
39
+ // Public API
40
+ // ---------------------------------------------------------------------------
41
+ /**
42
+ * Compile a Grammar symbology state to an OL FlatStyle object.
43
+ * Sub-channels (fill-red/green/blue/alpha) are assembled into fill-color.
44
+ *
45
+ * @param featureValues Feature attribute values for the rule field(s).
46
+ * Required for categorical and colorRamp scales so the compiler can
47
+ * enumerate unique values / compute classification breaks at render time,
48
+ * mirroring how buildVectorFlatStyle works.
49
+ */
50
+ export function grammarToOLStyle(state, featureValues = []) {
51
+ var _a, _b, _c, _d, _e, _f, _g;
52
+ // Accumulate per-channel entries from all layers and their rules.
53
+ // Layers with a kde/cluster preprocess are handled at the renderer level;
54
+ // this compiler only produces the flat-style for the vector portion.
55
+ const accumulator = new Map();
56
+ // Guard: state.layers may be absent on legacy Grammar states that predate
57
+ // the layers nesting (e.g. stored as { rules: [...] } without a layers wrapper).
58
+ for (const layer of (_a = state.layers) !== null && _a !== void 0 ? _a : []) {
59
+ if ((_b = layer.preprocess) === null || _b === void 0 ? void 0 : _b.some(t => t.type === 'kde')) {
60
+ // KDE layers are compiled separately by the renderer (HeatmapLayer).
61
+ // Skip flat-style compilation for this layer.
62
+ continue;
63
+ }
64
+ // Layer-level guard: compiled separately then AND-ed with the rule guard.
65
+ const layerGuard = layer.when && layer.when.length > 0
66
+ ? compileGuard(layer.when, (_c = layer.whenOp) !== null && _c !== void 0 ? _c : 'all')
67
+ : undefined;
68
+ for (const rule of layer.rules) {
69
+ // For now use the first field; multi-field assembly is handled via
70
+ // sub-channel mappings (pixel-red/green/blue) or expression scales.
71
+ const field = (_d = rule.fields) === null || _d === void 0 ? void 0 : _d[0];
72
+ const ruleGuard = rule.when && rule.when.length > 0
73
+ ? compileGuard(rule.when, (_e = rule.whenOp) !== null && _e !== void 0 ? _e : 'all')
74
+ : undefined;
75
+ const guard = layerGuard && ruleGuard
76
+ ? ['all', layerGuard, ruleGuard]
77
+ : (layerGuard !== null && layerGuard !== void 0 ? layerGuard : ruleGuard);
78
+ for (const mapping of rule.mappings) {
79
+ for (const channel of mapping.channels) {
80
+ if (channel === 'pixel-rgb') {
81
+ // Virtual channel: fan out to pixel-red/green/blue so assembleStyle
82
+ // can compose them into ['color', r, g, b, a] with a separate alpha.
83
+ for (const sub of [
84
+ 'pixel-red',
85
+ 'pixel-green',
86
+ 'pixel-blue',
87
+ ]) {
88
+ const expr = compileMapping(field, mapping, featureValues, sub);
89
+ const entries = (_f = accumulator.get(sub)) !== null && _f !== void 0 ? _f : [];
90
+ entries.push({ guard, expr });
91
+ accumulator.set(sub, entries);
92
+ }
93
+ }
94
+ else {
95
+ // Compile per-channel so sub-channels (pixel-red/green/blue) can each
96
+ // extract the correct component from a colorRamp or other color scale.
97
+ const expr = compileMapping(field, mapping, featureValues, channel);
98
+ const entries = (_g = accumulator.get(channel)) !== null && _g !== void 0 ? _g : [];
99
+ entries.push({ guard, expr });
100
+ accumulator.set(channel, entries);
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ // Build per-channel OL expressions.
107
+ const channelExprs = new Map();
108
+ for (const [channel, entries] of accumulator) {
109
+ channelExprs.set(channel, buildChannelExpr(entries, channel));
110
+ }
111
+ // Assemble into the final style object, handling sub-channel composition.
112
+ return assembleStyle(channelExprs);
113
+ }
114
+ // ---------------------------------------------------------------------------
115
+ // Feature-value extraction helper
116
+ // ---------------------------------------------------------------------------
117
+ /**
118
+ * Extract the encoding field column from feature property rows.
119
+ * colorRamp and categorical scales take a single input field; this returns
120
+ * all values for that field so the compiler can compute classification breaks.
121
+ */
122
+ export function extractEncodingFieldValues(state, rows) {
123
+ var _a, _b, _c;
124
+ let field;
125
+ for (const gl of (_a = state.layers) !== null && _a !== void 0 ? _a : []) {
126
+ for (const rule of (_b = gl.rules) !== null && _b !== void 0 ? _b : []) {
127
+ const f = (_c = rule.fields) === null || _c === void 0 ? void 0 : _c[0];
128
+ if (f && !f.startsWith('$')) {
129
+ field = f;
130
+ break;
131
+ }
132
+ }
133
+ if (field) {
134
+ break;
135
+ }
136
+ }
137
+ if (!field) {
138
+ console.debug('extractEncodingFieldValues: no encoding field found in Grammar state');
139
+ return [];
140
+ }
141
+ return rows.map(r => r[field]).filter(v => v !== null && v !== undefined);
142
+ }
143
+ // ---------------------------------------------------------------------------
144
+ // Channel expression builder
145
+ // ---------------------------------------------------------------------------
146
+ /**
147
+ * Merge a list of ChannelEntries into a single OL expression.
148
+ * Conditional entries form case branches; the last unconditional entry wins
149
+ * as the else branch (transparent/zero if none).
150
+ */
151
+ function buildChannelExpr(entries, channel) {
152
+ const conditional = entries.filter(e => e.guard !== undefined);
153
+ const unconditional = entries.filter(e => e.guard === undefined);
154
+ const elseExpr = unconditional.length > 0
155
+ ? unconditional[unconditional.length - 1].expr
156
+ : channelZero(channel);
157
+ if (conditional.length === 0) {
158
+ return elseExpr;
159
+ }
160
+ const caseExpr = ['case'];
161
+ for (const { guard, expr } of conditional) {
162
+ caseExpr.push(guard, expr);
163
+ }
164
+ caseExpr.push(elseExpr);
165
+ return caseExpr;
166
+ }
167
+ /** Typed zero for channels with no unconditional rule. */
168
+ function channelZero(channel) {
169
+ const rgbaChannels = new Set([
170
+ 'fill-color',
171
+ 'stroke-color',
172
+ 'circle-fill-color',
173
+ 'circle-stroke-color',
174
+ 'pixel-color',
175
+ ]);
176
+ return rgbaChannels.has(channel) ? 'rgba(0,0,0,0)' : 0;
177
+ }
178
+ // ---------------------------------------------------------------------------
179
+ // Sub-channel assembly
180
+ // ---------------------------------------------------------------------------
181
+ const FILL_SUB = ['fill-red', 'fill-green', 'fill-blue'];
182
+ const FILL_ALPHA_SUB = ['fill-alpha'];
183
+ const PIXEL_SUB = ['pixel-red', 'pixel-green', 'pixel-blue'];
184
+ const PIXEL_ALPHA_SUB = ['pixel-alpha'];
185
+ /**
186
+ * Assemble the final style object.
187
+ * Sub-channels (fill-red/green/blue/alpha, pixel-red/green/blue/alpha) are
188
+ * combined into a ['color', r, g, b, a] expression on the parent channel.
189
+ * Virtual channels (pixel-rgb) are already fanned out before this runs.
190
+ */
191
+ function assembleStyle(channelExprs) {
192
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
193
+ const style = {};
194
+ // Collect named channels directly.
195
+ const skip = new Set([
196
+ ...FILL_SUB,
197
+ ...FILL_ALPHA_SUB,
198
+ ...PIXEL_SUB,
199
+ ...PIXEL_ALPHA_SUB,
200
+ ]);
201
+ for (const [channel, expr] of channelExprs) {
202
+ if (!skip.has(channel)) {
203
+ style[channel] = expr;
204
+ }
205
+ }
206
+ // Assemble fill-color from sub-channels if any fill-* sub-channel is present.
207
+ // ['color', r, g, b, a] is the OL operator that produces ColorType (r/g/b 0-255, a 0-1).
208
+ if (FILL_SUB.some(c => channelExprs.has(c)) ||
209
+ FILL_ALPHA_SUB.some(c => channelExprs.has(c))) {
210
+ const r = (_a = channelExprs.get('fill-red')) !== null && _a !== void 0 ? _a : 0;
211
+ const g = (_b = channelExprs.get('fill-green')) !== null && _b !== void 0 ? _b : 0;
212
+ const b = (_c = channelExprs.get('fill-blue')) !== null && _c !== void 0 ? _c : 0;
213
+ const a = (_d = channelExprs.get('fill-alpha')) !== null && _d !== void 0 ? _d : 1;
214
+ style['fill-color'] = ['color', r, g, b, a];
215
+ }
216
+ // Assemble pixel-color from sub-channels when pixel-R/G/B are present.
217
+ // pixel-alpha alone does NOT overwrite a direct pixel-color mapping.
218
+ if (PIXEL_SUB.some(c => channelExprs.has(c))) {
219
+ const r = (_e = channelExprs.get('pixel-red')) !== null && _e !== void 0 ? _e : 0;
220
+ const g = (_f = channelExprs.get('pixel-green')) !== null && _f !== void 0 ? _f : 0;
221
+ const b = (_g = channelExprs.get('pixel-blue')) !== null && _g !== void 0 ? _g : 0;
222
+ const a = (_h = channelExprs.get('pixel-alpha')) !== null && _h !== void 0 ? _h : 1;
223
+ style['pixel-color'] = ['color', r, g, b, a];
224
+ }
225
+ else if (PIXEL_ALPHA_SUB.some(c => channelExprs.has(c)) &&
226
+ !channelExprs.has('pixel-color')) {
227
+ // Alpha-only with no direct pixel-color: compose with black.
228
+ const a = (_j = channelExprs.get('pixel-alpha')) !== null && _j !== void 0 ? _j : 1;
229
+ style['pixel-color'] = ['color', 0, 0, 0, a];
230
+ }
231
+ return style;
232
+ }
233
+ // ---------------------------------------------------------------------------
234
+ // Guard compilation
235
+ // ---------------------------------------------------------------------------
236
+ function compileGuard(predicates, op = 'all') {
237
+ const conditions = predicates.map(compilePredicate);
238
+ return conditions.length === 1 ? conditions[0] : [op, ...conditions];
239
+ }
240
+ function compilePredicate(predicate) {
241
+ switch (predicate.type) {
242
+ case 'geometryType':
243
+ return ['==', ['geometry-type'], predicate.value];
244
+ case 'hasField':
245
+ // Band pseudo-fields always exist; for vector features use ['has'].
246
+ return fieldAlwaysPresent(predicate.field)
247
+ ? true
248
+ : ['has', predicate.field];
249
+ case 'fieldEquals':
250
+ return ['==', fieldExpr(predicate.field), predicate.value];
251
+ case 'fieldCompare':
252
+ return [predicate.op, fieldExpr(predicate.field), predicate.value];
253
+ case 'between':
254
+ return [
255
+ 'all',
256
+ ['>=', fieldExpr(predicate.field), predicate.min],
257
+ ['<=', fieldExpr(predicate.field), predicate.max],
258
+ ];
259
+ }
260
+ }
261
+ // ---------------------------------------------------------------------------
262
+ // Mapping compilation — dispatches by scale scheme
263
+ // ---------------------------------------------------------------------------
264
+ /**
265
+ * Return the RGBA array index for a sub-channel, or undefined for full-color
266
+ * channels. Used to decompose a colorRamp into a single numeric component.
267
+ */
268
+ function colorComponentIndex(channel) {
269
+ switch (channel) {
270
+ case 'fill-red':
271
+ case 'pixel-red':
272
+ return 0;
273
+ case 'fill-green':
274
+ case 'pixel-green':
275
+ return 1;
276
+ case 'fill-blue':
277
+ case 'pixel-blue':
278
+ return 2;
279
+ case 'fill-alpha':
280
+ case 'pixel-alpha':
281
+ return 3;
282
+ default:
283
+ return undefined;
284
+ }
285
+ }
286
+ function compileMapping(field, mapping, featureValues, channel) {
287
+ const { scale } = mapping;
288
+ switch (scale.scheme) {
289
+ case 'colorRamp':
290
+ return field
291
+ ? compileColorRamp(field, scale, featureValues, channel)
292
+ : scale.params.fallback;
293
+ case 'categorical':
294
+ return field
295
+ ? compileCategorical(field, scale, featureValues)
296
+ : scale.params.fallback;
297
+ case 'expression':
298
+ // Expression scale is not yet implemented; fall back to channel zero.
299
+ console.warn('[grammarToOLStyle] expression scale is not yet implemented');
300
+ return channelZero(mapping.channels[0]);
301
+ case 'constant_rgba':
302
+ case 'constant_num':
303
+ return scale.params.value;
304
+ case 'scalar':
305
+ return field ? compileScalar(field, scale) : scale.params.fallback;
306
+ case 'identity': {
307
+ if (!field) {
308
+ return channelZero(mapping.channels[0]);
309
+ }
310
+ // Wrap with coalesce so OL's expression type system infers the correct
311
+ // output type (color vs number). Bare ['get', field] has type 'any'
312
+ // which OL rejects for typed channels like fill-color.
313
+ const isColorChannel = mapping.channels.some(ch => [
314
+ 'fill-color',
315
+ 'stroke-color',
316
+ 'circle-fill-color',
317
+ 'circle-stroke-color',
318
+ 'pixel-color',
319
+ ].includes(ch));
320
+ const typedFallback = isColorChannel
321
+ ? [0, 0, 0, 0]
322
+ : 0;
323
+ if (fieldAlwaysPresent(field)) {
324
+ return fieldExpr(field);
325
+ }
326
+ return ['coalesce', fieldExpr(field), typedFallback];
327
+ }
328
+ }
329
+ }
330
+ // ---------------------------------------------------------------------------
331
+ // Scale compilers
332
+ // ---------------------------------------------------------------------------
333
+ /**
334
+ * colorRamp: numeric field → RGBA color via a named palette + classification.
335
+ *
336
+ * Output:
337
+ * ['case', ['has', field],
338
+ * ['interpolate', ['linear'], ['get', field], stop0, color0, ...],
339
+ * fallback]
340
+ */
341
+ function compileColorRamp(field, scale, featureValues, channel) {
342
+ const stops = resolveColorStops(scale, featureValues);
343
+ // Guard: interpolate requires at least 2 stop pairs. Return fallback when
344
+ // the source is not yet loaded and no explicit domain/colorStops are set.
345
+ if (stops.length < 2) {
346
+ const componentIdx = channel !== undefined ? colorComponentIndex(channel) : undefined;
347
+ return componentIdx !== undefined ? 0 : scale.params.fallback;
348
+ }
349
+ const componentIdx = channel !== undefined ? colorComponentIndex(channel) : undefined;
350
+ const interpolateExpr = [
351
+ 'interpolate',
352
+ ['linear'],
353
+ fieldExpr(field),
354
+ ];
355
+ if (componentIdx !== undefined) {
356
+ // Sub-channel scalar interpolation for one color component (R=0,G=1,B=2,A=3).
357
+ // colormap stops carry [r, g, b, a] with r/g/b in 0-255 and a in 0-1.
358
+ // Values are passed as-is since assembleStyle uses ['color', r, g, b, a]
359
+ // which takes r/g/b in 0-255.
360
+ for (const { stop, color } of stops) {
361
+ interpolateExpr.push(stop, color[componentIdx]);
362
+ }
363
+ if (fieldAlwaysPresent(field)) {
364
+ return interpolateExpr;
365
+ }
366
+ return ['case', ['has', field], interpolateExpr, 0];
367
+ }
368
+ // Full color channel: emit the usual RGBA interpolation.
369
+ for (const { stop, color } of stops) {
370
+ interpolateExpr.push(stop, color);
371
+ }
372
+ if (fieldAlwaysPresent(field)) {
373
+ return interpolateExpr;
374
+ }
375
+ return ['case', ['has', field], interpolateExpr, scale.params.fallback];
376
+ }
377
+ /**
378
+ * Resolve color stops for a colorRamp scale.
379
+ * Explicit colorStops (user overrides) take precedence; otherwise classification
380
+ * breaks are computed from featureValues using computeGraduatedColorStops.
381
+ */
382
+ function resolveColorStops(scale, featureValues) {
383
+ var _a, _b;
384
+ if (scale.params.colorStops && scale.params.colorStops.length >= 2) {
385
+ return scale.params.colorStops;
386
+ }
387
+ const numericValues = featureValues.filter(Number.isFinite);
388
+ const syntheticState = {
389
+ nClasses: scale.params.nShades,
390
+ mode: scale.params.mode,
391
+ colorRamp: scale.params.name,
392
+ reverseRamp: scale.params.reverse,
393
+ vmin: (_a = scale.params.domain) === null || _a === void 0 ? void 0 : _a[0],
394
+ vmax: (_b = scale.params.domain) === null || _b === void 0 ? void 0 : _b[1],
395
+ };
396
+ const computed = computeGraduatedColorStops(syntheticState, numericValues);
397
+ return computed.map(s => ({
398
+ stop: s.value,
399
+ color: s.color,
400
+ }));
401
+ }
402
+ /**
403
+ * categorical: nominal field → RGBA color via a named palette.
404
+ * Unique field values are enumerated from featureValues at render time,
405
+ * mirroring buildCategorized.
406
+ *
407
+ * Output:
408
+ * ['case',
409
+ * ['==', ['get', field], val0], color0,
410
+ * ...,
411
+ * fallback]
412
+ */
413
+ function compileCategorical(field, scale, featureValues) {
414
+ var _a;
415
+ let stops;
416
+ if (scale.params.colorStops && scale.params.colorStops.length > 0) {
417
+ stops = scale.params.colorStops.map(s => ({
418
+ value: s.stop,
419
+ color: s.color,
420
+ }));
421
+ }
422
+ else {
423
+ const syntheticState = {
424
+ colorRamp: scale.params.colorRamp,
425
+ reverseRamp: (_a = scale.params.reverse) !== null && _a !== void 0 ? _a : false,
426
+ };
427
+ stops = computeCategorizedColorStops(syntheticState, featureValues);
428
+ }
429
+ // Guard: a OL case expression requires at least one condition+value pair
430
+ // before the else branch. Return fallback directly when stops is empty.
431
+ if (stops.length === 0) {
432
+ return scale.params.fallback;
433
+ }
434
+ const caseExpr = ['case'];
435
+ for (const stop of stops) {
436
+ caseExpr.push(['==', fieldExpr(field), stop.value], stop.color);
437
+ }
438
+ caseExpr.push(scale.params.fallback);
439
+ return caseExpr;
440
+ }
441
+ /**
442
+ * scalar: numeric field → numeric output (radius, width, sub-channel value).
443
+ *
444
+ * Output:
445
+ * ['case', ['has', field],
446
+ * ['interpolate', ['linear'], ['get', field], stop0, out0, ...],
447
+ * fallback]
448
+ */
449
+ function compileScalar(field, scale) {
450
+ const interpolateExpr = [
451
+ 'interpolate',
452
+ ['linear'],
453
+ fieldExpr(field),
454
+ ];
455
+ if (scale.params.scalarStops && scale.params.scalarStops.length >= 2) {
456
+ for (const { stop, output } of scale.params.scalarStops) {
457
+ interpolateExpr.push(stop, output);
458
+ }
459
+ }
460
+ else {
461
+ interpolateExpr.push(scale.params.domain[0], scale.params.range[0], scale.params.domain[1], scale.params.range[1]);
462
+ }
463
+ if (fieldAlwaysPresent(field)) {
464
+ return interpolateExpr;
465
+ }
466
+ return ['case', ['has', field], interpolateExpr, scale.params.fallback];
467
+ }
@@ -7,7 +7,7 @@ export interface IBandRow {
7
7
  maximum: number;
8
8
  };
9
9
  }
10
- declare const useGetBandInfo: (model: IJupyterGISModel, layer: IJGISLayer) => {
10
+ declare const useGetBandInfo: (model: IJupyterGISModel, layer: IJGISLayer | null | undefined) => {
11
11
  bandRows: IBandRow[];
12
12
  setBandRows: import("react").Dispatch<import("react").SetStateAction<IBandRow[]>>;
13
13
  loading: boolean;
@@ -1,6 +1,6 @@
1
1
  import { fromUrl, fromBlob } from 'geotiff';
2
2
  import { useEffect, useState } from 'react';
3
- import { loadFile } from "../../../tools";
3
+ import { loadFile } from "../../../../tools";
4
4
  const useGetBandInfo = (model, layer) => {
5
5
  const [bandRows, setBandRows] = useState([]);
6
6
  const [loading, setLoading] = useState(false);
@@ -1,6 +1,6 @@
1
1
  // import { GeoJSONFeature } from 'geojson';
2
2
  import { useEffect, useState } from 'react';
3
- import { loadFile } from "../../../tools";
3
+ import { loadFile } from "../../../../tools";
4
4
  async function getGeoJsonProperties({ source, model, }) {
5
5
  const result = {};
6
6
  const data = await (async () => {