@walkthru-earth/objex 1.3.0 → 1.4.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 (182) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +20 -12
  3. package/dist/components/browser/FileTreeSidebar.svelte +32 -17
  4. package/dist/components/layout/AboutSheet.svelte +5 -2
  5. package/dist/components/layout/ConnectionDialog.svelte +1 -1
  6. package/dist/components/layout/SettingsSheet.svelte +237 -0
  7. package/dist/components/layout/SettingsSheet.svelte.d.ts +6 -0
  8. package/dist/components/layout/Sidebar.svelte +73 -6
  9. package/dist/components/layout/Sidebar.svelte.d.ts +4 -1
  10. package/dist/components/layout/StatusBar.svelte +1 -1
  11. package/dist/components/layout/TabBar.svelte +2 -2
  12. package/dist/components/ui/context-menu/context-menu-radio-group.svelte.d.ts +1 -1
  13. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +1 -1
  14. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +1 -1
  15. package/dist/components/ui/input/input.svelte.d.ts +1 -1
  16. package/dist/components/ui/resizable/index.d.ts +1 -1
  17. package/dist/components/ui/resizable/index.js +2 -2
  18. package/dist/components/ui/slider/index.d.ts +3 -0
  19. package/dist/components/ui/slider/index.js +5 -0
  20. package/dist/components/ui/slider/range-slider.svelte +94 -0
  21. package/dist/components/ui/slider/range-slider.svelte.d.ts +21 -0
  22. package/dist/components/ui/slider/slider.svelte +83 -0
  23. package/dist/components/ui/slider/slider.svelte.d.ts +7 -0
  24. package/dist/components/viewers/ArchiveViewer.svelte +2 -2
  25. package/dist/components/viewers/CodeViewer.svelte +31 -22
  26. package/dist/components/viewers/CogControls.svelte +338 -184
  27. package/dist/components/viewers/CogControls.svelte.d.ts +33 -10
  28. package/dist/components/viewers/CogViewer.svelte +320 -119
  29. package/dist/components/viewers/CopcViewer.svelte +1 -1
  30. package/dist/components/viewers/FlatGeobufViewer.svelte +1 -1
  31. package/dist/components/viewers/GeoParquetMapViewer.svelte +6 -6
  32. package/dist/components/viewers/GeoParquetMapViewer.svelte.d.ts +1 -1
  33. package/dist/components/viewers/ImageViewer.svelte +2 -2
  34. package/dist/components/viewers/MarkdownViewer.svelte +12 -9
  35. package/dist/components/viewers/MediaViewer.svelte +2 -2
  36. package/dist/components/viewers/ModelViewer.svelte +1 -1
  37. package/dist/components/viewers/MultiCogViewer.svelte +467 -102
  38. package/dist/components/viewers/MultiCogViewer.svelte.d.ts +1 -1
  39. package/dist/components/viewers/NotebookViewer.svelte +6 -3
  40. package/dist/components/viewers/PdfViewer.svelte +2 -2
  41. package/dist/components/viewers/PmtilesViewer.svelte +3 -6
  42. package/dist/components/viewers/RawViewer.svelte +6 -3
  43. package/dist/components/viewers/StacMapViewer.svelte +10 -2
  44. package/dist/components/viewers/StacMosaicViewer.svelte +1800 -362
  45. package/dist/components/viewers/StacMosaicViewer.svelte.d.ts +1 -1
  46. package/dist/components/viewers/StacTabViewer.svelte +24 -13
  47. package/dist/components/viewers/StacTabViewer.svelte.d.ts +1 -1
  48. package/dist/components/viewers/TableGrid.svelte +4 -4
  49. package/dist/components/viewers/TableStatusBar.svelte +1 -1
  50. package/dist/components/viewers/TableToolbar.svelte +1 -1
  51. package/dist/components/viewers/TableViewer.svelte +25 -17
  52. package/dist/components/viewers/TableViewer.svelte.d.ts +1 -0
  53. package/dist/components/viewers/ViewerRouter.svelte +16 -8
  54. package/dist/components/viewers/ZarrMapViewer.svelte +11 -9
  55. package/dist/components/viewers/ZarrViewer.svelte +4 -4
  56. package/dist/components/viewers/cog/ChannelPicker.svelte +83 -0
  57. package/dist/components/viewers/cog/ChannelPicker.svelte.d.ts +13 -0
  58. package/dist/components/viewers/cog/PixelInspectorPanel.svelte +87 -0
  59. package/dist/components/viewers/cog/PixelInspectorPanel.svelte.d.ts +17 -0
  60. package/dist/components/viewers/cog/buildRgbLayer.d.ts +78 -0
  61. package/dist/components/viewers/cog/buildRgbLayer.js +176 -0
  62. package/dist/components/viewers/map/AttributeTable.svelte +1 -1
  63. package/dist/components/viewers/map/MapContainer.svelte +37 -11
  64. package/dist/components/viewers/pmtiles/PmtilesArchiveView.svelte +1 -1
  65. package/dist/components/viewers/pmtiles/PmtilesTileInspector.svelte +1 -1
  66. package/dist/components/viewers/stac/StacDatetimeBar.svelte +175 -0
  67. package/dist/components/viewers/stac/StacDatetimeBar.svelte.d.ts +10 -0
  68. package/dist/components/viewers/stac/StacFilterPanel.svelte +243 -0
  69. package/dist/components/viewers/stac/StacFilterPanel.svelte.d.ts +14 -0
  70. package/dist/components/viewers/stac/StacItemInspector.svelte +223 -0
  71. package/dist/components/viewers/stac/StacItemInspector.svelte.d.ts +10 -0
  72. package/dist/components/viewers/stac/StacItemStrip.svelte +228 -0
  73. package/dist/components/viewers/stac/StacItemStrip.svelte.d.ts +12 -0
  74. package/dist/file-icons/index.d.ts +1 -1
  75. package/dist/file-icons/index.js +1 -1
  76. package/dist/i18n/ar.js +110 -2
  77. package/dist/i18n/en.js +110 -2
  78. package/dist/index.d.ts +2 -28
  79. package/dist/index.js +7 -23
  80. package/dist/query/engine.d.ts +10 -0
  81. package/dist/query/source.js +1 -1
  82. package/dist/query/stac-source-factory.d.ts +65 -0
  83. package/dist/query/stac-source-factory.js +77 -0
  84. package/dist/query/stac-source-parquet.d.ts +135 -0
  85. package/dist/query/stac-source-parquet.js +465 -0
  86. package/dist/query/wasm.d.ts +8 -0
  87. package/dist/query/wasm.js +304 -2
  88. package/dist/storage/presign.js +1 -1
  89. package/dist/storage/providers.js +5 -5
  90. package/dist/stores/config.svelte.d.ts +15 -0
  91. package/dist/stores/config.svelte.js +46 -0
  92. package/dist/stores/connections.svelte.d.ts +2 -2
  93. package/dist/stores/connections.svelte.js +1 -2
  94. package/dist/stores/files.svelte.d.ts +1 -1
  95. package/dist/stores/files.svelte.js +1 -1
  96. package/dist/stores/query-history.svelte.js +1 -1
  97. package/dist/stores/settings.svelte.d.ts +16 -1
  98. package/dist/stores/settings.svelte.js +104 -48
  99. package/dist/stores/tabs.svelte.d.ts +3 -0
  100. package/dist/stores/tabs.svelte.js +17 -0
  101. package/dist/utils/cog-histogram.d.ts +121 -0
  102. package/dist/utils/cog-histogram.js +424 -0
  103. package/dist/utils/cog.d.ts +200 -60
  104. package/dist/utils/cog.js +377 -114
  105. package/dist/utils/colormap-sprite.d.ts +0 -9
  106. package/dist/utils/colormap-sprite.js +0 -21
  107. package/dist/utils/deck.d.ts +16 -12
  108. package/dist/utils/deck.js +10 -4
  109. package/dist/utils/pmtiles-tile.js +2 -2
  110. package/dist/utils/{url.d.ts → signed-url.d.ts} +15 -1
  111. package/dist/utils/{url.js → signed-url.js} +32 -10
  112. package/dist/utils/url-state.d.ts +36 -0
  113. package/dist/utils/url-state.js +72 -2
  114. package/dist/utils/zarr-tab.d.ts +1 -2
  115. package/dist/utils/zarr-tab.js +1 -2
  116. package/dist/utils/zarr.d.ts +0 -17
  117. package/dist/utils/zarr.js +1 -45
  118. package/package.json +55 -84
  119. package/dist/components/browser/Breadcrumb.svelte +0 -50
  120. package/dist/components/browser/Breadcrumb.svelte.d.ts +0 -7
  121. package/dist/components/browser/CreateFolderDialog.svelte +0 -98
  122. package/dist/components/browser/CreateFolderDialog.svelte.d.ts +0 -6
  123. package/dist/components/browser/DeleteConfirmDialog.svelte +0 -90
  124. package/dist/components/browser/DeleteConfirmDialog.svelte.d.ts +0 -8
  125. package/dist/components/browser/DropZone.svelte +0 -83
  126. package/dist/components/browser/DropZone.svelte.d.ts +0 -7
  127. package/dist/components/browser/FileBrowser.svelte +0 -252
  128. package/dist/components/browser/FileBrowser.svelte.d.ts +0 -3
  129. package/dist/components/browser/FileRow.svelte +0 -117
  130. package/dist/components/browser/FileRow.svelte.d.ts +0 -9
  131. package/dist/components/browser/RenameDialog.svelte +0 -101
  132. package/dist/components/browser/RenameDialog.svelte.d.ts +0 -8
  133. package/dist/components/browser/SearchBar.svelte +0 -40
  134. package/dist/components/browser/SearchBar.svelte.d.ts +0 -6
  135. package/dist/components/browser/UploadButton.svelte +0 -65
  136. package/dist/components/browser/UploadButton.svelte.d.ts +0 -3
  137. package/dist/query/stac-geoparquet.d.ts +0 -31
  138. package/dist/query/stac-geoparquet.js +0 -136
  139. package/dist/utils/clipboard.d.ts +0 -13
  140. package/dist/utils/clipboard.js +0 -38
  141. package/dist/utils/cloud-url.d.ts +0 -27
  142. package/dist/utils/cloud-url.js +0 -61
  143. package/dist/utils/column-types.d.ts +0 -5
  144. package/dist/utils/column-types.js +0 -137
  145. package/dist/utils/connection-identity.d.ts +0 -51
  146. package/dist/utils/connection-identity.js +0 -97
  147. package/dist/utils/error.d.ts +0 -8
  148. package/dist/utils/error.js +0 -12
  149. package/dist/utils/evidence-context.d.ts +0 -22
  150. package/dist/utils/evidence-context.js +0 -56
  151. package/dist/utils/export.d.ts +0 -22
  152. package/dist/utils/export.js +0 -76
  153. package/dist/utils/file-sort.d.ts +0 -20
  154. package/dist/utils/file-sort.js +0 -41
  155. package/dist/utils/format.d.ts +0 -24
  156. package/dist/utils/format.js +0 -78
  157. package/dist/utils/geoarrow.d.ts +0 -32
  158. package/dist/utils/geoarrow.js +0 -672
  159. package/dist/utils/geometry-type.d.ts +0 -52
  160. package/dist/utils/geometry-type.js +0 -76
  161. package/dist/utils/hex.d.ts +0 -10
  162. package/dist/utils/hex.js +0 -27
  163. package/dist/utils/host-detection.d.ts +0 -23
  164. package/dist/utils/host-detection.js +0 -95
  165. package/dist/utils/local-storage.d.ts +0 -16
  166. package/dist/utils/local-storage.js +0 -37
  167. package/dist/utils/markdown-sql.d.ts +0 -30
  168. package/dist/utils/markdown-sql.js +0 -72
  169. package/dist/utils/notebook.d.ts +0 -59
  170. package/dist/utils/notebook.js +0 -211
  171. package/dist/utils/parquet-metadata.d.ts +0 -64
  172. package/dist/utils/parquet-metadata.js +0 -262
  173. package/dist/utils/stac-geoparquet.d.ts +0 -90
  174. package/dist/utils/stac-geoparquet.js +0 -223
  175. package/dist/utils/stac-hydrate.d.ts +0 -38
  176. package/dist/utils/stac-hydrate.js +0 -243
  177. package/dist/utils/stac.d.ts +0 -136
  178. package/dist/utils/stac.js +0 -176
  179. package/dist/utils/storage-url.d.ts +0 -90
  180. package/dist/utils/storage-url.js +0 -568
  181. package/dist/utils/wkb.d.ts +0 -43
  182. package/dist/utils/wkb.js +0 -359
