diff --git a/README.md b/README.md index 12f0753..c13c95b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,18 @@ Standalone examples exist in the [`examples/`](examples/) directory. Create an i More hosted examples on Observable are planned. +## Importing individual layers + +Every layer is exported from the package root. Each layer is also available from its own subpath, named after its module: + +```ts +import { GeoArrowPathLayer } from "@geoarrow/deck.gl-geoarrow/layers/path-layer"; +import { GeoArrowPolygonLayer } from "@geoarrow/deck.gl-geoarrow/layers/polygon-layer"; +import { GeoArrowScatterplotLayer } from "@geoarrow/deck.gl-geoarrow/layers/scatterplot-layer"; +``` + +Importing from a subpath means your bundler only resolves the dependencies of the layers you use. For example, the imports above never load `@deck.gl/geo-layers` (used by the A5, Geohash, H3 hexagon, S2, and trips layers) or `@deck.gl/aggregation-layers` (used by the heatmap layer). + ## Providing accessors All deck.gl layers have two types of properties: ["Render Options"](https://deck.gl/docs/api-reference/layers/scatterplot-layer#render-options) — constant properties across a layer — and "Data Accessors" — properties that can vary across rows. An accessor is any property prefixed with `get`, like `GeoArrowScatterplotLayer`'s `getFillColor`. diff --git a/packages/deck.gl-geoarrow/package.json b/packages/deck.gl-geoarrow/package.json index 3cb44e0..f6c621f 100644 --- a/packages/deck.gl-geoarrow/package.json +++ b/packages/deck.gl-geoarrow/package.json @@ -9,7 +9,12 @@ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" - } + }, + "./layers/*": { + "types": "./dist/layers/*.d.ts", + "default": "./dist/layers/*.js" + }, + "./layers/text-layer": null }, "sideEffects": false, "files": [