@sqlrooms/kepler 0.29.0-rc.2 → 0.29.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +12 -2
  2. package/dist/KeplerSlice.d.ts +7 -5
  3. package/dist/KeplerSlice.d.ts.map +1 -1
  4. package/dist/KeplerSlice.js +48 -141
  5. package/dist/KeplerSlice.js.map +1 -1
  6. package/dist/components/CustomDndContext.d.ts.map +1 -1
  7. package/dist/components/CustomDndContext.js +5 -2
  8. package/dist/components/CustomDndContext.js.map +1 -1
  9. package/dist/components/CustomFilterPanelHeader.d.ts.map +1 -1
  10. package/dist/components/CustomFilterPanelHeader.js +5 -5
  11. package/dist/components/CustomFilterPanelHeader.js.map +1 -1
  12. package/dist/components/CustomLayerManager.d.ts.map +1 -1
  13. package/dist/components/CustomLayerManager.js.map +1 -1
  14. package/dist/components/CustomMapLegend.d.ts +4 -1
  15. package/dist/components/CustomMapLegend.d.ts.map +1 -1
  16. package/dist/components/CustomMapLegend.js +19 -8
  17. package/dist/components/CustomMapLegend.js.map +1 -1
  18. package/dist/components/CustomMapLegendPanel.d.ts +3 -3
  19. package/dist/components/CustomMapLegendPanel.d.ts.map +1 -1
  20. package/dist/components/CustomMapLegendPanel.js +19 -4
  21. package/dist/components/CustomMapLegendPanel.js.map +1 -1
  22. package/dist/components/KeplerMapContainer.d.ts.map +1 -1
  23. package/dist/components/KeplerMapContainer.js +36 -4
  24. package/dist/components/KeplerMapContainer.js.map +1 -1
  25. package/dist/components/KeplerPlotContainer.d.ts +1 -1
  26. package/dist/components/KeplerPlotContainer.d.ts.map +1 -1
  27. package/dist/components/KeplerPlotContainer.js +3 -1
  28. package/dist/components/KeplerPlotContainer.js.map +1 -1
  29. package/dist/components/SplitMapIndexContext.d.ts +2 -0
  30. package/dist/components/SplitMapIndexContext.d.ts.map +1 -0
  31. package/dist/components/SplitMapIndexContext.js +3 -0
  32. package/dist/components/SplitMapIndexContext.js.map +1 -0
  33. package/dist/hooks/useDndEffects.d.ts +1 -1
  34. package/dist/hooks/useDndEffects.d.ts.map +1 -1
  35. package/dist/hooks/useDndEffects.js +4 -0
  36. package/dist/hooks/useDndEffects.js.map +1 -1
  37. package/dist/hooks/useDndLayers.d.ts +1 -1
  38. package/dist/hooks/useDndLayers.d.ts.map +1 -1
  39. package/dist/hooks/useDndLayers.js +4 -0
  40. package/dist/hooks/useDndLayers.js.map +1 -1
  41. package/dist/index.d.ts +3 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -1
  44. package/dist/index.js.map +1 -1
  45. package/package.json +23 -23
