@loaders.gl/schema 3.1.6 → 3.2.0-alpha.1

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 (51) hide show
  1. package/dist/category/common.d.ts +1 -2
  2. package/dist/category/common.d.ts.map +1 -1
  3. package/dist/category/image/image.d.ts +18 -0
  4. package/dist/category/image/image.d.ts.map +1 -0
  5. package/dist/category/image/image.js +2 -0
  6. package/dist/category/mesh/convert-mesh.js +6 -5
  7. package/dist/category/mesh/mesh-to-arrow-table.d.ts +10 -0
  8. package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -1
  9. package/dist/category/mesh/mesh-to-arrow-table.js +26 -36
  10. package/dist/category/table/table-types.d.ts +9 -3
  11. package/dist/category/table/table-types.d.ts.map +1 -1
  12. package/dist/category/texture/texture.d.ts +18 -0
  13. package/dist/category/texture/texture.d.ts.map +1 -0
  14. package/dist/category/texture/texture.js +2 -0
  15. package/dist/dist.min.js +15078 -208
  16. package/dist/es5/category/image/image.js +2 -0
  17. package/dist/es5/category/image/image.js.map +1 -0
  18. package/dist/es5/category/mesh/convert-mesh.js +8 -0
  19. package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
  20. package/dist/es5/category/mesh/mesh-to-arrow-table.js +38 -0
  21. package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
  22. package/dist/es5/category/texture/texture.js +2 -0
  23. package/dist/es5/category/texture/texture.js.map +1 -0
  24. package/dist/es5/index.js.map +1 -1
  25. package/dist/es5/lib/arrow/arrow-type-utils.js +70 -0
  26. package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -1
  27. package/dist/esm/category/image/image.js +2 -0
  28. package/dist/esm/category/image/image.js.map +1 -0
  29. package/dist/esm/category/mesh/convert-mesh.js +7 -0
  30. package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
  31. package/dist/esm/category/mesh/mesh-to-arrow-table.js +29 -0
  32. package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -1
  33. package/dist/esm/category/texture/texture.js +2 -0
  34. package/dist/esm/category/texture/texture.js.map +1 -0
  35. package/dist/esm/index.js.map +1 -1
  36. package/dist/esm/lib/arrow/arrow-type-utils.js +60 -0
  37. package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -1
  38. package/dist/index.d.ts +3 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/lib/arrow/arrow-type-utils.d.ts +5 -0
  41. package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -1
  42. package/dist/lib/arrow/arrow-type-utils.js +47 -67
  43. package/package.json +4 -3
  44. package/src/category/common.ts +1 -2
  45. package/src/category/image/image.ts +19 -0
  46. package/src/category/mesh/convert-mesh.ts +6 -6
  47. package/src/category/mesh/mesh-to-arrow-table.ts +2 -4
  48. package/src/category/table/table-types.ts +7 -4
  49. package/src/category/texture/texture.ts +28 -0
  50. package/src/index.ts +8 -2
  51. package/src/lib/arrow/arrow-type-utils.ts +0 -2
@@ -1,6 +1,6 @@
1
1
  import type {Mesh} from './mesh-types';
2
2
  import type {ColumnarTable, ArrowTable} from '../table/table-types';
3
- // import {convertMeshToArrowTable} from './mesh-to-arrow-table';
3
+ import {convertMeshToArrowTable} from './mesh-to-arrow-table';
4
4
 
5
5
  type TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';
6
6
 
@@ -17,11 +17,11 @@ export function convertMesh(
17
17
  return mesh;
18
18
  case 'columnar-table':
19
19
  return convertMeshToColumnarTable(mesh);
20
- // case 'arrow-table':
21
- // return {
22
- // shape: 'arrow-table',
23
- // data: convertMeshToArrowTable(mesh)
24
- // };
20
+ case 'arrow-table':
21
+ return {
22
+ shape: 'arrow-table',
23
+ data: convertMeshToArrowTable(mesh)
24
+ };
25
25
  default:
26
26
  throw new Error(`Unsupported shape ${options?.shape}`);
27
27
  }