@@ -17,8 +17,6 @@ export { COLORMAP_INDEX, type ColormapName } from '@developmentseed/deck.gl-rast
17
17
  export declare const COLORMAP_SPRITE_URL: any;
18
18
  /** Number of distinct ramps encoded as 1-pixel-tall rows in the sprite. */
19
19
  export declare const COLORMAP_SPRITE_LAYERS: number;
20
- /** Width of each ramp row in pixels (also the sampling resolution). */
21
- export declare const COLORMAP_SPRITE_WIDTH = 256;
22
20
  /** All ramp names, sorted alphabetically (matches `COLORMAP_INDEX` key order). */
23
21
  export declare const COLORMAP_NAMES: ColormapName[];
24
22
  /** Decode the shipped sprite once per session. Safe to call repeatedly. */
@@ -30,10 +28,3 @@ export declare function loadColormapSprite(): Promise<ImageData>;
30
28
  * `Colormap` shader module.
31
29
  */
32
30
  export declare function getColormapTexture(device: Device): Promise<Texture>;
33
- /**
34
- * CSS `background` properties that render a single colormap row from the
35
- * shipped sprite. Vertically scales the sprite so each 1-pixel row fills
36
- * the container's full height, then offsets to land on the requested layer.
37
- * Returns `undefined` for unknown ramp names so the caller can fall back.
38
- */
39
- export declare function spriteBackgroundStyle(name: ColormapName, heightPx: number): string | undefined;
@@ -21,8 +21,6 @@ export { COLORMAP_INDEX } from '@developmentseed/deck.gl-raster/gpu-modules';
21
21
  export const COLORMAP_SPRITE_URL = colormapsPngUrl;
