@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
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { QueryResult } from '../query/engine';
|
|
2
|
-
export declare class EvidenceContext {
|
|
3
|
-
private connId;
|
|
4
|
-
private prefix;
|
|
5
|
-
private results;
|
|
6
|
-
constructor(connId: string, prefix?: string);
|
|
7
|
-
/**
|
|
8
|
-
* Execute a SQL query and store the result under the given name.
|
|
9
|
-
*/
|
|
10
|
-
executeSql(sql: string, queryName: string): Promise<Record<string, any>[]>;
|
|
11
|
-
/**
|
|
12
|
-
* Transform relative file paths in SQL to full S3 URLs.
|
|
13
|
-
* e.g., read_parquet('data.parquet') → read_parquet('s3://bucket/prefix/data.parquet')
|
|
14
|
-
*/
|
|
15
|
-
private transformPaths;
|
|
16
|
-
getResult(queryName: string): {
|
|
17
|
-
result: QueryResult;
|
|
18
|
-
rows: Record<string, any>[];
|
|
19
|
-
} | undefined;
|
|
20
|
-
getAllResults(): Map<string, Record<string, any>[]>;
|
|
21
|
-
getColumns(queryName: string): string[];
|
|
22
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { getQueryEngine } from '../query/index.js';
|
|
2
|
-
export class EvidenceContext {
|
|
3
|
-
connId;
|
|
4
|
-
prefix;
|
|
5
|
-
results = new Map();
|
|
6
|
-
constructor(connId, prefix = '') {
|
|
7
|
-
this.connId = connId;
|
|
8
|
-
this.prefix = prefix;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Execute a SQL query and store the result under the given name.
|
|
12
|
-
*/
|
|
13
|
-
async executeSql(sql, queryName) {
|
|
14
|
-
const engine = await getQueryEngine();
|
|
15
|
-
// Transform relative file paths to full paths
|
|
16
|
-
const transformedSql = this.transformPaths(sql);
|
|
17
|
-
const result = await engine.query(this.connId, transformedSql);
|
|
18
|
-
const rows = result.rows ?? [];
|
|
19
|
-
this.results.set(queryName, { result, rows });
|
|
20
|
-
return rows;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Transform relative file paths in SQL to full S3 URLs.
|
|
24
|
-
* e.g., read_parquet('data.parquet') → read_parquet('s3://bucket/prefix/data.parquet')
|
|
25
|
-
*/
|
|
26
|
-
transformPaths(sql) {
|
|
27
|
-
if (!this.connId || !this.prefix)
|
|
28
|
-
return sql;
|
|
29
|
-
// Match read_parquet('path'), read_csv('path'), read_json('path')
|
|
30
|
-
return sql.replace(/(read_(?:parquet|csv|json|csv_auto))\('([^']+)'\)/g, (match, fn, path) => {
|
|
31
|
-
// Skip absolute paths and URLs
|
|
32
|
-
if (path.startsWith('s3://') || path.startsWith('http') || path.startsWith('/')) {
|
|
33
|
-
return match;
|
|
34
|
-
}
|
|
35
|
-
// Resolve relative path
|
|
36
|
-
const fullPath = `s3://${this.prefix}/${path}`;
|
|
37
|
-
return `${fn}('${fullPath}')`;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
getResult(queryName) {
|
|
41
|
-
return this.results.get(queryName);
|
|
42
|
-
}
|
|
43
|
-
getAllResults() {
|
|
44
|
-
const map = new Map();
|
|
45
|
-
for (const [name, { rows }] of this.results) {
|
|
46
|
-
map.set(name, rows);
|
|
47
|
-
}
|
|
48
|
-
return map;
|
|
49
|
-
}
|
|
50
|
-
getColumns(queryName) {
|
|
51
|
-
const entry = this.results.get(queryName);
|
|
52
|
-
if (!entry)
|
|
53
|
-
return [];
|
|
54
|
-
return entry.result.columns;
|
|
55
|
-
}
|
|
56
|
-
}
|
package/dist/utils/export.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Escape a CSV field value per RFC 4180.
|
|
3
|
-
*/
|
|
4
|
-
export declare function escapeCsvField(value: string): string;
|
|
5
|
-
/**
|
|
6
|
-
* Serialize column/row data to a CSV string.
|
|
7
|
-
* Pure function — no browser APIs, works in Node.js.
|
|
8
|
-
*/
|
|
9
|
-
export declare function serializeToCsv(columns: string[], rows: Record<string, unknown>[]): string;
|
|
10
|
-
/**
|
|
11
|
-
* Serialize column/row data to a formatted JSON string.
|
|
12
|
-
* Pure function — no browser APIs, works in Node.js.
|
|
13
|
-
*/
|
|
14
|
-
export declare function serializeToJson(columns: string[], rows: Record<string, unknown>[]): string;
|
|
15
|
-
/**
|
|
16
|
-
* Export data as CSV file (triggers browser download).
|
|
17
|
-
*/
|
|
18
|
-
export declare function exportToCsv(columns: string[], rows: Record<string, unknown>[], filename: string): void;
|
|
19
|
-
/**
|
|
20
|
-
* Export data as JSON file (triggers browser download).
|
|
21
|
-
*/
|
|
22
|
-
export declare function exportToJson(columns: string[], rows: Record<string, unknown>[], filename: string): void;
|
package/dist/utils/export.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsonReplacerBigInt } from './format.js';
|
|
2
|
-
function triggerDownload(content, filename, mimeType) {
|
|
3
|
-
const blob = new Blob([content], { type: mimeType });
|
|
4
|
-
const url = URL.createObjectURL(blob);
|
|
5
|
-
const a = document.createElement('a');
|
|
6
|
-
a.href = url;
|
|
7
|
-
a.download = filename;
|
|
8
|
-
document.body.appendChild(a);
|
|
9
|
-
a.click();
|
|
10
|
-
document.body.removeChild(a);
|
|
11
|
-
URL.revokeObjectURL(url);
|
|
12
|
-
}
|
|
13
|
-
/** Format a cell value for export (empty string for null/undefined). */
|
|
14
|
-
function formatCellValue(value) {
|
|
15
|
-
if (value === null || value === undefined)
|
|
16
|
-
return '';
|
|
17
|
-
if (value instanceof Date)
|
|
18
|
-
return value.toISOString();
|
|
19
|
-
if (typeof value === 'bigint')
|
|
20
|
-
return value.toString();
|
|
21
|
-
if (typeof value === 'object')
|
|
22
|
-
return JSON.stringify(value, jsonReplacerBigInt);
|
|
23
|
-
return String(value);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Escape a CSV field value per RFC 4180.
|
|
27
|
-
*/
|
|
28
|
-
export function escapeCsvField(value) {
|
|
29
|
-
if (value.includes(',') || value.includes('"') || value.includes('\n') || value.includes('\r')) {
|
|
30
|
-
return `"${value.replace(/"/g, '""')}"`;
|
|
31
|
-
}
|
|
32
|
-
return value;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Serialize column/row data to a CSV string.
|
|
36
|
-
* Pure function — no browser APIs, works in Node.js.
|
|
37
|
-
*/
|
|
38
|
-
export function serializeToCsv(columns, rows) {
|
|
39
|
-
const header = columns.map(escapeCsvField).join(',');
|
|
40
|
-
const body = rows
|
|
41
|
-
.map((row) => columns.map((col) => escapeCsvField(formatCellValue(row[col]))).join(','))
|
|
42
|
-
.join('\n');
|
|
43
|
-
return `${header}\n${body}`;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Serialize column/row data to a formatted JSON string.
|
|
47
|
-
* Pure function — no browser APIs, works in Node.js.
|
|
48
|
-
*/
|
|
49
|
-
export function serializeToJson(columns, rows) {
|
|
50
|
-
const data = rows.map((row) => {
|
|
51
|
-
const obj = {};
|
|
52
|
-
for (const col of columns) {
|
|
53
|
-
const val = row[col];
|
|
54
|
-
if (val instanceof Date) {
|
|
55
|
-
obj[col] = val.toISOString();
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
obj[col] = val ?? null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return obj;
|
|
62
|
-
});
|
|
63
|
-
return JSON.stringify(data, jsonReplacerBigInt, 2);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Export data as CSV file (triggers browser download).
|
|
67
|
-
*/
|
|
68
|
-
export function exportToCsv(columns, rows, filename) {
|
|
69
|
-
triggerDownload(serializeToCsv(columns, rows), filename.endsWith('.csv') ? filename : `${filename}.csv`, 'text/csv;charset=utf-8;');
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Export data as JSON file (triggers browser download).
|
|
73
|
-
*/
|
|
74
|
-
export function exportToJson(columns, rows, filename) {
|
|
75
|
-
triggerDownload(serializeToJson(columns, rows), filename.endsWith('.json') ? filename : `${filename}.json`, 'application/json');
|
|
76
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure file entry sorting — framework-agnostic, works in Node.js.
|
|
3
|
-
*/
|
|
4
|
-
import type { FileEntry } from '../types.js';
|
|
5
|
-
export type SortField = 'name' | 'size' | 'modified' | 'extension';
|
|
6
|
-
export type SortDirection = 'asc' | 'desc';
|
|
7
|
-
export interface SortConfig {
|
|
8
|
-
field: SortField;
|
|
9
|
-
direction: SortDirection;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Sort file entries by the given config.
|
|
13
|
-
* Directories always sort before files regardless of sort field.
|
|
14
|
-
* Returns a new array (does not mutate the input).
|
|
15
|
-
*/
|
|
16
|
-
export declare function sortFileEntries(entries: FileEntry[], config: SortConfig): FileEntry[];
|
|
17
|
-
/**
|
|
18
|
-
* Toggle sort config: same field flips direction, new field starts ascending.
|
|
19
|
-
*/
|
|
20
|
-
export declare function toggleSortField(current: SortConfig, field: SortField): SortConfig;
|
package/dist/utils/file-sort.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure file entry sorting — framework-agnostic, works in Node.js.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Sort file entries by the given config.
|
|
6
|
-
* Directories always sort before files regardless of sort field.
|
|
7
|
-
* Returns a new array (does not mutate the input).
|
|
8
|
-
*/
|
|
9
|
-
export function sortFileEntries(entries, config) {
|
|
10
|
-
const sorted = [...entries];
|
|
11
|
-
const dir = config.direction === 'asc' ? 1 : -1;
|
|
12
|
-
sorted.sort((a, b) => {
|
|
13
|
-
// Directories always come first
|
|
14
|
-
if (a.is_dir && !b.is_dir)
|
|
15
|
-
return -1;
|
|
16
|
-
if (!a.is_dir && b.is_dir)
|
|
17
|
-
return 1;
|
|
18
|
-
switch (config.field) {
|
|
19
|
-
case 'name':
|
|
20
|
-
return dir * a.name.localeCompare(b.name, undefined, { sensitivity: 'base' });
|
|
21
|
-
case 'size':
|
|
22
|
-
return dir * (a.size - b.size);
|
|
23
|
-
case 'modified':
|
|
24
|
-
return dir * (a.modified - b.modified);
|
|
25
|
-
case 'extension':
|
|
26
|
-
return dir * a.extension.localeCompare(b.extension, undefined, { sensitivity: 'base' });
|
|
27
|
-
default:
|
|
28
|
-
return 0;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return sorted;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Toggle sort config: same field flips direction, new field starts ascending.
|
|
35
|
-
*/
|
|
36
|
-
export function toggleSortField(current, field) {
|
|
37
|
-
if (current.field === field) {
|
|
38
|
-
return { field, direction: current.direction === 'asc' ? 'desc' : 'asc' };
|
|
39
|
-
}
|
|
40
|
-
return { field, direction: 'asc' };
|
|
41
|
-
}
|
package/dist/utils/format.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a byte count into a human-readable string.
|
|
3
|
-
*/
|
|
4
|
-
export declare function formatFileSize(bytes: number): string;
|
|
5
|
-
/**
|
|
6
|
-
* Formats a unix timestamp (milliseconds) to a human-readable date string.
|
|
7
|
-
* Shows relative time for recent dates, absolute for older ones.
|
|
8
|
-
*/
|
|
9
|
-
export declare function formatDate(timestamp: number): string;
|
|
10
|
-
/**
|
|
11
|
-
* Extracts the file extension from a filename, including the leading dot.
|
|
12
|
-
* Returns an empty string if no extension is found.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getFileExtension(filename: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* JSON replacer that converts BigInt values to strings.
|
|
17
|
-
* Use with `JSON.stringify(value, jsonReplacerBigInt)`.
|
|
18
|
-
*/
|
|
19
|
-
export declare function jsonReplacerBigInt(_key: string, value: unknown): unknown;
|
|
20
|
-
/**
|
|
21
|
-
* Format a value for display in tables, attribute panels, and exports.
|
|
22
|
-
* Handles null, undefined, Date, BigInt, and objects uniformly.
|
|
23
|
-
*/
|
|
24
|
-
export declare function formatValue(value: unknown): string;
|
package/dist/utils/format.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a byte count into a human-readable string.
|
|
3
|
-
*/
|
|
4
|
-
export function formatFileSize(bytes) {
|
|
5
|
-
if (bytes < 0)
|
|
6
|
-
return '0 B';
|
|
7
|
-
if (bytes === 0)
|
|
8
|
-
return '0 B';
|
|
9
|
-
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
10
|
-
const base = 1024;
|
|
11
|
-
const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(base)), units.length - 1);
|
|
12
|
-
const value = bytes / base ** exponent;
|
|
13
|
-
// Use integer display for bytes, one decimal for everything else
|
|
14
|
-
if (exponent === 0)
|
|
15
|
-
return `${bytes} B`;
|
|
16
|
-
return `${value.toFixed(1)} ${units[exponent]}`;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Formats a unix timestamp (milliseconds) to a human-readable date string.
|
|
20
|
-
* Shows relative time for recent dates, absolute for older ones.
|
|
21
|
-
*/
|
|
22
|
-
export function formatDate(timestamp) {
|
|
23
|
-
if (!timestamp || timestamp <= 0 || !Number.isFinite(timestamp))
|
|
24
|
-
return '--';
|
|
25
|
-
const date = new Date(timestamp);
|
|
26
|
-
const now = Date.now();
|
|
27
|
-
const diffMs = now - timestamp;
|
|
28
|
-
const diffSeconds = Math.floor(diffMs / 1000);
|
|
29
|
-
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
30
|
-
const diffHours = Math.floor(diffMinutes / 60);
|
|
31
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
32
|
-
if (diffSeconds < 60)
|
|
33
|
-
return 'Just now';
|
|
34
|
-
if (diffMinutes < 60)
|
|
35
|
-
return `${diffMinutes}m ago`;
|
|
36
|
-
if (diffHours < 24)
|
|
37
|
-
return `${diffHours}h ago`;
|
|
38
|
-
if (diffDays < 7)
|
|
39
|
-
return `${diffDays}d ago`;
|
|
40
|
-
// For older dates, show absolute date
|
|
41
|
-
return date.toLocaleDateString(undefined, {
|
|
42
|
-
year: 'numeric',
|
|
43
|
-
month: 'short',
|
|
44
|
-
day: 'numeric'
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Extracts the file extension from a filename, including the leading dot.
|
|
49
|
-
* Returns an empty string if no extension is found.
|
|
50
|
-
*/
|
|
51
|
-
export function getFileExtension(filename) {
|
|
52
|
-
const lastDot = filename.lastIndexOf('.');
|
|
53
|
-
if (lastDot <= 0)
|
|
54
|
-
return '';
|
|
55
|
-
return filename.slice(lastDot).toLowerCase();
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* JSON replacer that converts BigInt values to strings.
|
|
59
|
-
* Use with `JSON.stringify(value, jsonReplacerBigInt)`.
|
|
60
|
-
*/
|
|
61
|
-
export function jsonReplacerBigInt(_key, value) {
|
|
62
|
-
return typeof value === 'bigint' ? value.toString() : value;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Format a value for display in tables, attribute panels, and exports.
|
|
66
|
-
* Handles null, undefined, Date, BigInt, and objects uniformly.
|
|
67
|
-
*/
|
|
68
|
-
export function formatValue(value) {
|
|
69
|
-
if (value === null || value === undefined)
|
|
70
|
-
return 'NULL';
|
|
71
|
-
if (value instanceof Date)
|
|
72
|
-
return value.toISOString();
|
|
73
|
-
if (typeof value === 'bigint')
|
|
74
|
-
return value.toString();
|
|
75
|
-
if (typeof value === 'object')
|
|
76
|
-
return JSON.stringify(value, jsonReplacerBigInt);
|
|
77
|
-
return String(value);
|
|
78
|
-
}
|
package/dist/utils/geoarrow.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Direct WKB → GeoArrow bridge (zero-copy).
|
|
3
|
-
*
|
|
4
|
-
* Reads raw WKB binary directly into pre-allocated Arrow typed arrays
|
|
5
|
-
* without any intermediate JS object allocation. No parseWKB(), no GeoJSON.
|
|
6
|
-
*
|
|
7
|
-
* Data flow: WKB Uint8Array[] → DataView binary reads → Float64Array/Int32Array
|
|
8
|
-
* → arrow.makeData() → arrow.Table with ARROW:extension:name metadata
|
|
9
|
-
*/
|
|
10
|
-
import { Table } from 'apache-arrow';
|
|
11
|
-
export type GeoArrowGeomType = 'point' | 'linestring' | 'polygon' | 'multipoint' | 'multilinestring' | 'multipolygon';
|
|
12
|
-
export interface GeoArrowResult {
|
|
13
|
-
table: Table;
|
|
14
|
-
geometryType: GeoArrowGeomType;
|
|
15
|
-
bounds: [number, number, number, number];
|
|
16
|
-
/** Maps local table row index → original WKB array index (for selection lookup). */
|
|
17
|
-
sourceIndices: number[];
|
|
18
|
-
}
|
|
19
|
-
/** Map DuckDB ST_GeometryType output to our normalized type. */
|
|
20
|
-
export declare function normalizeGeomType(raw: string): GeoArrowGeomType;
|
|
21
|
-
/**
|
|
22
|
-
* Build GeoArrow tables from raw WKB arrays, automatically splitting by geometry type.
|
|
23
|
-
* Returns one GeoArrowResult per non-empty type group, with shared merged bounds.
|
|
24
|
-
*
|
|
25
|
-
* @param wkbArrays Raw WKB binary arrays from DuckDB
|
|
26
|
-
* @param attributes Attribute columns (non-geometry)
|
|
27
|
-
* @param knownGeomType If provided (e.g. from GeoParquet metadata), skip classification
|
|
28
|
-
*/
|
|
29
|
-
export declare function buildGeoArrowTables(wkbArrays: Uint8Array[], attributes: Map<string, {
|
|
30
|
-
values: any[];
|
|
31
|
-
type: string;
|
|
32
|
-
}>, knownGeomType?: GeoArrowGeomType): GeoArrowResult[];
|