Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
37dc524
enable duckDB plugin in demo-app
igorDykhta Jan 28, 2025
652ab30
nit
igorDykhta Jan 28, 2025
2cc9ad9
hide not configured cloud storage providers
igorDykhta Jan 29, 2025
95e4a5e
nit
igorDykhta Jan 29, 2025
474fa16
disable banner
igorDykhta Jan 29, 2025
bcb169d
nit
igorDykhta Feb 6, 2025
f7bc510
Merge branch 'master' into igr/duckdb-demo-branch
igorDykhta Feb 19, 2025
e788f56
Show examples tab by default; css changes; move tiled examples to the…
igorDykhta Feb 20, 2025
38b5ba7
fix tests
igorDykhta Feb 20, 2025
2bc825c
test - redirects to allow custom urls for SPA
igorDykhta Feb 20, 2025
bb560d0
yarn lock; nit
igorDykhta Feb 20, 2025
f3848ee
add to load data modal + shortcut
igorDykhta Feb 21, 2025
b2e690d
lint
igorDykhta Feb 21, 2025
c8f3c86
nit
igorDykhta Feb 21, 2025
8418b7b
merge master
igorDykhta Feb 27, 2025
2d71b42
Merge branch 'master' into igr/duckdb-demo-branch
igorDykhta Feb 28, 2025
5d3b1ca
merge master
igorDykhta Mar 3, 2025
ae3937d
Merge branch 'master' into igr/duckdb-demo-branch
igorDykhta Mar 10, 2025
48710b7
Merge branch 'master' into igr/duckdb-demo-branch
igorDykhta Mar 11, 2025
a4a93cf
merge master
igorDykhta Mar 19, 2025
f6009e7
merge master
igorDykhta May 6, 2025
e07953e
merge master
igorDykhta May 14, 2025
55a42a4
merge master
igorDykhta Jun 27, 2025
24639f6
Merge branch 'master' into igr/duckdb-demo-branch
igorDykhta Jul 10, 2025
28b424d
Merge branch 'master' into igr/duckdb-demo-branch
igorDykhta Aug 13, 2025
53494eb
Merge branch 'master' into igr/duckdb-demo-branch
Aug 8, 2026
cc10cbe
fix upgrade to 3.3
Aug 8, 2026
4435158
try to resolve deployments
Aug 8, 2026
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
77 changes: 74 additions & 3 deletions examples/demo-app/esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import esbuild from 'esbuild';
import {replace} from 'esbuild-plugin-replace';
import copy from 'esbuild-plugin-copy';
import {dotenvRun} from '@dotenv-run/esbuild';

import process from 'node:process';
Expand Down Expand Up @@ -62,6 +63,44 @@ const getProductionReactAliases = nodeModulesDir => ({
'react-dom/client': `${nodeModulesDir}/react-dom/cjs/react-dom-client.production.js`
});

// Workspace packages to load from source when NODE_ENV=local.
// Must include package subpaths (e.g. duckdb/components) — the monorepo
// tsconfig only maps `@kepler.gl/*` (one segment), so subpath imports would
// otherwise resolve to demo-app/node_modules and create a second utils singleton.
const KEPLER_WORKSPACE_PACKAGES = [
'actions',
'ai-assistant',
'cloud-providers',
'common-utils',
'components',
'constants',
'deckgl-arrow-layers',
'deckgl-layers',
'duckdb',
'effects',
'layers',
'localization',
'processors',
'reducers',
'schemas',
'styles',
'table',
'tasks',
'utils'
];

const getKeplerLocalAliases = () => {
const aliases = {};
for (const pkg of KEPLER_WORKSPACE_PACKAGES) {
aliases[`@kepler.gl/${pkg}`] = join(SRC_DIR, pkg, 'src');
}
aliases['@kepler.gl/duckdb/components'] = join(SRC_DIR, 'duckdb/src/components');
aliases['@kepler.gl/duckdb/table'] = join(SRC_DIR, 'duckdb/src/table');
return aliases;
};

const isLocalEnv = process.env.NODE_ENV === 'local';