22
22
  /** Number of distinct ramps encoded as 1-pixel-tall rows in the sprite. */
23
23
  export const COLORMAP_SPRITE_LAYERS = Object.keys(COLORMAP_INDEX).length;
24
- /** Width of each ramp row in pixels (also the sampling resolution). */
25
- export const COLORMAP_SPRITE_WIDTH = 256;
26
24
  /** All ramp names, sorted alphabetically (matches `COLORMAP_INDEX` key order). */
27
25
  export const COLORMAP_NAMES = Object.keys(COLORMAP_INDEX).sort();
28
26
  let spritePromise = null;
@@ -56,22 +54,3 @@ export async function getColormapTexture(device) {
56
54
  textureCache.set(device, texture);
57
55
  return texture;
58
56
  }
59
- /**
60
- * CSS `background` properties that render a single colormap row from the
61
- * shipped sprite. Vertically scales the sprite so each 1-pixel row fills
62
- * the container's full height, then offsets to land on the requested layer.
63
- * Returns `undefined` for unknown ramp names so the caller can fall back.
64
- */
65
- export function spriteBackgroundStyle(name, heightPx) {
66
- const index = COLORMAP_INDEX[name];
67
- if (index === undefined)
68
- return undefined;
69
- const totalHeight = COLORMAP_SPRITE_LAYERS * heightPx;
70
- const yOffset = index * heightPx;
71
- return [
72
- `background-image: url("${COLORMAP_SPRITE_URL}")`,
73
- 'background-repeat: no-repeat',
74
- `background-size: 100% ${totalHeight}px`,
75
- `background-position: 0 -${yOffset}px`
76
- ].join('; ');
77
- }
@@ -4,7 +4,7 @@
4
4
  * - GeoJSON overlay: used by FlatGeobufViewer
