Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api-reference/core/widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Additional inline CSS styles on the top HTML element of the widget. camelCase CS

Additional CSS classnames on the top HTML element.

#### `_container` (string | HTMLDivElement, optional) {#container}
#### `_container` (string | HTMLDivElement, optional) {#_container}

Experimental. The container that this widget is being attached to. Default to `viewId`.
- If set to `'root'`, the widget is placed relative to the whole deck.gl canvas.
Expand Down
16 changes: 9 additions & 7 deletions docs/developer-guide/loading-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ All layers support a [loadOptions](../api-reference/core/layer.md#loadoptions) p

In a production environment, deck.gl applications may need to load data from secure APIs that require special HTTP headers (such as `Authorization`) to be set.

In order to access a secure API, the `loadOptions.fetch` option passes through additional parameters to [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch), which deck.gl calls under the hood to load resources.
In order to access a secure API, the `loadOptions.core.fetch` option passes through additional parameters to [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch), which deck.gl calls under the hood to load resources.

```ts
new ScatterplotLayer({
data: 'https://secure-server.com/userActivity',
loadOptions: {
fetch: {
method: 'POST',
body: JSON.stringify(requestBody),
headers: {
'Authorization': `Bearer ${accessToken}`,
core: {
fetch: {
method: 'POST',
body: JSON.stringify(requestBody),
headers: {
'Authorization': `Bearer ${accessToken}`,
}
}
}
}
Expand Down Expand Up @@ -268,7 +270,7 @@ If the layer is used in an environment that does not support web workers, or you
import {MVTLoader} from '@loaders.gl/mvt';
new MVTLayer({
loaders: [MVTLoader],
loadOptions: {worker: false}
loadOptions: {core: {worker: false}}
});
```

Expand Down
6 changes: 3 additions & 3 deletions examples/layer-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"start-local": "vite --config ../vite.config.local.mjs"
},
"dependencies": {
"@loaders.gl/core": "^4.3.4",
"@loaders.gl/gltf": "^4.3.4",
"@loaders.gl/ply": "^4.3.4",
"@loaders.gl/core": "^4.4.0-alpha.16",
"@loaders.gl/gltf": "^4.4.0-alpha.16",
"@loaders.gl/ply": "^4.4.0-alpha.16",
"@probe.gl/log": "^4.0.9",
"colorbrewer": "^1.0.0",
"d3-request": "^1.0.6",
Expand Down
10 changes: 5 additions & 5 deletions examples/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/3d-tiles": "^4.3.4",
"@loaders.gl/core": "^4.3.4",
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/draco": "^4.3.4",
"@loaders.gl/gltf": "^4.3.4",
"@loaders.gl/3d-tiles": "^4.4.0-alpha.16",
"@loaders.gl/core": "^4.4.0-alpha.16",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@loaders.gl/draco": "^4.4.0-alpha.16",
"@loaders.gl/gltf": "^4.4.0-alpha.16",
"@luma.gl/constants": "^9.2.6",
"deck.gl": "^9.0.0",
"maplibre-gl": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/3d-heatmap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"deck.gl": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/3d-tiles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@loaders.gl/3d-tiles": "^4.3.4",
"@loaders.gl/3d-tiles": "^4.4.0-alpha.16",
"deck.gl": "^9.0.0",
"maplibre-gl": "^5.0.0",
"react": "^18.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/website/arc/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {scaleQuantile} from 'd3-scale';
import type {Color, PickingInfo, MapViewState} from '@deck.gl/core';
import type {Feature, Polygon, MultiPolygon} from 'geojson';
import {CompassWidget, ZoomWidget, FullscreenWidget} from '@deck.gl/widgets';
import '@deck.gl/widgets/stylesheet.css';

// Source data GeoJSON
const DATA_URL =
Expand Down
2 changes: 1 addition & 1 deletion examples/website/data-filter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"deck.gl": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/global-grids/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"deck.gl": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/globe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"@types/react": "^18.0.0",
Expand Down
10 changes: 5 additions & 5 deletions examples/website/google-3d-tiles/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export const COLORS = [
const colorScale = scaleLinear().clamp(true).domain([0, 50, 100, 200, 300]).range(COLORS);

const INITIAL_VIEW_STATE = {
latitude: 50.089,
longitude: 14.42,
zoom: 16,
latitude: 50.0662,
longitude: 14.437,
zoom: 16.6,
minZoom: 14,
maxZoom: 16.5,
bearing: 90,
maxZoom: 20,
bearing: 98.91089,
pitch: 60
};

Expand Down
2 changes: 1 addition & 1 deletion examples/website/highway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@types/d3-scale": "^4.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/i3s/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/i3s": "^4.3.4",
"@loaders.gl/i3s": "^4.4.0-alpha.16",
"maplibre-gl": "^5.0.0",
"react-map-gl": "^8.0.0",
"deck.gl": "^9.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/website/mapbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"d3-scale": "^4.0.0",
"deck.gl": "^9.0.0",
"mapbox-gl": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/maplibre/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"@types/react": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/mask-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"@types/react": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/mesh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/obj": "^4.3.4",
"@loaders.gl/obj": "^4.4.0-alpha.16",
"@math.gl/core": "^4.1.0",
"deck.gl": "^9.0.0",
"react": "^18.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/website/point-cloud/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {DeckGL} from '@deck.gl/react';
import {OrbitView, LinearInterpolator} from '@deck.gl/core';
import {PointCloudLayer} from '@deck.gl/layers';

import {LASWorkerLoader} from '@loaders.gl/las';
import {LASLoader} from '@loaders.gl/las';
import type {OrbitViewState} from '@deck.gl/core';
import {Device} from '@luma.gl/core';

// TODO - export from loaders?
type LASMesh = (typeof LASWorkerLoader)['dataType'];
type LASMesh = (typeof LASLoader)['dataType'];

// Data source: kaarta.com
const LAZ_SAMPLE =
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function App({
opacity: 0.5,
pointSize: 0.5,
// Additional format support can be added here
loaders: [LASWorkerLoader],
loaders: [LASLoader],
// TODO (kaapp) currently webgpu requirement to ensure instanceColors are supplied
Comment thread
felixpalmer marked this conversation as resolved.
pickable: true
})
Expand Down
2 changes: 1 addition & 1 deletion examples/website/point-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/las": "^4.3.4",
"@loaders.gl/las": "^4.4.0-alpha.16",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"deck.gl": "^9.2.0-alpha.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/radio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@material-ui/core": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.57",
"@types/d3-scale": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@loaders.gl/csv": "^4.3.4",
"@loaders.gl/csv": "^4.4.0-alpha.16",
"@types/d3-scale": "^4.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
Expand Down
14 changes: 7 additions & 7 deletions modules/carto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
},
"dependencies": {
"@carto/api-client": "^0.5.19",
"@loaders.gl/compression": "^4.3.4",
"@loaders.gl/gis": "^4.3.4",
"@loaders.gl/loader-utils": "^4.3.4",
"@loaders.gl/mvt": "^4.3.4",
"@loaders.gl/schema": "^4.3.4",
"@loaders.gl/tiles": "^4.3.4",
"@loaders.gl/compression": "^4.4.0-alpha.16",
"@loaders.gl/gis": "^4.4.0-alpha.16",
"@loaders.gl/loader-utils": "^4.4.0-alpha.16",
"@loaders.gl/mvt": "^4.4.0-alpha.16",
"@loaders.gl/schema": "^4.4.0-alpha.16",
"@loaders.gl/tiles": "^4.4.0-alpha.16",
"@luma.gl/core": "^9.2.6",
"@luma.gl/shadertools": "^9.2.6",
"@math.gl/web-mercator": "^4.1.0",
Expand All @@ -72,7 +72,7 @@
"@deck.gl/extensions": "~9.2.0",
"@deck.gl/geo-layers": "~9.2.0",
"@deck.gl/layers": "~9.2.0",
"@loaders.gl/core": "^4.3.4",
"@loaders.gl/core": "^4.4.0-alpha.16",
"@luma.gl/core": "~9.2.6"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
Expand Down
2 changes: 1 addition & 1 deletion modules/carto/src/api/parse-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
assert(dataset, `No dataset matching dataId: ${dataId}`);
const {data} = dataset;
assert(data, `No data loaded for dataId: ${dataId}`);
const {Layer, propMap, defaultProps} = getLayer(type, config, dataset);

Check warning on line 68 in modules/carto/src/api/parse-map.ts

View workflow job for this annotation

GitHub Actions / test-node

'Layer' is already declared in the upper scope on line 8 column 9
const styleProps = createStyleProps(config, propMap);
return new Layer({
id,
Expand Down Expand Up @@ -206,9 +206,9 @@
if (type === 'point') {
const altitude = config.columns?.altitude;
if (altitude) {
result.dataTransform = data => {

Check warning on line 209 in modules/carto/src/api/parse-map.ts

View workflow job for this annotation

GitHub Actions / test-node

'data' is already declared in the upper scope on line 163 column 3
data.features.forEach(({geometry, properties}) => {
const {type, coordinates} = geometry;

Check warning on line 211 in modules/carto/src/api/parse-map.ts

View workflow job for this annotation

GitHub Actions / test-node

'type' is already declared in the upper scope on line 160 column 3
if (type === 'Point') {
coordinates[2] = properties[altitude];
}
Expand Down Expand Up @@ -367,6 +367,6 @@

function createLoadOptions(accessToken: string) {
return {
loadOptions: {fetch: {headers: {Authorization: `Bearer ${accessToken}`}}}
loadOptions: {core: {fetch: {headers: {Authorization: `Bearer ${accessToken}`}}}}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
import {LoaderOptions, LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';

import {Tile, TileReader} from './carto-properties-tile';
import {parsePbf} from './tile-loader-utils';
Expand Down Expand Up @@ -34,7 +34,7 @@ const CartoPropertiesTileLoader: LoaderWithParser = {
worker: true,
parse: async (arrayBuffer, options) => parseCartoPropertiesTile(arrayBuffer, options),
parseSync: parseCartoPropertiesTile,
options: DEFAULT_OPTIONS
options: DEFAULT_OPTIONS as StrictLoaderOptions
};

function parseCartoPropertiesTile(arrayBuffer: ArrayBuffer, options?: LoaderOptions): Tile | null {
Expand Down
6 changes: 3 additions & 3 deletions modules/carto/src/layers/schema/carto-raster-tile-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
import {LoaderOptions, LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';
import type {RasterMetadata} from '@carto/api-client';

import {TileReader} from './carto-raster-tile';
Expand All @@ -20,12 +20,12 @@ type CartoRasterTileLoaderOptions = LoaderOptions & {
};
};

const DEFAULT_OPTIONS: CartoRasterTileLoaderOptions = {
const DEFAULT_OPTIONS = {
cartoRasterTile: {
metadata: null,
workerUrl: getWorkerUrl(id, VERSION)
}
};
} as const satisfies CartoRasterTileLoaderOptions;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try making the interface updates consistent?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type fixes were done based on earlier comments from @ibgreen - if you like open a follow-up PR to discuss, but I'm not going to address in this PR in order to get it merged


const CartoRasterTileLoader: LoaderWithParser = {
name: 'CARTO Raster Tile',
Expand Down
4 changes: 2 additions & 2 deletions modules/carto/src/layers/schema/carto-spatial-tile-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
import {LoaderOptions, LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';

import {Tile, TileReader} from './carto-spatial-tile';
import {parsePbf} from './tile-loader-utils';
Expand Down Expand Up @@ -38,7 +38,7 @@ const CartoSpatialTileLoader: LoaderWithParser = {
parseCartoSpatialTile(arrayBuffer, options),
parseSync: parseCartoSpatialTile,
worker: true,
options: DEFAULT_OPTIONS
options: DEFAULT_OPTIONS as StrictLoaderOptions
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

};

function parseCartoSpatialTile(
Expand Down
6 changes: 3 additions & 3 deletions modules/carto/src/layers/schema/carto-vector-tile-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Copyright (c) vis.gl contributors

import earcut from 'earcut';
import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
import {LoaderOptions, LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';
import type {BinaryFeatureCollection, BinaryPolygonFeature, TypedArray} from '@loaders.gl/schema';

import {TileReader} from './carto-tile';
Expand All @@ -19,11 +19,11 @@ type CartoVectorTileLoaderOptions = LoaderOptions & {
};
};

const DEFAULT_OPTIONS: CartoVectorTileLoaderOptions = {
const DEFAULT_OPTIONS = {
cartoVectorTile: {
workerUrl: getWorkerUrl(id, VERSION)
}
};
} as const satisfies CartoVectorTileLoaderOptions;

const CartoVectorTileLoader: LoaderWithParser = {
name: 'CARTO Vector Tile',
Expand Down
4 changes: 2 additions & 2 deletions modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"prepublishOnly": "npm run build-debugger && npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@loaders.gl/core": "^4.3.4",
"@loaders.gl/images": "^4.3.4",
"@loaders.gl/core": "^4.4.0-alpha.16",
"@loaders.gl/images": "^4.4.0-alpha.16",
"@luma.gl/constants": "^9.2.6",
"@luma.gl/core": "^9.2.6",
"@luma.gl/engine": "^9.2.6",
Expand Down
9 changes: 6 additions & 3 deletions modules/core/src/lib/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ const defaultProps: DefaultProps<LayerProps> = {
if (signal) {
loadOptions = {
...loadOptions,
fetch: {
...loadOptions?.fetch,
signal
core: {
...loadOptions?.core,
fetch: {
...loadOptions?.core?.fetch,
signal
}
}
};
}
Expand Down
Loading
Loading