@walkthru-earth/objex 0.1.0 → 1.0.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/README.md +1 -1
- package/dist/components/browser/FileBrowser.svelte +37 -1
- package/dist/components/browser/FileRow.svelte +8 -3
- package/dist/components/browser/FileTreeSidebar.svelte +1 -3
- package/dist/components/layout/AboutSheet.svelte +126 -0
- package/dist/components/layout/AboutSheet.svelte.d.ts +6 -0
- package/dist/components/layout/ConnectionDialog.svelte +186 -138
- package/dist/components/layout/ConnectionDialog.svelte.d.ts +1 -0
- package/dist/components/layout/Sidebar.svelte +19 -3
- package/dist/components/layout/TabBar.svelte +4 -7
- package/dist/components/viewers/CodeViewer.svelte +17 -9
- package/dist/components/viewers/ImageViewer.svelte +6 -16
- package/dist/components/viewers/MarkdownViewer.svelte +8 -16
- package/dist/components/viewers/MediaViewer.svelte +6 -17
- package/dist/components/viewers/ModelViewer.svelte +4 -2
- package/dist/components/viewers/NotebookViewer.svelte +90 -40
- package/dist/components/viewers/PdfViewer.svelte +5 -3
- package/dist/components/viewers/RawViewer.svelte +4 -2
- package/dist/components/viewers/TableGrid.svelte +3 -2
- package/dist/components/viewers/ZarrMapViewer.svelte +334 -40
- package/dist/components/viewers/ZarrMapViewer.svelte.d.ts +3 -8
- package/dist/components/viewers/ZarrViewer.svelte +459 -178
- package/dist/components/viewers/map/AttributeTable.svelte +1 -6
- package/dist/components/viewers/pmtiles/PmtilesArchiveView.svelte +2 -6
- package/dist/components/viewers/pmtiles/PmtilesTileInspector.svelte +96 -22
- package/dist/constants.d.ts +28 -0
- package/dist/constants.js +34 -0
- package/dist/file-icons/index.js +6 -0
- package/dist/i18n/ar.js +34 -0
- package/dist/i18n/en.js +34 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -1
- package/dist/query/wasm.js +5 -4
- package/dist/storage/browser-cloud.d.ts +7 -0
- package/dist/storage/browser-cloud.js +74 -7
- package/dist/storage/providers.d.ts +53 -0
- package/dist/storage/providers.js +318 -0
- package/dist/stores/connections.svelte.js +5 -5
- package/dist/stores/query-history.svelte.js +4 -5
- package/dist/stores/settings.svelte.js +4 -4
- package/dist/types.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +13 -0
- package/dist/utils/clipboard.js +38 -0
- package/dist/utils/error.d.ts +8 -0
- package/dist/utils/error.js +12 -0
- package/dist/utils/format.d.ts +10 -0
- package/dist/utils/format.js +22 -0
- package/dist/utils/host-detection.js +78 -18
- package/dist/utils/notebook.d.ts +59 -0
- package/dist/utils/notebook.js +211 -0
- package/dist/utils/parquet-metadata.js +1 -1
- package/dist/utils/pmtiles-tile.js +2 -1
- package/dist/utils/pmtiles.js +2 -1
- package/dist/utils/storage-url.d.ts +1 -1
- package/dist/utils/storage-url.js +82 -24
- package/dist/utils/url-state.js +2 -7
- package/dist/utils/url.d.ts +15 -1
- package/dist/utils/url.js +45 -19
- package/dist/utils/zarr.d.ts +60 -20
- package/dist/utils/zarr.js +450 -103
- package/package.json +64 -52
- package/dist/assets/favicon.svg +0 -17
- package/dist/components/CLAUDE.md +0 -44
- package/dist/components/viewers/CLAUDE.md +0 -60
- package/dist/file-icons/CLAUDE.md +0 -21
- package/dist/i18n/CLAUDE.md +0 -19
- package/dist/query/CLAUDE.md +0 -22
- package/dist/storage/CLAUDE.md +0 -23
- package/dist/stores/CLAUDE.md +0 -29
- package/dist/types/notebookjs.d.ts +0 -14
- package/dist/utils/CLAUDE.md +0 -54
- package/dist/utils/analytics.d.ts +0 -10
- package/dist/utils/analytics.js +0 -38
package/dist/utils/url.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildProviderBaseUrl, PROVIDERS } from '../storage/providers.js';
|
|
1
2
|
import { connections } from '../stores/connections.svelte.js';
|
|
2
3
|
import { credentialStore } from '../stores/credentials.svelte.js';
|
|
3
4
|
/**
|
|
@@ -16,27 +17,18 @@ export function buildHttpsUrl(tab) {
|
|
|
16
17
|
: `https://${conn.bucket}.blob.core.windows.net/${cleanPath}`;
|
|
17
18
|
return appendAzureSas(base, conn.id);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
return `${conn.endpoint.replace(/\/$/, '')}/${conn.bucket}/${cleanPath}`;
|
|
21
|
-
}
|
|
22
|
-
return `https://s3.${conn.region || 'us-east-1'}.amazonaws.com/${conn.bucket}/${cleanPath}`;
|
|
20
|
+
return `${buildProviderBaseUrl(conn.provider, conn.endpoint, conn.bucket, conn.region)}/${cleanPath}`;
|
|
23
21
|
}
|
|
24
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Map provider to its native URI scheme prefix.
|
|
24
|
+
* Derived from the registry's `schemes` array (first entry is the primary scheme).
|
|
25
|
+
* Falls back to 's3' for providers without a scheme (S3-compatible).
|
|
26
|
+
*/
|
|
25
27
|
export function getNativeScheme(provider) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return 'az';
|
|
31
|
-
case 'r2':
|
|
32
|
-
return 'r2';
|
|
33
|
-
case 'storj':
|
|
34
|
-
return 'sj';
|
|
35
|
-
case 'minio':
|
|
36
|
-
return 's3';
|
|
37
|
-
default:
|
|
38
|
-
return 's3';
|
|
39
|
-
}
|
|
28
|
+
const def = PROVIDERS[provider];
|
|
29
|
+
if (def?.schemes.length)
|
|
30
|
+
return def.schemes[0];
|
|
31
|
+
return 's3';
|
|
40
32
|
}
|
|
41
33
|
/**
|
|
42
34
|
* Build a provider-native protocol URL (s3://bucket/path, sj://bucket/path, etc.).
|
|
@@ -113,3 +105,37 @@ function appendAzureSas(url, connectionId) {
|
|
|
113
105
|
const sep = url.includes('?') ? '&' : '?';
|
|
114
106
|
return `${url}${sep}${cleanToken}`;
|
|
115
107
|
}
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Cloud protocol URL → HTTPS conversion
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
/** AWS region pattern — matches prefixes like "us-west-2", "eu-central-1", etc. */
|
|
112
|
+
const AWS_REGION_RE = /^(us|eu|ap|sa|ca|me|af|il)-(north|south|east|west|central|northeast|southeast|northwest|southwest)-\d+/;
|
|
113
|
+
/**
|
|
114
|
+
* Convert a cloud storage protocol URL (s3://, gs://) to an HTTPS URL
|
|
115
|
+
* for browser access. Returns the original URL if already HTTP(S) or unknown.
|
|
116
|
+
*
|
|
117
|
+
* Supported:
|
|
118
|
+
* - `s3://bucket/key` → `https://s3.{region}.amazonaws.com/{bucket}/{key}`
|
|
119
|
+
* (region auto-detected from bucket name when possible, e.g. "us-west-2.opendata.source.coop")
|
|
120
|
+
* - `gs://bucket/key` → `https://storage.googleapis.com/{bucket}/{key}`
|
|
121
|
+
*/
|
|
122
|
+
export function resolveCloudUrl(url) {
|
|
123
|
+
// S3 / S3-compatible: s3://, s3a://, s3n://
|
|
124
|
+
const s3Match = url.match(/^s3[an]?:\/\/([^/]+)\/?(.*)$/);
|
|
125
|
+
if (s3Match) {
|
|
126
|
+
const [, bucket, key] = s3Match;
|
|
127
|
+
// Detect region from bucket name (e.g. "us-west-2.opendata.source.coop")
|
|
128
|
+
const regionMatch = bucket.match(AWS_REGION_RE);
|
|
129
|
+
const region = regionMatch ? regionMatch[0] : 'us-east-1';
|
|
130
|
+
const base = buildProviderBaseUrl('s3', '', bucket, region);
|
|
131
|
+
return key ? `${base}/${key}` : base;
|
|
132
|
+
}
|
|
133
|
+
// Google Cloud Storage: gs://, gcs://
|
|
134
|
+
const gcsMatch = url.match(/^gcs?:\/\/([^/]+)\/?(.*)$/);
|
|
135
|
+
if (gcsMatch) {
|
|
136
|
+
const [, bucket, key] = gcsMatch;
|
|
137
|
+
const base = buildProviderBaseUrl('gcs', '', bucket, '');
|
|
138
|
+
return key ? `${base}/${key}` : base;
|
|
139
|
+
}
|
|
140
|
+
return url;
|
|
141
|
+
}
|
package/dist/utils/zarr.d.ts
CHANGED
|
@@ -1,39 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zarr metadata parsing utilities.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Builds a hierarchical tree of groups and arrays from consolidated metadata
|
|
5
|
+
* (Zarr v2 .zmetadata, v3 zarr.json), with zarrita fallback for non-consolidated stores.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
/** Ensure numcodecs codecs are registered. Await before creating ZarrLayer. */
|
|
8
|
+
export declare function ensureCodecsRegistered(): Promise<void>;
|
|
9
|
+
/** Zarr store marker files — presence of any indicates a Zarr store. */
|
|
10
|
+
export declare const ZARR_MARKER_FILES: Set<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Detect whether a set of file names contains Zarr marker files.
|
|
13
|
+
* Returns the detected version (2 or 3) or null if not detected.
|
|
14
|
+
*/
|
|
15
|
+
export declare function detectZarrMarkers(fileNames: Iterable<string>): {
|
|
16
|
+
detected: boolean;
|
|
17
|
+
version: 2 | 3 | null;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* If a URL points to a Zarr marker file, strip the marker suffix and return the store URL.
|
|
21
|
+
* Returns null if the URL doesn't end with a known marker suffix.
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractZarrStoreUrl(url: string): string | null;
|
|
24
|
+
export interface ZarrNode {
|
|
25
|
+
path: string;
|
|
8
26
|
name: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
kind: 'group' | 'array';
|
|
28
|
+
children: ZarrNode[];
|
|
29
|
+
shape?: number[];
|
|
30
|
+
dtype?: string;
|
|
31
|
+
dims?: string[];
|
|
32
|
+
chunks?: number[];
|
|
33
|
+
fillValue?: any;
|
|
34
|
+
codecs?: any[];
|
|
35
|
+
compressor?: any;
|
|
36
|
+
filters?: any[];
|
|
37
|
+
chunkKeyEncoding?: string;
|
|
13
38
|
attributes: Record<string, any>;
|
|
14
39
|
}
|
|
15
|
-
export interface
|
|
40
|
+
export interface ZarrHierarchy {
|
|
41
|
+
root: ZarrNode;
|
|
42
|
+
zarrVersion: 2 | 3 | null;
|
|
43
|
+
totalNodes: number;
|
|
16
44
|
storeAttrs: Record<string, any>;
|
|
17
|
-
variables: VarMeta[];
|
|
18
|
-
coords: VarMeta[];
|
|
19
45
|
spatialRefAttrs: Record<string, any> | null;
|
|
20
|
-
zarrVersion: number | null;
|
|
21
46
|
}
|
|
47
|
+
/** Dimension-like variable names treated as coordinates. */
|
|
48
|
+
export declare const DIM_LIKE_NAMES: Set<string>;
|
|
22
49
|
/** Guess dimension names from shape length when metadata is absent. */
|
|
23
50
|
export declare function inferDims(name: string, shape: number[]): string[];
|
|
24
51
|
/** Format shape array for display: `[3 × 256 × 512]` or `scalar`. */
|
|
25
52
|
export declare function formatShape(shape: number[]): string;
|
|
26
|
-
/**
|
|
27
|
-
export declare function
|
|
28
|
-
/**
|
|
29
|
-
export declare function
|
|
53
|
+
/** Byte size of a dtype string. Handles v2 (`<f4`, `|u1`) and v3 (`float32`, `uint8`). */
|
|
54
|
+
export declare function dtypeByteSize(dtype: string): number;
|
|
55
|
+
/** Format chunk count: `"36 [6 × 6]"` */
|
|
56
|
+
export declare function computeChunkCount(shape: number[] | undefined, chunks: number[] | undefined): string | null;
|
|
57
|
+
/** Format chunk size in bytes: `"817.6 KB"` */
|
|
58
|
+
export declare function computeChunkSize(chunks: number[] | undefined, dtype: string | undefined): string | null;
|
|
59
|
+
/** Format uncompressed size: `"28.7 MB"` */
|
|
60
|
+
export declare function computeUncompressed(shape: number[] | undefined, dtype: string | undefined): string | null;
|
|
61
|
+
/** Format codec pipeline for display. */
|
|
62
|
+
export declare function formatCodecs(node: ZarrNode): string | null;
|
|
63
|
+
/** Format chunk_key_encoding for display: `"default (sep: "/")"` */
|
|
64
|
+
export declare function formatChunkKeys(node: ZarrNode): string | null;
|
|
65
|
+
/** Find a node by slash-delimited path. */
|
|
66
|
+
export declare function findNodeByPath(root: ZarrNode, path: string): ZarrNode | null;
|
|
67
|
+
/** Build tree from Zarr v3 consolidated metadata (zarr.json). */
|
|
68
|
+
export declare function buildV3Tree(data: any): ZarrHierarchy;
|
|
69
|
+
/** Build tree from Zarr v2 consolidated metadata (.zmetadata). */
|
|
70
|
+
export declare function buildV2Tree(data: any): ZarrHierarchy;
|
|
30
71
|
/**
|
|
31
|
-
* Fetch
|
|
32
|
-
* Tries v3 (zarr.json) first, then v2 (.zmetadata).
|
|
72
|
+
* Fetch hierarchy from a Zarr store URL.
|
|
73
|
+
* Tries v3 (zarr.json) first, then v2 (.zmetadata), then zarrita fallback.
|
|
33
74
|
*/
|
|
34
|
-
export declare function
|
|
75
|
+
export declare function fetchHierarchy(storeUrl: string, storeName: string, signal?: AbortSignal): Promise<ZarrHierarchy | null>;
|
|
35
76
|
/**
|
|
36
77
|
* Fallback: probe a Zarr store using zarrita when consolidated metadata is unavailable.
|
|
37
|
-
* @param storeName - Display name for the root array (e.g. file name without .zarr)
|
|
38
78
|
*/
|
|
39
|
-
export declare function
|
|
79
|
+
export declare function probeHierarchy(storeUrl: string, storeName: string): Promise<ZarrHierarchy | null>;
|