5
5
  * - GeoArrow overlay: used by GeoParquetMapViewer (zero-copy DuckDB → GPU pipeline)
6
6
  */
7
- import type { GeoArrowResult } from './geoarrow.js';
7
+ import type { GeoArrowResult } from '@walkthru-earth/objex-utils';
8
8
  /**
9
9
  * Create an onHover callback that toggles the cursor on the MapLibre canvas.
10
10
  * With `interleaved: false`, deck.gl's own canvas has pointer-events: none,
@@ -35,17 +35,21 @@ export declare function loadDeckModules(): Promise<{
35
35
  }>;
36
36
  /** Lazy-load GeoArrow deck.gl layers + MapboxOverlay + GeoJsonLayer (for selection). */
37
37
  export declare function loadGeoArrowModules(): Promise<{
38
- GeoArrowArcLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowArcLayer;
39
- GeoArrowColumnLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowColumnLayer;
40
- _GeoArrowH3HexagonLayer: typeof import("@geoarrow/deck.gl-layers")._GeoArrowH3HexagonLayer;
41
- GeoArrowHeatmapLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowHeatmapLayer;
42
- GeoArrowPathLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowPathLayer;
43
- GeoArrowPointCloudLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowPointCloudLayer;
44
- GeoArrowPolygonLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowPolygonLayer;
45
- GeoArrowScatterplotLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowScatterplotLayer;
46
- GeoArrowSolidPolygonLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowSolidPolygonLayer;
47
- _GeoArrowTextLayer: typeof import("@geoarrow/deck.gl-layers")._GeoArrowTextLayer;
48
- GeoArrowTripsLayer: typeof import("@geoarrow/deck.gl-layers").GeoArrowTripsLayer;
38
+ GeoArrowA5Layer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowA5Layer;
39
+ GeoArrowArcLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowArcLayer;
40
+ GeoArrowColumnLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowColumnLayer;
41
+ GeoArrowGeohashLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowGeohashLayer;
42
+ GeoArrowH3HexagonLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowH3HexagonLayer;
43
+ GeoArrowHeatmapLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowHeatmapLayer;
44
+ GeoArrowPathLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowPathLayer;
45
+ GeoArrowPointCloudLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowPointCloudLayer;
46
+ GeoArrowPolygonLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowPolygonLayer;
47
+ GeoArrowS2Layer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowS2Layer;
48
+ GeoArrowScatterplotLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowScatterplotLayer;
49
+ GeoArrowSolidPolygonLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowSolidPolygonLayer;
50
+ initEarcutPool: typeof import("@geoarrow/deck.gl-geoarrow").initEarcutPool;
51
+ _GeoArrowTextLayer: typeof import("@geoarrow/deck.gl-geoarrow")._GeoArrowTextLayer;
52
+ GeoArrowTripsLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowTripsLayer;
49
53
  MapboxOverlay: typeof import("@deck.gl/mapbox").MapboxOverlay;
50
54
  GeoJsonLayer: typeof import("@deck.gl/layers").GeoJsonLayer;
51
55
  }>;
