@walkthru-earth/objex 1.3.1 → 1.5.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.
- package/LICENSE +5 -0
- package/README.md +28 -20
- package/dist/components/browser/FileTreeSidebar.svelte +32 -17
- package/dist/components/layout/AboutSheet.svelte +5 -2
- package/dist/components/layout/ConnectionDialog.svelte +7 -2
- package/dist/components/layout/SettingsSheet.svelte +238 -0
- package/dist/components/layout/SettingsSheet.svelte.d.ts +6 -0
- package/dist/components/layout/Sidebar.svelte +73 -6
- package/dist/components/layout/Sidebar.svelte.d.ts +4 -1
- package/dist/components/layout/StatusBar.svelte +17 -14
- package/dist/components/layout/TabBar.svelte +4 -4
- package/dist/components/ui/context-menu/context-menu-radio-group.svelte.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +1 -1
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/resizable/index.d.ts +1 -1
- package/dist/components/ui/resizable/index.js +2 -2
- package/dist/components/ui/slider/index.d.ts +3 -0
- package/dist/components/ui/slider/index.js +5 -0
- package/dist/components/ui/slider/range-slider.svelte +94 -0
- package/dist/components/ui/slider/range-slider.svelte.d.ts +21 -0
- package/dist/components/ui/slider/slider.svelte +83 -0
- package/dist/components/ui/slider/slider.svelte.d.ts +7 -0
- package/dist/components/viewers/ArchiveViewer.svelte +140 -113
- package/dist/components/viewers/CodeViewer.svelte +45 -48
- package/dist/components/viewers/CodeViewer.svelte.d.ts +1 -1
- package/dist/components/viewers/CogControls.svelte +338 -184
- package/dist/components/viewers/CogControls.svelte.d.ts +33 -10
- package/dist/components/viewers/CogViewer.svelte +269 -116
- package/dist/components/viewers/CopcViewer.svelte +8 -15
- package/dist/components/viewers/DatabaseViewer.svelte +22 -21
- package/dist/components/viewers/FileInfo.svelte +16 -16
- package/dist/components/viewers/FlatGeobufViewer.svelte +16 -46
- package/dist/components/viewers/GeoParquetMapViewer.svelte +11 -9
- package/dist/components/viewers/GeoParquetMapViewer.svelte.d.ts +1 -1
- package/dist/components/viewers/ImageViewer.svelte +12 -14
- package/dist/components/viewers/LoadProgress.svelte +6 -6
- package/dist/components/viewers/MarkdownViewer.svelte +29 -30
- package/dist/components/viewers/MediaViewer.svelte +13 -14
- package/dist/components/viewers/ModelViewer.svelte +18 -21
- package/dist/components/viewers/MultiCogViewer.svelte +474 -106
- package/dist/components/viewers/MultiCogViewer.svelte.d.ts +1 -1
- package/dist/components/viewers/NotebookViewer.svelte +28 -29
- package/dist/components/viewers/PdfViewer.svelte +24 -33
- package/dist/components/viewers/PmtilesViewer.svelte +13 -15
- package/dist/components/viewers/QueryHistoryPanel.svelte +18 -18
- package/dist/components/viewers/RawViewer.svelte +27 -21
- package/dist/components/viewers/StacMapViewer.svelte +6 -13
- package/dist/components/viewers/StacMosaicViewer.svelte +1764 -410
- package/dist/components/viewers/StacMosaicViewer.svelte.d.ts +1 -1
- package/dist/components/viewers/StacTabViewer.svelte +26 -15
- package/dist/components/viewers/StacTabViewer.svelte.d.ts +1 -1
- package/dist/components/viewers/TableGrid.svelte +38 -34
- package/dist/components/viewers/TableStatusBar.svelte +7 -7
- package/dist/components/viewers/TableToolbar.svelte +10 -9
- package/dist/components/viewers/TableViewer.svelte +47 -30
- package/dist/components/viewers/TableViewer.svelte.d.ts +1 -0
- package/dist/components/viewers/ViewerHeader.svelte +18 -0
- package/dist/components/viewers/ViewerHeader.svelte.d.ts +10 -0
- package/dist/components/viewers/ViewerRouter.svelte +16 -8
- package/dist/components/viewers/ViewerStatus.svelte +19 -0
- package/dist/components/viewers/ViewerStatus.svelte.d.ts +7 -0
- package/dist/components/viewers/ZarrMapViewer.svelte +24 -21
- package/dist/components/viewers/ZarrViewer.svelte +98 -65
- package/dist/components/viewers/cog/ChannelPicker.svelte +83 -0
- package/dist/components/viewers/cog/ChannelPicker.svelte.d.ts +13 -0
- package/dist/components/viewers/cog/PixelInspectorPanel.svelte +87 -0
- package/dist/components/viewers/cog/PixelInspectorPanel.svelte.d.ts +17 -0
- package/dist/components/viewers/cog/buildRgbLayer.d.ts +78 -0
- package/dist/components/viewers/cog/buildRgbLayer.js +176 -0
- package/dist/components/viewers/map/AttributeTable.svelte +7 -7
- package/dist/components/viewers/map/MapContainer.svelte +38 -12
- package/dist/components/viewers/pmtiles/PmtilesArchiveView.svelte +109 -83
- package/dist/components/viewers/pmtiles/PmtilesTileInspector.svelte +16 -16
- package/dist/components/viewers/stac/StacDatetimeBar.svelte +175 -0
- package/dist/components/viewers/stac/StacDatetimeBar.svelte.d.ts +10 -0
- package/dist/components/viewers/stac/StacFilterPanel.svelte +243 -0
- package/dist/components/viewers/stac/StacFilterPanel.svelte.d.ts +14 -0
- package/dist/components/viewers/stac/StacItemInspector.svelte +223 -0
- package/dist/components/viewers/stac/StacItemInspector.svelte.d.ts +10 -0
- package/dist/components/viewers/stac/StacItemStrip.svelte +228 -0
- package/dist/components/viewers/stac/StacItemStrip.svelte.d.ts +12 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +8 -0
- package/dist/file-icons/index.d.ts +1 -1
- package/dist/file-icons/index.js +1 -1
- package/dist/i18n/ar.js +113 -2
- package/dist/i18n/en.js +113 -2
- package/dist/index.d.ts +2 -28
- package/dist/index.js +7 -23
- package/dist/query/engine.d.ts +10 -0
- package/dist/query/source.js +1 -1
- package/dist/query/stac-source-factory.d.ts +65 -0
- package/dist/query/stac-source-factory.js +77 -0
- package/dist/query/stac-source-parquet.d.ts +135 -0
- package/dist/query/stac-source-parquet.js +468 -0
- package/dist/query/wasm.d.ts +8 -0
- package/dist/query/wasm.js +310 -65
- package/dist/storage/presign.js +3 -2
- package/dist/storage/providers.js +7 -6
- package/dist/stores/config.svelte.d.ts +15 -0
- package/dist/stores/config.svelte.js +46 -0
- package/dist/stores/connections.svelte.d.ts +2 -2
- package/dist/stores/connections.svelte.js +1 -2
- package/dist/stores/files.svelte.d.ts +1 -1
- package/dist/stores/files.svelte.js +1 -1
- package/dist/stores/query-history.svelte.js +1 -1
- package/dist/stores/settings.svelte.d.ts +16 -1
- package/dist/stores/settings.svelte.js +104 -48
- package/dist/stores/tabs.svelte.d.ts +3 -0
- package/dist/stores/tabs.svelte.js +17 -0
- package/dist/utils/cog-histogram.d.ts +121 -0
- package/dist/utils/cog-histogram.js +424 -0
- package/dist/utils/cog.d.ts +177 -20
- package/dist/utils/cog.js +361 -76
- package/dist/utils/colormap-sprite.d.ts +0 -9
- package/dist/utils/colormap-sprite.js +0 -21
- package/dist/utils/deck.d.ts +18 -12
- package/dist/utils/deck.js +15 -7
- package/dist/utils/media-query.svelte.d.ts +14 -0
- package/dist/utils/media-query.svelte.js +29 -0
- package/dist/utils/pmtiles-tile.js +2 -2
- package/dist/utils/signed-url-effect.d.ts +7 -0
- package/dist/utils/signed-url-effect.js +19 -0
- package/dist/utils/{url.d.ts → signed-url.d.ts} +15 -1
- package/dist/utils/{url.js → signed-url.js} +32 -10
- package/dist/utils/url-state.d.ts +36 -0
- package/dist/utils/url-state.js +72 -2
- package/dist/utils/zarr-tab.d.ts +1 -2
- package/dist/utils/zarr-tab.js +1 -2
- package/dist/utils/zarr.d.ts +0 -17
- package/dist/utils/zarr.js +1 -45
- package/package.json +55 -84
- package/dist/components/browser/Breadcrumb.svelte +0 -50
- package/dist/components/browser/Breadcrumb.svelte.d.ts +0 -7
- package/dist/components/browser/CreateFolderDialog.svelte +0 -98
- package/dist/components/browser/CreateFolderDialog.svelte.d.ts +0 -6
- package/dist/components/browser/DeleteConfirmDialog.svelte +0 -90
- package/dist/components/browser/DeleteConfirmDialog.svelte.d.ts +0 -8
- package/dist/components/browser/DropZone.svelte +0 -83
- package/dist/components/browser/DropZone.svelte.d.ts +0 -7
- package/dist/components/browser/FileBrowser.svelte +0 -252
- package/dist/components/browser/FileBrowser.svelte.d.ts +0 -3
- package/dist/components/browser/FileRow.svelte +0 -117
- package/dist/components/browser/FileRow.svelte.d.ts +0 -9
- package/dist/components/browser/RenameDialog.svelte +0 -101
- package/dist/components/browser/RenameDialog.svelte.d.ts +0 -8
- package/dist/components/browser/SearchBar.svelte +0 -40
- package/dist/components/browser/SearchBar.svelte.d.ts +0 -6
- package/dist/components/browser/UploadButton.svelte +0 -65
- package/dist/components/browser/UploadButton.svelte.d.ts +0 -3
- package/dist/query/stac-geoparquet.d.ts +0 -31
- package/dist/query/stac-geoparquet.js +0 -136
- package/dist/utils/clipboard.d.ts +0 -13
- package/dist/utils/clipboard.js +0 -38
- package/dist/utils/cloud-url.d.ts +0 -27
- package/dist/utils/cloud-url.js +0 -61
- package/dist/utils/cog-pure.d.ts +0 -25
- package/dist/utils/cog-pure.js +0 -35
- package/dist/utils/column-types.d.ts +0 -5
- package/dist/utils/column-types.js +0 -137
- package/dist/utils/connection-identity.d.ts +0 -51
- package/dist/utils/connection-identity.js +0 -97
- package/dist/utils/error.d.ts +0 -8
- package/dist/utils/error.js +0 -12
- package/dist/utils/evidence-context.d.ts +0 -22
- package/dist/utils/evidence-context.js +0 -56
- package/dist/utils/export.d.ts +0 -22
- package/dist/utils/export.js +0 -76
- package/dist/utils/file-sort.d.ts +0 -20
- package/dist/utils/file-sort.js +0 -41
- package/dist/utils/format.d.ts +0 -24
- package/dist/utils/format.js +0 -78
- package/dist/utils/geoarrow.d.ts +0 -32
- package/dist/utils/geoarrow.js +0 -672
- package/dist/utils/geometry-type.d.ts +0 -52
- package/dist/utils/geometry-type.js +0 -76
- package/dist/utils/hex.d.ts +0 -10
- package/dist/utils/hex.js +0 -27
- package/dist/utils/host-detection.d.ts +0 -23
- package/dist/utils/host-detection.js +0 -95
- package/dist/utils/local-storage.d.ts +0 -16
- package/dist/utils/local-storage.js +0 -37
- package/dist/utils/markdown-sql.d.ts +0 -30
- package/dist/utils/markdown-sql.js +0 -72
- package/dist/utils/notebook.d.ts +0 -59
- package/dist/utils/notebook.js +0 -211
- package/dist/utils/parquet-metadata.d.ts +0 -64
- package/dist/utils/parquet-metadata.js +0 -262
- package/dist/utils/stac-geoparquet.d.ts +0 -90
- package/dist/utils/stac-geoparquet.js +0 -223
- package/dist/utils/stac-hydrate.d.ts +0 -38
- package/dist/utils/stac-hydrate.js +0 -243
- package/dist/utils/stac.d.ts +0 -136
- package/dist/utils/stac.js +0 -176
- package/dist/utils/storage-url.d.ts +0 -90
- package/dist/utils/storage-url.js +0 -568
- package/dist/utils/wkb.d.ts +0 -43
- package/dist/utils/wkb.js +0 -359
package/dist/utils/deck.d.ts
CHANGED
|
@@ -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 '
|
|
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,
|
|
@@ -17,6 +17,8 @@ export declare function hoverCursor(map: {
|
|
|
17
17
|
picked?: boolean;
|
|
18
18
|
}) => void;
|
|
19
19
|
type RGBA = [number, number, number, number];
|
|
20
|
+
/** RGBA used to highlight a hovered/selected feature across map viewers. */
|
|
21
|
+
export declare const HIGHLIGHT_COLOR: [number, number, number, number];
|
|
20
22
|
/** Distinct fill/line colors per geometry type. */
|
|
21
23
|
export declare const GEOMETRY_COLORS: Record<string, {
|
|
22
24
|
fill: RGBA;
|
|
@@ -35,17 +37,21 @@ export declare function loadDeckModules(): Promise<{
|
|
|
35
37
|
}>;
|
|
36
38
|
/** Lazy-load GeoArrow deck.gl layers + MapboxOverlay + GeoJsonLayer (for selection). */
|
|
37
39
|
export declare function loadGeoArrowModules(): Promise<{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
GeoArrowA5Layer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowA5Layer;
|
|
41
|
+
GeoArrowArcLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowArcLayer;
|
|
42
|
+
GeoArrowColumnLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowColumnLayer;
|
|
43
|
+
GeoArrowGeohashLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowGeohashLayer;
|
|
44
|
+
GeoArrowH3HexagonLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowH3HexagonLayer;
|
|
45
|
+
GeoArrowHeatmapLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowHeatmapLayer;
|
|
46
|
+
GeoArrowPathLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowPathLayer;
|
|
47
|
+
GeoArrowPointCloudLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowPointCloudLayer;
|
|
48
|
+
GeoArrowPolygonLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowPolygonLayer;
|
|
49
|
+
GeoArrowS2Layer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowS2Layer;
|
|
50
|
+
GeoArrowScatterplotLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowScatterplotLayer;
|
|
51
|
+
GeoArrowSolidPolygonLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowSolidPolygonLayer;
|
|
52
|
+
initEarcutPool: typeof import("@geoarrow/deck.gl-geoarrow").initEarcutPool;
|
|
53
|
+
_GeoArrowTextLayer: typeof import("@geoarrow/deck.gl-geoarrow")._GeoArrowTextLayer;
|
|
54
|
+
GeoArrowTripsLayer: typeof import("@geoarrow/deck.gl-geoarrow").GeoArrowTripsLayer;
|
|
49
55
|
MapboxOverlay: typeof import("@deck.gl/mapbox").MapboxOverlay;
|
|
50
56
|
GeoJsonLayer: typeof import("@deck.gl/layers").GeoJsonLayer;
|
|
51
57
|
}>;
|
package/dist/utils/deck.js
CHANGED
|
@@ -16,6 +16,8 @@ export function hoverCursor(map) {
|
|
|
16
16
|
map.getCanvas().style.cursor = info.picked ? 'pointer' : '';
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
/** RGBA used to highlight a hovered/selected feature across map viewers. */
|
|
20
|
+
export const HIGHLIGHT_COLOR = [255, 255, 255, 100];
|
|
19
21
|
/** Distinct fill/line colors per geometry type. */
|
|
20
22
|
export const GEOMETRY_COLORS = {
|
|
21
23
|
point: { fill: [66, 133, 244, 180], line: [25, 103, 210, 220] },
|
|
@@ -51,7 +53,7 @@ export async function loadDeckModules() {
|
|
|
51
53
|
export async function loadGeoArrowModules() {
|
|
52
54
|
const [{ MapboxOverlay }, geoarrowLayers, { GeoJsonLayer }] = await Promise.all([
|
|
53
55
|
import('@deck.gl/mapbox'),
|
|
54
|
-
import('@geoarrow/deck.gl-
|
|
56
|
+
import('@geoarrow/deck.gl-geoarrow'),
|
|
55
57
|
import('@deck.gl/layers')
|
|
56
58
|
]);
|
|
57
59
|
return { MapboxOverlay, GeoJsonLayer, ...geoarrowLayers };
|
|
@@ -60,6 +62,12 @@ export async function loadGeoArrowModules() {
|
|
|
60
62
|
function createLayerForResult(modules, result, layerId, onClick, onHover) {
|
|
61
63
|
const { GeoArrowScatterplotLayer, GeoArrowPathLayer, GeoArrowPolygonLayer } = modules;
|
|
62
64
|
const { table, geometryType, sourceIndices } = result;
|
|
65
|
+
// @geoarrow/deck.gl-geoarrow 0.4+ takes a single Arrow RecordBatch as `data`,
|
|
66
|
+
// not a Table. buildSingleTable() always assembles one batch per table, so the
|
|
67
|
+
// row index stays 0..N-1 and the sourceIndices click mapping is unaffected.
|
|
68
|
+
const batch = table.batches[0];
|
|
69
|
+
if (!batch)
|
|
70
|
+
return null;
|
|
63
71
|
const { fill, line } = colorsForType(geometryType);
|
|
64
72
|
const handleClick = (info) => {
|
|
65
73
|
if (!onClick)
|
|
@@ -71,7 +79,7 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
|
|
|
71
79
|
if (geometryType === 'point' || geometryType === 'multipoint') {
|
|
72
80
|
return new GeoArrowScatterplotLayer({
|
|
73
81
|
id: layerId,
|
|
74
|
-
data:
|
|
82
|
+
data: batch,
|
|
75
83
|
getFillColor: fill,
|
|
76
84
|
getRadius: 6,
|
|
77
85
|
radiusUnits: 'pixels',
|
|
@@ -79,7 +87,7 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
|
|
|
79
87
|
radiusMaxPixels: 12,
|
|
80
88
|
pickable: true,
|
|
81
89
|
autoHighlight: true,
|
|
82
|
-
highlightColor:
|
|
90
|
+
highlightColor: HIGHLIGHT_COLOR,
|
|
83
91
|
_validate: false,
|
|
84
92
|
onHover,
|
|
85
93
|
onClick: handleClick
|
|
@@ -88,14 +96,14 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
|
|
|
88
96
|
else if (geometryType === 'linestring' || geometryType === 'multilinestring') {
|
|
89
97
|
return new GeoArrowPathLayer({
|
|
90
98
|
id: layerId,
|
|
91
|
-
data:
|
|
99
|
+
data: batch,
|
|
92
100
|
getColor: line,
|
|
93
101
|
getWidth: 2.5,
|
|
94
102
|
widthUnits: 'pixels',
|
|
95
103
|
widthMinPixels: 1.5,
|
|
96
104
|
pickable: true,
|
|
97
105
|
autoHighlight: true,
|
|
98
|
-
highlightColor:
|
|
106
|
+
highlightColor: HIGHLIGHT_COLOR,
|
|
99
107
|
_validate: false,
|
|
100
108
|
onHover,
|
|
101
109
|
onClick: handleClick
|
|
@@ -104,14 +112,14 @@ function createLayerForResult(modules, result, layerId, onClick, onHover) {
|
|
|
104
112
|
else {
|
|
105
113
|
return new GeoArrowPolygonLayer({
|
|
106
114
|
id: layerId,
|
|
107
|
-
data:
|
|
115
|
+
data: batch,
|
|
108
116
|
getFillColor: fill,
|
|
109
117
|
getLineColor: line,
|
|
110
118
|
getLineWidth: 2,
|
|
111
119
|
lineWidthMinPixels: 1.5,
|
|
112
120
|
pickable: true,
|
|
113
121
|
autoHighlight: true,
|
|
114
|
-
highlightColor:
|
|
122
|
+
highlightColor: HIGHLIGHT_COLOR,
|
|
115
123
|
_validate: false,
|
|
116
124
|
onHover,
|
|
117
125
|
onClick: handleClick
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive media-query helpers for Svelte 5 runes.
|
|
3
|
+
*
|
|
4
|
+
* Usage (inside a component .svelte file):
|
|
5
|
+
* import { useIsWide } from '../utils/media-query.svelte.js';
|
|
6
|
+
* const isWide = useIsWide(); // true when viewport >= 640 px (Tailwind sm)
|
|
7
|
+
* // then: {#if isWide.value} ... {/if}
|
|
8
|
+
*
|
|
9
|
+
* SSR-safe: guards with `typeof window` (this is a CSR-only SPA, but be defensive).
|
|
10
|
+
*/
|
|
11
|
+
/** Reactive wrapper around a single MediaQueryList. */
|
|
12
|
+
export declare function useIsWide(): {
|
|
13
|
+
readonly value: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive media-query helpers for Svelte 5 runes.
|
|
3
|
+
*
|
|
4
|
+
* Usage (inside a component .svelte file):
|
|
5
|
+
* import { useIsWide } from '../utils/media-query.svelte.js';
|
|
6
|
+
* const isWide = useIsWide(); // true when viewport >= 640 px (Tailwind sm)
|
|
7
|
+
* // then: {#if isWide.value} ... {/if}
|
|
8
|
+
*
|
|
9
|
+
* SSR-safe: guards with `typeof window` (this is a CSR-only SPA, but be defensive).
|
|
10
|
+
*/
|
|
11
|
+
/** Reactive wrapper around a single MediaQueryList. */
|
|
12
|
+
export function useIsWide() {
|
|
13
|
+
let value = $state(typeof window !== 'undefined' ? window.matchMedia('(min-width: 640px)').matches : true);
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
const mq = window.matchMedia('(min-width: 640px)');
|
|
16
|
+
const handler = (e) => {
|
|
17
|
+
value = e.matches;
|
|
18
|
+
};
|
|
19
|
+
$effect(() => {
|
|
20
|
+
mq.addEventListener('change', handler);
|
|
21
|
+
return () => mq.removeEventListener('change', handler);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
get value() {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -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 }, {
|
|
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
|
|
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 = [];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Tab } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a tab's signed HTTPS URL reactively for iframe-style viewers.
|
|
4
|
+
* Call inside a component's $effect; returns a cleanup function.
|
|
5
|
+
* onResolved runs only if the tab is still current (guards the async race).
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveSignedTabUrl(tab: Tab, onResolved: (url: string) => void): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { buildHttpsUrlAsync } from './signed-url.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a tab's signed HTTPS URL reactively for iframe-style viewers.
|
|
4
|
+
* Call inside a component's $effect; returns a cleanup function.
|
|
5
|
+
* onResolved runs only if the tab is still current (guards the async race).
|
|
6
|
+
*/
|
|
7
|
+
export function resolveSignedTabUrl(tab, onResolved) {
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
const id = tab.id;
|
|
10
|
+
(async () => {
|
|
11
|
+
const url = await buildHttpsUrlAsync(tab);
|
|
12
|
+
if (cancelled || id !== tab.id)
|
|
13
|
+
return;
|
|
14
|
+
onResolved(url);
|
|
15
|
+
})();
|
|
16
|
+
return () => {
|
|
17
|
+
cancelled = true;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
*/
|
package/dist/utils/url-state.js
CHANGED
|
@@ -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
|
-
|
|
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
|
*/
|
package/dist/utils/zarr-tab.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zarr tab-opening helper.
|
|
3
|
-
* Centralizes Zarr store tab creation
|
|
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
|
*/
|
package/dist/utils/zarr-tab.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zarr tab-opening helper.
|
|
3
|
-
* Centralizes Zarr store tab creation
|
|
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
|
*/
|
package/dist/utils/zarr.d.ts
CHANGED
|
@@ -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. */
|
package/dist/utils/zarr.js
CHANGED
|
@@ -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 '
|
|
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
|
// ---------------------------------------------------------------------------
|