) {
3 | if (props[opt] === undefined || !validProps.includes(opt)) {
4 | delete props[opt]
5 | }
6 | }
7 |
8 | return props
9 | }
10 |
--------------------------------------------------------------------------------
/packages/google-maps/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@vue/tsconfig/tsconfig.dom.json",
3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.ts"],
4 | "exclude": ["src/**/__tests__/*", "node_modules/**", "dist", "../../node_modules"],
5 | "compilerOptions": {
6 | "baseUrl" : ".",
7 | "target" : "ESNext",
8 | "useDefineForClassFields": true,
9 | "module" : "ESNext",
10 | "moduleResolution" : "Node",
11 | "strict" : true,
12 | "jsx" : "preserve",
13 | "sourceMap" : true,
14 | "resolveJsonModule" : true,
15 | "esModuleInterop" : true,
16 | "isolatedModules" : true,
17 | "newLine" : "lf",
18 | "tsBuildInfoFile" : "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
19 | "skipLibCheck" : true,
20 | "paths": {
21 | "@/*": ["./src/*"]
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/packages/google-maps/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | {
5 | "path": "./tsconfig.node.json"
6 | },
7 | {
8 | "path": "./tsconfig.app.json"
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/packages/google-maps/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/node22/tsconfig.json",
3 | "include": [
4 | "vite.config.*",
5 | "vitest.config.*",
6 | "cypress.config.*",
7 | "nightwatch.conf.*",
8 | "playwright.config.*",
9 | "eslint.config.*"
10 | ],
11 | "compilerOptions": {
12 | "noEmit": true,
13 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
14 |
15 | "module": "ESNext",
16 | "moduleResolution": "Bundler",
17 | "types": ["node"]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/packages/google-maps/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { fileURLToPath, URL } from 'node:url'
2 |
3 | import { defineConfig, type PluginOption } from 'vite'
4 | import vue from '@vitejs/plugin-vue'
5 | import vueDevTools from 'vite-plugin-vue-devtools'
6 | import { resolve } from 'path'
7 | import dtsPlugin from 'vite-plugin-dts'
8 |
9 | // https://vite.dev/config/
10 | export default defineConfig({
11 | plugins: [
12 | vue() as PluginOption,
13 | dtsPlugin({
14 | entryRoot: './src',
15 | insertTypesEntry: true, // Ensure types are included in "exports" in package.json
16 | tsconfigPath: './tsconfig.app.json', // Point explicitly to the correct tsconfig
17 | rollupTypes: true, // Use rollup to bundle declaration files
18 | outDir: 'dist', // Place all declarations in the "dist" folder
19 | }) as PluginOption,
20 | vueDevTools() as PluginOption,
21 | ],
22 | resolve: {
23 | alias: {
24 | '@': fileURLToPath(new URL('./src', import.meta.url))
25 | },
26 | },
27 | build: {
28 | lib: {
29 | entry: resolve(__dirname, 'src/main.ts'),
30 | name: 'VueDeckGLSuiteGoogleMaps',
31 | fileName: (format) => `vue-deckgl-suite-google-maps.${format}.js`,
32 | },
33 | rollupOptions: {
34 | external: [
35 | 'vue',
36 | '@deck.gl/core',
37 | '@deck.gl/google-maps',
38 |
39 | ],
40 | output: {
41 | globals: {
42 | vue: 'Vue',
43 | }
44 | }
45 | }
46 | }
47 |
48 | })
49 |
--------------------------------------------------------------------------------
/packages/google-maps/web-types.config.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | componentsRoot: './src/components',
3 | components: '**/[a-zA-Z]*.(component|layer).ts',
4 | }
5 |
--------------------------------------------------------------------------------
/packages/layers/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
2 | charset = utf-8
3 | indent_size = 2
4 | indent_style = space
5 | insert_final_newline = true
6 | trim_trailing_whitespace = true
7 |
8 | end_of_line = lf
9 | max_line_length = 100
10 |
--------------------------------------------------------------------------------
/packages/layers/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto eol=lf
2 |
--------------------------------------------------------------------------------
/packages/layers/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | .DS_Store
12 | dist
13 | dist-ssr
14 | coverage
15 | *.local
16 |
17 | /cypress/videos/
18 | /cypress/screenshots/
19 |
20 | # Editor directories and files
21 | .vscode/*
22 | !.vscode/extensions.json
23 | .idea
24 | *.suo
25 | *.ntvs*
26 | *.njsproj
27 | *.sln
28 | *.sw?
29 |
30 | *.tsbuildinfo
31 |
--------------------------------------------------------------------------------
/packages/layers/.prettierrc.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "$schema": "https://json.schemastore.org/prettierrc",
4 | "semi": false,
5 | "singleQuote": true,
6 | "printWidth": 100
7 | }
8 |
--------------------------------------------------------------------------------
/packages/layers/README.md:
--------------------------------------------------------------------------------
1 | # @vue-deckgl-suite/layers
2 |
3 | The **[@vue-deckgl-suite](https://github.com/MostafaGamalSayed/vue-deck.gl-suite)** monorepo is built to provide a seamless integration of **Deck.gl** and **Vue-based applications**, enabling the development of high-performance geospatial visualizations with ease. It consists of a series of modular packages that work together to support various basemaps and visualization use cases.
4 |
5 | The `@vue-deckgl-suite/layers` package introduces **declarative Vue components** for defining and rendering **Deck.gl** layers. This approach simplifies the process of adding complex geospatial visualizations to your Vue applications, aligning closely with Vue's component-based architecture.
6 |
7 | ---
8 |
9 | ## Important Note: Basemap Package Required
10 |
11 | The `@vue-deckgl-suite/layers` package **must be used along with one of the supported basemap packages** to provide a valid context for rendering Deck.gl visualizations. You can choose one of the following basemap packages:
12 |
13 | 1. [`@vue-deckgl-suite/maplibre`](https://vue-deckgl-suite.wakeb.tech/maplibre/): For rendering basemaps using **MapLibre GL**.
14 | 2. [`@vue-deckgl-suite/google-maps`](https://vue-deckgl-suite.wakeb.tech/google-maps/): For rendering basemaps using **Google Maps**.
15 |
16 | Both basemap packages seamlessly integrate with `@vue-deckgl-suite/layers` to provide an easy-to-use and performant geospatial visualization solution.
17 |
18 | ---
19 |
20 | ## Installation
21 |
22 | Install the `@vue-deckgl-suite/layers` package along with a basemap package of your choice.
23 |
24 | ### 1. Install the Layers Package
25 | ```bash
26 | # With npm
27 | npm install @vue-deckgl-suite/layers
28 |
29 | # Or with yarn
30 | yarn add @vue-deckgl-suite/layers
31 |
32 | # Or with pnpm
33 | pnpm add @vue-deckgl-suite/layers
34 | ```
35 |
36 | ### 2. Install a Basemap Package
37 | You must also install one of the supported basemap packages depending on your project's requirements.
38 |
39 | #### For MapLibre:
40 | ```bash
41 | # With npm
42 | npm install @vue-deckgl-suite/maplibre maplibre-gl
43 |
44 | # Or with yarn
45 | yarn add @vue-deckgl-suite/maplibre maplibre-gl
46 |
47 | # Or with pnpm
48 | pnpm add @vue-deckgl-suite/maplibre maplibre-gl
49 | ```
50 |
51 | #### For Google Maps:
52 | ```bash
53 | # With npm
54 | npm install @vue-deckgl-suite/google-maps
55 |
56 | # Or with yarn
57 | yarn add @vue-deckgl-suite/google-maps
58 |
59 | # Or with pnpm
60 | pnpm add @vue-deckgl-suite/google-maps
61 | ```
62 |
63 | ### 3. Install Peer Dependencies
64 | The `@vue-deckgl-suite/layers` package relies on the following `deck.gl` core dependencies:
65 |
66 | ```bash
67 | npm install @deck.gl/core @deck.gl/layers @deck.gl/geo-layers @deck.gl/aggregation-layers
68 | ```
69 |
70 | ---
71 |
72 | ## Documentation
73 |
74 | For more information about available layers, supported basemaps, and future integrations, refer to the full documentation of the **[@vue-deckgl-suite](https://vue-deckgl-suite.wakeb.tech/)** package.
75 |
76 | ---
77 |
78 | ## Usage Scenarios
79 |
80 | Depending on the combination of packages and the basemap providers used, you can utilize **declarative Vue syntax** to define Deck.gl layers as child components of the `DeckGL` overlay. Example:
81 |
82 | ```vue
83 |
89 |
90 |
91 |
92 |
101 |
113 |
114 |
115 | ```
116 |
117 | With this approach, the **`@vue-deckgl-suite/layers`** package simplifies configuration by allowing each layer to be treated as a standalone Vue component. Props passed to each component map directly to Deck.gl class attributes.
118 |
119 | ---
120 |
121 | For more examples and guides, visit the **[official documentation →](https://vue-deckgl-suite.wakeb.tech)**.
--------------------------------------------------------------------------------
/packages/layers/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite App
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/packages/layers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vue-deckgl-suite/layers",
3 | "description": "Provides Deck.gl layers as Vue 3 components for creating interactive and high-performance geospatial visualizations.",
4 | "version": "1.0.0-beta.4",
5 | "author": {
6 | "name": "Mostafa Gamal",
7 | "email": "mostafagamal99418@gmail.com"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/MostafaGamalSayed/vue-deck.gl-suite.git"
12 | },
13 | "keywords": [
14 | "deckgl",
15 | "geo-layers",
16 | "aggregation-layers",
17 | "deckgl vue wrapper",
18 | "wrapper",
19 | "maplibre",
20 | "map",
21 | "vue3",
22 | "Vue.js",
23 | "layers",
24 | "components"
25 | ],
26 | "publishConfig": {
27 | "access": "public"
28 | },
29 | "type": "module",
30 | "main": "dist/vue-deckgl-suite-layers.umd.js",
31 | "module": "dist/vue-deckgl-suite-layers.es.js",
32 | "types": "dist/main.d.ts",
33 | "web-types": "dist/web-types.json",
34 | "files": [
35 | "dist/**/*",
36 | "src/**/*"
37 | ],
38 | "scripts": {
39 | "dev": "vite",
40 | "build": "run-p type-check \"build-only {@}\" --",
41 | "preview": "vite preview",
42 | "build-only": "vite build && vue-docgen-web-types --configFile web-types.config.cjs",
43 | "type-check": "vue-tsc --build",
44 | "lint": "eslint . --fix",
45 | "format": "prettier --write src/"
46 | },
47 | "devDependencies": {
48 | "@deck.gl/aggregation-layers": "^9.1.8",
49 | "@deck.gl/core": "^9.1.8",
50 | "@deck.gl/geo-layers": "^9.1.8",
51 | "@deck.gl/layers": "^9.1.8",
52 | "@tsconfig/node22": "^22.0.0",
53 | "@types/node": "^22.10.7",
54 | "@vitejs/plugin-vue": "^5.2.1",
55 | "@vue/eslint-config-prettier": "^10.1.0",
56 | "@vue/eslint-config-typescript": "^14.3.0",
57 | "@vue/tsconfig": "^0.7.0",
58 | "eslint": "^9.18.0",
59 | "eslint-plugin-vue": "^9.32.0",
60 | "jiti": "^2.4.2",
61 | "npm-run-all2": "^7.0.2",
62 | "prettier": "^3.4.2",
63 | "typescript": "~5.7.3",
64 | "vite": "^6.0.11",
65 | "vite-plugin-dts": "^4.5.0",
66 | "vite-plugin-vue-devtools": "^7.7.0",
67 | "vue": "^3.5.13",
68 | "vue-docgen-web-types": "^0.1.8",
69 | "vue-tsc": "^2.2.0"
70 | },
71 | "peerDependencies": {
72 | "@deck.gl/aggregation-layers": "^9.1.3",
73 | "@deck.gl/core": "^9.1.3",
74 | "@deck.gl/geo-layers": "^9.1.3",
75 | "@deck.gl/layers": "^9.1.3",
76 | "vue": "^3.5.13"
77 | },
78 | "engines": {
79 | "node": ">=18"
80 | },
81 | "gitHead": "6748997e3584871bafea9f3d997dac136d4e8563"
82 | }
83 |
--------------------------------------------------------------------------------
/packages/layers/src/components/index.ts:
--------------------------------------------------------------------------------
1 | export { default as ArcLayer } from '@/components/layers/arc.layer.ts'
2 | export { default as ColumnLayer } from '@/components/layers/column.layer.ts'
3 | export { default as GeoJsonLayer } from '@/components/layers/geojson.layer.ts'
4 | export { default as PathLayer } from '@/components/layers/path.layer.ts'
5 | export { default as TripsLayer } from '@/components/layers/trips.layer.ts'
6 | export { default as WMSLayer } from '@/components/layers/wms.layer.ts'
7 | export { default as HexagonLayer } from '@/components/layers/hexagon.layer.ts'
8 | export { default as IconLayer } from '@/components/layers/icon.layer.ts'
9 | export { default as GridLayer } from '@/components/layers/grid.layer.ts'
10 | export { default as PointCloudLayer } from '@/components/layers/point-cloud.layer.ts'
11 | export { default as PolygonLayer } from '@/components/layers/polygon.layer.ts'
12 | export { default as ContourLayer } from '@/components/layers/contour.layer.ts'
13 | export { default as ScatterplotLayer } from '@/components/layers/scatterplot.layer.ts'
14 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/arc.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { arcLayerProps, arcPropsKeys } from '@/lib/layers/arc.lib.ts'
3 | import { ArcLayer, type ArcLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'ArcLayer',
8 | props: { ...arcLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: ArcLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new ArcLayer(opts), // Layer factory function
14 | props,
15 | arcPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/column.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { columnLayerProps, columnPropsKeys } from '@/lib/layers/column.lib.ts'
3 | import { ColumnLayer, type ColumnLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'ColumnLayer',
8 | props: { ...columnLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: ColumnLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new ColumnLayer(opts), // Layer factory function
14 | props,
15 | columnPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/contour.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { contourLayerProps, contourPropsKeys } from '@/lib/layers/contour.lib.ts'
3 | import { ContourLayer, type ContourLayerProps } from '@deck.gl/aggregation-layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'ContourLayer',
8 | props: { ...contourLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: ContourLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new ContourLayer(opts as any), // Layer factory function
14 | props,
15 | contourPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/geojson.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { geoJsonLayerProps, geoJsonPropsKeys } from '@/lib/layers/geojson.lib.ts'
3 | import { GeoJsonLayer, type GeoJsonLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'GeoJsonLayer',
8 | props: { ...geoJsonLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new GeoJsonLayer(opts), // Layer factory function
14 | props as GeoJsonLayerProps,
15 | geoJsonPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/grid.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { gridLayerProps, gridPropsKeys } from '@/lib/layers/grid.lib.ts'
3 | import { GridLayer, type GridLayerProps } from '@deck.gl/aggregation-layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'GridLayer',
8 | props: { ...gridLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: GridLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new GridLayer(opts as any), // Layer factory function
14 | props,
15 | gridPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/heatmap.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { heatmapLayerProps, heatmapPropsKeys } from '@/lib/layers/heatmap.lib.ts'
3 | import { HeatmapLayer, type HeatmapLayerProps } from '@deck.gl/aggregation-layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'HeatmapLayer',
8 | props: { ...heatmapLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: HeatmapLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new HeatmapLayer(opts as any), // Layer factory function
14 | props,
15 | heatmapPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/hexagon.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent, type Ref, ref } from 'vue'
2 | import { hexagonLayerProps, hexagonPropsKeys } from '@/lib/layers/hexagon.lib.ts'
3 | import { HexagonLayer, type HexagonLayerProps } from '@deck.gl/aggregation-layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'HexagonLayer',
8 | props: { ...hexagonLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: HexagonLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new HexagonLayer(opts as any), // Layer factory function
14 | props,
15 | hexagonPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/icon.layer.ts:
--------------------------------------------------------------------------------
1 | import { iconLayerProps, iconPropsKeys } from '@/lib/layers/icon.lib.ts'
2 | import { IconLayer, type IconLayerProps } from '@deck.gl/layers'
3 | import { defineComponent } from 'vue'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'IconLayer',
8 | props: { ...iconLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: IconLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new IconLayer(opts as any), // Layer factory function
14 | props,
15 | iconPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/path.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { pathLayerProps, pathPropsKeys } from '@/lib/layers/path.lib.ts'
3 | import { PathLayer, type PathLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'PathLayer',
8 | props: { ...pathLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: PathLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new PathLayer(opts as any), // Layer factory function
14 | props,
15 | pathPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/point-cloud.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { pointCloudProps, pointCloudPropsKeys } from '@/lib/layers/point-cloud.lib.ts'
3 | import { PointCloudLayer, type PointCloudLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'PointCloudLayer',
8 | props: { ...pointCloudProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: PointCloudLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new PointCloudLayer(opts), // Layer factory function
14 | props,
15 | pointCloudPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/polygon.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { polygonLayerProps, polygonPropsKeys } from '@/lib/layers/polygon.lib.ts'
3 | import { PolygonLayer, type PolygonLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'PolygonLayer',
8 | props: { ...polygonLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: PolygonLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new PolygonLayer(opts), // Layer factory function
14 | props,
15 | polygonPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/scatterplot.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { scatterplotLayerProps, scatterplotPropsKeys } from '@/lib/layers/scatterplot.lib.ts'
3 | import { ScatterplotLayer, type ScatterplotLayerProps } from '@deck.gl/layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'ScatterplotLayer',
8 | props: { ...scatterplotLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: ScatterplotLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new ScatterplotLayer(opts), // Layer factory function
14 | props,
15 | scatterplotPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/tile3d.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { useLayer } from '@/composables/useLayer.ts'
3 | import { tile3DLayerProps, tile3DPropsKeys } from '@/lib/layers/tile3d.lib.ts'
4 | import { type Tile3DLayerProps, Tile3DLayer } from '@deck.gl/geo-layers'
5 |
6 | export default defineComponent({
7 | name: 'Tile3DLayer',
8 | props: { ...tile3DLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: Tile3DLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new Tile3DLayer(opts as any), // Layer factory function
14 | props,
15 | tile3DPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/trips.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { TripsLayer, type TripsLayerProps } from '@deck.gl/geo-layers'
3 | import { useLayer } from '@/composables/useLayer.ts'
4 | import { tripsLayerProps, tripsPropsKeys } from '@/lib/layers/trips.lib.ts'
5 |
6 | export default defineComponent({
7 | name: 'TripsLayer',
8 | props: { ...tripsLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: TripsLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new TripsLayer(opts as any), // Layer factory function
14 | props,
15 | tripsPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/components/layers/wms.layer.ts:
--------------------------------------------------------------------------------
1 | import { defineComponent } from 'vue'
2 | import { wmsLayerProps, wmsPropsKeys } from '@/lib/layers/wms.lib.ts'
3 | import { _WMSLayer, type WMSLayerProps } from '@deck.gl/geo-layers'
4 | import { useLayer } from '@/composables/useLayer.ts'
5 |
6 | export default defineComponent({
7 | name: 'WMSLayer',
8 | props: { ...wmsLayerProps },
9 | emits: ['hover', 'click', 'drag', 'dragStart', 'dragEnd', 'dataLoad', 'error'],
10 | setup(props: WMSLayerProps, { emit, expose }) {
11 | // Use `useLayer` for layer lifecycle management
12 | const { layer } = useLayer(
13 | (opts) => new _WMSLayer(opts as any), // Layer factory function
14 | props,
15 | wmsPropsKeys,
16 | emit,
17 | )
18 |
19 | // Expose the layer reference for external use
20 | expose({ layer })
21 |
22 | return () => [] // Renderless component
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/packages/layers/src/composables/useLayer.ts:
--------------------------------------------------------------------------------
1 | import type { Layer } from '@deck.gl/core'
2 | import { inject, markRaw, onUnmounted, ref, type Ref, watch } from 'vue'
3 | import type { DeckLayerProps } from '@/shared/types.ts'
4 | import { genDeckLayerOpts } from '@/utils'
5 |
6 | /**
7 | * A composable function to manage the lifecycle of a reactive Deck.gl layer.
8 | *
9 | * @param {function} layerFactory - A factory function that generates a new Deck.gl `Layer` instance.
10 | * @param props - Reactive props used to configure the `Layer`.
11 | * @param validProps - List of valid prop keys to transform into layer options.
12 | * @param emit - Emit function for Vue component events.
13 | */
14 | export const useLayer = (
15 | layerFactory: (options: Partial
) => Layer,
16 | props: P,
17 | validProps: Array,
18 | emit: (
19 | event: 'click' | 'hover' | 'drag' | 'dragStart' | 'dragEnd' | 'error' | 'dataLoad',
20 | ...args: any[]
21 | ) => void,
22 | ) => {
23 | // References to the current Deck.gl layer and layer management functions
24 | const addLayer = inject('addLayer') as (layer: Layer) => void
25 | const removeLayer = inject('removeLayer') as (layer: Layer) => void
26 | const layer: Ref = ref(null)
27 |
28 | if (!addLayer || !removeLayer) {
29 | throw new Error(
30 | 'DeckGL context is missing. Ensure you are using this within a DeckGL parent component.',
31 | )
32 | }
33 |
34 | /**
35 | * Create or update the layer based on the current props
36 | */
37 | const initializeLayer = () => {
38 | const opts: any = genDeckLayerOpts({ ...props }, validProps, emit)
39 |
40 | // Remove the previous layer if it exists from the registered layers of the overlay
41 | if (layer.value) {
42 | removeLayer(layer.value)
43 | layer.value = null
44 | }
45 |
46 | // Create a new layer and register it
47 | layer.value = markRaw(layerFactory(opts))
48 | addLayer(layer.value)
49 | }
50 |
51 | /**
52 | * Cleanup and finalize the current layer
53 | */
54 | const destroyLayer = () => {
55 | if (layer.value) {
56 | try {
57 | removeLayer(layer.value) // Remove the layer from Deck.gl
58 | if (layer.value.context) {
59 | layer.value.finalizeState(layer.value.context) // Release GPU memory
60 | }
61 | layer.value = null
62 | } catch (error) {
63 | console.error('Error finalizing layer:', error)
64 | }
65 | }
66 | }
67 |
68 | // Watch for prop changes and update the layer reactively
69 | watch(
70 | props,
71 | () => {
72 | initializeLayer()
73 | },
74 | { deep: true, immediate: true },
75 | )
76 |
77 | // Clean up the layer when the component is unmounted
78 | onUnmounted(destroyLayer)
79 |
80 | return {
81 | layer,
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/arc.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type ArcLayerProps } from '@deck.gl/layers'
4 |
5 | export const arcLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | greatCircle: {
8 | type: Boolean as PropType,
9 | default: false,
10 | },
11 | numSegments: {
12 | type: Number as PropType,
13 | default: 50,
14 | },
15 | widthUnits: {
16 | type: String as PropType,
17 | default: 'pixels',
18 | },
19 | widthScale: {
20 | type: Number as PropType,
21 | default: 1,
22 | },
23 | widthMinPixels: {
24 | type: Number as PropType,
25 | default: 0,
26 | },
27 | widthMaxPixels: {
28 | type: Number as PropType,
29 | default: Number.MAX_SAFE_INTEGER,
30 | },
31 | getSourcePosition: {
32 | type: Function as unknown as PropType,
33 | default: (x: any) => x?.sourcePosition,
34 | },
35 | getTargetPosition: {
36 | type: Function as unknown as PropType,
37 | default: (x: any) => x?.targetPosition,
38 | },
39 | getSourceColor: {
40 | type: Function as unknown as PropType,
41 | default: () => [0, 0, 0, 255],
42 | },
43 | getTargetColor: {
44 | type: Function as unknown as PropType,
45 | default: () => [0, 0, 0, 255],
46 | },
47 | getWidth: {
48 | type: Number as PropType,
49 | default: 1,
50 | },
51 | getHeight: {
52 | type: Number as PropType,
53 | default: 1,
54 | },
55 | getTilt: {
56 | type: Number as PropType,
57 | default: 0,
58 | },
59 | }
60 | export const arcPropsKeys: (keyof ArcLayerProps)[] = [
61 | ...baseLayerKeys,
62 | 'greatCircle',
63 | 'numSegments',
64 | 'widthUnits',
65 | 'widthScale',
66 | 'widthMinPixels',
67 | 'widthMaxPixels',
68 | 'getSourcePosition',
69 | 'getTargetPosition',
70 | 'getSourceColor',
71 | 'getTargetColor',
72 | 'getWidth',
73 | 'getHeight',
74 | 'getTilt',
75 | ]
76 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/contour.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type ContourLayerProps } from '@deck.gl/aggregation-layers'
4 |
5 | export const contourLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | cellSize: {
8 | type: Number as PropType,
9 | default: 1000,
10 | },
11 | gpuAggregation: {
12 | type: Boolean as PropType,
13 | default: true,
14 | },
15 | aggregation: {
16 | type: String as PropType,
17 | default: 'SUM',
18 | },
19 | contours: {
20 | type: Array as PropType,
21 | default: () => [{ threshold: 1 }],
22 | },
23 | getPosition: {
24 | type: Function as unknown as PropType,
25 | default: (object: any) => object?.position,
26 | },
27 | getWeight: {
28 | type: Function as unknown as PropType,
29 | default: () => 1,
30 | },
31 | zOffset: {
32 | type: Number as PropType,
33 | default: 0.005,
34 | },
35 | }
36 |
37 | export const contourPropsKeys: (keyof ContourLayerProps)[] = [
38 | ...baseLayerKeys,
39 | 'cellSize',
40 | 'gpuAggregation',
41 | 'aggregation',
42 | 'contours',
43 | 'getPosition',
44 | 'getWeight',
45 | 'zOffset',
46 | ]
47 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/grid.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type GridLayerProps } from '@deck.gl/aggregation-layers'
4 |
5 | export const gridLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | gpuAggregation: {
8 | type: Boolean as PropType,
9 | default: false,
10 | },
11 | colorAggregation: {
12 | type: String as PropType,
13 | default: 'SUM',
14 | },
15 | elevationAggregation: {
16 | type: String as PropType,
17 | default: 'SUM',
18 | },
19 | gridAggregator: {
20 | type: Function as unknown as PropType,
21 | default: null,
22 | },
23 | colorScaleType: {
24 | type: String as PropType,
25 | default: 'quantile',
26 | },
27 | cellSize: {
28 | type: Number as PropType,
29 | default: 1000,
30 | },
31 | colorDomain: {
32 | type: Array as unknown as PropType,
33 | default: null,
34 | },
35 | colorRange: {
36 | type: Array as PropType,
37 | },
38 | coverage: {
39 | type: Number as PropType,
40 | default: 1,
41 | },
42 | elevationDomain: {
43 | type: Array as unknown as PropType,
44 | },
45 | elevationScale: {
46 | type: Number as PropType,
47 | default: 1,
48 | },
49 | elevationScaleType: {
50 | type: String as PropType,
51 | default: 'linear',
52 | },
53 | elevationRange: {
54 | type: Array as unknown as PropType,
55 | default: [0, 1000],
56 | },
57 | extruded: {
58 | type: Boolean as PropType,
59 | default: true,
60 | },
61 | upperPercentile: {
62 | type: Number as PropType,
63 | default: 100,
64 | },
65 | lowerPercentile: {
66 | type: Number as PropType,
67 | default: 0,
68 | },
69 | elevationUpperPercentile: {
70 | type: Number as PropType,
71 | default: 100,
72 | },
73 | elevationLowerPercentile: {
74 | type: Number as PropType,
75 | default: 0,
76 | },
77 | getPosition: {
78 | type: Function as unknown as PropType,
79 | default: (x: any) => x?.position,
80 | },
81 | getColorWeight: {
82 | type: [Function, Number] as PropType,
83 | default: 1,
84 | },
85 | getColorValue: {
86 | type: Function as unknown as PropType,
87 | default: null,
88 | },
89 | getElevationWeight: {
90 | type: [Function, Number] as PropType,
91 | default: 1,
92 | },
93 | getElevationValue: {
94 | type: Function as unknown as PropType,
95 | default: null,
96 | },
97 | material: {
98 | type: Boolean as PropType,
99 | default: true,
100 | },
101 | onSetColorDomain: Function as unknown as PropType,
102 | onSetElevationDomain: Function as unknown as PropType,
103 | }
104 |
105 | export const gridPropsKeys: (keyof GridLayerProps)[] = [
106 | ...baseLayerKeys,
107 | 'gpuAggregation',
108 | 'colorAggregation',
109 | 'elevationAggregation',
110 | 'gridAggregator',
111 | 'colorScaleType',
112 | 'cellSize',
113 | 'colorDomain',
114 | 'colorRange',
115 | 'coverage',
116 | 'elevationDomain',
117 | 'elevationScale',
118 | 'elevationScaleType',
119 | 'elevationRange',
120 | 'extruded',
121 | 'upperPercentile',
122 | 'lowerPercentile',
123 | 'elevationUpperPercentile',
124 | 'elevationLowerPercentile',
125 | 'getPosition',
126 | 'getColorWeight',
127 | 'getColorValue',
128 | 'getElevationWeight',
129 | 'getElevationValue',
130 | 'material',
131 | 'onSetColorDomain',
132 | 'onSetElevationDomain',
133 | ]
134 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/heatmap.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type HeatmapLayerProps } from '@deck.gl/aggregation-layers'
4 |
5 | export const heatmapLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | intensity: {
8 | type: Number as PropType,
9 | default: 1,
10 | },
11 | radiusPixels: {
12 | type: Number as PropType,
13 | default: 30,
14 | },
15 | colorRange: {
16 | type: Array as unknown as PropType,
17 | },
18 | threshold: {
19 | type: Number as PropType,
20 | default: 0.05,
21 | },
22 | colorDomain: {
23 | type: Array as unknown as PropType,
24 | default: null,
25 | },
26 | aggregation: {
27 | type: String as PropType,
28 | default: 'SUM',
29 | },
30 | weightsTextureSize: {
31 | type: Number as PropType,
32 | default: 2048,
33 | },
34 | debounceTimeout: {
35 | type: Number as PropType,
36 | default: 500,
37 | },
38 | getPosition: {
39 | type: Function as PropType,
40 | default: (x: any) => x?.position,
41 | },
42 | getWeight: {
43 | type: [Function, Number] as PropType,
44 | default: 1,
45 | },
46 | }
47 |
48 | export const heatmapPropsKeys: (keyof HeatmapLayerProps)[] = [
49 | ...baseLayerKeys,
50 | 'intensity',
51 | 'radiusPixels',
52 | 'colorRange',
53 | 'threshold',
54 | 'colorDomain',
55 | 'aggregation',
56 | 'weightsTextureSize',
57 | 'debounceTimeout',
58 | 'getPosition',
59 | 'getWeight',
60 | ]
61 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/hexagon.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type HexagonLayerProps } from '@deck.gl/aggregation-layers'
4 |
5 | export const hexagonLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | gpuAggregation: {
8 | type: Boolean as PropType,
9 | default: false,
10 | },
11 | colorAggregation: {
12 | type: String as PropType,
13 | default: 'SUM',
14 | },
15 | elevationAggregation: {
16 | type: String as PropType,
17 | default: 'SUM',
18 | },
19 | hexagonAggregator: {
20 | type: Function as unknown as PropType,
21 | default: null,
22 | },
23 | radius: {
24 | type: Number as PropType,
25 | default: 1000,
26 | },
27 | elevationScale: {
28 | type: Number as PropType,
29 | default: 1,
30 | },
31 | coverage: {
32 | type: Number as PropType,
33 | default: 1,
34 | },
35 | lowerPercentile: {
36 | type: Number as PropType,
37 | default: 0,
38 | },
39 | upperPercentile: {
40 | type: Number as PropType,
41 | default: 100,
42 | },
43 | getPosition: {
44 | type: Function as unknown as PropType,
45 | default: (x: any) => x?.position,
46 | },
47 | getColorWeight: {
48 | type: [Function, Number] as PropType,
49 | default: 1,
50 | },
51 | getColorValue: {
52 | type: Function as unknown as PropType,
53 | default: null,
54 | },
55 | colorScaleType: {
56 | type: String as PropType,
57 | default: 'quantile',
58 | },
59 | colorDomain: {
60 | type: Array as unknown as PropType,
61 | default: null,
62 | },
63 | colorRange: {
64 | type: Array as unknown as PropType,
65 | },
66 | elevationScaleType: {
67 | type: String as PropType,
68 | default: 'linear',
69 | },
70 | elevationDomain: {
71 | type: Array as unknown as PropType,
72 | default: null,
73 | },
74 | elevationRange: {
75 | type: Array as unknown as PropType,
76 | default: [0, 1000],
77 | },
78 | elevationUpperPercentile: {
79 | type: Number as PropType,
80 | default: 100,
81 | },
82 | elevationLowerPercentile: {
83 | type: Number as PropType,
84 | default: 0,
85 | },
86 | material: {
87 | type: [Object, Boolean] as PropType,
88 | default: true,
89 | },
90 | extruded: {
91 | type: Boolean as PropType,
92 | default: false,
93 | },
94 | getElevationWeight: {
95 | type: [Function, Number] as PropType,
96 | default: 1,
97 | },
98 | }
99 |
100 | export const hexagonPropsKeys: (keyof HexagonLayerProps)[] = [
101 | ...baseLayerKeys,
102 | 'gpuAggregation',
103 | 'colorAggregation',
104 | 'elevationAggregation',
105 | 'hexagonAggregator',
106 | 'radius',
107 | 'elevationScale',
108 | 'coverage',
109 | 'lowerPercentile',
110 | 'upperPercentile',
111 | 'getPosition',
112 | 'getColorWeight',
113 | 'getColorValue',
114 | 'colorScaleType',
115 | 'colorDomain',
116 | 'colorRange',
117 | 'elevationScaleType',
118 | 'elevationDomain',
119 | 'elevationRange',
120 | 'elevationUpperPercentile',
121 | 'elevationLowerPercentile',
122 | 'material',
123 | 'getElevationWeight',
124 | 'extruded',
125 | ]
126 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/icon.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type IconLayerProps } from '@deck.gl/layers'
4 |
5 | export const iconLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | sizeScale: {
8 | type: Number as PropType,
9 | default: 1,
10 | },
11 | sizeUnits: {
12 | type: String as PropType,
13 | default: 'meters',
14 | },
15 | sizeMinPixels: {
16 | type: Number as PropType,
17 | default: 0,
18 | },
19 | sizeMaxPixels: {
20 | type: Number as PropType,
21 | default: Number.MAX_SAFE_INTEGER,
22 | },
23 | iconAtlas: {
24 | type: String as PropType,
25 | },
26 | iconMapping: {
27 | type: [Object, String] as PropType,
28 | },
29 | billboard: {
30 | type: Boolean as PropType,
31 | default: true,
32 | },
33 | alphaCutoff: {
34 | type: Number as PropType,
35 | default: 0.5,
36 | },
37 | loadOptions: {
38 | type: Object as PropType,
39 | },
40 | textureParameters: {
41 | type: Object as PropType,
42 | },
43 | getAngle: {
44 | type: [Function, Number] as PropType,
45 | default: 0,
46 | },
47 | getPosition: {
48 | type: Function as unknown as PropType,
49 | default: (x: any) => x?.position,
50 | },
51 | getSize: {
52 | type: [Function, Number] as PropType,
53 | default: 1,
54 | },
55 | getColor: {
56 | type: [Function, Array] as unknown as PropType,
57 | default: [255, 255, 255, 255],
58 | },
59 | getIcon: {
60 | type: Function as unknown as PropType,
61 | default: (x: any) => x?.icon,
62 | },
63 | onIconError: {
64 | type: Function as unknown as PropType,
65 | },
66 | }
67 |
68 | export const iconPropsKeys: (keyof IconLayerProps)[] = [
69 | ...baseLayerKeys,
70 | 'sizeScale',
71 | 'sizeUnits',
72 | 'sizeMinPixels',
73 | 'sizeMaxPixels',
74 | 'iconAtlas',
75 | 'iconMapping',
76 | 'billboard',
77 | 'alphaCutoff',
78 | 'loadOptions',
79 | 'textureParameters',
80 | 'getAngle',
81 | 'getPosition',
82 | 'getSize',
83 | 'getColor',
84 | 'getIcon',
85 | 'onIconError',
86 | ]
87 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/layer.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { COORDINATE_SYSTEM, type LayerProps } from '@deck.gl/core'
3 |
4 | export const baseLayerProps: ComponentPropsOptions = {
5 | // basic props
6 | id: {
7 | type: String as PropType,
8 | required: true,
9 | },
10 | data: {
11 | type: [Object, String] as PropType,
12 | },
13 | visible: {
14 | type: Boolean as PropType,
15 | default: true,
16 | },
17 | opacity: {
18 | type: Number as PropType,
19 | default: 1,
20 | },
21 | extensions: {
22 | type: Array as PropType,
23 | },
24 |
25 | // Interaction Properties
26 | pickable: {
27 | type: Boolean as PropType,
28 | default: false,
29 | },
30 | highlightColor: {
31 | type: [Array, Function] as PropType,
32 | default: () => [0, 0, 128, 128],
33 | },
34 | highlightedObjectIndex: {
35 | type: [Number, null] as PropType,
36 | default: null,
37 | },
38 | autoHighlight: {
39 | type: Boolean as PropType,
40 | default: false,
41 | },
42 |
43 | // Coordinate System Properties
44 | coordinateSystem: {
45 | type: Number as PropType,
46 | default: COORDINATE_SYSTEM.DEFAULT,
47 | },
48 | coordinateOrigin: {
49 | type: Array as unknown as PropType,
50 | default: () => [0, 0, 0],
51 | },
52 | wrapLongitude: {
53 | type: Boolean as PropType,
54 | default: false,
55 | },
56 | modelMatrix: {
57 | type: Array as unknown as PropType,
58 | default: undefined,
59 | },
60 |
61 | // data properties
62 | dataComparator: {
63 | type: Function as unknown as PropType,
64 | },
65 | _dataDiff: {
66 | type: Function as unknown as PropType,
67 | },
68 | dataTransform: {
69 | type: Function as unknown as PropType,
70 | default: undefined,
71 | },
72 | positionFormat: {
73 | type: String as PropType,
74 | default: 'XYZ',
75 | },
76 | colorFormat: {
77 | type: String as PropType,
78 | default: 'RGBA',
79 | },
80 | numInstances: {
81 | type: Number as PropType,
82 | default: undefined,
83 | },
84 | updateTriggers: {
85 | type: Object as PropType,
86 | },
87 | transitions: {
88 | type: Object as PropType,
89 | },
90 | }
91 | export const baseLayerKeys: (keyof LayerProps)[] = [
92 | 'id',
93 | 'data',
94 | 'visible',
95 | 'opacity',
96 | 'extensions',
97 | 'pickable',
98 | 'highlightColor',
99 | 'highlightedObjectIndex',
100 | 'autoHighlight',
101 | 'coordinateSystem',
102 | 'coordinateOrigin',
103 | 'wrapLongitude',
104 | 'modelMatrix',
105 | 'dataComparator',
106 | '_dataDiff',
107 | 'dataTransform',
108 | 'positionFormat',
109 | 'colorFormat',
110 | 'numInstances',
111 | 'transitions',
112 | ]
113 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/path.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import type { PathLayerProps } from '@deck.gl/layers'
4 |
5 | export const pathLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | widthUnits: {
8 | type: String as PropType,
9 | default: 'meters',
10 | },
11 | widthScale: {
12 | type: Number as PropType,
13 | default: 1,
14 | },
15 | widthMinPixels: {
16 | type: Number as PropType,
17 | default: 0,
18 | },
19 | widthMaxPixels: {
20 | type: Number as PropType,
21 | default: Number.MAX_SAFE_INTEGER,
22 | },
23 | jointRounded: {
24 | type: Boolean as PropType,
25 | default: false,
26 | },
27 | capRounded: {
28 | type: Boolean as PropType,
29 | default: false,
30 | },
31 | miterLimit: {
32 | type: Number as PropType,
33 | default: 4,
34 | },
35 | billboard: {
36 | type: Boolean as PropType,
37 | default: false,
38 | },
39 | _pathType: {
40 | type: String as PropType,
41 | default: null,
42 | },
43 | getPath: {
44 | type: Function as unknown as PropType,
45 | default: (object: any) => object.path,
46 | },
47 | getColor: {
48 | type: [Function, Array] as PropType,
49 | default: () => [0, 0, 0, 255],
50 | },
51 | getWidth: {
52 | type: [Function, Number] as PropType,
53 | default: 1,
54 | },
55 | }
56 |
57 | export const pathPropsKeys: (keyof PathLayerProps)[] = [
58 | ...baseLayerKeys,
59 | 'widthUnits',
60 | 'widthScale',
61 | 'widthMinPixels',
62 | 'widthMaxPixels',
63 | 'jointRounded',
64 | 'capRounded',
65 | 'miterLimit',
66 | 'billboard',
67 | '_pathType',
68 | 'getPath',
69 | 'getColor',
70 | 'getWidth',
71 | ]
72 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/point-cloud.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import type { PointCloudLayerProps } from '@deck.gl/layers'
4 |
5 | export const pointCloudProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | /**
8 | * The units of the point size, one of `'meters'`, `'common'`, and `'pixels'`.
9 | * @default 'pixels'
10 | */
11 | sizeUnits: {
12 | type: String as PropType,
13 | default: 'pixels',
14 | },
15 | /**
16 | * Global radius of all points, in units specified by `sizeUnits`
17 | * @default 10
18 | */
19 | pointSize: {
20 | type: Number as PropType,
21 | default: 10,
22 | },
23 |
24 | /**
25 | * Material settings for lighting effect.
26 | *
27 | * @default true
28 | * @see https://deck.gl/docs/developer-guide/using-lighting
29 | */
30 | material: {
31 | type: [Boolean, Object] as PropType,
32 | default: true,
33 | },
34 | /**
35 | * Method called to retrieve the position of each object.
36 | * @default object => object?.position
37 | */
38 | getPosition: {
39 | type: Function as PropType,
40 | default: (object: { position: any }) => object?.position,
41 | },
42 | /**
43 | * The normal of each object, in `[nx, ny, nz]`.
44 | * @default [0, 0, 1]
45 | */
46 | getNormal: {
47 | type: [Function, Array] as unknown as PropType,
48 | default: [0, 0, 1],
49 | },
50 | /**
51 | * The rgba color is in the format of `[r, g, b, [a]]`
52 | * @default [0, 0, 0, 255]
53 | */
54 | getColor: {
55 | type: [Function, Array] as unknown as PropType,
56 | default: [0, 0, 0, 255],
57 | },
58 | }
59 |
60 | export const pointCloudPropsKeys: (keyof PointCloudLayerProps)[] = [
61 | ...baseLayerKeys,
62 | 'sizeUnits',
63 | 'pointSize',
64 | 'material',
65 | 'getPosition',
66 | 'getNormal',
67 | 'getColor',
68 | ]
69 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/polygon.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type PolygonLayerProps } from '@deck.gl/layers'
4 |
5 | export const polygonLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | stroked: {
8 | type: Boolean as PropType,
9 | default: true,
10 | },
11 | filled: {
12 | type: Boolean as PropType,
13 | default: true,
14 | },
15 | extruded: {
16 | type: Boolean as PropType,
17 | default: false,
18 | },
19 | elevationScale: {
20 | type: Number as PropType,
21 | default: 1,
22 | },
23 | wireframe: {
24 | type: Boolean as PropType,
25 | default: false,
26 | },
27 | lineWidthUnits: {
28 | type: String as PropType,
29 | default: 'meters',
30 | },
31 | lineWidthScale: {
32 | type: Number as PropType,
33 | default: 1,
34 | },
35 | lineWidthMinPixels: {
36 | type: Number as PropType,
37 | default: 0,
38 | },
39 | lineWidthMaxPixels: {
40 | type: Number as PropType,
41 | default: Number.MAX_SAFE_INTEGER,
42 | },
43 | lineJointRounded: {
44 | type: Boolean as PropType,
45 | default: false,
46 | },
47 | lineMiterLimit: {
48 | type: Number as PropType,
49 | default: 4,
50 | },
51 | lineDashJustified: {
52 | type: Boolean as PropType,
53 | default: undefined, // Not directly defined
54 | },
55 | getPolygon: {
56 | type: Function as unknown as PropType,
57 | default: (f: any) => f.polygon,
58 | },
59 | getFillColor: {
60 | type: [Function, Array] as unknown as PropType,
61 | default: [0, 0, 0, 255],
62 | },
63 | getLineColor: {
64 | type: [Function, Array] as unknown as PropType,
65 | default: [0, 0, 0, 255],
66 | },
67 | getLineWidth: {
68 | type: [Function, Number] as unknown as PropType,
69 | default: 1,
70 | },
71 | getElevation: {
72 | type: [Function, Number] as unknown as PropType,
73 | default: 1000,
74 | },
75 | material: {
76 | type: [Object, Boolean] as PropType,
77 | default: true,
78 | },
79 | _normalize: {
80 | type: Boolean as PropType,
81 | default: true,
82 | },
83 | _windingOrder: {
84 | type: String as PropType,
85 | default: 'CW',
86 | },
87 | }
88 |
89 | export const polygonPropsKeys: (keyof PolygonLayerProps)[] = [
90 | ...baseLayerKeys,
91 | 'stroked',
92 | 'filled',
93 | 'extruded',
94 | 'elevationScale',
95 | 'wireframe',
96 | 'lineWidthUnits',
97 | 'lineWidthScale',
98 | 'lineWidthMinPixels',
99 | 'lineWidthMaxPixels',
100 | 'lineJointRounded',
101 | 'lineMiterLimit',
102 | 'lineDashJustified',
103 | 'getPolygon',
104 | 'getFillColor',
105 | 'getLineColor',
106 | 'getLineWidth',
107 | 'getElevation',
108 | 'material',
109 | '_normalize',
110 | '_windingOrder',
111 | ]
112 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/scatterplot.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type ScatterplotLayerProps } from '@deck.gl/layers'
4 |
5 | export const scatterplotLayerProps: ComponentPropsOptions = {
6 | ...baseLayerProps,
7 | radiusUnits: {
8 | type: String as PropType,
9 | default: 'meters',
10 | },
11 | radiusScale: {
12 | type: Number as PropType,
13 | default: 1,
14 | },
15 | radiusMinPixels: {
16 | type: Number as PropType,
17 | default: 0,
18 | },
19 | radiusMaxPixels: {
20 | type: Number as PropType,
21 | default: Number.MAX_SAFE_INTEGER,
22 | },
23 | lineWidthUnits: {
24 | type: String as PropType,
25 | default: 'meters',
26 | },
27 | lineWidthScale: {
28 | type: Number as PropType,
29 | default: 1,
30 | },
31 | lineWidthMinPixels: {
32 | type: Number as PropType,
33 | default: 0,
34 | },
35 | lineWidthMaxPixels: {
36 | type: Number as PropType,
37 | default: Number.MAX_SAFE_INTEGER,
38 | },
39 | stroked: {
40 | type: Boolean as PropType,
41 | default: false,
42 | },
43 | filled: {
44 | type: Boolean as PropType,
45 | default: true,
46 | },
47 | billboard: {
48 | type: Boolean as PropType,
49 | default: false,
50 | },
51 | antialiasing: {
52 | type: Boolean as PropType,
53 | default: true,
54 | },
55 | getPosition: {
56 | type: Function as unknown as PropType,
57 | default: (object: any) => object?.position,
58 | },
59 | getRadius: {
60 | type: [Function, Number] as unknown as PropType,
61 | default: 1,
62 | },
63 | getFillColor: {
64 | type: [Function, Array] as unknown as PropType,
65 | default: [0, 0, 0, 255],
66 | },
67 | getLineColor: {
68 | type: [Function, Array] as unknown as PropType,
69 | default: [0, 0, 0, 255],
70 | },
71 | getLineWidth: {
72 | type: [Function, Number] as unknown as PropType,
73 | default: 1,
74 | },
75 | }
76 |
77 | export const scatterplotPropsKeys: (keyof ScatterplotLayerProps)[] = [
78 | ...baseLayerKeys,
79 | 'radiusUnits',
80 | 'radiusScale',
81 | 'radiusMinPixels',
82 | 'radiusMaxPixels',
83 | 'lineWidthUnits',
84 | 'lineWidthScale',
85 | 'lineWidthMinPixels',
86 | 'lineWidthMaxPixels',
87 | 'stroked',
88 | 'filled',
89 | 'billboard',
90 | 'antialiasing',
91 | 'getPosition',
92 | 'getRadius',
93 | 'getFillColor',
94 | 'getLineColor',
95 | 'getLineWidth',
96 | ]
97 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/tile3d.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import type { Tile3DLayerProps } from '@deck.gl/geo-layers'
4 | import { Tiles3DLoader } from '@loaders.gl/3d-tiles'
5 |
6 | // Define Vue-style props for Tile3DLayer
7 | export const tile3DLayerProps: ComponentPropsOptions = {
8 | ...baseLayerProps,
9 | data: {
10 | type: String as PropType,
11 | default: undefined,
12 | },
13 | loadOptions: {
14 | type: Object as PropType,
15 | default: undefined,
16 | },
17 | getPointColor: {
18 | type: [Function, Array] as unknown as PropType,
19 | default: () => [0, 0, 0, 255],
20 | },
21 | pointSize: {
22 | type: Number as PropType,
23 | default: 1.0,
24 | },
25 |
26 | loader: {
27 | type: Object as PropType,
28 | default: Tiles3DLoader,
29 | },
30 | onTilesetLoad: {
31 | type: Function as PropType,
32 | default: undefined,
33 | },
34 | onTileLoad: {
35 | type: Function as PropType,
36 | default: undefined,
37 | },
38 | onTileUnload: {
39 | type: Function as PropType,
40 | default: undefined,
41 | },
42 | onTileError: {
43 | type: Function as PropType,
44 | default: undefined,
45 | },
46 | _getMeshColor: {
47 | type: Function as PropType,
48 | default: () => [255, 255, 255],
49 | },
50 | }
51 |
52 | // Define the keys for Tile3DLayer props to simplify further use
53 | export const tile3DPropsKeys: (keyof Tile3DLayerProps)[] = [
54 | ...baseLayerKeys,
55 | 'data',
56 | 'getPointColor',
57 | 'pointSize',
58 | 'loader',
59 | 'loadOptions',
60 | 'onTilesetLoad',
61 | 'onTileLoad',
62 | 'onTileUnload',
63 | 'onTileError',
64 | '_getMeshColor',
65 | ]
66 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/trips.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import type { TripsLayerProps } from '@deck.gl/geo-layers'
3 | import { pathLayerProps, pathPropsKeys } from '@/lib/layers/path.lib.ts'
4 |
5 | // Define Vue-style props for TripsLayer
6 | export const tripsLayerProps: ComponentPropsOptions = {
7 | ...pathLayerProps,
8 | fadeTrail: {
9 | type: Boolean as PropType,
10 | default: true,
11 | },
12 | trailLength: {
13 | type: Number as PropType,
14 | default: 120,
15 | },
16 | currentTime: {
17 | type: Number as PropType,
18 | default: 0,
19 | },
20 | getTimestamps: {
21 | type: Function as PropType,
22 | default: (d: any) => d.timestamps,
23 | },
24 | }
25 |
26 | // Define the keys for TripsLayer props to simplify further use
27 | export const tripsPropsKeys: (keyof TripsLayerProps)[] = [
28 | ...pathPropsKeys,
29 | 'fadeTrail',
30 | 'trailLength',
31 | 'currentTime',
32 | 'getTimestamps',
33 | ]
34 |
--------------------------------------------------------------------------------
/packages/layers/src/lib/layers/wms.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { baseLayerKeys, baseLayerProps } from '@/lib/layers/layer.lib.ts'
3 | import { type WMSLayerProps } from '@deck.gl/geo-layers'
4 |
5 | /** Props for customizing the behavior and appearance of the WMS Layer */
6 | export const wmsLayerProps: ComponentPropsOptions = {
7 | ...baseLayerProps,
8 | data: {
9 | type: [String, Object] as PropType,
10 | required: true,
11 | },
12 | serviceType: {
13 | type: String as PropType,
14 | default: 'auto',
15 | },
16 | layers: {
17 | type: Array as PropType,
18 | default: () => [],
19 | },
20 | srs: {
21 | type: String as PropType,
22 | default: 'auto',
23 | },
24 | onMetadataLoad: {
25 | type: Function as PropType,
26 | default: () => {},
27 | },
28 | onMetadataLoadError: {
29 | type: Function as PropType,
30 | default: (error: Error) => console.error(error),
31 | },
32 | onImageLoadStart: {
33 | type: Function as PropType,
34 | default: () => {},
35 | },
36 | onImageLoad: {
37 | type: Function as PropType,
38 | default: () => {},
39 | },
40 | onImageLoadError: {
41 | type: Function as PropType,
42 | default: (requestId: unknown, error: Error) =>
43 | console.error('Error loading image:', error, 'Request ID:', requestId),
44 | },
45 | }
46 |
47 | /** Keys for WMS Layer Props to simplify destructuring or usage */
48 | export const wmsPropsKeys: (keyof WMSLayerProps)[] = [
49 | ...baseLayerKeys,
50 | 'data',
51 | 'serviceType',
52 | 'layers',
53 | 'srs',
54 | 'onMetadataLoad',
55 | 'onMetadataLoadError',
56 | 'onImageLoadStart',
57 | 'onImageLoad',
58 | 'onImageLoadError',
59 | ]
60 |
--------------------------------------------------------------------------------
/packages/layers/src/main.ts:
--------------------------------------------------------------------------------
1 | import { type App, type Plugin } from 'vue'
2 |
3 | // Import vue components
4 | import * as components from '@/components'
5 |
6 | // install function executed by Vue.use()
7 | const install: Exclude = function installVueDeckglSuiteLayers(app: App) {
8 | Object.entries(components).forEach(([componentName, component]) => {
9 | app.component(componentName, component)
10 | })
11 | }
12 |
13 | // Create module definition for Vue.use()
14 | export default install
15 |
16 | // To allow individual component use, export components
17 | // each can be registered via Vue.component()
18 | export * from '@/components'
19 | export { genDeckOpts, genDeckLayerOpts } from '@/utils'
20 |
--------------------------------------------------------------------------------
/packages/layers/src/shared/types.ts:
--------------------------------------------------------------------------------
1 | import {
2 | type ArcLayerProps,
3 | type BitmapLayerProps,
4 | type ColumnLayerProps,
5 | type GeoJsonLayerProps,
6 | type IconLayerProps,
7 | type LineLayerProps,
8 | type PathLayerProps,
9 | type PointCloudLayerProps,
10 | type PolygonLayerProps,
11 | type ScatterplotLayerProps,
12 | } from '@deck.gl/layers'
13 | import type { Tile3DLayerProps, WMSLayerProps } from '@deck.gl/geo-layers'
14 | import type {
15 | GridLayerProps,
16 | HeatmapLayerProps,
17 | HexagonLayerProps,
18 | } from '@deck.gl/aggregation-layers'
19 |
20 | /**
21 | * Represents a utility type that excludes specific layer-related event properties from the given type `T`.
22 | *
23 | * The excluded event properties are 'onHover', 'onClick', 'onDrag', 'onDragStart',
24 | * 'onDragEnd', 'onDataLoad', and 'onError'.
25 | *
26 | * This is useful for creating a type that inherits from `T` but does not include these specific events.
27 | *
28 | * @template T The base type from which the properties will be omitted.
29 | */
30 | export type WithoutLayerEvents = Omit<
31 | T,
32 | 'onHover' | 'onClick' | 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onDataLoad' | 'onError'
33 | >
34 |
35 | /**
36 | * Represents the properties for various Deck.gl layer types without layer event properties.
37 | *
38 | * DeckLayerProps combines the settings for multiple types of layers, excluding the layer-specific events.
39 | * This allows for standardized handling of properties across different types of layers.
40 | *
41 | * The supported layer types include:
42 | * - ArcLayer
43 | * - GeoJsonLayer
44 | * - BitmapLayer
45 | * - ColumnLayer
46 | * - LineLayer
47 | * - PolygonLayer
48 | * - ScatterplotLayer
49 | * - PathLayer
50 | * - IconLayer
51 | * - PointCloudLayer
52 | * - Tile3DLayer
53 | * - WMSLayer
54 | * - HexagonLayer
55 | * - GridLayer
56 | * Each type is represented as a union, enabling flexibility to select properties specific to individual layer types.
57 | */
58 | export type DeckLayerProps =
59 | | WithoutLayerEvents
60 | | WithoutLayerEvents
61 | | WithoutLayerEvents
62 | | WithoutLayerEvents
63 | | WithoutLayerEvents
64 | | WithoutLayerEvents
65 | | WithoutLayerEvents
66 | | WithoutLayerEvents
67 | | WithoutLayerEvents
68 | | WithoutLayerEvents
69 | | WithoutLayerEvents
70 | | WithoutLayerEvents
71 | | WithoutLayerEvents
72 | | WithoutLayerEvents
73 | | WithoutLayerEvents
74 |
--------------------------------------------------------------------------------
/packages/layers/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | import type { DeckLayerProps } from '@/shared/types.ts'
2 |
3 | /**
4 | * Generates an object containing only valid properties from the provided input.
5 | * Filters out properties that are undefined or not included in the list of valid properties.
6 | *
7 | * @param {Partial} props - The input object containing a partial set of properties.
8 | * @param {(keyof T)[]} validProps - An array of keys representing the valid properties.
9 | * @return {Partial} A new object containing only the valid properties from the input.
10 | */
11 | export function genDeckOpts(props: Partial, validProps: (keyof T)[]): Partial {
12 | for (const opt of Object.keys(props) as Array) {
13 | if (props[opt] === undefined || !validProps.includes(opt)) {
14 | delete props[opt]
15 | }
16 | }
17 |
18 | return props
19 | }
20 |
21 | /**
22 | * Generates a deck.gl layer options object by filtering valid properties and attaching event emitters.
23 | *
24 | * @param {T} props - The properties to be processed for generating the layer options.
25 | * @param {Array} validProps - An array of keys representing valid properties to be included in the layer options.
26 | * @param {(event: 'click' | 'hover' | 'drag' | 'dragStart' | 'dragEnd' | 'error' | 'dataLoad', ...args: any[]) => void} emit - A function to emit events with specified type and arguments.
27 | * @return {Partial} A filtered properties object with added event handler callbacks for the specified events.
28 | */
29 | export function genDeckLayerOpts(
30 | props: T,
31 | validProps: Array,
32 | emit: (
33 | event: 'click' | 'hover' | 'drag' | 'dragStart' | 'dragEnd' | 'error' | 'dataLoad',
34 | ...args: any[]
35 | ) => void,
36 | ): Partial {
37 | for (const opt of Object.keys(props) as Array) {
38 | if (props[opt] === undefined || !validProps.includes(opt)) {
39 | delete props[opt]
40 | }
41 | }
42 |
43 | return {
44 | ...props,
45 | onClick: (...args: any[]) => emit('click', ...args),
46 | onHover: (...args: any[]) => emit('hover', ...args),
47 | onDrag: (...args: any[]) => emit('drag', ...args),
48 | onDragStart: (...args: any[]) => emit('dragStart', ...args),
49 | onDragEnd: (...args: any[]) => emit('dragEnd', ...args),
50 | onError: (...args: any[]) => emit('error', ...args),
51 | onDataLoad: (...args: any[]) => emit('dataLoad', ...args),
52 | }
53 | }
54 |
55 |
56 |
--------------------------------------------------------------------------------
/packages/layers/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@vue/tsconfig/tsconfig.dom.json",
3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.ts"],
4 | "exclude": ["src/**/__tests__/*", "node_modules/**", "dist", "../../node_modules"],
5 | "compilerOptions": {
6 | "baseUrl" : ".",
7 | "target" : "ESNext",
8 | "useDefineForClassFields": true,
9 | "module" : "ESNext",
10 | "moduleResolution" : "Node",
11 | "strict" : true,
12 | "jsx" : "preserve",
13 | "sourceMap" : true,
14 | "resolveJsonModule" : true,
15 | "esModuleInterop" : true,
16 | "isolatedModules" : true,
17 | "newLine" : "lf",
18 | "tsBuildInfoFile" : "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
19 | "skipLibCheck" : true,
20 | "paths": {
21 | "@/*": ["./src/*"]
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/packages/layers/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | {
5 | "path": "./tsconfig.node.json"
6 | },
7 | {
8 | "path": "./tsconfig.app.json"
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/packages/layers/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/node22/tsconfig.json",
3 | "include": [
4 | "vite.config.*",
5 | "vitest.config.*",
6 | "cypress.config.*",
7 | "nightwatch.conf.*",
8 | "playwright.config.*",
9 | "eslint.config.*"
10 | ],
11 | "compilerOptions": {
12 | "noEmit": true,
13 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
14 |
15 | "module": "ESNext",
16 | "moduleResolution": "Bundler",
17 | "types": ["node"]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/packages/layers/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { fileURLToPath, URL } from 'node:url'
2 |
3 | import { defineConfig, type PluginOption } from 'vite'
4 | import vue from '@vitejs/plugin-vue'
5 | import vueDevTools from 'vite-plugin-vue-devtools'
6 | import { resolve } from 'path'
7 | import dtsPlugin from 'vite-plugin-dts'
8 |
9 | // https://vite.dev/config/
10 | export default defineConfig({
11 | plugins: [
12 | vue() as PluginOption,
13 | dtsPlugin({
14 | entryRoot: './src',
15 | insertTypesEntry: true, // Ensure types are included in "exports" in package.json
16 | tsconfigPath: './tsconfig.app.json', // Point explicitly to the correct tsconfig
17 | rollupTypes: true, // Use rollup to bundle declaration files
18 | outDir: 'dist', // Place all declarations in the "dist" folder
19 | }) as PluginOption,
20 | vueDevTools() as PluginOption,
21 | ],
22 | resolve: {
23 | alias: {
24 | '@': fileURLToPath(new URL('./src', import.meta.url))
25 | },
26 | },
27 | build: {
28 | lib: {
29 | entry: resolve(__dirname, 'src/main.ts'),
30 | // Simplified library global name
31 | name: 'VueDeckGLSuiteLayers',
32 | // Dynamically include format in the file name
33 | fileName: (format) => `vue-deckgl-suite-layers.${format}.js`,
34 | },
35 | rollupOptions: {
36 | external: [
37 | 'vue',
38 | '@deck.gl/core',
39 | '@deck.gl/layers',
40 | '@deck.gl/geo-layers',
41 | '@deck.gl/aggregation-layers'
42 | ],
43 | output: {
44 | globals: {
45 | vue: 'Vue',
46 | '@deck.gl/core': 'deck',
47 | '@deck.gl/layers': 'deck.layers',
48 | '@deck.gl/geo-layers': 'deck.geo-layers',
49 | '@deck.gl/aggregation-layers': 'deck.aggregation-layers',
50 | },
51 | },
52 | }
53 | }
54 | })
55 |
--------------------------------------------------------------------------------
/packages/layers/web-types.config.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | componentsRoot: './src/components',
3 | components: '**/[a-zA-Z]*.(component|layer).ts',
4 | }
5 |
--------------------------------------------------------------------------------
/packages/maplibre/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
2 | charset = utf-8
3 | indent_size = 2
4 | indent_style = space
5 | insert_final_newline = true
6 | trim_trailing_whitespace = true
7 |
8 | end_of_line = lf
9 | max_line_length = 100
10 |
--------------------------------------------------------------------------------
/packages/maplibre/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto eol=lf
2 |
--------------------------------------------------------------------------------
/packages/maplibre/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | .DS_Store
12 | dist
13 | dist-ssr
14 | coverage
15 | *.local
16 |
17 | /cypress/videos/
18 | /cypress/screenshots/
19 |
20 | # Editor directories and files
21 | .vscode/*
22 | !.vscode/extensions.json
23 | .idea
24 | *.suo
25 | *.ntvs*
26 | *.njsproj
27 | *.sln
28 | *.sw?
29 |
30 | *.tsbuildinfo
31 |
--------------------------------------------------------------------------------
/packages/maplibre/.prettierrc.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "$schema": "https://json.schemastore.org/prettierrc",
4 | "semi": false,
5 | "singleQuote": true,
6 | "printWidth": 100
7 | }
8 |
--------------------------------------------------------------------------------
/packages/maplibre/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "Vue.volar",
4 | "dbaeumer.vscode-eslint",
5 | "EditorConfig.EditorConfig",
6 | "esbenp.prettier-vscode"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/packages/maplibre/env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/packages/maplibre/eslint.config.ts:
--------------------------------------------------------------------------------
1 | import pluginVue from 'eslint-plugin-vue'
2 | import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
3 | import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
4 |
5 | // To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
6 | // import { configureVueProject } from '@vue/eslint-config-typescript'
7 | // configureVueProject({ scriptLangs: ['ts', 'tsx'] })
8 | // More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
9 |
10 | export default defineConfigWithVueTs(
11 | {
12 | name: 'app/files-to-lint',
13 | files: ['**/*.{ts,mts,tsx,vue}'],
14 | },
15 |
16 | {
17 | name: 'app/files-to-ignore',
18 | ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
19 | },
20 |
21 | pluginVue.configs['flat/essential'],
22 | vueTsConfigs.recommended,
23 | skipFormatting,
24 | )
25 |
--------------------------------------------------------------------------------
/packages/maplibre/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite App
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/packages/maplibre/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vue-deckgl-suite/maplibre",
3 | "description": "A Vue 3 package integrating Deck.gl with MapLibre for geospatial visualizations",
4 | "version": "1.0.0-beta.4",
5 | "author": {
6 | "name": "Mostafa Gamal",
7 | "email": "mostafagamal99418@gmail.com"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/MostafaGamalSayed/vue-deck.gl-suite.git"
12 | },
13 | "keywords": [
14 | "deckgl",
15 | "geo-layers",
16 | "aggregation-layers",
17 | "deckgl vue wrapper",
18 | "wrapper",
19 | "maplibre",
20 | "map",
21 | "vue3",
22 | "Vue.js",
23 | "layers",
24 | "components"
25 | ],
26 | "publishConfig": {
27 | "access": "public"
28 | },
29 | "type": "module",
30 | "main": "dist/vue-deckgl-suite-maplibre.umd.js",
31 | "module": "dist/vue-deckgl-suite-maplibre.es.js",
32 | "types": "dist/main.d.ts",
33 | "web-types": "dist/web-types.json",
34 | "files": [
35 | "dist/**/*"
36 | ],
37 | "scripts": {
38 | "dev": "vite",
39 | "build": "run-p type-check \"build-only {@}\" --",
40 | "preview": "vite preview",
41 | "build-only": "vite build && vue-docgen-web-types --configFile web-types.config.cjs",
42 | "type-check": "vue-tsc --build",
43 | "lint": "eslint . --fix",
44 | "format": "prettier --write src/"
45 | },
46 | "devDependencies": {
47 | "@deck.gl/core": "^9.1.8",
48 | "@deck.gl/mapbox": "^9.1.8",
49 | "@tsconfig/node22": "^22.0.0",
50 | "@types/node": "^22.13.1",
51 | "@vitejs/plugin-vue": "^5.2.1",
52 | "@vue/eslint-config-prettier": "^10.1.0",
53 | "@vue/eslint-config-typescript": "^14.3.0",
54 | "@vue/tsconfig": "^0.7.0",
55 | "eslint": "^9.18.0",
56 | "eslint-plugin-vue": "^9.32.0",
57 | "jiti": "^2.4.2",
58 | "maplibre-gl": "^5.1.0",
59 | "npm-run-all2": "^7.0.2",
60 | "prettier": "^3.4.2",
61 | "typescript": "~5.7.3",
62 | "vite": "^6.0.11",
63 | "vite-plugin-dts": "^4.5.0",
64 | "vite-plugin-vue-devtools": "^7.7.1",
65 | "vue": "^3.5.13",
66 | "vue-docgen-web-types": "^0.1.8",
67 | "vue-tsc": "^2.2.0"
68 | },
69 | "peerDependencies": {
70 | "@deck.gl/core": "^9.1.8",
71 | "@deck.gl/mapbox": "^9.1.8",
72 | "maplibre-gl": "^5.1.0",
73 | "vue": "^3.5.13"
74 | },
75 | "engines": {
76 | "node": ">=18"
77 | },
78 | "gitHead": "6748997e3584871bafea9f3d997dac136d4e8563"
79 | }
80 |
--------------------------------------------------------------------------------
/packages/maplibre/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MostafaGamalSayed/vue-deck.gl-suite/c3c1b9b5ff8145d0399d53bbf0f87195ba1cb9ee/packages/maplibre/public/favicon.ico
--------------------------------------------------------------------------------
/packages/maplibre/src/components/index.ts:
--------------------------------------------------------------------------------
1 | export { default as Map } from './map.component.ts'
2 | export { default as DeckGL } from './overlay.component.ts'
3 |
--------------------------------------------------------------------------------
/packages/maplibre/src/lib/overlay.lib.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentPropsOptions, PropType } from 'vue'
2 | import { type MapboxOverlayProps } from '@deck.gl/mapbox'
3 | import { Deck } from '@deck.gl/core'
4 |
5 | export const overlayProps: ComponentPropsOptions = {
6 | // Add props explicitly defined in MapboxOverlayProps
7 | interleaved: {
8 | type: Boolean as PropType,
9 | default: false,
10 | },
11 | beforeId: {
12 | type: String as PropType,
13 | default: undefined,
14 | },
15 | id: {
16 | type: String,
17 | default: 'deckgl-overlay',
18 | },
19 | /** Additional CSS styles for the canvas. */
20 | style: {
21 | type: Object as PropType,
22 | default: Deck.defaultProps.style,
23 | },
24 |
25 | /** Controls the resolution of drawing buffer used for rendering.
26 | * @default `true` (use browser devicePixelRatio)
27 | */
28 | useDevicePixels: {
29 | type: [Boolean, Number] as PropType,
30 | default: Deck.defaultProps.useDevicePixels,
31 | },
32 | /** Extra pixels around the pointer to include while picking.
33 | * @default `0`
34 | */
35 | pickingRadius: {
36 | type: Number as PropType,
37 | default: Deck.defaultProps.pickingRadius,
38 | },
39 | /** WebGL parameters to be set before each frame is rendered. */
40 | parameters: {
41 | type: Object as PropType