@@ -1 +1 @@
1
- {"version":3,"file":"CustomMapLegend.js","sourceRoot":"","sources":["../../src/components/CustomMapLegend.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,kDAAkD;AAElD,OAAO,EAAoB,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,gBAAgB,EAGhB,KAAK,GACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAElD,MAAM,kBAAkB,GAAG;IACzB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,UAAU;CACtB,CAAC;AAEF,sBAAsB,CAAC,IAAI,GAAG;IAC5B,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC;AAEF,MAAM,UAAU,sBAAsB,CACpC,iBAA8D,EAC9D,kBAAgE;IAEhE,MAAM,SAAS,G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C,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CACL,eACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAC,yDAAyD,aAEnE,0BAAQ,2EAA2E,GAAS,EAC5F,eACE,SAAS,EAAC,yCAAyC,EACnD,OAAO,EAAE,oBAAoB,aAE7B,cAAK,SAAS,EAAC,qGAAqG,YACjH,KAAK,CAAC,MAAM,CAAC,KAAK,GACf,EACN,cAAK,SAAS,EAAC,QAAQ,GAAG,EAC1B,cAAK,SAAS,EAAC,8CAA8C,YAC3D,KAAC,MAAM,IACL,SAAS,EAAC,SAAS,EACnB,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,oBAAoB,YAE5B,UAAU,CAAC,CAAC,CAAC,CACZ,KAAC,eAAe,IAAC,SAAS,EAAC,SAAS,GAAG,CACxC,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,IAAC,SAAS,EAAC,SAAS,GAAG,CACzC,GACM,GACL,IACF,EAEL,UAAU,IAAI,CACb,cAAK,SAAS,EAAC,kCAAkC,YAC/C,KAAC,kBAAkB,IACjB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,sBAAsB,EAAE,sBAAsB,EAC9C,WAAW,EAAE,kBAAkB,GAC/B,GACE,CACP,IACG,CACP,CAAC;IACJ,CAAC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;IAEpC,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {layerConfigChange, toggleMapControl} from '@kepler.gl/actions';\nimport {\n KeplerGlContext,\n LayerLegendContentFactory,\n LayerLegendHeaderFactory,\n} from '@kepler.gl/components';\nimport {MapLegendProps} from '@kepler.gl/components/dist/map/map-legend';\nimport {DIMENSIONS} from '@kepler.gl/constants';\nimport {Layer} from '@kepler.gl/layers';\nimport {Button} from '@sqlrooms/ui';\nimport {\n ArrowDown,\n ArrowRight,\n ChevronDownIcon,\n ChevronRightIcon,\n EyeIcon,\n EyeOffIcon,\n XIcon,\n} from 'lucide-react';\nimport {\n MouseEventHandler,\n useCallback,\n useContext,\n useRef,\n useState,\n} from 'react';\nimport {useStoreWithKepler} from '../KeplerSlice';\n\nconst defaultActionIcons = {\n expanded: ArrowDown,\n collapsed: ArrowRight,\n};\n\nCustomMapLegendFactory.deps = [\n LayerLegendHeaderFactory,\n LayerLegendContentFactory,\n];\n\nexport function CustomMapLegendFactory(\n LayerLegendHeader: ReturnType<typeof LayerLegendHeaderFactory>,\n LayerLegendContent: ReturnType<typeof LayerLegendContentFactory>,\n) {\n const MapLegend: React.FC<MapLegendProps> = ({\n layers = [],\n width,\n isExport,\n ...restProps\n }) => {\n const containerW = width || DIMENSIONS.mapControl.width;\n const mapId = useContext(KeplerGlContext).id;\n const dispatchAction = useStoreWithKepler(\n (state) => state.kepler.dispatchAction,\n );\n const handleClose = (evt: React.MouseEvent<HTMLButtonElement>) => {\n evt.stopPropagation();\n dispatchAction(mapId, toggleMapControl('mapLegend', 0));\n };\n\n return (\n <div\n className=\"map-legend border-border border\"\n style={{width: containerW}}\n >\n <div className=\"relative flex flex-col\">\n {!isExport && (\n <div className=\"border-muted bg-background sticky top-0 flex w-full items-center justify-between border-b p-2\">\n <div className=\"text-xs font-medium\">Legend</div>\n <Button\n variant=\"ghost\"\n size=\"xs\"\n className=\"h-6 w-6\"\n onClick={handleClose}\n >\n <XIcon className=\"h-4 w-4\" />\n </Button>\n </div>\n )}\n <div className=\"flex w-full flex-1 flex-col items-center\">\n {layers\n .filter((layer) => layer.config.isVisible)\n .map((layer, index) => {\n return (\n <LayerLegendItem\n key={index}\n layer={layer}\n containerW={containerW}\n isExport={isExport}\n {...restProps}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n };\n\n const LayerLegendItem = ({\n layer,\n containerW,\n isExport,\n mapState,\n disableEdit,\n onLayerVisConfigChange,\n }: {layer: Layer; containerW: number} & MapLegendProps) => {\n const [isExpanded, setIsExpanded] = useState(layer.config.isVisible);\n\n const dispatchAction = useStoreWithKepler(\n (state) => state.kepler.dispatchAction,\n );\n const scrollIntoView = useCallback(() => {\n requestAnimationFrame(() => {\n containerRef.current?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n });\n }, []);\n\n const handleToggleExpanded: MouseEventHandler<HTMLElement> = (evt) => {\n evt.stopPropagation();\n const nextExpanded = !isExpanded;\n setIsExpanded(nextExpanded);\n if (!isExpanded) {\n scrollIntoView();\n }\n };\n\n const mapId = useContext(KeplerGlContext).id;\n const containerRef = useRef<HTMLDivElement>(null);\n\n if (!layer.isValidToSave() || layer.config.hidden) {\n return null;\n }\n\n if (isExport && !layer.config.isVisible) {\n return null;\n }\n\n return (\n <div\n ref={containerRef}\n className=\"border-muted flex w-full flex-col items-center border-b\"\n >\n <style>{`.legend--layer__item .panel--header__action { display: none !important; }`}</style>\n <div\n className=\"flex w-full flex-row items-center gap-2\"\n onClick={handleToggleExpanded}\n >\n <div className=\"cursor-pointer items-center overflow-hidden p-2 text-xs text-ellipsis whitespace-nowrap select-none\">\n {layer.config.label}\n </div>\n <div className=\"flex-1\" />\n <div className=\"flex flex-row items-center justify-end gap-1\">\n <Button\n className=\"h-7 w-7\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={handleToggleExpanded}\n >\n {isExpanded ? (\n <ChevronDownIcon className=\"h-4 w-4\" />\n ) : (\n <ChevronRightIcon className=\"h-4 w-4\" />\n )}\n </Button>\n </div>\n </div>\n\n {isExpanded && (\n <div className=\"w-full px-[8px] py-[5px] text-xs\">\n <LayerLegendContent\n containerW={containerW}\n layer={layer}\n mapState={mapState}\n disableEdit={disableEdit}\n isExport={isExport}\n onLayerVisConfigChange={onLayerVisConfigChange}\n actionIcons={defaultActionIcons}\n />\n </div>\n )}\n </div>\n );\n };\n\n MapLegend.displayName = 'MapLegend';\n\n return MapLegend;\n}\n"]}
1
+ {"version":3,"file":"CustomMapLegend.js","sourceRoot":"","sources":["../../src/components/CustomMapLegend.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,kDAAkD;AAElD,OAAO,EAAoB,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,gBAAgB,EAGhB,KAAK,GACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D,MAAM,kBAAkB,GAAG;IACzB,QAAQ,EAAE,SAAkD;IAC5D,SAAS,EAAE,UAAoD;CACvC,CAAC;AAO3B,MAAM,eAAe,GACnB,eAA2D,CAAC;AAE9D,sBAAsB,CAAC,IAAI,GAAG;IAC5B,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC;AAEF,MAAM,UAAU,sBAAsB,CACpC,iBAA8D,EAC9D,kBAAgE;IAEhE,MAAM,SAAS,GAEX,CAAC,EACH,MAAM,GAAG,EAAE,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EAAE,YAAY,EACtB,OAAO,EACP,GAAG,SAAS,EACb,EAAE,EAAE;QACH,MAAM,UAAU,GAAG,KAAK,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QACxD,MA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ACjB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,sBAAsB,EAAE,sBAAsB,EAC9C,WAAW,EAAE,kBAAkB,GAC/B,GACE,CACP,IACG,CACP,CAAC;IACJ,CAAC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;IAEpC,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {layerConfigChange, toggleMapControl} from '@kepler.gl/actions';\nimport {\n KeplerGlContext,\n LayerLegendContentFactory,\n LayerLegendHeaderFactory,\n} from '@kepler.gl/components';\nimport {\n MapLegendIcons,\n MapLegendProps,\n} from '@kepler.gl/components/dist/map/map-legend';\nimport {DIMENSIONS} from '@kepler.gl/constants';\nimport {Layer} from '@kepler.gl/layers';\nimport {Button} from '@sqlrooms/ui';\nimport {\n ArrowDown,\n ArrowRight,\n ChevronDownIcon,\n ChevronRightIcon,\n EyeIcon,\n EyeOffIcon,\n XIcon,\n} from 'lucide-react';\nimport {useCallback, useContext, useRef, useState} from 'react';\nimport type {Context, MouseEventHandler} from 'react';\nimport {useStoreWithKepler} from '../KeplerSlice';\nimport {SplitMapIndexContext} from './SplitMapIndexContext';\n\nconst defaultActionIcons = {\n expanded: ArrowDown as unknown as MapLegendIcons['expanded'],\n collapsed: ArrowRight as unknown as MapLegendIcons['collapsed'],\n} satisfies MapLegendIcons;\n\ntype KeplerGlContextValue = {\n selector: (state: any) => any;\n id: string;\n};\n\nconst keplerGlContext =\n KeplerGlContext as unknown as Context<KeplerGlContextValue>;\n\nCustomMapLegendFactory.deps = [\n LayerLegendHeaderFactory,\n LayerLegendContentFactory,\n];\n\nexport function CustomMapLegendFactory(\n LayerLegendHeader: ReturnType<typeof LayerLegendHeaderFactory>,\n LayerLegendContent: ReturnType<typeof LayerLegendContentFactory>,\n) {\n const MapLegend: React.FC<\n MapLegendProps & {mapIndex?: number; onClose?: () => void}\n > = ({\n layers = [],\n width,\n isExport,\n mapIndex: mapIndexProp,\n onClose,\n ...restProps\n }) => {\n const containerW = width || DIMENSIONS.mapControl.width;\n const mapId = useContext(keplerGlContext).id;\n const splitMapIndex = useContext(SplitMapIndexContext);\n const mapIndex = mapIndexProp ?? splitMapIndex;\n const dispatchAction = useStoreWithKepler(\n (state) => state.kepler.dispatchAction,\n );\n const splitMaps = useStoreWithKepler(\n (state) => state.kepler.map[mapId]?.visState?.splitMaps,\n );\n const handleClose = (evt: React.MouseEvent<HTMLButtonElement>) => {\n evt.stopPropagation();\n if (onClose) {\n onClose();\n } else {\n dispatchAction(mapId, toggleMapControl('mapLegend', 0));\n }\n };\n\n const isSplit = splitMaps && splitMaps.length > 1;\n const panelLayers =\n isSplit && mapIndex != null ? splitMaps[mapIndex]?.layers : undefined;\n\n const visibleLayers = layers.filter(\n (layer) =>\n layer.config.isVisible && (!panelLayers || panelLayers[layer.id]),\n );\n\n return (\n <div\n className=\"map-legend border-border border\"\n style={{width: containerW}}\n >\n <div className=\"relative flex flex-col\">\n {!isExport && (\n <div className=\"border-muted bg-background sticky top-0 flex w-full items-center justify-between border-b p-2\">\n <div className=\"text-xs font-medium\">Legend</div>\n <Button\n variant=\"ghost\"\n size=\"xs\"\n className=\"h-6 w-6\"\n onClick={handleClose}\n >\n <XIcon className=\"h-4 w-4\" />\n </Button>\n </div>\n )}\n <div className=\"flex w-full flex-1 flex-col items-center\">\n {visibleLayers.map((layer, index) => {\n return (\n <LayerLegendItem\n key={index}\n layer={layer}\n containerW={containerW}\n isExport={isExport}\n {...restProps}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n };\n\n const LayerLegendItem = ({\n layer,\n containerW,\n isExport,\n mapState,\n disableEdit,\n onLayerVisConfigChange,\n }: {layer: Layer; containerW: number} & MapLegendProps) => {\n const [isExpanded, setIsExpanded] = useState(layer.config.isVisible);\n\n const dispatchAction = useStoreWithKepler(\n (state) => state.kepler.dispatchAction,\n );\n const scrollIntoView = useCallback(() => {\n requestAnimationFrame(() => {\n containerRef.current?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n });\n }, []);\n\n const handleToggleExpanded: MouseEventHandler<HTMLElement> = (evt) => {\n evt.stopPropagation();\n const nextExpanded = !isExpanded;\n setIsExpanded(nextExpanded);\n if (!isExpanded) {\n scrollIntoView();\n }\n };\n\n const mapId = useContext(keplerGlContext).id;\n const containerRef = useRef<HTMLDivElement>(null);\n\n if (!layer.isValidToSave() || layer.config.hidden) {\n return null;\n }\n\n if (isExport && !layer.config.isVisible) {\n return null;\n }\n\n return (\n <div\n ref={containerRef}\n className=\"border-muted flex w-full flex-col items-center border-b\"\n >\n <style>{`.legend--layer__item .panel--header__action { display: none !important; }`}</style>\n <div\n className=\"flex w-full flex-row items-center gap-2\"\n onClick={handleToggleExpanded}\n >\n <div className=\"cursor-pointer items-center overflow-hidden p-2 text-xs text-ellipsis whitespace-nowrap select-none\">\n {layer.config.label}\n </div>\n <div className=\"flex-1\" />\n <div className=\"flex flex-row items-center justify-end gap-1\">\n <Button\n className=\"h-7 w-7\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={handleToggleExpanded}\n >\n {isExpanded ? (\n <ChevronDownIcon className=\"h-4 w-4\" />\n ) : (\n <ChevronRightIcon className=\"h-4 w-4\" />\n )}\n </Button>\n </div>\n </div>\n\n {isExpanded && (\n <div className=\"w-full px-[8px] py-[5px] text-xs\">\n <LayerLegendContent\n containerW={containerW}\n layer={layer}\n mapState={mapState}\n disableEdit={disableEdit}\n isExport={isExport}\n onLayerVisConfigChange={onLayerVisConfigChange}\n actionIcons={defaultActionIcons}\n />\n </div>\n )}\n </div>\n );\n };\n\n MapLegend.displayName = 'MapLegend';\n\n return MapLegend;\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { MapLegendPanelFactory } from '@kepler.gl/components';
2
- export declare function CustomMapLegendPanelFactory(...deps: Parameters<typeof MapLegendPanelFactory>): ReturnType<typeof MapLegendPanelFactory>;
1
+ import { MapControlPanelFactory, MapControlTooltipFactory, MapLegendFactory, MapLegendPanelFactory } from '@kepler.gl/components';
2
+ export declare function CustomMapLegendPanelFactory(MapControlTooltip: ReturnType<typeof MapControlTooltipFactory>, MapControlPanel: ReturnType<typeof MapControlPanelFactory>, MapLegend: ReturnType<typeof MapLegendFactory>): ReturnType<typeof MapLegendPanelFactory>;
3
3
  export declare namespace CustomMapLegendPanelFactory {
4
- var deps: (typeof import("@kepler.gl/components").MapControlTooltipFactory | typeof import("@kepler.gl/components").MapControlPanelFactory | typeof import("@kepler.gl/components").MapLegendFactory)[];
4
+ var deps: (typeof MapControlTooltipFactory | typeof MapControlPanelFactory | typeof MapLegendFactory)[];
5
5
  }
6
6
  //# sourceMappingURL=CustomMapLegendPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomMapLegendPanel.d.ts","sourceRoot":"","sources":["../../src/components/CustomMapLegendPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,uBAAuB,CAAC;AAI/B,wBAAgB,2BAA2B,CACzC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,GAChD,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAY1C;yBAde,2BAA2B"}
1
+ {"version":3,"file":"CustomMapLegendPanel.d.ts","sourceRoot":"","sources":["../../src/components/CustomMapLegendPanel.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,uBAAuB,CAAC;AAI/B,wBAAgB,2BAA2B,CACzC,iBAAiB,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,EAC9D,eAAe,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAC1D,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC7C,UAAU,CAAC,OAAO,qBAAqB,CAAC,CA0E1C;yBA9Ee,2BAA2B"}
@@ -1,10 +1,25 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MapLegendPanelFactory, } from '@kepler.gl/components';
2
+ import { useCallback, useState } from 'react';
3
+ import { Icons, MapControlButton, MapLegendPanelFactory, } from '@kepler.gl/components';
3
4
  CustomMapLegendPanelFactory.deps = MapLegendPanelFactory.deps;
4
- export function CustomMapLegendPanelFactory(...deps) {
5
- const MapLegendPanel = MapLegendPanelFactory(...deps);
5
+ export function CustomMapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
6
+ const OriginalMapLegendPanel = MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend);
7
+ const SplitPaneLegend = (props) => {
8
+ const [isActive, setIsActive] = useState(false);
9
+ const mapLegend = props.mapControls?.mapLegend;
10
+ const toggleLegend = useCallback((e) => {
11
+ e?.preventDefault();
12
+ setIsActive((prev) => !prev);
13
+ }, []);
14
+ if (!mapLegend?.show)
15
+ return null;
16
+ return isActive ? (_jsxs(_Fragment, { children: [_jsx("style", { children: `.split-legend .map-control__panel-header { display: none !important; }` }), _jsx("div", { className: "split-legend", children: _jsx(MapControlPanel, { scale: props.scale, header: "header.layerLegend", onClick: toggleLegend, pinnable: false, disableClose: false, isExport: props.isExport, logoComponent: props.logoComponent, children: _jsx(MapLegend, { layers: props.layers, mapState: props.mapState, disableEdit: mapLegend.disableEdit, isExport: props.isExport, onLayerVisConfigChange: props.onLayerVisConfigChange, onToggleLayerVisibility: props.onToggleLayerVisibility, ...{ onClose: toggleLegend } }) }) })] })) : (_jsx(MapControlTooltip, { id: "show-legend", message: "tooltip.showLegend", children: _jsx(MapControlButton, { className: "map-control-button show-legend", onClick: toggleLegend, children: _jsx(Icons.Legend, { height: "22px" }) }) }));
17
+ };
6
18
  const CustomMapLegendPanel = (props) => {
7
- return (_jsxs(_Fragment, { children: [_jsx("style", { children: `.draggable-legend .map-control__panel-header { display: none !important; }` }), _jsx(MapLegendPanel, { ...props })] }));
19
+ if (props.isSplit) {
20
+ return _jsx(SplitPaneLegend, { ...props });
21
+ }
22
+ return (_jsxs(_Fragment, { children: [_jsx("style", { children: `.draggable-legend .map-control__panel-header { display: none !important; }` }), _jsx(OriginalMapLegendPanel, { ...props })] }));
8
23
  };
9
24
  CustomMapLegendPanel.displayName = 'CustomMapLegendPanel';
10
25
  return CustomMapLegendPanel;
@@ -1 +1 @@
1
- {"version":3,"file":"CustomMapLegendPanel.js","sourceRoot":"","sources":["../../src/components/CustomMapLegendPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,uBAAuB,CAAC;AAE/B,2BAA2B,CAAC,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC;AAE9D,MAAM,UAAU,2BAA2B,CACzC,GAAG,IAA8C;IAEjD,MAAM,cAAc,GAAG,qBAAqB,CAAC,GAAG,IAAI,CAAC,CAAC;IACtD,MAAM,oBAAoB,GAAG,CAAC,KAA0B,EAAE,EAAE;QAC1D,OAAO,CACL,8BACE,0BAAQ,4EAA4E,GAAS,EAC7F,KAAC,cAAc,OAAK,KAAK,GAAI,IAC5B,CACJ,CAAC;IACJ,CAAC,CAAC;IACF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;IAC1D,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import {\n MapLegendPanelFactory,\n MapLegendPanelProps,\n} from '@kepler.gl/components';\n\nCustomMapLegendPanelFactory.deps = MapLegendPanelFactory.deps;\n\nexport function CustomMapLegendPanelFactory(\n ...deps: Parameters<typeof MapLegendPanelFactory>\n): ReturnType<typeof MapLegendPanelFactory> {\n const MapLegendPanel = MapLegendPanelFactory(...deps);\n const CustomMapLegendPanel = (props: MapLegendPanelProps) => {\n return (\n <>\n <style>{`.draggable-legend .map-control__panel-header { display: none !important; }`}</style>\n <MapLegendPanel {...props} />\n </>\n );\n };\n CustomMapLegendPanel.displayName = 'CustomMapLegendPanel';\n return CustomMapLegendPanel;\n}\n"]}
1
+ {"version":3,"file":"CustomMapLegendPanel.js","sourceRoot":"","sources":["../../src/components/CustomMapLegendPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,KAAK,EACL,gBAAgB,EAIhB,qBAAqB,GAEtB,MAAM,uBAAuB,CAAC;AAE/B,2BAA2B,CAAC,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC;AAE9D,MAAM,UAAU,2BAA2B,CACzC,iBAA8D,EAC9D,eAA0D,EAC1D,SAA8C;IAE9C,MAAM,sBAAsB,GAAG,qBAAqB,CAClD,iBAAiB,EACjB,eAAe,EACf,SAAS,CACV,CAAC;IAEF,MAAM,eAAe,GAAG,CACtB,KAAgD,EAChD,EAAE;QACF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC;QAE/C,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAoB,EAAE,EAAE;YACxD,CAAC,EAAE,cAAc,EAAE,CAAC;YACpB,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,IAAI,CAAC,SAAS,EAAE,IAAI;YAAE,OAAO,IAAI,CAAC;QAElC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAChB,8BACE,0BAAQ,wEAAwE,GAAS,EACzF,cAAK,SAAS,EAAC,cAAc,YAC3B,KAAC,eAAe,IACd,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAC,oBAAoB,EAC3B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,aAAa,EAAE,KAAK,CAAC,aAAa,YAElC,KAAC,SAAS,IACR,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,SAAS,CAAC,WAAW,EAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,KACjD,EAAC,OAAO,EAAE,YAAY,EAAS,GACpC,GACc,GACd,IACL,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,iBAAiB,IAAC,EAAE,EAAC,aAAa,EAAC,OAAO,EAAC,oBAAoB,YAC9D,KAAC,gBAAgB,IACf,SAAS,EAAC,gCAAgC,EAC1C,OAAO,EAAE,YAAY,YAErB,KAAC,KAAK,CAAC,MAAM,IAAC,MAAM,EAAC,MAAM,GAAG,GACb,GACD,CACrB,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,CAC3B,KAAmE,EACnE,EAAE;QACF,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,KAAC,eAAe,OAAK,KAAK,GAAI,CAAC;QACxC,CAAC;QAED,OAAO,CACL,8BACE,0BAAQ,4EAA4E,GAAS,EAC7F,KAAC,sBAAsB,OAAK,KAAK,GAAI,IACpC,CACJ,CAAC;IACJ,CAAC,CAAC;IAEF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;IAC1D,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import {useCallback, useState} from 'react';\nimport {\n Icons,\n MapControlButton,\n MapControlPanelFactory,\n MapControlTooltipFactory,\n MapLegendFactory,\n MapLegendPanelFactory,\n MapLegendPanelProps,\n} from '@kepler.gl/components';\n\nCustomMapLegendPanelFactory.deps = MapLegendPanelFactory.deps;\n\nexport function CustomMapLegendPanelFactory(\n MapControlTooltip: ReturnType<typeof MapControlTooltipFactory>,\n MapControlPanel: ReturnType<typeof MapControlPanelFactory>,\n MapLegend: ReturnType<typeof MapLegendFactory>,\n): ReturnType<typeof MapLegendPanelFactory> {\n const OriginalMapLegendPanel = MapLegendPanelFactory(\n MapControlTooltip,\n MapControlPanel,\n MapLegend,\n );\n\n const SplitPaneLegend = (\n props: MapLegendPanelProps & {mapIndex?: number},\n ) => {\n const [isActive, setIsActive] = useState(false);\n const mapLegend = props.mapControls?.mapLegend;\n\n const toggleLegend = useCallback((e?: React.MouseEvent) => {\n e?.preventDefault();\n setIsActive((prev) => !prev);\n }, []);\n\n if (!mapLegend?.show) return null;\n\n return isActive ? (\n <>\n <style>{`.split-legend .map-control__panel-header { display: none !important; }`}</style>\n <div className=\"split-legend\">\n <MapControlPanel\n scale={props.scale}\n header=\"header.layerLegend\"\n onClick={toggleLegend}\n pinnable={false}\n disableClose={false}\n isExport={props.isExport}\n logoComponent={props.logoComponent}\n >\n <MapLegend\n layers={props.layers}\n mapState={props.mapState}\n disableEdit={mapLegend.disableEdit}\n isExport={props.isExport}\n onLayerVisConfigChange={props.onLayerVisConfigChange}\n onToggleLayerVisibility={props.onToggleLayerVisibility}\n {...({onClose: toggleLegend} as any)}\n />\n </MapControlPanel>\n </div>\n </>\n ) : (\n <MapControlTooltip id=\"show-legend\" message=\"tooltip.showLegend\">\n <MapControlButton\n className=\"map-control-button show-legend\"\n onClick={toggleLegend}\n >\n <Icons.Legend height=\"22px\" />\n </MapControlButton>\n </MapControlTooltip>\n );\n };\n\n const CustomMapLegendPanel = (\n props: MapLegendPanelProps & {mapIndex?: number; isSplit?: boolean},\n ) => {\n if (props.isSplit) {\n return <SplitPaneLegend {...props} />;\n }\n\n return (\n <>\n <style>{`.draggable-legend .map-control__panel-header { display: none !important; }`}</style>\n <OriginalMapLegendPanel {...props} />\n </>\n );\n };\n\n CustomMapLegendPanel.displayName = 'CustomMapLegendPanel';\n return CustomMapLegendPanel;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KeplerMapContainer.d.ts","sourceRoot":"","sources":["../../src/components/KeplerMapContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAuC,MAAM,OAAO,CAAC;AAyK/D,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,CAMA,CAAC"}
1
+ {"version":3,"file":"KeplerMapContainer.d.ts","sourceRoot":"","sources":["../../src/components/KeplerMapContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAuC,MAAM,OAAO,CAAC;AAsO/D,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,CAMA,CAAC"}
@@ -7,6 +7,7 @@ import { getKeplerFactory } from './KeplerInjector';
7
7
  import { KeplerProvider } from './KeplerProvider';
8
8
  import { useKeplerStateActions } from '../hooks/useKeplerStateActions';
9
9
  import { useStoreWithKepler } from '../KeplerSlice';
10
+ import { SplitMapIndexContext } from './SplitMapIndexContext';
10
11
  const MapContainer = getKeplerFactory(MapContainerFactory);
11
12
  const BottomWidget = getKeplerFactory(BottomWidgetFactory);
12
13
  const GeoCoderPanel = getKeplerFactory(GeocoderPanelFactory);
@@ -36,6 +37,12 @@ const CustomWidgetcontainer = styled.div `
36
37
  margin-top: 0 !important;
37
38
  }
38
39
  `;
40
+ const SplitMapsContainer = styled.div `
41
+ display: flex;
42
+ width: 100%;
43
+ height: 100%;
44
+ position: relative;
45
+ `;
39
46
  const KeplerGl = ({ mapId }) => {
40
47
  const bottomWidgetRef = useRef(null);
41
48
  const [containerRef, size] = useDimensions();
@@ -70,22 +77,47 @@ const KeplerGl = ({ mapId }) => {
70
77
  // dont need height
71
78
  size || DEFAULT_DIMENSIONS)
72
79
  : null;
80
+ const splitMaps = keplerState?.visState?.splitMaps;
81
+ const isSplit = splitMaps && splitMaps.length > 1;
73
82
  const mapFields = useMemo(() => (keplerState?.visState ? mapFieldsSelector(mergedKeplerProps) : null), [keplerState, mergedKeplerProps]);
83
+ const mapFieldsSplit = useMemo(() => isSplit && keplerState?.visState
84
+ ? splitMaps.map((_, index) => mapFieldsSelector(mergedKeplerProps, index))
85
+ : null, [keplerState, mergedKeplerProps, isSplit, splitMaps]);
74
86
  // Check if there are filters or animatable layers (e.g., Trip layers)
75
87
  const hasFilters = Boolean(keplerState?.visState.filters?.length);
76
88
  const hasAnimatableLayers = useMemo(() => {
77
89
  const layers = keplerState?.visState?.layers || [];
78
90
  return getAnimatableVisibleLayers(layers).length > 0;
79
91
  }, [keplerState?.visState?.layers]);
80
- const bottomWidgetFields = hasFilters || hasAnimatableLayers
81
- ? bottomWidgetSelector(mergedKeplerProps, theme)
82
- : null;
92
+ const bottomWidgetFields = useMemo(() => {
93
+ if (!hasFilters && !hasAnimatableLayers)
94
+ return null;
95
+ const fields = bottomWidgetSelector(mergedKeplerProps, theme);
96
+ // The legend is rendered as a draggable, portaled overlay so the
97
+ // BottomWidget should not shrink to reserve space for it. Mask
98
+ // mapLegend.active so the upstream spaceForLegendWidth stays 0.
99
+ return {
100
+ ...fields,
101
+ uiState: {
102
+ ...fields.uiState,
103
+ mapControls: {
104
+ ...fields.uiState.mapControls,
105
+ mapLegend: {
106
+ ...fields.uiState.mapControls?.mapLegend,
107
+ show: fields.uiState.mapControls?.mapLegend?.show ?? false,
108
+ active: false,
109
+ },
110
+ },
111
+ },
112
+ };
113
+ }, [hasFilters, hasAnimatableLayers, mergedKeplerProps, theme]);
83
114
  const modalContainerFields = keplerState?.visState
84
115
  ? modalContainerSelector(mergedKeplerProps, containerNode)
85
116
  : null;
86
117
  const mapboxApiAccessToken = mapFields?.mapStyle?.mapboxApiAccessToken ||
87
118
  basicKeplerProps?.mapboxApiAccessToken;
88
- return (_jsx(RootContext.Provider, { value: containerRef, children: _jsxs(CustomWidgetcontainer, { ref: containerRef, className: "kepler-gl relative flex h-full w-full flex-col justify-between", children: [mapFields?.mapState ? (_jsx(MapViewStateContextProvider, { mapState: mapFields.mapState, children: _jsx(MapContainer, { primary: true, containerId: 0, index: 0, ...mapFields, mapboxApiAccessToken: mapboxApiAccessToken || '' }, 0) })) : null, geoCoderPanelFields && interactionConfig?.geocoder?.enabled ? (_jsx(GeoCoderPanel, { ...geoCoderPanelFields, index: 0, unsyncedViewports: false, mapboxApiAccessToken: mapboxApiAccessToken || '' })) : null, size && bottomWidgetFields ? (_jsx(BottomWidget, { rootRef: bottomWidgetRef, ...bottomWidgetFields, theme: theme, containerW: size?.width })) : null, size && size.width && size.height && modalContainerFields ? (_jsx(ModalContainer, { ...modalContainerFields, containerW: size?.width, containerH: size?.height })) : null] }) }));
119
+ return (_jsx(RootContext.Provider, { value: containerRef, children: _jsxs(CustomWidgetcontainer, { ref: containerRef, className: "kepler-gl relative flex h-full w-full flex-col justify-between", children: [isSplit && mapFieldsSplit ? (_jsx(SplitMapsContainer, { children: _jsx(MapViewStateContextProvider, { mapState: (mapFieldsSplit[0]?.mapState ??
120
+ mapFields?.mapState), children: mapFieldsSplit.map((fields, index) => (_jsx(SplitMapIndexContext.Provider, { value: index, children: _jsx(MapContainer, { index: index, primary: index === 1, containerId: index, ...fields, mapboxApiAccessToken: mapboxApiAccessToken || '' }) }, index))) }) })) : mapFields?.mapState ? (_jsx(MapViewStateContextProvider, { mapState: mapFields.mapState, children: _jsx(MapContainer, { primary: true, containerId: 0, index: 0, ...mapFields, mapboxApiAccessToken: mapboxApiAccessToken || '' }, 0) })) : null, geoCoderPanelFields && interactionConfig?.geocoder?.enabled ? (_jsx(GeoCoderPanel, { ...geoCoderPanelFields, index: 0, unsyncedViewports: false, mapboxApiAccessToken: mapboxApiAccessToken || '' })) : null, size && bottomWidgetFields ? (_jsx(BottomWidget, { rootRef: bottomWidgetRef, ...bottomWidgetFields, theme: theme, containerW: size?.width })) : null, size && size.width && size.height && modalContainerFields ? (_jsx(ModalContainer, { ...modalContainerFields, containerW: size?.width, containerH: size?.height })) : null] }) }));
89
121
  };
90
122
  export const KeplerMapContainer = ({ mapId }) => {
91
123
  return (_jsx(KeplerProvider, { mapId: mapId, children: _jsx(KeplerGl, { mapId: mapId }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"KeplerMapContainer.js","sourceRoot":"","sources":["../../src/components/KeplerMapContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAK,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,WAAW,EACX,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAE,0BAA0B,EAAC,MAAM,kBAAkB,CAAC;AAC3E,OAAO,MAAM,EAAE,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAElD,MAAM,YAAY,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;AAC3D,MAAM,YAAY,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;AAC3D,MAAM,aAAa,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAC7D,MAAM,cAAc,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AAE/D,MAAM,kBAAkB,GAAG;IACzB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AACF,MAAM,YAAY,GAAG;IACnB,YAAY,EAAE,wBAAwB;IACtC,OAAO,EAAE,WAA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MAAM,CAAC,MAAM,kBAAkB,GAE1B,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACf,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,YAC1B,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,GAAI,GACX,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {FC, useMemo, useRef, useEffect, useState} from 'react';\n\nimport {\n MapContainerFactory,\n BottomWidgetFactory,\n GeocoderPanelFactory,\n mapFieldsSelector,\n bottomWidgetSelector,\n geoCoderPanelSelector,\n modalContainerSelector,\n MapViewStateContextProvider,\n RootContext,\n ModalContainerFactory,\n} from '@kepler.gl/components';\nimport {useDimensions, getAnimatableVisibleLayers} from '@kepler.gl/utils';\nimport styled, {useTheme} from 'styled-components';\n\nimport {getKeplerFactory} from './KeplerInjector';\nimport {KeplerProvider} from './KeplerProvider';\nimport {useKeplerStateActions} from '../hooks/useKeplerStateActions';\nimport {useStoreWithKepler} from '../KeplerSlice';\n\nconst MapContainer = getKeplerFactory(MapContainerFactory);\nconst BottomWidget = getKeplerFactory(BottomWidgetFactory);\nconst GeoCoderPanel = getKeplerFactory(GeocoderPanelFactory);\nconst ModalContainer = getKeplerFactory(ModalContainerFactory);\n\nconst DEFAULT_DIMENSIONS = {\n width: 0,\n height: 0,\n};\nconst KEPLER_PROPS = {\n mapboxApiUrl: 'https://api.mapbox.com',\n appName: 'kepler.gl',\n sidePanelWidth: 0,\n};\n// overide kepler default style\nconst CustomWidgetcontainer = styled.div`\n .bottom-widget--inner {\n margin-top: 0;\n }\n\n .map-popover {\n z-index: 50;\n }\n\n /* Remove top margin from Trip layer timeline */\n .kepler-gl .bottom-widget--container .animation-control-container,\n .bottom-widget--container .animation-control-container {\n margin-top: 0 !important;\n }\n`;\n\ntype KeplerGLProps = Parameters<typeof geoCoderPanelSelector>[0];\n\nconst KeplerGl: FC<{\n mapId: string;\n}> = ({mapId}) => {\n const bottomWidgetRef = useRef(null);\n const [containerRef, size] = useDimensions<HTMLDivElement>();\n const [containerNode, setContainerNode] = useState<HTMLElement | null>(null);\n const theme = useTheme();\n const basicKeplerProps = useStoreWithKepler(\n (state) => state.kepler.basicKeplerProps,\n );\n\n const {keplerActions, keplerState} = useKeplerStateActions({mapId});\n const interactionConfig = keplerState?.visState?.interactionConfig;\n\n // Capture the current container DOM node outside of render logic\n useEffect(() => {\n setContainerNode(containerRef.current);\n }, [containerRef]);\n\n // Update export image settings when size changes\n useEffect(() => {\n if (size?.width && size?.height) {\n keplerActions.uiStateActions.setExportImageSetting({\n mapW: size.width,\n mapH: size.height,\n });\n }\n }, [size?.width, size?.height, keplerActions.uiStateActions]);\n\n const mergedKeplerProps = useMemo(() => {\n return {\n ...KEPLER_PROPS,\n ...keplerState,\n ...keplerActions,\n id: mapId,\n } as KeplerGLProps;\n }, [keplerState, keplerActions, mapId]);\n const geoCoderPanelFields = keplerState?.visState\n ? geoCoderPanelSelector(\n mergedKeplerProps,\n // dont need height\n size || DEFAULT_DIMENSIONS,\n )\n : null;\n const mapFields = useMemo(\n () => (keplerState?.visState ? mapFieldsSelector(mergedKeplerProps) : null),\n [keplerState, mergedKeplerProps],\n );\n\n // Check if there are filters or animatable layers (e.g., Trip layers)\n const hasFilters = Boolean(keplerState?.visState.filters?.length);\n const hasAnimatableLayers = useMemo(() => {\n const layers = keplerState?.visState?.layers || [];\n return getAnimatableVisibleLayers(layers).length > 0;\n }, [keplerState?.visState?.layers]);\n\n const bottomWidgetFields =\n hasFilters || hasAnimatableLayers\n ? bottomWidgetSelector(mergedKeplerProps, theme)\n : null;\n\n const modalContainerFields = keplerState?.visState\n ? modalContainerSelector(mergedKeplerProps, containerNode)\n : null;\n\n const mapboxApiAccessToken =\n mapFields?.mapStyle?.mapboxApiAccessToken ||\n basicKeplerProps?.mapboxApiAccessToken;\n return (\n <RootContext.Provider value={containerRef}>\n <CustomWidgetcontainer\n ref={containerRef}\n className=\"kepler-gl relative flex h-full w-full flex-col justify-between\"\n >\n {mapFields?.mapState ? (\n <MapViewStateContextProvider mapState={mapFields.mapState}>\n <MapContainer\n primary={true}\n containerId={0}\n key={0}\n index={0}\n {...mapFields}\n mapboxApiAccessToken={mapboxApiAccessToken || ''}\n />\n </MapViewStateContextProvider>\n ) : null}\n {geoCoderPanelFields && interactionConfig?.geocoder?.enabled ? (\n <GeoCoderPanel\n {...geoCoderPanelFields}\n index={0}\n unsyncedViewports={false}\n mapboxApiAccessToken={mapboxApiAccessToken || ''}\n />\n ) : null}\n {size && bottomWidgetFields ? (\n <BottomWidget\n rootRef={bottomWidgetRef}\n {...bottomWidgetFields}\n theme={theme}\n containerW={size?.width}\n />\n ) : null}\n {size && size.width && size.height && modalContainerFields ? (\n <ModalContainer\n {...modalContainerFields}\n containerW={size?.width}\n containerH={size?.height}\n />\n ) : null}\n </CustomWidgetcontainer>\n </RootContext.Provider>\n );\n};\n\nexport const KeplerMapContainer: FC<{\n mapId: string;\n}> = ({mapId}) => {\n return (\n <KeplerProvider mapId={mapId}>\n <KeplerGl mapId={mapId} />\n </KeplerProvider>\n );\n};\n"]}
1
+ {"version":3,"file":"KeplerMapContainer.js","sourceRoot":"","sources":["../../src/components/KeplerMapContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAK,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,WAAW,EACX,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAE,0BAA0B,EAAC,MAAM,kBAAkB,CAAC;AAC3E,OAAO,MAAM,EAAE,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,cAAc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AAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,YACvD,KAAC,YAAY,IACX,OAAO,EAAE,IAAI,EACb,WAAW,EAAE,CAAC,EAEd,KAAK,EAAE,CAAC,KACJ,SAAS,EACb,oBAAoB,EAAE,oBAAoB,IAAI,EAAE,IAH3C,CAAC,CAIN,GAC0B,CAC/B,CAAC,CAAC,CAAC,IAAI,EACP,mBAAmB,IAAI,iBAAiB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAC7D,KAAC,aAAa,OACR,mBAAmB,EACvB,KAAK,EAAE,CAAC,EACR,iBAAiB,EAAE,KAAK,EACxB,oBAAoB,EAAE,oBAAoB,IAAI,EAAE,GAChD,CACH,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC5B,KAAC,YAAY,IACX,OAAO,EAAE,eAAe,KACpB,kBAAkB,EACtB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,IAAI,EAAE,KAAK,GACvB,CACH,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAC3D,KAAC,cAAc,OACT,oBAAoB,EACxB,UAAU,EAAE,IAAI,EAAE,KAAK,EACvB,UAAU,EAAE,IAAI,EAAE,MAAM,GACxB,CACH,CAAC,CAAC,CAAC,IAAI,IACc,GACH,CACxB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAE1B,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACf,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,YAC1B,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,GAAI,GACX,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {FC, useMemo, useRef, useEffect, useState} from 'react';\n\nimport {\n MapContainerFactory,\n BottomWidgetFactory,\n GeocoderPanelFactory,\n mapFieldsSelector,\n bottomWidgetSelector,\n geoCoderPanelSelector,\n modalContainerSelector,\n MapViewStateContextProvider,\n RootContext,\n ModalContainerFactory,\n} from '@kepler.gl/components';\nimport {useDimensions, getAnimatableVisibleLayers} from '@kepler.gl/utils';\nimport styled, {useTheme} from 'styled-components';\n\nimport {getKeplerFactory} from './KeplerInjector';\nimport {KeplerProvider} from './KeplerProvider';\nimport {useKeplerStateActions} from '../hooks/useKeplerStateActions';\nimport {useStoreWithKepler} from '../KeplerSlice';\nimport {SplitMapIndexContext} from './SplitMapIndexContext';\n\nconst MapContainer = getKeplerFactory(MapContainerFactory);\nconst BottomWidget = getKeplerFactory(BottomWidgetFactory);\nconst GeoCoderPanel = getKeplerFactory(GeocoderPanelFactory);\nconst ModalContainer = getKeplerFactory(ModalContainerFactory);\n\nconst DEFAULT_DIMENSIONS = {\n width: 0,\n height: 0,\n};\nconst KEPLER_PROPS = {\n mapboxApiUrl: 'https://api.mapbox.com',\n appName: 'kepler.gl',\n sidePanelWidth: 0,\n};\n// overide kepler default style\nconst CustomWidgetcontainer = styled.div`\n .bottom-widget--inner {\n margin-top: 0;\n }\n\n .map-popover {\n z-index: 50;\n }\n\n /* Remove top margin from Trip layer timeline */\n .kepler-gl .bottom-widget--container .animation-control-container,\n .bottom-widget--container .animation-control-container {\n margin-top: 0 !important;\n }\n`;\n\nconst SplitMapsContainer = styled.div`\n display: flex;\n width: 100%;\n height: 100%;\n position: relative;\n`;\n\ntype KeplerGLProps = Parameters<typeof geoCoderPanelSelector>[0];\n\nconst KeplerGl: FC<{\n mapId: string;\n}> = ({mapId}) => {\n const bottomWidgetRef = useRef(null);\n const [containerRef, size] = useDimensions<HTMLDivElement>();\n const [containerNode, setContainerNode] = useState<HTMLElement | null>(null);\n const theme = useTheme();\n const basicKeplerProps = useStoreWithKepler(\n (state) => state.kepler.basicKeplerProps,\n );\n\n const {keplerActions, keplerState} = useKeplerStateActions({mapId});\n const interactionConfig = keplerState?.visState?.interactionConfig;\n\n // Capture the current container DOM node outside of render logic\n useEffect(() => {\n setContainerNode(containerRef.current);\n }, [containerRef]);\n\n // Update export image settings when size changes\n useEffect(() => {\n if (size?.width && size?.height) {\n keplerActions.uiStateActions.setExportImageSetting({\n mapW: size.width,\n mapH: size.height,\n });\n }\n }, [size?.width, size?.height, keplerActions.uiStateActions]);\n\n const mergedKeplerProps = useMemo(() => {\n return {\n ...KEPLER_PROPS,\n ...keplerState,\n ...keplerActions,\n id: mapId,\n } as KeplerGLProps;\n }, [keplerState, keplerActions, mapId]);\n const geoCoderPanelFields = keplerState?.visState\n ? geoCoderPanelSelector(\n mergedKeplerProps,\n // dont need height\n size || DEFAULT_DIMENSIONS,\n )\n : null;\n\n const splitMaps = keplerState?.visState?.splitMaps;\n const isSplit = splitMaps && splitMaps.length > 1;\n\n const mapFields = useMemo(\n () => (keplerState?.visState ? mapFieldsSelector(mergedKeplerProps) : null),\n [keplerState, mergedKeplerProps],\n );\n const mapFieldsSplit = useMemo(\n () =>\n isSplit && keplerState?.visState\n ? splitMaps.map((_, index) =>\n mapFieldsSelector(mergedKeplerProps, index),\n )\n : null,\n [keplerState, mergedKeplerProps, isSplit, splitMaps],\n );\n\n // Check if there are filters or animatable layers (e.g., Trip layers)\n const hasFilters = Boolean(keplerState?.visState.filters?.length);\n const hasAnimatableLayers = useMemo(() => {\n const layers = keplerState?.visState?.layers || [];\n return getAnimatableVisibleLayers(layers).length > 0;\n }, [keplerState?.visState?.layers]);\n\n const bottomWidgetFields = useMemo(() => {\n if (!hasFilters && !hasAnimatableLayers) return null;\n const fields = bottomWidgetSelector(mergedKeplerProps, theme);\n // The legend is rendered as a draggable, portaled overlay so the\n // BottomWidget should not shrink to reserve space for it. Mask\n // mapLegend.active so the upstream spaceForLegendWidth stays 0.\n return {\n ...fields,\n uiState: {\n ...fields.uiState,\n mapControls: {\n ...fields.uiState.mapControls,\n mapLegend: {\n ...fields.uiState.mapControls?.mapLegend,\n show: fields.uiState.mapControls?.mapLegend?.show ?? false,\n active: false,\n },\n },\n },\n };\n }, [hasFilters, hasAnimatableLayers, mergedKeplerProps, theme]);\n\n const modalContainerFields = keplerState?.visState\n ? modalContainerSelector(mergedKeplerProps, containerNode)\n : null;\n\n const mapboxApiAccessToken =\n mapFields?.mapStyle?.mapboxApiAccessToken ||\n basicKeplerProps?.mapboxApiAccessToken;\n return (\n <RootContext.Provider value={containerRef}>\n <CustomWidgetcontainer\n ref={containerRef}\n className=\"kepler-gl relative flex h-full w-full flex-col justify-between\"\n >\n {isSplit && mapFieldsSplit ? (\n <SplitMapsContainer>\n <MapViewStateContextProvider\n mapState={\n (mapFieldsSplit[0]?.mapState ??\n mapFields?.mapState) as NonNullable<\n typeof mapFields\n >['mapState']\n }\n >\n {mapFieldsSplit.map((fields, index) => (\n <SplitMapIndexContext.Provider key={index} value={index}>\n <MapContainer\n index={index}\n primary={index === 1}\n containerId={index}\n {...fields}\n mapboxApiAccessToken={mapboxApiAccessToken || ''}\n />\n </SplitMapIndexContext.Provider>\n ))}\n </MapViewStateContextProvider>\n </SplitMapsContainer>\n ) : mapFields?.mapState ? (\n <MapViewStateContextProvider mapState={mapFields.mapState}>\n <MapContainer\n primary={true}\n containerId={0}\n key={0}\n index={0}\n {...mapFields}\n mapboxApiAccessToken={mapboxApiAccessToken || ''}\n />\n </MapViewStateContextProvider>\n ) : null}\n {geoCoderPanelFields && interactionConfig?.geocoder?.enabled ? (\n <GeoCoderPanel\n {...geoCoderPanelFields}\n index={0}\n unsyncedViewports={false}\n mapboxApiAccessToken={mapboxApiAccessToken || ''}\n />\n ) : null}\n {size && bottomWidgetFields ? (\n <BottomWidget\n rootRef={bottomWidgetRef}\n {...bottomWidgetFields}\n theme={theme}\n containerW={size?.width}\n />\n ) : null}\n {size && size.width && size.height && modalContainerFields ? (\n <ModalContainer\n {...modalContainerFields}\n containerW={size?.width}\n containerH={size?.height}\n />\n ) : null}\n </CustomWidgetcontainer>\n </RootContext.Provider>\n );\n};\n\nexport const KeplerMapContainer: FC<{\n mapId: string;\n}> = ({mapId}) => {\n return (\n <KeplerProvider mapId={mapId}>\n <KeplerGl mapId={mapId} />\n </KeplerProvider>\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { FC, ReactNode } from 'react';
1
+ import type { FC, ReactNode } from 'react';
2
2
  export declare const KeplerPlotContainer: FC<{
3
3
  mapId: string;
4
4
  logoComponent?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"KeplerPlotContainer.d.ts","sourceRoot":"","sources":["../../src/components/KeplerPlotContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAmB7C,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B,CAmCA,CAAC"}
1
+ {"version":3,"file":"KeplerPlotContainer.d.ts","sourceRoot":"","sources":["../../src/components/KeplerPlotContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,EAAE,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAsBxD,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B,CAqCA,CAAC"}
@@ -28,6 +28,8 @@ export const KeplerPlotContainer = ({ mapId, logoComponent }) => {
28
28
  const plotContainerFields = useMemo(() => (mergedKeplerProps ? plotContainerSelector(mergedKeplerProps) : null),
29
29
  // mergedKeplerProps already changes when filters change via keplerState
30
30
  [mergedKeplerProps]);
31
- return isExportingImage && plotContainerFields ? (_jsx(KeplerProvider, { mapId: mapId, children: _jsx(PlotContainer, { ...plotContainerFields, logoComponent: logoComponent ?? null }) })) : null;
31
+ const logo = logoComponent ?? null;
32
+ const keplerLogoComponent = logo;
33
+ return isExportingImage && plotContainerFields ? (_jsx(KeplerProvider, { mapId: mapId, children: _jsx(PlotContainer, { ...plotContainerFields, logoComponent: keplerLogoComponent }) })) : null;
32
34
  };
33
35
  //# sourceMappingURL=KeplerPlotContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeplerPlotContainer.js","sourceRoot":"","sources":["../../src/components/KeplerPlotContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,MAAM,aAAa,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAE7D,MAAM,YAAY,GAAG;IACnB,YAAY,EAAE,wBAAwB;IACtC,OAAO,EAAE,WAAW;IACpB,cAAc,EAAE,CAAC;IACjB,oBAAoB,EAAE,EAAE;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAG3B,CAAC,EAAC,KAAK,EAAE,aAAa,EAAC,EAAE,EAAE;IAC9B,MAAM,EAAC,WAAW,EAAE,aAAa,EAAC,GAAG,qBAAqB,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC;IAEpE,MAAM,gBAAgB,GAAG,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;IACtE,MAAM,iBAAiB,GAAG,OAAO,CAC/B,GAAG,EAAE,CACH,WAAW,KAAK,SAAS;QACvB,CAAC,CAAC;YACE,GAAG,YAAY;YACf,oBAAoB,EAClB,YAAY,CAAC,oBAAoB;gBACjC,WAAW,EAAE,QAAQ,EAAE,oBAAoB;gBAC3C,EAAE;YACJ,GAAG,WAAW;YACd,GAAG,aAAa;YAChB,EAAE,EAAE,KAAK;SACV;QACH,CAAC,CAAC,IAAI,EACV,CAAC,WAAW,EAAE,aAAa,EAAE,KAAK,CAAC,CACpC,CAAC;IAEF,MAAM,mBAAmB,GAAG,OAAO,CACjC,GAAG,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,wEAAwE;IACxE,CAAC,iBAAiB,CAAC,CACpB,CAAC;IAEF,OAAO,gBAAgB,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAC/C,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,YAC1B,KAAC,aAAa,OACR,mBAAmB,EACvB,aAAa,EAAE,aAAa,IAAI,IAAI,GACpC,GACa,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC","sourcesContent":["import {FC, ReactNode, useMemo} from 'react';\n\nimport {\n PlotContainerFactory,\n plotContainerSelector,\n} from '@kepler.gl/components';\nimport {useKeplerStateActions} from '../hooks/useKeplerStateActions';\nimport {getKeplerFactory} from './KeplerInjector';\nimport {KeplerProvider} from './KeplerProvider';\n\nconst PlotContainer = getKeplerFactory(PlotContainerFactory);\n\nconst KEPLER_PROPS = {\n mapboxApiUrl: 'https://api.mapbox.com',\n appName: 'kepler.gl',\n sidePanelWidth: 0,\n mapboxApiAccessToken: '',\n};\n\nexport const KeplerPlotContainer: FC<{\n mapId: string;\n logoComponent?: ReactNode;\n}> = ({mapId, logoComponent}) => {\n const {keplerState, keplerActions} = useKeplerStateActions({mapId});\n\n const isExportingImage = keplerState?.uiState?.exportImage?.exporting;\n const mergedKeplerProps = useMemo(\n () =>\n keplerState !== undefined\n ? {\n ...KEPLER_PROPS,\n mapboxApiAccessToken:\n KEPLER_PROPS.mapboxApiAccessToken ||\n keplerState?.mapStyle?.mapboxApiAccessToken ||\n '',\n ...keplerState,\n ...keplerActions,\n id: mapId,\n }\n : null,\n [keplerState, keplerActions, mapId],\n );\n\n const plotContainerFields = useMemo(\n () => (mergedKeplerProps ? plotContainerSelector(mergedKeplerProps) : null),\n // mergedKeplerProps already changes when filters change via keplerState\n [mergedKeplerProps],\n );\n\n return isExportingImage && plotContainerFields ? (\n <KeplerProvider mapId={mapId}>\n <PlotContainer\n {...plotContainerFields}\n logoComponent={logoComponent ?? null}\n />\n </KeplerProvider>\n ) : null;\n};\n"]}
1
+ {"version":3,"file":"KeplerPlotContainer.js","sourceRoot":"","sources":["../../src/components/KeplerPlotContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAG9B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,MAAM,aAAa,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAK7D,MAAM,YAAY,GAAG;IACnB,YAAY,EAAE,wBAAwB;IACtC,OAAO,EAAE,WAAW;IACpB,cAAc,EAAE,CAAC;IACjB,oBAAoB,EAAE,EAAE;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAG3B,CAAC,EAAC,KAAK,EAAE,aAAa,EAAC,EAAE,EAAE;IAC9B,MAAM,EAAC,WAAW,EAAE,aAAa,EAAC,GAAG,qBAAqB,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC;IAEpE,MAAM,gBAAgB,GAAG,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;IACtE,MAAM,iBAAiB,GAAG,OAAO,CAC/B,GAAG,EAAE,CACH,WAAW,KAAK,SAAS;QACvB,CAAC,CAAC;YACE,GAAG,YAAY;YACf,oBAAoB,EAClB,YAAY,CAAC,oBAAoB;gBACjC,WAAW,EAAE,QAAQ,EAAE,oBAAoB;gBAC3C,EAAE;YACJ,GAAG,WAAW;YACd,GAAG,aAAa;YAChB,EAAE,EAAE,KAAK;SACV;QACH,CAAC,CAAC,IAAI,EACV,CAAC,WAAW,EAAE,aAAa,EAAE,KAAK,CAAC,CACpC,CAAC;IAEF,MAAM,mBAAmB,GAAG,OAAO,CACjC,GAAG,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,wEAAwE;IACxE,CAAC,iBAAiB,CAAC,CACpB,CAAC;IACF,MAAM,IAAI,GAAG,aAAa,IAAI,IAAI,CAAC;IACnC,MAAM,mBAAmB,GAAG,IAA6C,CAAC;IAE1E,OAAO,gBAAgB,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAC/C,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,YAC1B,KAAC,aAAa,OACR,mBAAmB,EACvB,aAAa,EAAE,mBAAmB,GAClC,GACa,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC","sourcesContent":["import {useMemo} from 'react';\nimport type {ComponentType, FC, ReactNode} from 'react';\n\nimport {\n PlotContainerFactory,\n plotContainerSelector,\n} from '@kepler.gl/components';\nimport {useKeplerStateActions} from '../hooks/useKeplerStateActions';\nimport {getKeplerFactory} from './KeplerInjector';\nimport {KeplerProvider} from './KeplerProvider';\n\nconst PlotContainer = getKeplerFactory(PlotContainerFactory);\ntype PlotContainerProps =\n typeof PlotContainer extends ComponentType<infer Props> ? Props : never;\ntype PlotContainerLogoComponent = PlotContainerProps['logoComponent'];\n\nconst KEPLER_PROPS = {\n mapboxApiUrl: 'https://api.mapbox.com',\n appName: 'kepler.gl',\n sidePanelWidth: 0,\n mapboxApiAccessToken: '',\n};\n\nexport const KeplerPlotContainer: FC<{\n mapId: string;\n logoComponent?: ReactNode;\n}> = ({mapId, logoComponent}) => {\n const {keplerState, keplerActions} = useKeplerStateActions({mapId});\n\n const isExportingImage = keplerState?.uiState?.exportImage?.exporting;\n const mergedKeplerProps = useMemo(\n () =>\n keplerState !== undefined\n ? {\n ...KEPLER_PROPS,\n mapboxApiAccessToken:\n KEPLER_PROPS.mapboxApiAccessToken ||\n keplerState?.mapStyle?.mapboxApiAccessToken ||\n '',\n ...keplerState,\n ...keplerActions,\n id: mapId,\n }\n : null,\n [keplerState, keplerActions, mapId],\n );\n\n const plotContainerFields = useMemo(\n () => (mergedKeplerProps ? plotContainerSelector(mergedKeplerProps) : null),\n // mergedKeplerProps already changes when filters change via keplerState\n [mergedKeplerProps],\n );\n const logo = logoComponent ?? null;\n const keplerLogoComponent = logo as unknown as PlotContainerLogoComponent;\n\n return isExportingImage && plotContainerFields ? (\n <KeplerProvider mapId={mapId}>\n <PlotContainer\n {...plotContainerFields}\n logoComponent={keplerLogoComponent}\n />\n </KeplerProvider>\n ) : null;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const SplitMapIndexContext: import("react").Context<number | undefined>;
2
+ //# sourceMappingURL=SplitMapIndexContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitMapIndexContext.d.ts","sourceRoot":"","sources":["../../src/components/SplitMapIndexContext.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,6CAEhC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ export const SplitMapIndexContext = createContext(undefined);
3
+ //# sourceMappingURL=SplitMapIndexContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitMapIndexContext.js","sourceRoot":"","sources":["../../src/components/SplitMapIndexContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,SAAS,CACV,CAAC","sourcesContent":["import {createContext} from 'react';\n\nexport const SplitMapIndexContext = createContext<number | undefined>(\n undefined,\n);\n"]}
@@ -5,6 +5,6 @@ type DndEffectsHook = {
5
5
  onDragStart: (event: DragStartEvent) => void;
6
6
  onDragEnd: (event: DragEndEvent) => void;
7
7
  };
8
- declare const useDndEffects: (mapId: string, effects: Effect[], effectOrder: string[]) => DndEffectsHook;
8
+ declare const useDndEffects: (mapId: string | undefined, effects: Effect[], effectOrder: string[]) => DndEffectsHook;
9
9
  export default useDndEffects;
10
10
  //# sourceMappingURL=useDndEffects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDndEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useDndEffects.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAQxC,KAAK,cAAc,GAAG;IACpB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,CACnB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,EAAE,MAAM,EAAE,KAClB,cAgFJ,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"useDndEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useDndEffects.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAQxC,KAAK,cAAc,GAAG;IACpB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,CACnB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,EAAE,MAAM,EAAE,KAClB,cAkFJ,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -11,6 +11,8 @@ const useDndEffects = (mapId, effects, effectOrder) => {
11
11
  const [activeEffect, setActiveEffect] = useState();
12
12
  const onEffectDragStart = useCallback((event) => {
13
13
  const { active } = event;
14
+ if (!mapId)
15
+ return;
14
16
  const newActiveEffect = effects.find((effect) => effect.id === active.id);
15
17
  if (newActiveEffect) {
16
18
  setActiveEffect(newActiveEffect);
@@ -21,6 +23,8 @@ const useDndEffects = (mapId, effects, effectOrder) => {
21
23
  }, [dispatch, effects, mapId]);
22
24
  const onEffectDragEnd = useCallback((event) => {
23
25
  const { active, over } = event;
26
+ if (!mapId)
27
+ return;
24
28
  const { id: activeEffectId } = active;
25
29
  const overType = over?.data?.current?.type;
26
30
  if (!overType) {
@@ -1 +1 @@
1
- {"version":3,"file":"useDndEffects.js","sourceRoot":"","sources":["../../src/hooks/useDndEffects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAElD,yEAAyE;AACzE,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAQ1C,MAAM,aAAa,GAIG,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;IACpD,oEAAoE;IACpE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;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AAoC;YACpC,KAAK,0BAA0B;gBAC7B,qCAAqC;gBACrC,QAAQ,CACN,KAAK,EACL,aAAa,CACX,kBAAkB,CAChB,WAAW,EACX,cAAc,CAAC,QAAQ,EAAE,EACzB,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAC1C,CACF,CACF,CAAC;gBACF,MAAM;YACR;gBACE,MAAM;QACV,CAAC;QAED,eAAe,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC,EACD,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,CAC/B,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,WAAW,EAAE,iBAAiB;QAC9B,SAAS,EAAE,eAAe;KAC3B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {useCallback, useState} from 'react';\nimport {DragEndEvent, DragStartEvent} from '@dnd-kit/core';\nimport {reorderEffect, updateEffect} from '@kepler.gl/actions';\nimport {reorderEffectOrder} from '@kepler.gl/utils';\nimport {Effect} from '@kepler.gl/types';\nimport {SORTABLE_EFFECT_TYPE} from '@kepler.gl/components';\n\nimport {useStoreWithKepler} from '../KeplerSlice';\n\n// TODO import from @kepler.gl/components once 3.2.1 release is available\nconst SORTABLE_EFFECT_PANEL_TYPE = 'root';\n\ntype DndEffectsHook = {\n activeEffect: Effect | undefined;\n onDragStart: (event: DragStartEvent) => void;\n onDragEnd: (event: DragEndEvent) => void;\n};\n\nconst useDndEffects: (\n mapId: string,\n effects: Effect[],\n effectOrder: string[],\n) => DndEffectsHook = (mapId, effects, effectOrder) => {\n // Use the proper sqlrooms dispatch mechanism instead of useDispatch\n const dispatch = useStoreWithKepler((state) => state.kepler.dispatchAction);\n\n const [activeEffect, setActiveEffect]: [\n Effect | undefined,\n (effect: Effect | undefined) => void,\n ] = useState();\n\n const onEffectDragStart = useCallback(\n (event: DragStartEvent) => {\n const {active} = event;\n const newActiveEffect = effects.find((effect) => effect.id === active.id);\n if (newActiveEffect) {\n setActiveEffect(newActiveEffect);\n if ((newActiveEffect as any).isConfigActive) {\n dispatch(\n mapId,\n updateEffect(newActiveEffect.id, {isConfigActive: false}),\n );\n }\n }\n },\n [dispatch, effects, mapId],\n );\n\n const onEffectDragEnd = useCallback(\n (event: DragEndEvent) => {\n const {active, over} = event;\n\n const {id: activeEffectId} = active;\n const overType = over?.data?.current?.type;\n\n if (!overType) {\n setActiveEffect(undefined);\n return;\n }\n\n switch (overType) {\n // swaping effects\n case SORTABLE_EFFECT_TYPE:\n dispatch(\n mapId,\n reorderEffect(\n reorderEffectOrder(\n effectOrder,\n activeEffectId.toString(),\n over.id.toString(),\n ),\n ),\n );\n break;\n // moving effects within side panel\n case SORTABLE_EFFECT_PANEL_TYPE:\n // move effect to the end of the list\n dispatch(\n mapId,\n reorderEffect(\n reorderEffectOrder(\n effectOrder,\n activeEffectId.toString(),\n effectOrder[effectOrder.length - 1] || '',\n ),\n ),\n );\n break;\n default:\n break;\n }\n\n setActiveEffect(undefined);\n },\n [dispatch, effectOrder, mapId],\n );\n\n return {\n activeEffect,\n onDragStart: onEffectDragStart,\n onDragEnd: onEffectDragEnd,\n };\n};\n\nexport default useDndEffects;\n"]}
1
+ {"version":3,"file":"useDndEffects.js","sourceRoot":"","sources":["../../src/hooks/useDndEffects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAElD,yEAAyE;AACzE,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAQ1C,MAAM,aAAa,GAIG,CAAC,KAAK,EAAE,OAAO,EAAE,WA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AAC;YACjB,kBAAkB;YAClB,KAAK,oBAAoB;gBACvB,QAAQ,CACN,KAAK,EACL,aAAa,CACX,kBAAkB,CAChB,WAAW,EACX,cAAc,CAAC,QAAQ,EAAE,EACzB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CACnB,CACF,CACF,CAAC;gBACF,MAAM;YACR,oCAAoC;YACpC,KAAK,0BAA0B;gBAC7B,qCAAqC;gBACrC,QAAQ,CACN,KAAK,EACL,aAAa,CACX,kBAAkB,CAChB,WAAW,EACX,cAAc,CAAC,QAAQ,EAAE,EACzB,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAC1C,CACF,CACF,CAAC;gBACF,MAAM;YACR;gBACE,MAAM;QACV,CAAC;QAED,eAAe,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC,EACD,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,CAC/B,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,WAAW,EAAE,iBAAiB;QAC9B,SAAS,EAAE,eAAe;KAC3B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {useCallback, useState} from 'react';\nimport {DragEndEvent, DragStartEvent} from '@dnd-kit/core';\nimport {reorderEffect, updateEffect} from '@kepler.gl/actions';\nimport {reorderEffectOrder} from '@kepler.gl/utils';\nimport {Effect} from '@kepler.gl/types';\nimport {SORTABLE_EFFECT_TYPE} from '@kepler.gl/components';\n\nimport {useStoreWithKepler} from '../KeplerSlice';\n\n// TODO import from @kepler.gl/components once 3.2.1 release is available\nconst SORTABLE_EFFECT_PANEL_TYPE = 'root';\n\ntype DndEffectsHook = {\n activeEffect: Effect | undefined;\n onDragStart: (event: DragStartEvent) => void;\n onDragEnd: (event: DragEndEvent) => void;\n};\n\nconst useDndEffects: (\n mapId: string | undefined,\n effects: Effect[],\n effectOrder: string[],\n) => DndEffectsHook = (mapId, effects, effectOrder) => {\n // Use the proper sqlrooms dispatch mechanism instead of useDispatch\n const dispatch = useStoreWithKepler((state) => state.kepler.dispatchAction);\n\n const [activeEffect, setActiveEffect]: [\n Effect | undefined,\n (effect: Effect | undefined) => void,\n ] = useState();\n\n const onEffectDragStart = useCallback(\n (event: DragStartEvent) => {\n const {active} = event;\n if (!mapId) return;\n const newActiveEffect = effects.find((effect) => effect.id === active.id);\n if (newActiveEffect) {\n setActiveEffect(newActiveEffect);\n if ((newActiveEffect as any).isConfigActive) {\n dispatch(\n mapId,\n updateEffect(newActiveEffect.id, {isConfigActive: false}),\n );\n }\n }\n },\n [dispatch, effects, mapId],\n );\n\n const onEffectDragEnd = useCallback(\n (event: DragEndEvent) => {\n const {active, over} = event;\n if (!mapId) return;\n\n const {id: activeEffectId} = active;\n const overType = over?.data?.current?.type;\n\n if (!overType) {\n setActiveEffect(undefined);\n return;\n }\n\n switch (overType) {\n // swaping effects\n case SORTABLE_EFFECT_TYPE:\n dispatch(\n mapId,\n reorderEffect(\n reorderEffectOrder(\n effectOrder,\n activeEffectId.toString(),\n over.id.toString(),\n ),\n ),\n );\n break;\n // moving effects within side panel\n case SORTABLE_EFFECT_PANEL_TYPE:\n // move effect to the end of the list\n dispatch(\n mapId,\n reorderEffect(\n reorderEffectOrder(\n effectOrder,\n activeEffectId.toString(),\n effectOrder[effectOrder.length - 1] || '',\n ),\n ),\n );\n break;\n default:\n break;\n }\n\n setActiveEffect(undefined);\n },\n [dispatch, effectOrder, mapId],\n );\n\n return {\n activeEffect,\n onDragStart: onEffectDragStart,\n onDragEnd: onEffectDragEnd,\n };\n};\n\nexport default useDndEffects;\n"]}
@@ -5,6 +5,6 @@ type DndEffectsHook = {
5
5
  onDragStart: (event: DragStartEvent) => void;
6
6
  onDragEnd: (event: DragEndEvent) => void;
7
7
  };
8
- declare const useDndLayers: (mapId: string, layers: Layer[], layerOrder: string[]) => DndEffectsHook;
8
+ declare const useDndLayers: (mapId: string | undefined, layers: Layer[], layerOrder: string[]) => DndEffectsHook;
9
9
  export default useDndLayers;
10
10
  //# sourceMappingURL=useDndLayers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDndLayers.d.ts","sourceRoot":"","sources":["../../src/hooks/useDndLayers.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAO3D,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAQxC,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,KAAK,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,KAAK,EAAE,EACf,UAAU,EAAE,MAAM,EAAE,KACjB,cA8EJ,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"useDndLayers.d.ts","sourceRoot":"","sources":["../../src/hooks/useDndLayers.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAO3D,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAQxC,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,KAAK,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,CAClB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,KAAK,EAAE,EACf,UAAU,EAAE,MAAM,EAAE,KACjB,cAgFJ,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -8,6 +8,8 @@ const useDndLayers = (mapId, layers, layerOrder) => {
8
8
  const [activeLayer, setActiveLayer] = useState();
9
9
  const onDragStart = useCallback((event) => {
10
10
  const { active } = event;
11
+ if (!mapId)
12
+ return;
11
13
  const newActiveLayer = layers.find((layer) => layer.id === active.id);
12
14
  if (newActiveLayer) {
13
15
  setActiveLayer(newActiveLayer);
@@ -18,6 +20,8 @@ const useDndLayers = (mapId, layers, layerOrder) => {
18
20
  }, [dispatch, layers, mapId]);
19
21
  const onDragEnd = useCallback((event) => {
20
22
  const { active, over } = event;
23
+ if (!mapId)
24
+ return;
21
25
  const { id: activeLayerId } = active;
22
26
  const overType = over?.data?.current?.type;
23
27
  if (!overType) {
@@ -1 +1 @@
1
- {"version":3,"file":"useDndLayers.js","sourceRoot":"","sources":["../../src/hooks/useDndLayers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAQlD,MAAM,YAAY,GAII,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;IAClD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAE5E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAG/B,QAAQ,EAAE,CAAC;IAEf,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAAU,EAAE,EAAE;QACb,MAAM,EAAC,MAAM,EAAC,GAAG,KAAK,CAAC;QACvB,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAA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AAa,CAAC,CAAC,CAAC;gBAC7C,MAAM;YACR,CAAC;YACD,mCAAmC;YACnC,KAAK,wBAAwB;gBAC3B,oCAAoC;gBACpC,QAAQ,CACN,KAAK,EACL,YAAY,CACV,iBAAiB,CACf,UAAU,EACV,aAAa,EACb,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CACxC,CACF,CACF,CAAC;gBACF,MAAM;YACR;gBACE,MAAM;QACV,CAAC;QAED,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC,EACD,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAC9B,CAAC;IAEF,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {useCallback, useState} from 'react';\nimport {DragEndEvent, DragStartEvent} from '@dnd-kit/core';\nimport {\n layerConfigChange,\n reorderLayer,\n toggleLayerForMap,\n} from '@kepler.gl/actions';\nimport {reorderLayerOrder} from '@kepler.gl/reducers';\nimport {Layer} from '@kepler.gl/layers';\nimport {\n DROPPABLE_MAP_CONTAINER_TYPE,\n SORTABLE_LAYER_TYPE,\n SORTABLE_SIDE_PANEL_TYPE,\n} from '@kepler.gl/components';\nimport {useStoreWithKepler} from '../KeplerSlice';\n\ntype DndEffectsHook = {\n activeLayer: Layer | undefined;\n onDragStart: (event: DragStartEvent) => void;\n onDragEnd: (event: DragEndEvent) => void;\n};\n\nconst useDndLayers: (\n mapId: string,\n layers: Layer[],\n layerOrder: string[],\n) => DndEffectsHook = (mapId, layers, layerOrder) => {\n const dispatch = useStoreWithKepler((state) => state.kepler.dispatchAction);\n\n const [activeLayer, setActiveLayer]: [\n activeEffect: Layer | undefined,\n setActiveEffect: (effect: Layer | undefined) => void,\n ] = useState();\n\n const onDragStart = useCallback(\n (event: any) => {\n const {active} = event;\n const newActiveLayer = layers.find((layer) => layer.id === active.id);\n if (newActiveLayer) {\n setActiveLayer(newActiveLayer);\n if (newActiveLayer?.config.isConfigActive) {\n dispatch(\n mapId,\n layerConfigChange(newActiveLayer, {isConfigActive: false}),\n );\n }\n }\n },\n [dispatch, layers, mapId],\n );\n\n const onDragEnd = useCallback(\n (event: any) => {\n const {active, over} = event;\n\n const {id: activeLayerId} = active;\n const overType = over?.data?.current?.type;\n\n if (!overType) {\n setActiveLayer(undefined);\n return;\n }\n\n switch (overType) {\n // moving layers into maps\n case DROPPABLE_MAP_CONTAINER_TYPE: {\n const mapIndex = over.data.current?.index ?? 0;\n dispatch(mapId, toggleLayerForMap(mapIndex, activeLayerId));\n break;\n }\n // swaping layers\n case SORTABLE_LAYER_TYPE: {\n const newLayerOrder = reorderLayerOrder(\n layerOrder,\n activeLayerId,\n over.id,\n );\n dispatch(mapId, reorderLayer(newLayerOrder));\n break;\n }\n // moving layers within side panel\n case SORTABLE_SIDE_PANEL_TYPE:\n // move layer to the end of the list\n dispatch(\n mapId,\n reorderLayer(\n reorderLayerOrder(\n layerOrder,\n activeLayerId,\n layerOrder[layerOrder.length - 1] || '',\n ),\n ),\n );\n break;\n default:\n break;\n }\n\n setActiveLayer(undefined);\n },\n [dispatch, layerOrder, mapId],\n );\n\n return {activeLayer, onDragStart, onDragEnd};\n};\n\nexport default useDndLayers;\n"]}
1
+ {"version":3,"file":"useDndLayers.js","sourceRoot":"","sources":["../../src/hooks/useDndLayers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AA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ACT,CAAC;QAED,QAAQ,QAAQ,EAAE,CAAC;YACjB,0BAA0B;YAC1B,KAAK,4BAA4B,CAAC,CAAC,CAAC;gBAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC;gBAC/C,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;gBAC5D,MAAM;YACR,CAAC;YACD,iBAAiB;YACjB,KAAK,mBAAmB,CAAC,CAAC,CAAC;gBACzB,MAAM,aAAa,GAAG,iBAAiB,CACrC,UAAU,EACV,aAAa,EACb,IAAI,CAAC,EAAE,CACR,CAAC;gBACF,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC7C,MAAM;YACR,CAAC;YACD,mCAAmC;YACnC,KAAK,wBAAwB;gBAC3B,oCAAoC;gBACpC,QAAQ,CACN,KAAK,EACL,YAAY,CACV,iBAAiB,CACf,UAAU,EACV,aAAa,EACb,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CACxC,CACF,CACF,CAAC;gBACF,MAAM;YACR;gBACE,MAAM;QACV,CAAC;QAED,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC,EACD,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAC9B,CAAC;IAEF,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {useCallback, useState} from 'react';\nimport {DragEndEvent, DragStartEvent} from '@dnd-kit/core';\nimport {\n layerConfigChange,\n reorderLayer,\n toggleLayerForMap,\n} from '@kepler.gl/actions';\nimport {reorderLayerOrder} from '@kepler.gl/reducers';\nimport {Layer} from '@kepler.gl/layers';\nimport {\n DROPPABLE_MAP_CONTAINER_TYPE,\n SORTABLE_LAYER_TYPE,\n SORTABLE_SIDE_PANEL_TYPE,\n} from '@kepler.gl/components';\nimport {useStoreWithKepler} from '../KeplerSlice';\n\ntype DndEffectsHook = {\n activeLayer: Layer | undefined;\n onDragStart: (event: DragStartEvent) => void;\n onDragEnd: (event: DragEndEvent) => void;\n};\n\nconst useDndLayers: (\n mapId: string | undefined,\n layers: Layer[],\n layerOrder: string[],\n) => DndEffectsHook = (mapId, layers, layerOrder) => {\n const dispatch = useStoreWithKepler((state) => state.kepler.dispatchAction);\n\n const [activeLayer, setActiveLayer]: [\n activeEffect: Layer | undefined,\n setActiveEffect: (effect: Layer | undefined) => void,\n ] = useState();\n\n const onDragStart = useCallback(\n (event: any) => {\n const {active} = event;\n if (!mapId) return;\n const newActiveLayer = layers.find((layer) => layer.id === active.id);\n if (newActiveLayer) {\n setActiveLayer(newActiveLayer);\n if (newActiveLayer?.config.isConfigActive) {\n dispatch(\n mapId,\n layerConfigChange(newActiveLayer, {isConfigActive: false}),\n );\n }\n }\n },\n [dispatch, layers, mapId],\n );\n\n const onDragEnd = useCallback(\n (event: any) => {\n const {active, over} = event;\n if (!mapId) return;\n\n const {id: activeLayerId} = active;\n const overType = over?.data?.current?.type;\n\n if (!overType) {\n setActiveLayer(undefined);\n return;\n }\n\n switch (overType) {\n // moving layers into maps\n case DROPPABLE_MAP_CONTAINER_TYPE: {\n const mapIndex = over.data.current?.index ?? 0;\n dispatch(mapId, toggleLayerForMap(mapIndex, activeLayerId));\n break;\n }\n // swaping layers\n case SORTABLE_LAYER_TYPE: {\n const newLayerOrder = reorderLayerOrder(\n layerOrder,\n activeLayerId,\n over.id,\n );\n dispatch(mapId, reorderLayer(newLayerOrder));\n break;\n }\n // moving layers within side panel\n case SORTABLE_SIDE_PANEL_TYPE:\n // move layer to the end of the list\n dispatch(\n mapId,\n reorderLayer(\n reorderLayerOrder(\n layerOrder,\n activeLayerId,\n layerOrder[layerOrder.length - 1] || '',\n ),\n ),\n );\n break;\n default:\n break;\n }\n\n setActiveLayer(undefined);\n },\n [dispatch, layerOrder, mapId],\n );\n\n return {activeLayer, onDragStart, onDragEnd};\n};\n\nexport default useDndLayers;\n"]}
package/dist/index.d.ts CHANGED
@@ -13,13 +13,15 @@ export { KeplerImageExport } from './components/KeplerImageExport';
13
13
  export { configureKeplerInjector, getKeplerFactory, getKeplerInjector, KeplerInjector, resetKeplerInjectorRecipes, } from './components/KeplerInjector';
14
14
  export type { KeplerFactoryRecipe, KeplerFactoryRecipeMode, } from './components/KeplerInjector';
15
15
  export { KeplerMapContainer } from './components/KeplerMapContainer';
16
+ export { SplitMapIndexContext } from './components/SplitMapIndexContext';
16
17
  export { KeplerPlotContainer } from './components/KeplerPlotContainer';
17
18
  export { KeplerProvider } from './components/KeplerProvider';
18
19
  export { KeplerS3Browser } from './components/KeplerS3Browser';
19
20
  export type { KeplerS3BrowserProps } from './components/KeplerS3Browser';
20
21
  export { KeplerSidePanels } from './components/KeplerSidePanels';
21
22
  export { useKeplerStateActions } from './hooks/useKeplerStateActions';
22
- export { KeplerMapSchema, KeplerSliceConfig } from '@sqlrooms/kepler-config';
23
+ export { KeplerMapSchema, KeplerSliceConfig, migrateKeplerTabsToArtifacts, } from '@sqlrooms/kepler-config';
24
+ export type { KeplerTabsArtifactsMigrationOptions } from '@sqlrooms/kepler-config';
23
25
  export { CustomDndContextFactory } from './components/CustomDndContext';
24
26
  export { CustomFilterPanelHeaderFactory } from './components/CustomFilterPanelHeader';
25
27
  export { CustomMapControlTooltipFactory } from './components/CustomMapControlTooltipFactory';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,kCAAkC,EAClC,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,aAAa,EAAC,MAAM,4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,CAAC;AACjC,YAAY,EAAC,mCAAmC,EAAC,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAC,uBAAuB,EAAC,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAC,8BAA8B,EAAC,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAC,8BAA8B,EAAC,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAC,sBAAsB,EAAC,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAC,2BAA2B,EAAC,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export { KeplerAddTileSetDialog } from './components/KeplerAddTileSetDialog';
9
9
  export { KeplerImageExport } from './components/KeplerImageExport';
10
10
  export { configureKeplerInjector, getKeplerFactory, getKeplerInjector, KeplerInjector, resetKeplerInjectorRecipes, } from './components/KeplerInjector';
11
11
  export { KeplerMapContainer } from './components/KeplerMapContainer';
12
+ export { SplitMapIndexContext } from './components/SplitMapIndexContext';
12
13
  export { KeplerPlotContainer } from './components/KeplerPlotContainer';
13
14
  export { KeplerProvider } from './components/KeplerProvider';
14
15
  export { KeplerS3Browser } from './components/KeplerS3Browser';
@@ -16,7 +17,7 @@ export { KeplerSidePanels } from './components/KeplerSidePanels';
16
17
  export { useKeplerStateActions } from './hooks/useKeplerStateActions';
17
18
  // Re-export from @sqlrooms/kepler-config
18
19
  // Values also export their corresponding types automatically (Zod pattern)
19
- export { KeplerMapSchema, KeplerSliceConfig } from '@sqlrooms/kepler-config';
20
+ export { KeplerMapSchema, KeplerSliceConfig, migrateKeplerTabsToArtifacts, } from '@sqlrooms/kepler-config';
20
21
  export { CustomDndContextFactory } from './components/CustomDndContext';
21
22
  export { CustomFilterPanelHeaderFactory } from './components/CustomFilterPanelHeader';
22
23
  export { CustomMapControlTooltipFactory } from './components/CustomMapControlTooltipFactory';
package/dist/index.js.map CHANGED
@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AC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n createDefaultKeplerConfig,\n createKeplerSlice,\n useStoreWithKepler,\n} from './KeplerSlice';\nexport type {\n CreateInitialMapKeplerStateContext,\n CreateKeplerSliceOptions,\n KeplerSliceState,\n} from './KeplerSlice';\n\nexport {FileDropInput} from './components/FileDropInput';\nexport {KeplerAddDataDialog} from './components/KeplerAddDataDialog';\nexport type {\n AddDataMethods,\n KeplerAddDataDialogProps,\n} from './components/KeplerAddDataDialog';\nexport {KeplerAddTileSetDialog} from './components/KeplerAddTileSetDialog';\nexport type {LoadTileSet} from './components/KeplerAddTileSetDialog';\nexport {KeplerImageExport} from './components/KeplerImageExport';\nexport {\n configureKeplerInjector,\n getKeplerFactory,\n getKeplerInjector,\n KeplerInjector,\n resetKeplerInjectorRecipes,\n} from './components/KeplerInjector';\nexport type {\n KeplerFactoryRecipe,\n KeplerFactoryRecipeMode,\n} from './components/KeplerInjector';\nexport {KeplerMapContainer} from './components/KeplerMapContainer';\nexport {KeplerPlotContainer} from './components/KeplerPlotContainer';\nexport {KeplerProvider} from './components/KeplerProvider';\nexport {KeplerS3Browser} from './components/KeplerS3Browser';\nexport type {KeplerS3BrowserProps} from './components/KeplerS3Browser';\nexport {KeplerSidePanels} from './components/KeplerSidePanels';\nexport {useKeplerStateActions} from './hooks/useKeplerStateActions';\n\n// Re-export from @sqlrooms/kepler-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {KeplerMapSchema, KeplerSliceConfig} from '@sqlrooms/kepler-config';\n\nexport {CustomDndContextFactory} from './components/CustomDndContext';\nexport {CustomFilterPanelHeaderFactory} from './components/CustomFilterPanelHeader';\nexport {CustomMapControlTooltipFactory} from './components/CustomMapControlTooltipFactory';\nexport {CustomMapLegendFactory} from './components/CustomMapLegend';\nexport {CustomMapLegendPanelFactory} from './components/CustomMapLegendPanel';\nexport {\n CustomAddDataButtonFactory,\n CustomPanelTitleFactory,\n} from './components/KeplerInjector';\n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,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n createDefaultKeplerConfig,\n createKeplerSlice,\n useStoreWithKepler,\n} from './KeplerSlice';\nexport type {\n CreateInitialMapKeplerStateContext,\n CreateKeplerSliceOptions,\n KeplerSliceState,\n} from './KeplerSlice';\n\nexport {FileDropInput} from './components/FileDropInput';\nexport {KeplerAddDataDialog} from './components/KeplerAddDataDialog';\nexport type {\n AddDataMethods,\n KeplerAddDataDialogProps,\n} from './components/KeplerAddDataDialog';\nexport {KeplerAddTileSetDialog} from './components/KeplerAddTileSetDialog';\nexport type {LoadTileSet} from './components/KeplerAddTileSetDialog';\nexport {KeplerImageExport} from './components/KeplerImageExport';\nexport {\n configureKeplerInjector,\n getKeplerFactory,\n getKeplerInjector,\n KeplerInjector,\n resetKeplerInjectorRecipes,\n} from './components/KeplerInjector';\nexport type {\n KeplerFactoryRecipe,\n KeplerFactoryRecipeMode,\n} from './components/KeplerInjector';\nexport {KeplerMapContainer} from './components/KeplerMapContainer';\nexport {SplitMapIndexContext} from './components/SplitMapIndexContext';\nexport {KeplerPlotContainer} from './components/KeplerPlotContainer';\nexport {KeplerProvider} from './components/KeplerProvider';\nexport {KeplerS3Browser} from './components/KeplerS3Browser';\nexport type {KeplerS3BrowserProps} from './components/KeplerS3Browser';\nexport {KeplerSidePanels} from './components/KeplerSidePanels';\nexport {useKeplerStateActions} from './hooks/useKeplerStateActions';\n\n// Re-export from @sqlrooms/kepler-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n KeplerMapSchema,\n KeplerSliceConfig,\n migrateKeplerTabsToArtifacts,\n} from '@sqlrooms/kepler-config';\nexport type {KeplerTabsArtifactsMigrationOptions} from '@sqlrooms/kepler-config';\n\nexport {CustomDndContextFactory} from './components/CustomDndContext';\nexport {CustomFilterPanelHeaderFactory} from './components/CustomFilterPanelHeader';\nexport {CustomMapControlTooltipFactory} from './components/CustomMapControlTooltipFactory';\nexport {CustomMapLegendFactory} from './components/CustomMapLegend';\nexport {CustomMapLegendPanelFactory} from './components/CustomMapLegendPanel';\nexport {\n CustomAddDataButtonFactory,\n CustomPanelTitleFactory,\n} from './components/KeplerInjector';\n"]}
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "@sqlrooms/kepler",
3
- "version": "0.29.0-rc.2",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "module": "dist/index.js",
7
- "type": "module",
8
- "sideEffects": false,
9
- "author": "SQLRooms Contributors",
10
- "license": "MIT",
3
+ "version": "0.29.0-rc.4",
11
4
  "repository": {
12
5
  "type": "git",
13
6
  "url": "git+https://github.com/sqlrooms/sqlrooms.git"
14
7
  },
8
+ "license": "MIT",
9
+ "author": "SQLRooms Contributors",
10
+ "sideEffects": false,
11
+ "type": "module",
12
+ "main": "dist/index.js",
13
+ "module": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
- "publishConfig": {
19
- "access": "public"
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsc -w",
21
+ "lint": "eslint .",
22
+ "typedoc": "typedoc"
20
23
  },
21
24
  "dependencies": {
22
25
  "@dnd-kit/core": "^6.1.0",
@@ -34,10 +37,10 @@
34
37
  "@kepler.gl/types": "3.3.0-alpha.0",
35
38
  "@kepler.gl/utils": "3.3.0-alpha.0",
36
39
  "@paralleldrive/cuid2": "^3.0.0",
37
- "@sqlrooms/kepler-config": "0.29.0-rc.2",
38
- "@sqlrooms/room-shell": "0.29.0-rc.2",
39
- "@sqlrooms/s3-browser": "0.29.0-rc.2",
40
- "@sqlrooms/ui": "0.29.0-rc.2",
40
+ "@sqlrooms/kepler-config": "0.29.0-rc.4",
41
+ "@sqlrooms/room-shell": "0.29.0-rc.4",
42
+ "@sqlrooms/s3-browser": "0.29.0-rc.4",
43
+ "@sqlrooms/ui": "0.29.0-rc.4",
41
44
  "apache-arrow": "17.0.0",
42
45
  "immer": "^11.0.1",
43
46
  "lucide-react": "^0.556.0",
@@ -48,18 +51,15 @@
48
51
  "redux-logger": "^3.0.6",
49
52
  "styled-components": "6.1.8"
50
53
  },
54
+ "devDependencies": {
55
+ "@types/redux-logger": "^3.0.13"
56
+ },
51
57
  "peerDependencies": {
52
58
  "react": ">=18",
53
59
  "react-dom": ">=18"
54
60
  },
55
- "scripts": {
56
- "dev": "tsc -w",
57
- "build": "tsc",
58
- "lint": "eslint .",
59
- "typedoc": "typedoc"
60
- },
61
- "devDependencies": {
62
- "@types/redux-logger": "^3.0.13"
61
+ "publishConfig": {
62
+ "access": "public"
63
63
  },
64
- "gitHead": "5d511631992c1af8852ea79ced488867aad4a555"
64
+ "gitHead": "8694bab9d3d915a06d28675ad801b21444bcc55f"
65
65
  }