@@ -51,7 +51,7 @@ export async function loadDeckModules() {
51
51
  export async function loadGeoArrowModules() {
52
52
  const [{ MapboxOverlay }, geoarrowLayers, { GeoJsonLayer }] = await Promise.all([
53
53
  import('@deck.gl/mapbox'),
54
- import('@geoarrow/deck.gl-layers'),
54
+ import('@geoarrow/deck.gl-geoarrow'),
55
55
  import('@deck.gl/layers')
56
56
  ]);
57
57
  return { MapboxOverlay, GeoJsonLayer, ...geoarrowLayers };
@@ -60,6 +60,12 @@ export async function loadGeoArrowModules() {
60
60
  function createLayerForResult(modules, result, layerId, onClick, onHover) {
61
61
  const { GeoArrowScatterplotLayer, GeoArrowPathLayer, GeoArrowPolygonLayer } = modules;
62
62
  const { table, geometryType, sourceIndices } = result;
63
+ // @geoarrow/deck.gl-geoarrow 0.4+ takes a single Arrow RecordBatch as `data`,
64
+ // not a Table. buildSingleTable() always assembles one batch per table, so the
65
+ // row index stays 0..N-1 and the sourceIndices click mapping is unaffected.
66
+ const batch = table.batches[0];
67
+ if (!batch)
68
+ return null;
63
69
  const { fill, line } = colorsForType(geometryType);
64
70
  const handleClick = (info) => {
65
71
  if (!onClick)
@@ -71,7 +77,7 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
71
77
  if (geometryType === 'point' || geometryType === 'multipoint') {
72
78
  return new GeoArrowScatterplotLayer({
73
79
  id: layerId,
74
- data: table,
80
+ data: batch,
75
81
  getFillColor: fill,
76
82
  getRadius: 6,
77
83
  radiusUnits: 'pixels',
@@ -88,7 +94,7 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
88
94
  else if (geometryType === 'linestring' || geometryType === 'multilinestring') {
89
95
  return new GeoArrowPathLayer({
90
96
  id: layerId,
91
- data: table,
97
+ data: batch,
92
98
  getColor: line,
93
99
  getWidth: 2.5,
94
100
  widthUnits: 'pixels',
@@ -104,7 +110,7 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
104
110
  else {
105
111
  return new GeoArrowPolygonLayer({
106
112
  id: layerId,
107
- data: table,
113
+ data: batch,
108
114
  getFillColor: fill,
109
115
  getLineColor: line,
110
116
  getLineWidth: 2,
@@ -18,11 +18,11 @@ export async function decodeMvtTile(pmtiles, z, x, y) {
18
18
  const bytes = new Uint8Array(resp.data);
19
19
  const rawSize = bytes.length;
20
20
  // Lazy-load @mapbox/vector-tile + pbf (only when inspector is opened)
21
- const [{ VectorTile }, { default: Pbf }] = await Promise.all([
21
+ const [{ VectorTile }, { PbfReader }] = await Promise.all([
22
22
  import('@mapbox/vector-tile'),
23
23
  import('pbf')
24
24
  ]);
25
- const tile = new VectorTile(new Pbf(bytes));
25
+ const tile = new VectorTile(new PbfReader(bytes));
26
26
  const layers = [];
27
27
  for (const [name, vtLayer] of Object.entries(tile.layers)) {
28
28
  const features = [];
@@ -1,4 +1,18 @@
1
- import type { Tab } from '../types.js';
1
+ import type { Connection, Tab } from '../types.js';
2
+ /**
3
+ * Build an HTTPS URL for a file in a given connection. Provider-aware via
4
+ * `buildProviderBaseUrl` (AWS, GCS, R2, Wasabi, B2, DO, Storj, Contabo, Hetzner,
5
+ * Linode, OVH, MinIO), with the Azure container/blob + SAS special case. This is
6
+ * the single source of truth shared by `buildHttpsUrl` (tab-based) and the
7
+ * FileTreeSidebar "Copy HTTP URL" action, so neither can drift back to a
8
+ * hardcoded AWS fallback for non-AWS providers.
9
+ *
10
+ * @param opts.encode percent-encode each path segment (for copy-to-clipboard).
11
+ * Off by default to preserve the raw streaming-URL behavior viewers rely on.
12
+ */
13
+ export declare function buildHttpsUrlForConnection(conn: Connection, path: string, opts?: {
14
+ encode?: boolean;
15
+ }): string;
2
16
  /**
3
17
  * Build an HTTPS URL for a tab's file.
4
18
  * Works for any viewer that needs an HTTP-accessible URL (COG, PMTiles, Zarr, etc.)
@@ -1,8 +1,38 @@
1
+ import { getNativeScheme, safeDecodeURIComponent } from '@walkthru-earth/objex-utils';
1
2
  import { presignHttpsUrl } from '../storage/presign.js';
2
3
  import { buildProviderBaseUrl, isPubliclyStreamable } from '../storage/providers.js';
3
4
  import { connections } from '../stores/connections.svelte.js';
4
5
  import { credentialStore } from '../stores/credentials.svelte.js';
5
- import { getNativeScheme, safeDecodeURIComponent } from './cloud-url.js';
6
+ /** Percent-encode each path segment, preserving the slashes between them. */
7
+ function encodeKeyPath(key) {
8
+ return key
9
+ .split('/')
10
+ .map((s) => encodeURIComponent(s))
11
+ .join('/');
12
+ }
13
+ /**
14
+ * Build an HTTPS URL for a file in a given connection. Provider-aware via
15
+ * `buildProviderBaseUrl` (AWS, GCS, R2, Wasabi, B2, DO, Storj, Contabo, Hetzner,
16
+ * Linode, OVH, MinIO), with the Azure container/blob + SAS special case. This is
17
+ * the single source of truth shared by `buildHttpsUrl` (tab-based) and the
18
+ * FileTreeSidebar "Copy HTTP URL" action, so neither can drift back to a
19
+ * hardcoded AWS fallback for non-AWS providers.
20
+ *
21
+ * @param opts.encode percent-encode each path segment (for copy-to-clipboard).
22
+ * Off by default to preserve the raw streaming-URL behavior viewers rely on.
23
+ */
24
+ export function buildHttpsUrlForConnection(conn, path, opts) {
25
+ const cleanPath = path.replace(/^\//, '');
26
+ const finalPath = opts?.encode ? encodeKeyPath(cleanPath) : cleanPath;
27
+ // Azure: <endpoint>/<container>/<blob>, append SAS if available
28
+ if (conn.provider === 'azure') {
29
+ const base = conn.endpoint
30
+ ? `${conn.endpoint.replace(/\/$/, '')}/${conn.bucket}/${finalPath}`
31
+ : `https://${conn.bucket}.blob.core.windows.net/${finalPath}`;
32
+ return appendAzureSas(base, conn.id);
33
+ }
34
+ return `${buildProviderBaseUrl(conn.provider, conn.endpoint, conn.bucket, conn.region)}/${finalPath}`;
35
+ }
6
36
  /**
7
37
  * Build an HTTPS URL for a tab's file.
8
38
  * Works for any viewer that needs an HTTP-accessible URL (COG, PMTiles, Zarr, etc.)
@@ -11,15 +41,7 @@ export function buildHttpsUrl(tab) {
11
41
  const conn = tab.connectionId ? connections.getById(tab.connectionId) : null;
12
42
  if (!conn)
13
43
  return tab.path;
14
- const cleanPath = tab.path.replace(/^\//, '');
15
- // Azure: <endpoint>/<container>/<blob>, append SAS if available
16
- if (conn.provider === 'azure') {
17
- const base = conn.endpoint
18
- ? `${conn.endpoint.replace(/\/$/, '')}/${conn.bucket}/${cleanPath}`
19
- : `https://${conn.bucket}.blob.core.windows.net/${cleanPath}`;
20
- return appendAzureSas(base, conn.id);
21
- }
22
- return `${buildProviderBaseUrl(conn.provider, conn.endpoint, conn.bucket, conn.region)}/${cleanPath}`;
44
+ return buildHttpsUrlForConnection(conn, tab.path);
23
45
  }
24
46
  /**
25
47
  * Async counterpart of `buildHttpsUrl`. For `signed-s3` connections, returns a
@@ -28,8 +28,40 @@ export declare function syncUrlParam(conn: Connection, prefix?: string): void;
28
28
  export declare function updateUrlView(view: string): void;
29
29
  /**
30
30
  * Read the current #hash view mode from the URL.
31
+ *
32
+ * The hash is parsed as `#<mode>?<viewParams>`, where `<mode>` is the viewer
33
+ * token (`map`, `stac-map`, `code`, `multicog`, ...) and `<viewParams>` is an
34
+ * optional URLSearchParams-shaped string used by viewers that want richer
35
+ * shareable state (e.g. MultiCogViewer encoding its chosen R/G/B asset keys).
36
+ * Returns just the mode string for backwards compatibility; per-viewer
37
+ * params are retrieved via `getUrlViewParams()`.
31
38
  */
32
39
  export declare function getUrlView(): string;
40
+ /**
41
+ * Pick a viewer's `viewMode` from the current URL hash, validated against the
42
+ * viewer's known token vocabulary. Centralises the "is this hash one of the
43
+ * modes I support?" decision so each viewer doesn't reimplement string-match
44
+ * ternary chains, and so we have one place to enforce the invariant: an
45
+ * explicit hash is honoured exactly, an unknown or empty hash falls back to
46
+ * `defaultMode` WITHOUT rewriting the URL. Viewers that mount transiently
47
+ * while another viewer farther up the stack is being chosen (e.g. CodeViewer
48
+ * during ViewerRouter's async STAC detection) MUST NOT clobber a hash they
49
+ * don't understand, because that hash is owned by the eventual viewer.
50
+ */
51
+ export declare function pickViewMode<T extends string>(validModes: readonly T[], defaultMode: T): T;
52
+ /**
53
+ * Read viewer-specific params from the URL hash query-string portion.
54
+ *
55
+ * Format: `#<mode>?k1=v1&k2=v2`. Returns a `URLSearchParams` so callers can
56
+ * `.get(key)` cleanly and merge their own state into it.
57
+ */
58
+ export declare function getUrlViewParams(): URLSearchParams;
59
+ /**
60
+ * Update the hash with both a mode and an optional set of viewer params.
61
+ * Empty / null `params` writes just `#<mode>`. Existing hash params are
62
+ * fully replaced — pass the merged set in.
63
+ */
64
+ export declare function updateUrlViewParams(view: string, params?: URLSearchParams | null): void;
33
65
  /**
34
66
  * Read the prefix (file/folder path) from the ?url= param.
35
67
  */
@@ -40,6 +72,10 @@ export declare function getUrlPrefix(): string;
40
72
  * auto-migration is in progress (see `+page.svelte` tab-sync effect).
41
73
  */
42
74
  export declare function hasUrlParam(): boolean;
75
+ /**
76
+ * Read the `?panel=` param (e.g. `?panel=settings`) to auto-open a panel on load.
77
+ */
78
+ export declare function getPanelParam(): string | null;
43
79
  /**
44
80
  * Clear all URL state params.
45
81
  */
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * Uses SvelteKit's replaceState to avoid conflicts with the router.
11
11
  */
12
+ import { parseStorageUrl } from '@walkthru-earth/objex-utils';
12
13
  import { replaceState } from '$app/navigation';
13
14
  import { buildProviderBaseUrl } from '../storage/providers.js';
14
- import { parseStorageUrl } from './storage-url.js';
15
15
  /**
16
16
  * Build the base HTTPS URL for a connection (endpoint + bucket).
17
17
  */
@@ -68,15 +68,74 @@ export function updateUrlView(view) {
68
68
  }
69
69
  /**
70
70
  * Read the current #hash view mode from the URL.
71
+ *
72
+ * The hash is parsed as `#<mode>?<viewParams>`, where `<mode>` is the viewer
73
+ * token (`map`, `stac-map`, `code`, `multicog`, ...) and `<viewParams>` is an
74
+ * optional URLSearchParams-shaped string used by viewers that want richer
75
+ * shareable state (e.g. MultiCogViewer encoding its chosen R/G/B asset keys).
76
+ * Returns just the mode string for backwards compatibility; per-viewer
77
+ * params are retrieved via `getUrlViewParams()`.
71
78
  */
72
79
  export function getUrlView() {
73
80
  try {
74
- return window.location.hash.replace('#', '');
81
+ const raw = window.location.hash.replace('#', '');
82
+ const q = raw.indexOf('?');
83
+ return q >= 0 ? raw.slice(0, q) : raw;
75
84
  }
76
85
  catch {
77
86
  return '';
78
87
  }
79
88
  }
89
+ /**
90
+ * Pick a viewer's `viewMode` from the current URL hash, validated against the
91
+ * viewer's known token vocabulary. Centralises the "is this hash one of the
92
+ * modes I support?" decision so each viewer doesn't reimplement string-match
93
+ * ternary chains, and so we have one place to enforce the invariant: an
94
+ * explicit hash is honoured exactly, an unknown or empty hash falls back to
95
+ * `defaultMode` WITHOUT rewriting the URL. Viewers that mount transiently
96
+ * while another viewer farther up the stack is being chosen (e.g. CodeViewer
97
+ * during ViewerRouter's async STAC detection) MUST NOT clobber a hash they
98
+ * don't understand, because that hash is owned by the eventual viewer.
99
+ */
100
+ export function pickViewMode(validModes, defaultMode) {
101
+ const view = getUrlView();
102
+ if (view && validModes.includes(view))
103
+ return view;
104
+ return defaultMode;
105
+ }
106
+ /**
107
+ * Read viewer-specific params from the URL hash query-string portion.
108
+ *
109
+ * Format: `#<mode>?k1=v1&k2=v2`. Returns a `URLSearchParams` so callers can
110
+ * `.get(key)` cleanly and merge their own state into it.
111
+ */
112
+ export function getUrlViewParams() {
113
+ try {
114
+ const raw = window.location.hash.replace('#', '');
115
+ const q = raw.indexOf('?');
116
+ if (q < 0)
117
+ return new URLSearchParams();
118
+ return new URLSearchParams(raw.slice(q + 1));
119
+ }
120
+ catch {
121
+ return new URLSearchParams();
122
+ }
123
+ }
124
+ /**
125
+ * Update the hash with both a mode and an optional set of viewer params.
126
+ * Empty / null `params` writes just `#<mode>`. Existing hash params are
127
+ * fully replaced — pass the merged set in.
128
+ */
129
+ export function updateUrlViewParams(view, params) {
130
+ const qs = params?.toString();
131
+ writeLocation((url) => {
132
+ if (!view) {
133
+ url.hash = '';
134
+ return;
135
+ }
136
+ url.hash = qs ? `${view}?${qs}` : view;
137
+ });
138
+ }
80
139
  /**
81
140
  * Read the prefix (file/folder path) from the ?url= param.
82
141
  */
@@ -105,6 +164,17 @@ export function hasUrlParam() {
105
164
  return false;
106
165
  }
107
166
  }
167
+ /**
168
+ * Read the `?panel=` param (e.g. `?panel=settings`) to auto-open a panel on load.
169
+ */
170
+ export function getPanelParam() {
171
+ try {
172
+ return new URL(window.location.href).searchParams.get('panel');
173
+ }
174
+ catch {
175
+ return null;
176
+ }
177
+ }
108
178
  /**
109
179
  * Clear all URL state params.
110
180
  */
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Zarr tab-opening helper.
3
- * Centralizes Zarr store tab creation to avoid duplicating the same logic
4
- * across FileBrowser, FileRow, FileTreeSidebar, and +page.svelte.
3
+ * Centralizes Zarr store tab creation across FileTreeSidebar and +page.svelte.
5
4
  *
6
5
  * Kept separate from zarr.ts to avoid adding a store dependency to a pure utility.
7
6
  */
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Zarr tab-opening helper.
3
- * Centralizes Zarr store tab creation to avoid duplicating the same logic
4
- * across FileBrowser, FileRow, FileTreeSidebar, and +page.svelte.
3
+ * Centralizes Zarr store tab creation across FileTreeSidebar and +page.svelte.
5
4
  *
6
5
  * Kept separate from zarr.ts to avoid adding a store dependency to a pure utility.
7
6
  */
@@ -61,23 +61,6 @@ export interface GeoZarrInfo {
61
61
  * caller to the `@carbonplan/zarr-layer` fallback.
62
62
  */
63
63
  export declare function detectGeoZarr(hierarchy: ZarrHierarchy): GeoZarrInfo | null;
64
- /**
65
- * Convert a decoded GeoZarr tile (band-planar or packed RGB) into RGBA
66
- * `ImageData` for deck.gl-zarr's `renderTile` callback. Input is expected to
67
- * be a Uint8 or Uint16 typed array with either 3 interleaved bytes per pixel
68
- * or 3 planar bands of width*height values.
69
- *
70
- * For 16-bit data the caller supplies the rescale range so the CPU
71
- * normalization matches what the GPU `LinearRescale` module would produce.
72
- */
73
- export declare function zarrTileToImageData(raw: ArrayLike<number> & {
74
- length: number;
75
- }, width: number, height: number, opts?: {
76
- layout?: 'packed' | 'planar';
77
- bands?: 1 | 3;
78
- rescaleMin?: number;
79
- rescaleMax?: number;
80
- }): ImageData;
81
64
  /** Dimension-like variable names treated as coordinates. */
82
65
  export declare const DIM_LIKE_NAMES: Set<string>;
83
66
  /** Guess dimension names from shape length when metadata is absent. */
@@ -4,7 +4,7 @@
4
4
  * Builds a hierarchical tree of groups and arrays from consolidated metadata
5
5
  * (Zarr v2 .zmetadata, v3 zarr.json), with zarrita fallback for non-consolidated stores.
6
6
  */
7
- import { formatFileSize } from './format.js';
7
+ import { formatFileSize } from '@walkthru-earth/objex-utils';
8
8
  // ---------------------------------------------------------------------------
9
9
  // Register numcodecs-wrapped codecs with zarrita's codec registry.
10
10
  // Zarr v3 stores produced by Python's zarr-python may wrap codecs with the
@@ -163,50 +163,6 @@ function isGeoZarrAttrs(attrs) {
163
163
  Boolean(attrs.crs_wkt);
164
164
  return hasMultiscales && hasSpatial && hasCrs;
165
165
  }
166
- /**
167
- * Convert a decoded GeoZarr tile (band-planar or packed RGB) into RGBA
168
- * `ImageData` for deck.gl-zarr's `renderTile` callback. Input is expected to
169
- * be a Uint8 or Uint16 typed array with either 3 interleaved bytes per pixel
170
- * or 3 planar bands of width*height values.
171
- *
172
- * For 16-bit data the caller supplies the rescale range so the CPU
173
- * normalization matches what the GPU `LinearRescale` module would produce.
174
- */
175
- export function zarrTileToImageData(raw, width, height, opts = {}) {
176
- const bands = opts.bands ?? 3;
177
- const layout = opts.layout ?? 'packed';
178
- const min = opts.rescaleMin ?? 0;
179
- const max = opts.rescaleMax ?? 255;
180
- const range = max - min || 1;
181
- const pixelCount = width * height;
182
- const rgba = new Uint8ClampedArray(pixelCount * 4);
183
- for (let i = 0; i < pixelCount; i++) {
184
- let r = 0;
185
- let g = 0;
186
- let b = 0;
187
- if (bands === 1) {
188
- const v = Number(raw[i]);
189
- r = g = b = (v - min) / range;
190
- }
191
- else if (layout === 'planar') {
192
- r = (Number(raw[i]) - min) / range;
193
- g = (Number(raw[pixelCount + i]) - min) / range;
194
- b = (Number(raw[2 * pixelCount + i]) - min) / range;
195
- }
196
- else {
197
- const base = i * 3;
198
- r = (Number(raw[base]) - min) / range;
199
- g = (Number(raw[base + 1]) - min) / range;
200
- b = (Number(raw[base + 2]) - min) / range;
201
- }
202
- const idx = i * 4;
203
- rgba[idx] = Math.round(Math.max(0, Math.min(1, r)) * 255);
204
- rgba[idx + 1] = Math.round(Math.max(0, Math.min(1, g)) * 255);
205
- rgba[idx + 2] = Math.round(Math.max(0, Math.min(1, b)) * 255);
206
- rgba[idx + 3] = 255;
207
- }
208
- return new ImageData(rgba, width, height);
209
- }
210
166
  // ---------------------------------------------------------------------------
211
167
  // Kept helpers
212
168
  // ---------------------------------------------------------------------------