// Env variables required for demo app
const requiredEnvVariables = [
'MapboxAccessToken',
Expand Down Expand Up @@ -95,6 +134,10 @@ const config = {
logOverride: {
'unsupported-jsx-comment': 'silent'
},
// Use demo-app tsconfig (no path mappings). Walking up to the monorepo
// tsconfig would rewrite `@kepler.gl/pkg` → `src/pkg/src` but not subpaths
// like `@kepler.gl/duckdb/components`, splitting the applicationConfig singleton.
tsconfig: join(__dirname, 'tsconfig.json'),
inject: ['src/react19-shim.js'],
loader: {
'.js': 'jsx',
Expand Down Expand Up @@ -146,7 +189,34 @@ const config = {
return result;
});
}
}
},
// Force a single @kepler.gl/* copy from demo-app/node_modules (published
// packages on Netlify/production). Local monorepo source is handled via
// getKeplerLocalAliases() instead — do not resolve from the repo root
// node_modules here (workspace dist/ is often missing on CI).
{
name: 'dedupe-kepler',
setup(build) {
if (isLocalEnv) return;
build.onResolve({filter: /^@kepler\.gl\//}, async args => {
if (args.pluginData?.deduped) return;
const result = await build.resolve(args.path, {
resolveDir: __dirname,
kind: 'import-statement',
pluginData: {deduped: true}
});
return result;
});
}
},
// copy files to dist
copy({
resolveFrom: 'cwd',
assets: {
from: ['./src/static/_redirects'],
to: ['./dist/']
}
})
]
};