@@ -1,4 +1,3 @@
1
- /*
2
1
  import {
3
2
  Table,
4
3
  Schema,
@@ -7,7 +6,7 @@ import {
7
6
  Field,
8
7
  Data,
9
8
  FixedSizeListVector
10
- } from 'apache-arrow';
9
+ } from 'apache-arrow/Arrow.dom';
11
10
  import {AbstractVector} from 'apache-arrow/vector';
12
11
  import {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';
13
12
  import type {Mesh} from './mesh-types';
@@ -19,7 +18,7 @@ import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
19
18
  * @param metadata
20
19
  * @param batchSize
21
20
  * @returns
22
- *
21
+ */
23
22
  export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
24
23
  const vectors: AbstractVector[] = [];
25
24
  const fields: Field[] = [];
@@ -40,4 +39,3 @@ export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
40
39
  const table = new Table(schema, recordBatch);
41
40
  return table;
42
41
  }
43
- */
@@ -1,10 +1,7 @@
1
1
  import type {Schema} from '../../lib/schema/schema';
2
+ import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
2
3
  import type {AnyArray} from '../../types';
3
4
  import type {Batch} from '../common';
4
- // TODO Arrow dependency causes issues
5
- // import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
6
- type ApacheArrowTable = any;
7
- type RecordBatch = any;
8
5
 
9
6
  /** A general table */
10
7
  export interface Table {
@@ -43,6 +40,12 @@ export interface ArrowTable extends Table {
43
40
  data: ApacheArrowTable;
44
41
  }
45
42
 
43
+ /** A collection of tables */
44
+ export type Tables<TableType extends Table = Table> = {
45
+ shape: 'tables';
46
+ tables: {name: string; table: TableType}[];
47
+ };
48
+
46
49
  // Batches
47
50
 
48
51
  /** Batch for a general table */
@@ -0,0 +1,28 @@
1
+ import type {ImageType} from '../image/image';
2
+
3
+ /**
4
+ * These represent the main compressed texture formats
5
+ * Each format typically has a number of more specific subformats
6
+ */
7
+ export type GPUTextureFormat =
8
+ | 'dxt'
9
+ | 'dxt-srgb'
10
+ | 'etc1'
11
+ | 'etc2'
12
+ | 'pvrtc'
13
+ | 'atc'
14
+ | 'astc'
15
+ | 'rgtc';
16
+
17
+ /** One mip level */
18
+ export type TextureLevel = {
19
+ compressed: boolean;
20
+ format?: number;
21
+ data: Uint8Array;
22
+ width: number;
23
+ height: number;
24
+ levelSize?: number;
25
+ hasAlpha?: boolean;
26
+ };
27
+
28
+ export type TextureOrImage = ImageType | (TextureLevel | ImageType);
package/src/index.ts CHANGED
@@ -4,13 +4,13 @@ export type {TypedArray, NumberArray, AnyArray} from './types';
4
4
  export type {Batch} from './category/common';
5
5
 
6
6
  // TABLE CATEGORY TYPES
7
-
8
7
  export type {
9
8
  Table,
10
9
  ArrayRowTable,
11
10
  ObjectRowTable,
12
11
  ColumnarTable,
13
- ArrowTable
12
+ ArrowTable,
13
+ Tables
14
14
  } from './category/table/table-types';
15
15
  export type {
16
16
  TableBatch,
@@ -46,6 +46,12 @@ export {
46
46
  makeMeshAttributeMetadata
47
47
  } from './category/mesh/deduce-mesh-schema';
48
48
 
49
+ // TEXTURES
50
+ export type {TextureLevel, GPUTextureFormat} from './category/texture/texture';
51
+
52
+ // IMAGES
53
+ export type {ImageDataType, ImageType, ImageTypeEnum} from './category/image/image';
54
+
49
55
  // TYPES
50
56
  // GIS CATEGORY - GEOJSON
51
57
  export type {GeoJSON, Feature, Geometry, Position, GeoJsonProperties} from './category/gis';
@@ -1,4 +1,3 @@
1
- /*
2
1
  import type {TypedArray} from '../../types';
3
2
  import {
4
3
  DataType,
@@ -66,4 +65,3 @@ export function getArrowVector(array: TypedArray): AbstractVector {
66
65
  throw new Error('array type not supported');
67
66
  }
68
67
  }
69
- */