@sqlrooms/kepler 0.27.0-rc.1 → 0.27.0-rc.3
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.
- package/dist/KeplerSlice.d.ts +1 -1
- package/dist/KeplerSlice.d.ts.map +1 -1
- package/dist/KeplerSlice.js +15 -2
- package/dist/KeplerSlice.js.map +1 -1
- package/dist/components/CustomFilterManager.d.ts.map +1 -1
- package/dist/components/CustomFilterManager.js +6 -6
- package/dist/components/CustomFilterManager.js.map +1 -1
- package/dist/components/CustomLayerManager.js +5 -5
- package/dist/components/CustomLayerManager.js.map +1 -1
- package/dist/components/CustomMapControlTooltipFactory.d.ts +5 -0
- package/dist/components/CustomMapControlTooltipFactory.d.ts.map +1 -0
- package/dist/components/CustomMapControlTooltipFactory.js +8 -0
- package/dist/components/CustomMapControlTooltipFactory.js.map +1 -0
- package/dist/components/CustomMapLegend.d.ts.map +1 -1
- package/dist/components/CustomMapLegend.js +2 -2
- package/dist/components/CustomMapLegend.js.map +1 -1
- package/dist/components/CustomMapManager.js +3 -3
- package/dist/components/CustomMapManager.js.map +1 -1
- package/dist/components/CustomTooltipConfig.d.ts.map +1 -1
- package/dist/components/CustomTooltipConfig.js +3 -4
- package/dist/components/CustomTooltipConfig.js.map +1 -1
- package/dist/components/KeplerAddDataDialog.d.ts.map +1 -1
- package/dist/components/KeplerAddDataDialog.js +5 -4
- package/dist/components/KeplerAddDataDialog.js.map +1 -1
- package/dist/components/KeplerAddTileSetDialog.d.ts.map +1 -1
- package/dist/components/KeplerAddTileSetDialog.js +5 -4
- package/dist/components/KeplerAddTileSetDialog.js.map +1 -1
- package/dist/components/KeplerInjector.d.ts +12 -1
- package/dist/components/KeplerInjector.d.ts.map +1 -1
- package/dist/components/KeplerInjector.js +36 -3
- package/dist/components/KeplerInjector.js.map +1 -1
- package/dist/components/KeplerMapContainer.js +6 -6
- package/dist/components/KeplerMapContainer.js.map +1 -1
- package/dist/components/KeplerPlotContainer.d.ts.map +1 -1
- package/dist/components/KeplerPlotContainer.js +2 -2
- package/dist/components/KeplerPlotContainer.js.map +1 -1
- package/dist/components/KeplerSidePanels.d.ts.map +1 -1
- package/dist/components/KeplerSidePanels.js +5 -2
- package/dist/components/KeplerSidePanels.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -4,13 +4,13 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { LayerGroupSelectorFactory, PanelTitleFactory, SidePanelSection, Button, Icons, } from '@kepler.gl/components';
|
|
6
6
|
import { SIDEBAR_PANELS, ADD_MAP_STYLE_ID } from '@kepler.gl/constants';
|
|
7
|
-
import {
|
|
7
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
8
8
|
import { useKeplerStateActions, } from '../hooks/useKeplerStateActions';
|
|
9
9
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuCheckboxItem, DropdownMenuTrigger, } from '@sqlrooms/ui';
|
|
10
10
|
import { ChevronDown } from 'lucide-react';
|
|
11
11
|
// Get the kepler.gl components through the injector
|
|
12
|
-
const LayerGroupSelector =
|
|
13
|
-
const PanelTitle =
|
|
12
|
+
const LayerGroupSelector = getKeplerFactory(LayerGroupSelectorFactory);
|
|
13
|
+
const PanelTitle = getKeplerFactory(PanelTitleFactory);
|
|
14
14
|
// Import icons from kepler.gl
|
|
15
15
|
const { Add, Trash } = Icons;
|
|
16
16
|
const mapPanelMetadata = SIDEBAR_PANELS.find((p) => p.id === 'map');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMapManager.js","sourceRoot":"","sources":["../../src/components/CustomMapManager.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;A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AAC","sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport {useIntl} from 'react-intl';\nimport styled from 'styled-components';\n\nimport {\n LayerGroupSelectorFactory,\n PanelTitleFactory,\n SidePanelSection,\n Button,\n Icons,\n} from '@kepler.gl/components';\nimport {SIDEBAR_PANELS, ADD_MAP_STYLE_ID} from '@kepler.gl/constants';\nimport {MapStyle} from '@kepler.gl/reducers';\n\nimport {KeplerInjector} from './KeplerInjector';\nimport {\n KeplerActions,\n useKeplerStateActions,\n} from '../hooks/useKeplerStateActions';\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuCheckboxItem,\n DropdownMenuTrigger,\n} from '@sqlrooms/ui';\nimport {ChevronDown} from 'lucide-react';\n\n// Get the kepler.gl components through the injector\nconst LayerGroupSelector = KeplerInjector.get(LayerGroupSelectorFactory);\nconst PanelTitle = KeplerInjector.get(PanelTitleFactory);\n\n// Import icons from kepler.gl\nconst {Add, Trash} = Icons;\n\nconst mapPanelMetadata = SIDEBAR_PANELS.find((p) => p.id === 'map');\n\n// Custom styled components for the map manager\nconst CustomMapManagerContainer = styled.div<{isOpen?: boolean}>`\n .map-style-panel {\n /* Add your custom styles here */\n }\n\n .map-manager-title {\n /* Custom title styling */\n }\n\n .add-map-style-button {\n background-color: ${(props) =>\n props.theme.sidePanelBg || props.theme.panelBackground || '#fff'};\n color: ${(props) =>\n props.theme.activeColor || props.theme.textColorHl || '#2563EB'};\n border: 0px;\n height: 28px;\n font-weight: 500;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .layer-group__header {\n display: none;\n }\n`;\n\ntype CustomMapManagerProps = {\n mapId: string;\n};\n\n// Custom hook for map style actions\nfunction useCustomMapActions(keplerActions: KeplerActions) {\n const {toggleModal} = keplerActions.uiStateActions;\n const {mapStyleChange, removeCustomMapStyle} = keplerActions.mapStyleActions;\n\n const onShowAddMapStyleModal = useCallback(\n () => toggleModal(ADD_MAP_STYLE_ID),\n [toggleModal],\n );\n\n const onMapStyleChange = useCallback(\n (styleType: string) => mapStyleChange(styleType),\n [mapStyleChange],\n );\n\n const onRemoveCustomMapStyle = useCallback(\n (styleId: string) => removeCustomMapStyle({id: styleId}),\n [removeCustomMapStyle],\n );\n\n return {\n onShowAddMapStyleModal,\n onMapStyleChange,\n onRemoveCustomMapStyle,\n };\n}\n\n// Custom Map Style Dropdown Component\nconst MapStyleDropdown: React.FC<{\n mapStyle: MapStyle;\n onChange: (styleType: string) => void;\n customMapStylesActions?: any;\n}> = ({mapStyle, onChange, customMapStylesActions}) => {\n const {mapStyles, styleType} = mapStyle;\n const currentStyle = mapStyles[styleType];\n\n const handleStyleSelect = (styleId: string) => onChange(styleId);\n return (\n <div className=\"w-full\">\n <DropdownMenu>\n <DropdownMenuTrigger asChild className=\"w-full\">\n <div className=\"border-primary-foreground bg-muted flex min-h-[40px] w-full cursor-pointer items-center justify-between rounded border px-3 py-2 transition-colors hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:hover:bg-gray-700\">\n <div className=\"flex items-center gap-2\">\n <img\n className=\"h-6 w-6 rounded-sm object-cover\"\n src={currentStyle?.icon || ''}\n alt={currentStyle?.label || 'Map Style'}\n />\n <span className=\"text-sm font-medium dark:text-white\">\n {currentStyle?.label || 'Select Style'}\n </span>\n </div>\n <ChevronDown className=\"h-4 w-4 text-gray-500 dark:text-gray-400\" />\n </div>\n </DropdownMenuTrigger>\n <DropdownMenuContent className=\"max-h-64 w-[var(--radix-dropdown-menu-trigger-width)] overflow-y-auto bg-white dark:bg-gray-700\">\n {Object.values(mapStyles).map((style: any) => (\n <DropdownMenuCheckboxItem\n key={style.id}\n onClick={() => handleStyleSelect(style.id)}\n className=\"flex cursor-pointer items-center gap-2 bg-white p-2 text-gray-900 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600\"\n >\n <img\n src={style.icon || ''}\n alt={style.label || 'Untitled'}\n className=\"h-6 w-6 flex-shrink-0 rounded-sm object-cover\"\n />\n <span className=\"flex-1 truncate text-sm\">\n {style.label || 'Untitled'}\n </span>\n {style.custom && customMapStylesActions?.[style.id] && (\n <div\n className=\"flex items-center\"\n onClick={(e) => e.stopPropagation()}\n >\n {customMapStylesActions[style.id].map((action: any) => (\n <button\n key={action.id}\n onClick={(e) => {\n e.stopPropagation();\n action.onClick();\n }}\n className=\"rounded bg-white p-1 transition-colors hover:bg-gray-100 dark:hover:bg-gray-700\"\n title={action.tooltip}\n >\n <action.IconComponent height=\"16px\" />\n </button>\n ))}\n </div>\n )}\n </DropdownMenuCheckboxItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n\n// Main Custom Map Manager Component\nexport const CustomMapManager: React.FC<CustomMapManagerProps> = ({mapId}) => {\n const {keplerActions, keplerState} = useKeplerStateActions({mapId});\n const intl = useIntl();\n\n const {onShowAddMapStyleModal, onMapStyleChange, onRemoveCustomMapStyle} =\n useCustomMapActions(keplerActions);\n\n // Custom map styles actions (for delete functionality)\n const customMapStylesActions = useMemo(() => {\n const actionsPerCustomStyle: any = {};\n Object.values(keplerState?.mapStyle.mapStyles || {})\n .filter((style: any) => Boolean(style.custom))\n .forEach((style: any) => {\n actionsPerCustomStyle[style.id] = [\n {\n id: `remove-map-style-${style.id}`,\n IconComponent: Trash,\n tooltip: 'tooltip.removeBaseMapStyle',\n onClick: () => onRemoveCustomMapStyle(style.id),\n },\n ];\n });\n return actionsPerCustomStyle;\n }, [keplerState?.mapStyle.mapStyles, onRemoveCustomMapStyle]);\n if (!keplerState || !keplerActions) {\n return null;\n }\n\n const {mapStyle} = keplerState;\n const currentStyle = mapStyle.mapStyles[mapStyle.styleType] || {};\n const editableLayers = (currentStyle as any).layerGroups || [];\n\n return (\n <CustomMapManagerContainer>\n <div className=\"map-style-panel\">\n <SidePanelSection>\n <PanelTitle\n className=\"map-manager-title\"\n title={intl.formatMessage({\n id: mapPanelMetadata?.label || 'Base map',\n })}\n >\n <Button\n className=\"add-map-style-button\"\n onClick={onShowAddMapStyleModal}\n >\n <Add height=\"12px\" />\n <span>{intl.formatMessage({id: 'mapManager.addMapStyle'})}</span>\n </Button>\n </PanelTitle>\n </SidePanelSection>\n\n <SidePanelSection>\n <div className=\"mb-1\">\n <MapStyleDropdown\n mapStyle={mapStyle}\n onChange={onMapStyleChange}\n customMapStylesActions={customMapStylesActions}\n />\n </div>\n\n {editableLayers.length ? (\n <LayerGroupSelector\n layers={mapStyle.visibleLayerGroups}\n editableLayers={editableLayers}\n topLayers={mapStyle.topLayerGroups}\n onChange={keplerActions.mapStyleActions.mapConfigChange}\n threeDBuildingColor={mapStyle.threeDBuildingColor}\n on3dBuildingColorChange={\n keplerActions.mapStyleActions.set3dBuildingColor\n }\n backgroundColor={mapStyle.backgroundColor}\n onBackgroundColorChange={\n keplerActions.mapStyleActions.setBackgroundColor\n }\n />\n ) : null}\n </SidePanelSection>\n </div>\n </CustomMapManagerContainer>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"CustomMapManager.js","sourceRoot":"","sources":["../../src/components/CustomMapManager.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,KAAK,GACN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAGtE,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEL,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAEz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AC,MAAM,GAAG,EACrB,yBAAO,IAAI,CAAC,aAAa,CAAC,EAAC,EAAE,EAAE,wBAAwB,EAAC,CAAC,GAAQ,IAC1D,GACE,GACI,EAEnB,MAAC,gBAAgB,eACf,cAAK,SAAS,EAAC,MAAM,YACnB,KAAC,gBAAgB,IACf,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,sBAAsB,EAAE,sBAAsB,GAC9C,GACE,EAEL,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CACvB,KAAC,kBAAkB,IACjB,MAAM,EAAE,QAAQ,CAAC,kBAAkB,EACnC,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,QAAQ,CAAC,cAAc,EAClC,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,eAAe,EACvD,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,EACjD,uBAAuB,EACrB,aAAa,CAAC,eAAe,CAAC,kBAAkB,EAElD,eAAe,EAAE,QAAQ,CAAC,eAAe,EACzC,uBAAuB,EACrB,aAAa,CAAC,eAAe,CAAC,kBAAkB,GAElD,CACH,CAAC,CAAC,CAAC,IAAI,IACS,IACf,GACoB,CAC7B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport {useIntl} from 'react-intl';\nimport styled from 'styled-components';\n\nimport {\n LayerGroupSelectorFactory,\n PanelTitleFactory,\n SidePanelSection,\n Button,\n Icons,\n} from '@kepler.gl/components';\nimport {SIDEBAR_PANELS, ADD_MAP_STYLE_ID} from '@kepler.gl/constants';\nimport {MapStyle} from '@kepler.gl/reducers';\n\nimport {getKeplerFactory} from './KeplerInjector';\nimport {\n KeplerActions,\n useKeplerStateActions,\n} from '../hooks/useKeplerStateActions';\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuCheckboxItem,\n DropdownMenuTrigger,\n} from '@sqlrooms/ui';\nimport {ChevronDown} from 'lucide-react';\n\n// Get the kepler.gl components through the injector\nconst LayerGroupSelector = getKeplerFactory(LayerGroupSelectorFactory);\nconst PanelTitle = getKeplerFactory(PanelTitleFactory);\n\n// Import icons from kepler.gl\nconst {Add, Trash} = Icons;\n\nconst mapPanelMetadata = SIDEBAR_PANELS.find((p) => p.id === 'map');\n\n// Custom styled components for the map manager\nconst CustomMapManagerContainer = styled.div<{isOpen?: boolean}>`\n .map-style-panel {\n /* Add your custom styles here */\n }\n\n .map-manager-title {\n /* Custom title styling */\n }\n\n .add-map-style-button {\n background-color: ${(props) =>\n props.theme.sidePanelBg || props.theme.panelBackground || '#fff'};\n color: ${(props) =>\n props.theme.activeColor || props.theme.textColorHl || '#2563EB'};\n border: 0px;\n height: 28px;\n font-weight: 500;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .layer-group__header {\n display: none;\n }\n`;\n\ntype CustomMapManagerProps = {\n mapId: string;\n};\n\n// Custom hook for map style actions\nfunction useCustomMapActions(keplerActions: KeplerActions) {\n const {toggleModal} = keplerActions.uiStateActions;\n const {mapStyleChange, removeCustomMapStyle} = keplerActions.mapStyleActions;\n\n const onShowAddMapStyleModal = useCallback(\n () => toggleModal(ADD_MAP_STYLE_ID),\n [toggleModal],\n );\n\n const onMapStyleChange = useCallback(\n (styleType: string) => mapStyleChange(styleType),\n [mapStyleChange],\n );\n\n const onRemoveCustomMapStyle = useCallback(\n (styleId: string) => removeCustomMapStyle({id: styleId}),\n [removeCustomMapStyle],\n );\n\n return {\n onShowAddMapStyleModal,\n onMapStyleChange,\n onRemoveCustomMapStyle,\n };\n}\n\n// Custom Map Style Dropdown Component\nconst MapStyleDropdown: React.FC<{\n mapStyle: MapStyle;\n onChange: (styleType: string) => void;\n customMapStylesActions?: any;\n}> = ({mapStyle, onChange, customMapStylesActions}) => {\n const {mapStyles, styleType} = mapStyle;\n const currentStyle = mapStyles[styleType];\n\n const handleStyleSelect = (styleId: string) => onChange(styleId);\n return (\n <div className=\"w-full\">\n <DropdownMenu>\n <DropdownMenuTrigger asChild className=\"w-full\">\n <div className=\"border-primary-foreground bg-muted flex min-h-[40px] w-full cursor-pointer items-center justify-between rounded border px-3 py-2 transition-colors hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:hover:bg-gray-700\">\n <div className=\"flex items-center gap-2\">\n <img\n className=\"h-6 w-6 rounded-sm object-cover\"\n src={currentStyle?.icon || ''}\n alt={currentStyle?.label || 'Map Style'}\n />\n <span className=\"text-sm font-medium dark:text-white\">\n {currentStyle?.label || 'Select Style'}\n </span>\n </div>\n <ChevronDown className=\"h-4 w-4 text-gray-500 dark:text-gray-400\" />\n </div>\n </DropdownMenuTrigger>\n <DropdownMenuContent className=\"max-h-64 w-[var(--radix-dropdown-menu-trigger-width)] overflow-y-auto bg-white dark:bg-gray-700\">\n {Object.values(mapStyles).map((style: any) => (\n <DropdownMenuCheckboxItem\n key={style.id}\n onClick={() => handleStyleSelect(style.id)}\n className=\"flex cursor-pointer items-center gap-2 bg-white p-2 text-gray-900 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600\"\n >\n <img\n src={style.icon || ''}\n alt={style.label || 'Untitled'}\n className=\"h-6 w-6 flex-shrink-0 rounded-sm object-cover\"\n />\n <span className=\"flex-1 truncate text-sm\">\n {style.label || 'Untitled'}\n </span>\n {style.custom && customMapStylesActions?.[style.id] && (\n <div\n className=\"flex items-center\"\n onClick={(e) => e.stopPropagation()}\n >\n {customMapStylesActions[style.id].map((action: any) => (\n <button\n key={action.id}\n onClick={(e) => {\n e.stopPropagation();\n action.onClick();\n }}\n className=\"rounded bg-white p-1 transition-colors hover:bg-gray-100 dark:hover:bg-gray-700\"\n title={action.tooltip}\n >\n <action.IconComponent height=\"16px\" />\n </button>\n ))}\n </div>\n )}\n </DropdownMenuCheckboxItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n\n// Main Custom Map Manager Component\nexport const CustomMapManager: React.FC<CustomMapManagerProps> = ({mapId}) => {\n const {keplerActions, keplerState} = useKeplerStateActions({mapId});\n const intl = useIntl();\n\n const {onShowAddMapStyleModal, onMapStyleChange, onRemoveCustomMapStyle} =\n useCustomMapActions(keplerActions);\n\n // Custom map styles actions (for delete functionality)\n const customMapStylesActions = useMemo(() => {\n const actionsPerCustomStyle: any = {};\n Object.values(keplerState?.mapStyle.mapStyles || {})\n .filter((style: any) => Boolean(style.custom))\n .forEach((style: any) => {\n actionsPerCustomStyle[style.id] = [\n {\n id: `remove-map-style-${style.id}`,\n IconComponent: Trash,\n tooltip: 'tooltip.removeBaseMapStyle',\n onClick: () => onRemoveCustomMapStyle(style.id),\n },\n ];\n });\n return actionsPerCustomStyle;\n }, [keplerState?.mapStyle.mapStyles, onRemoveCustomMapStyle]);\n if (!keplerState || !keplerActions) {\n return null;\n }\n\n const {mapStyle} = keplerState;\n const currentStyle = mapStyle.mapStyles[mapStyle.styleType] || {};\n const editableLayers = (currentStyle as any).layerGroups || [];\n\n return (\n <CustomMapManagerContainer>\n <div className=\"map-style-panel\">\n <SidePanelSection>\n <PanelTitle\n className=\"map-manager-title\"\n title={intl.formatMessage({\n id: mapPanelMetadata?.label || 'Base map',\n })}\n >\n <Button\n className=\"add-map-style-button\"\n onClick={onShowAddMapStyleModal}\n >\n <Add height=\"12px\" />\n <span>{intl.formatMessage({id: 'mapManager.addMapStyle'})}</span>\n </Button>\n </PanelTitle>\n </SidePanelSection>\n\n <SidePanelSection>\n <div className=\"mb-1\">\n <MapStyleDropdown\n mapStyle={mapStyle}\n onChange={onMapStyleChange}\n customMapStylesActions={customMapStylesActions}\n />\n </div>\n\n {editableLayers.length ? (\n <LayerGroupSelector\n layers={mapStyle.visibleLayerGroups}\n editableLayers={editableLayers}\n topLayers={mapStyle.topLayerGroups}\n onChange={keplerActions.mapStyleActions.mapConfigChange}\n threeDBuildingColor={mapStyle.threeDBuildingColor}\n on3dBuildingColorChange={\n keplerActions.mapStyleActions.set3dBuildingColor\n }\n backgroundColor={mapStyle.backgroundColor}\n onBackgroundColorChange={\n keplerActions.mapStyleActions.setBackgroundColor\n }\n />\n ) : null}\n </SidePanelSection>\n </div>\n </CustomMapManagerContainer>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomTooltipConfig.d.ts","sourceRoot":"","sources":["../../src/components/CustomTooltipConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomTooltipConfig.d.ts","sourceRoot":"","sources":["../../src/components/CustomTooltipConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAiF1C,KAAK,wBAAwB,GAAG;IAC9B,MAAM,EAAE;QACN,YAAY,EAAE;YACZ,CAAC,GAAG,EAAE,MAAM,GAAG;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;aAAC,EAAE,CAAC;SACxD,CAAC;QACF,WAAW,EAAE,OAAO,CAAC;QACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,CAAC;IACF,QAAQ,EAAE,CAAC,MAAM,EAAE;QACjB,YAAY,EAAE;YACZ,CAAC,GAAG,EAAE,MAAM,GAAG;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;aAAC,EAAE,CAAC;SACxD,CAAC;QACF,WAAW,EAAE,OAAO,CAAC;QACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,KAAK,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,qBAAqB,EAAE,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,KAClB,IAAI,CAAC;IACV,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAoBlE,CAAC"}
|
|
@@ -2,9 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import { TooltipConfigFactory } from '@kepler.gl/components';
|
|
5
|
-
import {
|
|
6
|
-
// Get the original TooltipConfig from kepler.gl
|
|
7
|
-
const TooltipConfig = KeplerInjector.get(TooltipConfigFactory);
|
|
5
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
8
6
|
const TooltipConfigWrapper = styled.div `
|
|
9
7
|
width: 100%;
|
|
10
8
|
max-width: 100%;
|
|
@@ -78,8 +76,9 @@ const TooltipConfigWrapper = styled.div `
|
|
|
78
76
|
box-sizing: border-box !important;
|
|
79
77
|
}
|
|
80
78
|
`;
|
|
79
|
+
const TooltipConfig = getKeplerFactory(TooltipConfigFactory);
|
|
81
80
|
export const CustomTooltipConfig = ({ config, datasets, onChange, onDisplayFormatChange, isDark, }) => {
|
|
82
81
|
const intl = useIntl();
|
|
83
|
-
return (_jsx(TooltipConfigWrapper, { isDark: isDark, children: _jsx(TooltipConfig, { config: config, datasets: datasets, onChange: onChange, onDisplayFormatChange: onDisplayFormatChange, intl
|
|
82
|
+
return (_jsx(TooltipConfigWrapper, { isDark: isDark, children: _jsx(TooltipConfig, { config: config, datasets: datasets, onChange: onChange, onDisplayFormatChange: onDisplayFormatChange, ...(intl ? { intl } : {}) }) }));
|
|
84
83
|
};
|
|
85
84
|
//# sourceMappingURL=CustomTooltipConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomTooltipConfig.js","sourceRoot":"","sources":["../../src/components/CustomTooltipConfig.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC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AAqB,EAAE,qBAAqB,KACxC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxB,GACmB,CACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport {useIntl} from 'react-intl';\nimport {TooltipConfigFactory} from '@kepler.gl/components';\nimport {Datasets} from '@kepler.gl/table';\n\nimport {getKeplerFactory} from './KeplerInjector';\n\nconst TooltipConfigWrapper = styled.div<{isDark: boolean}>`\n width: 100%;\n max-width: 100%;\n overflow-x: hidden;\n overflow-y: visible;\n box-sizing: border-box;\n position: relative;\n contain: layout;\n\n .sortable-layer-items > div {\n padding: 2px 4px;\n background-color: ${(props) =>\n props.theme.sidePanelBg || props.theme.panelBackground};\n border-radius: 4px;\n }\n .chickleted-input {\n background-color: ${(props) =>\n props.isDark ? '#0f172a' : '#F6F8FB'} !important;\n border-color: transparent;\n border-radius: 6px;\n font-weight: 400;\n max-width: 100% !important;\n box-sizing: border-box !important;\n }\n .side-panel-section {\n position: relative !important;\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: hidden !important;\n box-sizing: border-box !important;\n }\n .side-panel-section > :first-child {\n display: flex;\n justify-content: space-between;\n position: absolute !important;\n left: 0 !important;\n right: 0 !important;\n width: auto !important;\n padding: 0px 9px;\n top: 8px;\n box-sizing: border-box !important;\n }\n .field-selector {\n padding-top: 32px;\n background-color: ${(props) =>\n props.isDark ? '#0f172a' : '#F6F8FB'} !important;\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: hidden !important;\n box-sizing: border-box !important;\n }\n .update-color {\n display: none;\n }\n .dataset-name {\n font-weight: 500;\n font-size: 12px;\n }\n .clear-all {\n width: 64px;\n font-weight: 400;\n color: #94a2b8 !important;\n font-size: 12px;\n }\n .item-selector {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: hidden !important;\n box-sizing: border-box !important;\n }\n .item-selector > div {\n max-width: 100% !important;\n overflow-x: hidden !important;\n box-sizing: border-box !important;\n }\n`;\n\ntype CustomTooltipConfigProps = {\n config: {\n fieldsToShow: {\n [key: string]: {name: string; format: string | null}[];\n };\n compareMode: boolean;\n compareType: string | null;\n };\n onChange: (config: {\n fieldsToShow: {\n [key: string]: {name: string; format: string | null}[];\n };\n compareMode: boolean;\n compareType: string | null;\n }) => void;\n datasets: Datasets;\n onDisplayFormatChange: (\n dataId: string,\n column: string,\n displayFormat: string,\n ) => void;\n isDark: boolean;\n};\n\nconst TooltipConfig = getKeplerFactory(TooltipConfigFactory);\n\nexport const CustomTooltipConfig: React.FC<CustomTooltipConfigProps> = ({\n config,\n datasets,\n onChange,\n onDisplayFormatChange,\n isDark,\n}) => {\n const intl = useIntl();\n\n return (\n <TooltipConfigWrapper isDark={isDark}>\n <TooltipConfig\n config={config}\n datasets={datasets}\n onChange={onChange}\n onDisplayFormatChange={onDisplayFormatChange}\n {...(intl ? {intl} : {})}\n />\n </TooltipConfigWrapper>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerAddDataDialog.d.ts","sourceRoot":"","sources":["../../src/components/KeplerAddDataDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,wBAAwB,EAKzB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"KeplerAddDataDialog.d.ts","sourceRoot":"","sources":["../../src/components/KeplerAddDataDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,wBAAwB,EAKzB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAe5D,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE;IAC/B,OAAO,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,KAAK,IAAI,CAAC;AA+BX,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,EAAE,OAAO;CACV;AAgBD,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IACnE,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,GAAG,oBAAoB,CAAC;AAEzB,eAAO,MAAM,mBAAmB,GAAI,oKAYjC,wBAAwB,4CAkG1B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState } from 'react';
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, Tabs, TabsContent, TabsList, TabsTrigger, } from '@sqlrooms/ui';
|
|
4
4
|
import { LoadTileSetFactory, Icons } from '@kepler.gl/components';
|
|
5
5
|
import { FileDropInput } from './FileDropInput';
|
|
6
|
-
import {
|
|
6
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
7
7
|
import { KeplerProvider } from './KeplerProvider';
|
|
8
8
|
import { KeplerS3Browser } from './KeplerS3Browser';
|
|
9
9
|
import { useIntl } from 'react-intl';
|
|
@@ -16,14 +16,15 @@ const DEFAULT_ACCEPTED_FORMATS = [
|
|
|
16
16
|
'shp',
|
|
17
17
|
'kml',
|
|
18
18
|
];
|
|
19
|
-
const LoadTileSet =
|
|
19
|
+
const LoadTileSet = getKeplerFactory(LoadTileSetFactory);
|
|
20
20
|
function LoadTileSetContent({ loadTileSet, onClose, }) {
|
|
21
21
|
const intl = useIntl();
|
|
22
22
|
const onTilesetAdded = useCallback((tileset, metadata) => {
|
|
23
23
|
loadTileSet({ tileset, metadata });
|
|
24
24
|
onClose?.();
|
|
25
25
|
}, [loadTileSet, onClose]);
|
|
26
|
-
|
|
26
|
+
const meta = useMemo(() => ({}), []); // TODO: add metadata
|
|
27
|
+
return (_jsx(LoadTileSet, { meta: meta, isAddingDatasets: false, intl: intl, onTilesetAdded: onTilesetAdded }));
|
|
27
28
|
}
|
|
28
29
|
export var AddDataMethods;
|
|
29
30
|
(function (AddDataMethods) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerAddDataDialog.js","sourceRoot":"","sources":["../../src/components/KeplerAddDataDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"KeplerAddDataDialog.js","sourceRoot":"","sources":["../../src/components/KeplerAddDataDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAErD,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,EAEX,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,kBAAkB,EAAE,KAAK,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAA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DialogDescription,\n DialogHeader,\n DialogTitle,\n UseDisclosureReturnValue,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n} from '@sqlrooms/ui';\nimport {LoadTileSetFactory, Icons} from '@kepler.gl/components';\nimport {FileDropInput} from './FileDropInput';\nimport {getKeplerFactory} from './KeplerInjector';\nimport {KeplerProvider} from './KeplerProvider';\nimport {KeplerS3Browser} from './KeplerS3Browser';\nimport type {KeplerS3BrowserProps} from './KeplerS3Browser';\nimport {useIntl} from 'react-intl';\n\nconst DEFAULT_ACCEPTED_FORMATS = [\n 'csv',\n 'tsv',\n 'parquet',\n 'json',\n 'arrow',\n 'shp',\n 'kml',\n];\n\nconst LoadTileSet = getKeplerFactory(LoadTileSetFactory);\n\nexport type LoadTileSet = (args: {\n tileset: {name: string; type: string; metadata: Record<string, any>};\n metadata?: Record<string, any>;\n}) => void;\n\nfunction LoadTileSetContent({\n loadTileSet,\n onClose,\n}: {\n loadTileSet: LoadTileSet;\n onClose?: () => void;\n}) {\n const intl = useIntl();\n const onTilesetAdded = useCallback(\n (\n tileset: {name: string; type: string; metadata: Record<string, any>},\n metadata?: Record<string, any>,\n ) => {\n loadTileSet({tileset, metadata});\n onClose?.();\n },\n [loadTileSet, onClose],\n );\n const meta = useMemo(() => ({}), []); // TODO: add metadata\n return (\n <LoadTileSet\n meta={meta}\n isAddingDatasets={false}\n intl={intl}\n onTilesetAdded={onTilesetAdded}\n />\n );\n}\n\nexport enum AddDataMethods {\n Upload = 'upload',\n TileSet = 'tileset',\n S3 = 's3',\n}\nconst ADD_DATA_METHODS = [\n {\n label: 'Local File',\n value: AddDataMethods.Upload,\n },\n {\n label: 'Tiles',\n value: AddDataMethods.TileSet,\n },\n // {\n // label: 'S3',\n // value: AddDataMethods.S3,\n // },\n];\n\nexport type KeplerAddDataDialogProps = {\n addDataModal: Pick<UseDisclosureReturnValue, 'isOpen' | 'onClose'>;\n loadTileSet: LoadTileSet;\n loadFiles: (files: FileList | string[]) => Promise<void>;\n method?: AddDataMethods;\n acceptedFormats?: string[];\n} & KeplerS3BrowserProps;\n\nexport const KeplerAddDataDialog = ({\n addDataModal,\n loadTileSet,\n loadFiles,\n listS3Files,\n loadS3Files,\n saveS3Credentials,\n loadS3Credentials,\n deleteS3Credentials,\n s3Browser,\n method = AddDataMethods.Upload,\n acceptedFormats = DEFAULT_ACCEPTED_FORMATS,\n}: KeplerAddDataDialogProps) => {\n const [currentMethod, selectCurrentMethod] = useState<AddDataMethods>(method);\n const onFileDrop = useCallback(\n (files: FileList) => {\n loadFiles(files);\n addDataModal.onClose();\n },\n [loadFiles, addDataModal],\n );\n const onLoadS3Files = useCallback(\n async (...args: Parameters<KeplerS3BrowserProps['loadS3Files']>) => {\n await loadS3Files(...args);\n addDataModal.onClose();\n },\n [loadS3Files, addDataModal],\n );\n return (\n <KeplerProvider mapId={''}>\n <Dialog\n open={addDataModal.isOpen}\n onOpenChange={(isOpen: boolean) => !isOpen && addDataModal.onClose()}\n >\n <DialogContent className=\"min-w-md h-[80vh] max-w-4xl grid-rows-[auto,1fr]\">\n <DialogHeader>\n <DialogTitle>Add Data</DialogTitle>\n <DialogDescription>Add data to the project.</DialogDescription>\n </DialogHeader>\n <Tabs\n defaultValue={currentMethod}\n className=\"flex h-full w-full flex-col gap-4 overflow-auto\"\n onValueChange={(value) =>\n selectCurrentMethod(value as AddDataMethods)\n }\n >\n <TabsList className=\"flex h-10 items-center justify-start gap-1\">\n {ADD_DATA_METHODS.map(({value, label}) => (\n <TabsTrigger\n value={value}\n className=\"flex items-center gap-2\"\n key={value}\n >\n <span className=\"text-muted-foreground\">{label}</span>\n </TabsTrigger>\n ))}\n </TabsList>\n\n {/** File Upload */}\n <TabsContent\n value={AddDataMethods.Upload}\n className=\"h-full w-full data-[state=inactive]:hidden\"\n >\n <div className=\"h-min-[200px] flex h-full w-full items-center justify-center\">\n <FileDropInput onFileDrop={onFileDrop}>\n {acceptedFormats ? (\n <div className=\"text-muted-foreground flex flex-wrap justify-center gap-2 opacity-80\">\n {acceptedFormats.map((ext) => (\n <Icons.FileType\n key={ext}\n ext={ext}\n height=\"50px\"\n fontSize=\"9px\"\n />\n ))}\n </div>\n ) : null}\n </FileDropInput>\n </div>\n </TabsContent>\n\n {/** TileSet*/}\n <TabsContent\n value={AddDataMethods.TileSet}\n className=\"h-full w-full overflow-auto data-[state=inactive]:hidden\"\n >\n <LoadTileSetContent\n loadTileSet={loadTileSet}\n onClose={addDataModal.onClose}\n />\n </TabsContent>\n {/** S3 */}\n <TabsContent\n value={AddDataMethods.S3}\n className=\"h-full w-full data-[state=inactive]:hidden\"\n >\n <KeplerS3Browser\n listS3Files={listS3Files}\n s3Browser={s3Browser}\n loadS3Files={onLoadS3Files}\n saveS3Credentials={saveS3Credentials}\n loadS3Credentials={loadS3Credentials}\n deleteS3Credentials={deleteS3Credentials}\n />\n </TabsContent>\n </Tabs>\n </DialogContent>\n </Dialog>\n </KeplerProvider>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerAddTileSetDialog.d.ts","sourceRoot":"","sources":["../../src/components/KeplerAddTileSetDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,wBAAwB,EACzB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"KeplerAddTileSetDialog.d.ts","sourceRoot":"","sources":["../../src/components/KeplerAddTileSetDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,wBAAwB,EACzB,MAAM,cAAc,CAAC;AAUtB,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE;IAC/B,OAAO,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AA+BpB,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,WAAW,GACZ,EAAE;IACD,YAAY,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IACnE,WAAW,EAAE,WAAW,CAAC;CAC1B,2CAuBA"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
3
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@sqlrooms/ui';
|
|
4
4
|
import { LoadTileSetFactory } from '@kepler.gl/components';
|
|
5
|
-
import {
|
|
5
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
6
6
|
import { KeplerProvider } from './KeplerProvider';
|
|
7
7
|
import { useIntl } from 'react-intl';
|
|
8
|
-
const LoadTileSet =
|
|
8
|
+
const LoadTileSet = getKeplerFactory(LoadTileSetFactory);
|
|
9
9
|
function LoadTileSetContent({ loadTileSet, onClose, }) {
|
|
10
10
|
const intl = useIntl();
|
|
11
11
|
const onTilesetAdded = useCallback((tileset, metadata) => {
|
|
12
12
|
loadTileSet({ tileset, metadata });
|
|
13
13
|
onClose?.();
|
|
14
14
|
}, [loadTileSet, onClose]);
|
|
15
|
-
|
|
15
|
+
const meta = useMemo(() => ({}), []); // TODO: add metadata
|
|
16
|
+
return (_jsx(LoadTileSet, { meta: meta, isAddingDatasets: false, intl: intl, onTilesetAdded: onTilesetAdded }));
|
|
16
17
|
}
|
|
17
18
|
export function KeplerAddTileSetDialog({ tileSetModal, loadTileSet, }) {
|
|
18
19
|
return (_jsx(KeplerProvider, { mapId: '', children: _jsx(Dialog, { open: tileSetModal.isOpen, onOpenChange: (isOpen) => !isOpen && tileSetModal.onClose(), children: _jsxs(DialogContent, { className: "h-[60vh] max-w-[75vw]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Add Tileset" }), _jsx(DialogDescription, { children: "Add a tileset to your map. Supported: PMTiles, Vector Tiles, and Raster Tiles." })] }), _jsx(LoadTileSetContent, { loadTileSet: loadTileSet, onClose: tileSetModal.onClose })] }) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerAddTileSetDialog.js","sourceRoot":"","sources":["../../src/components/KeplerAddTileSetDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"KeplerAddTileSetDialog.js","sourceRoot":"","sources":["../../src/components/KeplerAddTileSetDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAE3C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,GAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAOzD,SAAS,kBAAkB,CAAC,EAC1B,WAAW,EACX,OAAO,GAIR;IACC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,cAAc,GAAG,WAAW,CAChC,CACE,OAAoE,EACpE,QAA8B,EAC9B,EAAE;QACF,WAAW,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAC,CAAC,CAAC;QACjC,OAAO,EAAE,EAAE,CAAC;IACd,CAAC,EACD,CAAC,WAAW,EAAE,OAAO,CAAC,CACvB,CAAC;IACF,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,qBAAqB;IAC3D,OAAO,CACL,KAAC,WAAW,IACV,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,KAAK,EACvB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,EACrC,YAAY,EACZ,WAAW,GAIZ;IACC,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,EAAE,YACvB,KAAC,MAAM,IACL,IAAI,EAAE,YAAY,CAAC,MAAM,EACzB,YAAY,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,YAEpE,MAAC,aAAa,IAAC,SAAS,EAAC,uBAAuB,aAC9C,MAAC,YAAY,eACX,KAAC,WAAW,8BAA0B,EACtC,KAAC,iBAAiB,iGAGE,IACP,EACf,KAAC,kBAAkB,IACjB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,CAAC,OAAO,GAC7B,IACY,GACT,GACM,CAClB,CAAC;AACJ,CAAC","sourcesContent":["import {useCallback, useMemo} from 'react';\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n UseDisclosureReturnValue,\n} from '@sqlrooms/ui';\n\nimport {LoadTileSetFactory} from '@kepler.gl/components';\n\nimport {getKeplerFactory} from './KeplerInjector';\nimport {KeplerProvider} from './KeplerProvider';\nimport {useIntl} from 'react-intl';\n\nconst LoadTileSet = getKeplerFactory(LoadTileSetFactory);\n\nexport type LoadTileSet = (args: {\n tileset: {name: string; type: string; metadata: Record<string, any>};\n metadata?: Record<string, any>;\n}) => Promise<void>;\n\nfunction LoadTileSetContent({\n loadTileSet,\n onClose,\n}: {\n loadTileSet: LoadTileSet;\n onClose?: () => void;\n}) {\n const intl = useIntl();\n const onTilesetAdded = useCallback(\n (\n tileset: {name: string; type: string; metadata: Record<string, any>},\n metadata?: Record<string, any>,\n ) => {\n loadTileSet({tileset, metadata});\n onClose?.();\n },\n [loadTileSet, onClose],\n );\n const meta = useMemo(() => ({}), []); // TODO: add metadata\n return (\n <LoadTileSet\n meta={meta}\n isAddingDatasets={false}\n intl={intl}\n onTilesetAdded={onTilesetAdded}\n />\n );\n}\n\nexport function KeplerAddTileSetDialog({\n tileSetModal,\n loadTileSet,\n}: {\n tileSetModal: Pick<UseDisclosureReturnValue, 'isOpen' | 'onClose'>;\n loadTileSet: LoadTileSet;\n}) {\n return (\n <KeplerProvider mapId={''}>\n <Dialog\n open={tileSetModal.isOpen}\n onOpenChange={(isOpen: boolean) => !isOpen && tileSetModal.onClose()}\n >\n <DialogContent className=\"h-[60vh] max-w-[75vw]\">\n <DialogHeader>\n <DialogTitle>Add Tileset</DialogTitle>\n <DialogDescription>\n Add a tileset to your map. Supported: PMTiles, Vector Tiles, and\n Raster Tiles.\n </DialogDescription>\n </DialogHeader>\n <LoadTileSetContent\n loadTileSet={loadTileSet}\n onClose={tileSetModal.onClose}\n />\n </DialogContent>\n </Dialog>\n </KeplerProvider>\n );\n}\n"]}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type KeplerFactory<TReturn = unknown> = (...args: any[]) => TReturn;
|
|
2
|
+
export type KeplerFactoryRecipe = [KeplerFactory, KeplerFactory];
|
|
3
|
+
export type KeplerFactoryRecipeMode = 'append' | 'replace';
|
|
4
|
+
export declare function configureKeplerInjector(recipes: KeplerFactoryRecipe[], options?: {
|
|
5
|
+
mode?: KeplerFactoryRecipeMode;
|
|
6
|
+
}): void;
|
|
7
|
+
export declare function resetKeplerInjectorRecipes(): void;
|
|
8
|
+
export declare function getKeplerInjector(): import("@kepler.gl/components").InjectorType;
|
|
9
|
+
export declare function getKeplerFactory<TFactory extends KeplerFactory>(factory: TFactory): ReturnType<TFactory>;
|
|
10
|
+
export declare const KeplerInjector: {
|
|
11
|
+
get<TFactory extends KeplerFactory>(factory: TFactory): ReturnType<TFactory>;
|
|
12
|
+
};
|
|
2
13
|
//# sourceMappingURL=KeplerInjector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerInjector.d.ts","sourceRoot":"","sources":["../../src/components/KeplerInjector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KeplerInjector.d.ts","sourceRoot":"","sources":["../../src/components/KeplerInjector.tsx"],"names":[],"mappings":"AA8BA,MAAM,MAAM,aAAa,CAAC,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACjE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAsB3D,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,mBAAmB,EAAE,EAC9B,OAAO,GAAE;IAAC,IAAI,CAAC,EAAE,uBAAuB,CAAA;CAAM,QAM/C;AAED,wBAAgB,0BAA0B,SAGzC;AAED,wBAAgB,iBAAiB,iDAEhC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,aAAa,EAC7D,OAAO,EAAE,QAAQ,GAChB,UAAU,CAAC,QAAQ,CAAC,CAUtB;AAED,eAAO,MAAM,cAAc;QACrB,QAAQ,SAAS,aAAa,WAAW,QAAQ;CAGtD,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { AddDataButtonFactory, appInjector, DndContextFactory, FilterPanelHeaderFactory, MapControlTooltipFactory, MapLegendFactory, MapLegendPanelFactory, PanelTitleFactory, provideRecipesToInjector, } from '@kepler.gl/components';
|
|
3
3
|
import { CustomDndContextFactory } from './CustomDndContext';
|
|
4
4
|
import { CustomFilterPanelHeaderFactory } from './CustomFilterPanelHeader';
|
|
5
|
+
import { CustomMapControlTooltipFactory } from './CustomMapControlTooltipFactory';
|
|
5
6
|
import { CustomMapLegendFactory } from './CustomMapLegend';
|
|
6
7
|
import { CustomMapLegendPanelFactory } from './CustomMapLegendPanel';
|
|
7
8
|
const CustomAddDataButtonFactory = () => {
|
|
@@ -11,13 +12,45 @@ const CustomPanelTitleFactory = () => {
|
|
|
11
12
|
const PanelTitle = ({ children }) => (_jsx("div", { className: "flex items-center justify-end", children: children }));
|
|
12
13
|
return PanelTitle;
|
|
13
14
|
};
|
|
14
|
-
const
|
|
15
|
+
const defaultRecipes = [
|
|
15
16
|
[AddDataButtonFactory, CustomAddDataButtonFactory],
|
|
16
17
|
[PanelTitleFactory, CustomPanelTitleFactory],
|
|
17
18
|
[DndContextFactory, CustomDndContextFactory],
|
|
18
19
|
[FilterPanelHeaderFactory, CustomFilterPanelHeaderFactory],
|
|
19
20
|
[MapLegendPanelFactory, CustomMapLegendPanelFactory],
|
|
20
21
|
[MapLegendFactory, CustomMapLegendFactory],
|
|
22
|
+
[MapControlTooltipFactory, CustomMapControlTooltipFactory],
|
|
21
23
|
];
|
|
22
|
-
|
|
24
|
+
let customRecipes = [];
|
|
25
|
+
let injector = createKeplerInjector();
|
|
26
|
+
function createKeplerInjector(recipes = []) {
|
|
27
|
+
return provideRecipesToInjector([...defaultRecipes, ...recipes], appInjector);
|
|
28
|
+
}
|
|
29
|
+
export function configureKeplerInjector(recipes, options = {}) {
|
|
30
|
+
const mode = options.mode ?? 'append';
|
|
31
|
+
customRecipes =
|
|
32
|
+
mode === 'replace' ? [...recipes] : [...customRecipes, ...recipes];
|
|
33
|
+
injector = createKeplerInjector(customRecipes);
|
|
34
|
+
}
|
|
35
|
+
export function resetKeplerInjectorRecipes() {
|
|
36
|
+
customRecipes = [];
|
|
37
|
+
injector = createKeplerInjector();
|
|
38
|
+
}
|
|
39
|
+
export function getKeplerInjector() {
|
|
40
|
+
return injector;
|
|
41
|
+
}
|
|
42
|
+
export function getKeplerFactory(factory) {
|
|
43
|
+
// Resolve from the injector at render time so late configuration works,
|
|
44
|
+
// while keeping a stable component definition outside render.
|
|
45
|
+
const Wrapped = ((props) => {
|
|
46
|
+
const Component = getKeplerInjector().get(factory);
|
|
47
|
+
return _jsx(Component, { ...props });
|
|
48
|
+
});
|
|
49
|
+
return Wrapped;
|
|
50
|
+
}
|
|
51
|
+
export const KeplerInjector = {
|
|
52
|
+
get(factory) {
|
|
53
|
+
return getKeplerFactory(factory);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
23
56
|
//# sourceMappingURL=KeplerInjector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerInjector.js","sourceRoot":"","sources":["../../src/components/KeplerInjector.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"KeplerInjector.js","sourceRoot":"","sources":["../../src/components/KeplerInjector.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EAEjB,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAC,8BAA8B,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAC,8BAA8B,EAAC,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAC,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,2BAA2B,EAAC,MAAM,wBAAwB,CAAC;AAEnE,MAAM,0BAA0B,GAAG,GAAG,EAAE;IACtC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACnC,MAAM,UAAU,GAAgC,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE,CAAC,CAC9D,cAAK,SA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MAAM,OAAO,GAAG,CAAC,CAAC,KAA8B,EAAE,EAAE;QAClD,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC,GAAG,CACvC,OAA6B,CACkB,CAAC;QAClD,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAC;IAClC,CAAC,CAAoC,CAAC;IACtC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,CAAiC,OAAiB;QACnD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACF,CAAC","sourcesContent":["import {\n AddDataButtonFactory,\n appInjector,\n DndContextFactory,\n Factory,\n FilterPanelHeaderFactory,\n MapControlTooltipFactory,\n MapLegendFactory,\n MapLegendPanelFactory,\n PanelTitleFactory,\n provideRecipesToInjector,\n} from '@kepler.gl/components';\nimport React, {PropsWithChildren} from 'react';\nimport {CustomDndContextFactory} from './CustomDndContext';\nimport {CustomFilterPanelHeaderFactory} from './CustomFilterPanelHeader';\nimport {CustomMapControlTooltipFactory} from './CustomMapControlTooltipFactory';\nimport {CustomMapLegendFactory} from './CustomMapLegend';\nimport {CustomMapLegendPanelFactory} from './CustomMapLegendPanel';\n\nconst CustomAddDataButtonFactory = () => {\n return () => null;\n};\n\nconst CustomPanelTitleFactory = () => {\n const PanelTitle: React.FC<PropsWithChildren> = ({children}) => (\n <div className=\"flex items-center justify-end\">{children}</div>\n );\n\n return PanelTitle;\n};\nexport type KeplerFactory<TReturn = unknown> = (...args: any[]) => TReturn;\nexport type KeplerFactoryRecipe = [KeplerFactory, KeplerFactory];\nexport type KeplerFactoryRecipeMode = 'append' | 'replace';\n\nconst defaultRecipes: KeplerFactoryRecipe[] = [\n [AddDataButtonFactory, CustomAddDataButtonFactory],\n [PanelTitleFactory, CustomPanelTitleFactory],\n [DndContextFactory, CustomDndContextFactory],\n [FilterPanelHeaderFactory, CustomFilterPanelHeaderFactory],\n [MapLegendPanelFactory, CustomMapLegendPanelFactory],\n [MapLegendFactory, CustomMapLegendFactory],\n [MapControlTooltipFactory, CustomMapControlTooltipFactory],\n];\n\nlet customRecipes: KeplerFactoryRecipe[] = [];\nlet injector = createKeplerInjector();\n\nfunction createKeplerInjector(recipes: KeplerFactoryRecipe[] = []) {\n return provideRecipesToInjector(\n [...defaultRecipes, ...recipes] as unknown as [Factory, Factory][],\n appInjector,\n );\n}\n\nexport function configureKeplerInjector(\n recipes: KeplerFactoryRecipe[],\n options: {mode?: KeplerFactoryRecipeMode} = {},\n) {\n const mode = options.mode ?? 'append';\n customRecipes =\n mode === 'replace' ? [...recipes] : [...customRecipes, ...recipes];\n injector = createKeplerInjector(customRecipes);\n}\n\nexport function resetKeplerInjectorRecipes() {\n customRecipes = [];\n injector = createKeplerInjector();\n}\n\nexport function getKeplerInjector() {\n return injector;\n}\n\nexport function getKeplerFactory<TFactory extends KeplerFactory>(\n factory: TFactory,\n): ReturnType<TFactory> {\n // Resolve from the injector at render time so late configuration works,\n // while keeping a stable component definition outside render.\n const Wrapped = ((props: Record<string, unknown>) => {\n const Component = getKeplerInjector().get(\n factory as unknown as Factory,\n ) as React.ComponentType<Record<string, unknown>>;\n return <Component {...props} />;\n }) as unknown as ReturnType<TFactory>;\n return Wrapped;\n}\n\nexport const KeplerInjector = {\n get<TFactory extends KeplerFactory>(factory: TFactory) {\n return getKeplerFactory(factory);\n },\n};\n"]}
|
|
@@ -3,14 +3,14 @@ import { useMemo, useRef, useEffect, useState } from 'react';
|
|
|
3
3
|
import { MapContainerFactory, BottomWidgetFactory, GeocoderPanelFactory, mapFieldsSelector, bottomWidgetSelector, geoCoderPanelSelector, modalContainerSelector, MapViewStateContextProvider, RootContext, ModalContainerFactory, } from '@kepler.gl/components';
|
|
4
4
|
import { useDimensions, getAnimatableVisibleLayers } from '@kepler.gl/utils';
|
|
5
5
|
import styled, { useTheme } from 'styled-components';
|
|
6
|
-
import {
|
|
6
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
7
7
|
import { KeplerProvider } from './KeplerProvider';
|
|
8
8
|
import { useKeplerStateActions } from '../hooks/useKeplerStateActions';
|
|
9
9
|
import { useStoreWithKepler } from '../KeplerSlice';
|
|
10
|
-
const MapContainer =
|
|
11
|
-
const BottomWidget =
|
|
12
|
-
const GeoCoderPanel =
|
|
13
|
-
const ModalContainer =
|
|
10
|
+
const MapContainer = getKeplerFactory(MapContainerFactory);
|
|
11
|
+
const BottomWidget = getKeplerFactory(BottomWidgetFactory);
|
|
12
|
+
const GeoCoderPanel = getKeplerFactory(GeocoderPanelFactory);
|
|
13
|
+
const ModalContainer = getKeplerFactory(ModalContainerFactory);
|
|
14
14
|
const DEFAULT_DIMENSIONS = {
|
|
15
15
|
width: 0,
|
|
16
16
|
height: 0,
|
|
@@ -85,7 +85,7 @@ const KeplerGl = ({ mapId }) => {
|
|
|
85
85
|
: null;
|
|
86
86
|
const mapboxApiAccessToken = mapFields?.mapStyle?.mapboxApiAccessToken ||
|
|
87
87
|
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, interactionConfig?.geocoder?.enabled ? (_jsx(GeoCoderPanel, { ...geoCoderPanelFields, index: 0, unsyncedViewports: false, mapboxApiAccessToken: mapboxApiAccessToken })) : null, bottomWidgetFields ? (_jsx(BottomWidget, { rootRef: bottomWidgetRef, ...bottomWidgetFields, theme: theme, containerW: size?.width })) : null, modalContainerFields ? (_jsx(ModalContainer, { ...modalContainerFields, containerW: size?.width, containerH: size?.height })) : null] }) }));
|
|
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] }) }));
|
|
89
89
|
};
|
|
90
90
|
export const KeplerMapContainer = ({ mapId }) => {
|
|
91
91
|
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,
|
|
1
|
+
{"version":3,"file":"KeplerMapContainer.js","sourceRoot":"","sources":["../../src/components/KeplerMapContainer.tsx"],"names":[],"mappings":";AAA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, 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 +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;
|
|
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"}
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { PlotContainerFactory, plotContainerSelector, } from '@kepler.gl/components';
|
|
4
4
|
import { useKeplerStateActions } from '../hooks/useKeplerStateActions';
|
|
5
|
-
import {
|
|
5
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
6
6
|
import { KeplerProvider } from './KeplerProvider';
|
|
7
|
-
const PlotContainer =
|
|
7
|
+
const PlotContainer = getKeplerFactory(PlotContainerFactory);
|
|
8
8
|
const KEPLER_PROPS = {
|
|
9
9
|
mapboxApiUrl: 'https://api.mapbox.com',
|
|
10
10
|
appName: 'kepler.gl',
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerSidePanels.d.ts","sourceRoot":"","sources":["../../src/components/KeplerSidePanels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,GAAG,KAAK,CAAC;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"KeplerSidePanels.d.ts","sourceRoot":"","sources":["../../src/components/KeplerSidePanels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,GAAG,KAAK,CAAC;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkC3D,CAAC"}
|
|
@@ -2,14 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { DndContextFactory } from '@kepler.gl/components';
|
|
3
3
|
import { useKeplerStateActions } from '../hooks/useKeplerStateActions';
|
|
4
4
|
import { KeplerProvider } from './KeplerProvider';
|
|
5
|
-
import {
|
|
5
|
+
import { getKeplerFactory } from './KeplerInjector';
|
|
6
6
|
import { CustomLayerManager } from './CustomLayerManager';
|
|
7
7
|
import { CustomFilterManager } from './CustomFilterManager';
|
|
8
8
|
import { CustomMapManager } from './CustomMapManager';
|
|
9
9
|
import { CustomInteractionManager } from './CustomInteractionManager';
|
|
10
|
-
const DndContext =
|
|
10
|
+
const DndContext = getKeplerFactory(DndContextFactory);
|
|
11
11
|
export const KeplerSidePanels = ({ mapId, panelId, showDeleteDataset, }) => {
|
|
12
12
|
const { keplerState } = useKeplerStateActions({ mapId });
|
|
13
|
+
if (!keplerState?.visState) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
13
16
|
return (_jsx(KeplerProvider, { mapId: mapId, children: _jsx(DndContext, { visState: keplerState?.visState, children: _jsxs("div", { children: [panelId === 'layer' && (_jsx(CustomLayerManager, { mapId: mapId, showDeleteDataset: showDeleteDataset })), panelId === 'filter' && (_jsx(CustomFilterManager, { mapId: mapId, showDeleteDataset: showDeleteDataset })), panelId === 'map' && _jsx(CustomMapManager, { mapId: mapId }), panelId === 'interaction' && (_jsx(CustomInteractionManager, { mapId: mapId }))] }) }) }));
|
|
14
17
|
};
|
|
15
18
|
//# sourceMappingURL=KeplerSidePanels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeplerSidePanels.js","sourceRoot":"","sources":["../../src/components/KeplerSidePanels.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,C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B,KAAC,mBAAmB,IAClB,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,GACpC,CACH,EACA,OAAO,KAAK,KAAK,IAAI,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,GAAI,EACvD,OAAO,KAAK,aAAa,IAAI,CAC5B,KAAC,wBAAwB,IAAC,KAAK,EAAE,KAAK,GAAI,CAC3C,IACG,GACK,GACE,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {DndContextFactory} from '@kepler.gl/components';\nimport {useKeplerStateActions} from '../hooks/useKeplerStateActions';\nimport {KeplerProvider} from './KeplerProvider';\nimport {getKeplerFactory} from './KeplerInjector';\nimport {CustomLayerManager} from './CustomLayerManager';\nimport {CustomFilterManager} from './CustomFilterManager';\nimport {CustomMapManager} from './CustomMapManager';\nimport {CustomInteractionManager} from './CustomInteractionManager';\n\nconst DndContext = getKeplerFactory(DndContextFactory);\n\ntype KeplerSidePanelProps = {\n mapId: string;\n panelId: 'layer' | 'filter' | 'interaction' | 'map';\n showDeleteDataset?: boolean;\n};\nexport const KeplerSidePanels: React.FC<KeplerSidePanelProps> = ({\n mapId,\n panelId,\n showDeleteDataset,\n}) => {\n const {keplerState} = useKeplerStateActions({mapId});\n\n if (!keplerState?.visState) {\n return null;\n }\n return (\n <KeplerProvider mapId={mapId}>\n <DndContext visState={keplerState?.visState}>\n <div>\n {panelId === 'layer' && (\n <CustomLayerManager\n mapId={mapId}\n showDeleteDataset={showDeleteDataset}\n />\n )}\n {panelId === 'filter' && (\n <CustomFilterManager\n mapId={mapId}\n showDeleteDataset={showDeleteDataset}\n />\n )}\n {panelId === 'map' && <CustomMapManager mapId={mapId} />}\n {panelId === 'interaction' && (\n <CustomInteractionManager mapId={mapId} />\n )}\n </div>\n </DndContext>\n </KeplerProvider>\n );\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,7 @@ export { KeplerProvider } from './components/KeplerProvider';
|
|
|
17
17
|
export { useKeplerStateActions } from './hooks/useKeplerStateActions';
|
|
18
18
|
export { KeplerPlotContainer } from './components/KeplerPlotContainer';
|
|
19
19
|
export { KeplerImageExport } from './components/KeplerImageExport';
|
|
20
|
+
export { configureKeplerInjector, resetKeplerInjectorRecipes, getKeplerInjector, getKeplerFactory, } from './components/KeplerInjector';
|
|
21
|
+
export type { KeplerFactoryRecipe, KeplerFactoryRecipeMode, } from './components/KeplerInjector';
|
|
20
22
|
export { KeplerMapSchema, KeplerSliceConfig } from '@sqlrooms/kepler-config';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,YAAY,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,YAAY,EAAC,WAAW,EAAC,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AACrE,YAAY,EACV,wBAAwB,EACxB,cAAc,GACf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,YAAY,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AACpE,OAA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