Expand Down Expand Up @@ -309,7 +379,8 @@ function openURL(url) {
sourcemap: false,
// Add alias resolution for build
alias: {
...getThirdPartyLibraryAliases(true)
...getThirdPartyLibraryAliases(true),
...(isLocalEnv ? getKeplerLocalAliases() : {})
},
// Add these production optimizations
define: {
Expand Down Expand Up @@ -348,7 +419,7 @@ function openURL(url) {
if (args.includes('--start')) {
const isLocal = process.env.NODE_ENV === 'local';
const baseAliases = isLocal
? localAliases
? {...localAliases, ...getKeplerLocalAliases()}
: getThirdPartyLibraryAliases(false);
const nodeModulesDir = isLocal ? NODE_MODULES_DIR : BASE_NODE_MODULES_DIR;
// Skip dedupe-webgl when a local deck.gl source override is active so that
Expand Down
1 change: 1 addition & 0 deletions examples/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"packageManager": "yarn@4.4.0",
"devDependencies": {
"@dotenv-run/esbuild": "^1.5.0",
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-replace": "^1.4.0"
}
}
9 changes: 9 additions & 0 deletions examples/demo-app/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ export function loadSampleConfigurations(sampleMapId = null) {
}
})
.then(samples => {
if (samples.length > 10) {
Comment thread
igorDykhta marked this conversation as resolved.
// For DuckDB preview: move tiled examples to the top
let removed = samples.splice(4, 2);
Comment thread
igorDykhta marked this conversation as resolved.
samples.splice(1, 0, ...removed);
Comment thread
igorDykhta marked this conversation as resolved.

// For DuckDB preview: filter out the example with trips as 4th timecoordinate is dropped in GEOMETRY
samples = samples.filter(s => s.id !== 'world_flights');
}

dispatch(loadMapSampleFile(samples));
// Load the specified map
const map = sampleMapId && samples.find(s => s.id === sampleMapId);
Expand Down
3 changes: 2 additions & 1 deletion examples/demo-app/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import {panelBorderColor, theme} from '@kepler.gl/styles';
import {ParsedConfig} from '@kepler.gl/types';
import {getApplicationConfig} from '@kepler.gl/utils';
import {injectComponents} from '@kepler.gl/components';
import {SqlPanel} from '@kepler.gl/duckdb/components';
import Banner from './components/banner';
import Announcement, {FormLink} from './components/announcement';
Expand All @@ -46,7 +47,7 @@
import {CLOUD_PROVIDERS} from './cloud-providers';
import {Panel, PanelGroup, PanelResizeHandle} from 'react-resizable-panels';

const KeplerGl = require('@kepler.gl/components').injectComponents([
const KeplerGl = injectComponents([
replaceLoadDataModal(),
replaceMapControl(),
replacePanelHeader()
Expand Down Expand Up @@ -150,7 +151,7 @@
}
`;

const App = props => {

Check warning on line 154 in examples/demo-app/src/app.tsx

View workflow job for this annotation

GitHub Actions / build

'props' is defined but never used. Allowed unused args must match /^_/u
const [showBanner, toggleShowBanner] = useState(false);
const {id, provider} = useParams();
const [searchParams] = useSearchParams();
Expand Down
18 changes: 10 additions & 8 deletions examples/demo-app/src/cloud-providers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

import {CLOUD_PROVIDERS_CONFIGURATION} from '../constants/default-settings';

import DropboxProvider from './dropbox/dropbox-provider';
import CartoProvider from './carto/carto-provider';
// import DropboxProvider from './dropbox/dropbox-provider';
// import CartoProvider from './carto/carto-provider';
import FoursquareProvider from './foursquare/foursquare-provider';

const {
DROPBOX_CLIENT_ID,
CARTO_CLIENT_ID,
// DROPBOX_CLIENT_ID,
// CARTO_CLIENT_ID,
FOURSQUARE_CLIENT_ID,
FOURSQUARE_DOMAIN,
FOURSQUARE_API_URL,
FOURSQUARE_USER_MAPS_URL
} = CLOUD_PROVIDERS_CONFIGURATION;

const DROPBOX_CLIENT_NAME = 'Kepler.gl Demo App';
// const DROPBOX_CLIENT_NAME = 'Kepler.gl Demo App';

export const DEFAULT_CLOUD_PROVIDER = 'dropbox';

Expand All @@ -26,9 +26,11 @@ export const CLOUD_PROVIDERS = [
authDomain: FOURSQUARE_DOMAIN,
apiURL: FOURSQUARE_API_URL,
userMapsURL: FOURSQUARE_USER_MAPS_URL
}),
new DropboxProvider(DROPBOX_CLIENT_ID, DROPBOX_CLIENT_NAME),
new CartoProvider(CARTO_CLIENT_ID)
})
// TODO DuckDB preview only
// Disable Dropbox and Carto providers in DuckDb-preview as the domain isn't whitelisted for them.
// new DropboxProvider(DROPBOX_CLIENT_ID, DROPBOX_CLIENT_NAME),
// new CartoProvider(CARTO_CLIENT_ID)
];

export function getCloudProvider(providerName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {useEffect} from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import {format} from 'd3-format';
import {LoadingDialog} from '@kepler.gl/components';
import {LoadingDialog, Icons} from '@kepler.gl/components';
import {FormattedMessage} from 'react-intl';

const numFormat = format(',');
Expand Down Expand Up @@ -72,6 +72,24 @@ const StyledError = styled.div`
margin-bottom: 16px;
`;

const AddDataHelper = styled.div`
margin-left: auto;
margin-right: auto;
margin-top: -25px;
margin-bottom: 6px;
cursor: pointer;

color: ${props => props.theme.subtextColorLT};
&:hover {
color: ${props => props.theme.textColorLT};
}
`;

const StyledAddIcon = styled(Icons.Add)`
display: inline;
margin-top: -3px;
`;

const SampleMap = ({id, sample, onClick}) => (
<StyledSampleMap id={id} className="sample-map-gallery__item">
<div className="sample-map">
Expand All @@ -98,7 +116,8 @@ const SampleMapGallery = ({
error,
isMapLoading,
locale,
loadSampleConfigurations
loadSampleConfigurations,
enableLoadDataModal
}) => {
useEffect(() => {
if (!sampleMaps.length) {
Expand All @@ -107,27 +126,34 @@ const SampleMapGallery = ({
}, [sampleMaps, loadSampleConfigurations]);

return (
<div className="sample-data-modal">
{error ? (
<StyledError>{error.message}</StyledError>
) : isMapLoading ? (
<LoadingDialog size={64} />
) : (
<StyledSampleGallery className="sample-map-gallery">
{sampleMaps
.filter(sp => sp.visible)
.map(sp => (
<SampleMap
id={sp.id}
sample={sp}
key={sp.id}
onClick={() => onLoadSample(sp)}
locale={locale}
/>
))}
</StyledSampleGallery>
)}
</div>
<>
{!error && !isMapLoading ? (
<AddDataHelper onClick={enableLoadDataModal}>
Add data <StyledAddIcon />
</AddDataHelper>
) : null}
<div className="sample-data-modal">
{error ? (
<StyledError>{error.message}</StyledError>
) : isMapLoading ? (
<LoadingDialog size={64} />
) : (
<StyledSampleGallery className="sample-map-gallery">
{sampleMaps
.filter(sp => sp.visible)
.map(sp => (
<SampleMap
id={sp.id}
sample={sp}
key={sp.id}
onClick={() => onLoadSample(sp)}
locale={locale}
/>
))}
</StyledSampleGallery>
)}
</div>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright contributors to the kepler.gl project

import React from 'react';
import classnames from 'classnames';
import styled from 'styled-components';
import {Icons} from '@kepler.gl/components';
import {media} from '@kepler.gl/styles';
Expand All @@ -25,10 +26,13 @@ const StyledMapIcon = styled.div`

const StyledTrySampleData = styled.div`
display: flex;
margin-bottom: 12px;
margin-bottom: 0px;
margin-left: 84px;
padding-bottom: 9px;
flex-grow: 1;
justify-content: flex-end;
color: ${props => props.theme.subtextColorLT};
border-bottom: 3px solid transparent;

.demo-map-title {
margin-left: 16px;
Expand All @@ -37,6 +41,12 @@ const StyledTrySampleData = styled.div`
justify-content: flex-end;
}

.load-data-modal__tab__item.active {
color: ${props => props.theme.textColorLT};
border-bottom: 3px solid ${props => props.theme.textColorLT};
font-weight: 500;
}

.demo-map-label {
font-size: 11px;

Expand Down Expand Up @@ -70,9 +80,9 @@ const StyledTrySampleData = styled.div`
}
`;

const SampleMapsTab = ({onClick}) => {
const SampleMapsTab = ({onClick, className}) => {
return (
<StyledTrySampleData className="try-sample-data">
<StyledTrySampleData className={classnames('try-sample-data', className)}>
<StyledMapIcon className="demo-map-icon" />
<div className="demo-map-title">
<div className="demo-map-label">
Expand Down
14 changes: 5 additions & 9 deletions examples/demo-app/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ import {processGeojson, processRowObject, processArrowTable} from '@kepler.gl/pr
import keplerGlReducer, {combinedUpdaters, uiStateUpdaters} from '@kepler.gl/reducers';
import KeplerGlSchema from '@kepler.gl/schemas';
import {KeplerTable} from '@kepler.gl/table';
import {getApplicationConfig} from '@kepler.gl/utils';

// import {getApplicationConfig, initApplicationConfig} from '@kepler.gl/utils';
// import keplerGlDuckdbPlugin, {KeplerGlDuckDbTable, DuckDBWasmAdapter} from '@kepler.gl/duckdb';

import {initApplicationConfig} from '@kepler.gl/utils';
import {getApplicationConfig, initApplicationConfig} from '@kepler.gl/utils';
import keplerGlDuckdbPlugin, {KeplerGlDuckDbTable, DuckDBWasmAdapter} from '@kepler.gl/duckdb';

import {
INIT,
Expand All @@ -31,7 +27,7 @@ import {CLOUD_PROVIDERS_CONFIGURATION} from '../constants/default-settings';
import {generateHashId} from '../utils/strings';

// initialize kepler demo-app with DuckDB plugin
/*

initApplicationConfig({
// Custom UI for DuckDB
plugins: [keplerGlDuckdbPlugin],
Expand All @@ -46,9 +42,9 @@ initApplicationConfig({
}
}),
// progressive loading is sync, doesn't wait properly for a dataset to be created in DuckDB
useArrowProgressiveLoading: false
useArrowProgressiveLoading: false,
showReleaseBanner: false
});
*/

// Example: Register custom icons for the icon layer.
// These will be merged with the default icons fetched from CDN.
Expand Down
1 change: 1 addition & 0 deletions examples/demo-app/src/static/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* / 200
Loading
Loading