@sqlrooms/cells 0.29.0-rc.1 → 0.29.0-rc.2
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/cellsSlice.d.ts.map +1 -1
- package/dist/cellsSlice.js +191 -73
- package/dist/cellsSlice.js.map +1 -1
- package/dist/components/AggregationSelector.d.ts +8 -0
- package/dist/components/AggregationSelector.d.ts.map +1 -0
- package/dist/components/AggregationSelector.js +13 -0
- package/dist/components/AggregationSelector.js.map +1 -0
- package/dist/components/CellSourceSelector.d.ts +11 -0
- package/dist/components/CellSourceSelector.d.ts.map +1 -0
- package/dist/components/CellSourceSelector.js +35 -0
- package/dist/components/CellSourceSelector.js.map +1 -0
- package/dist/components/ChartTypeSelector.d.ts +8 -0
- package/dist/components/ChartTypeSelector.d.ts.map +1 -0
- package/dist/components/ChartTypeSelector.js +13 -0
- package/dist/components/ChartTypeSelector.js.map +1 -0
- package/dist/components/CollapsibleSectionButton.d.ts +10 -0
- package/dist/components/CollapsibleSectionButton.d.ts.map +1 -0
- package/dist/components/CollapsibleSectionButton.js +10 -0
- package/dist/components/CollapsibleSectionButton.js.map +1 -0
- package/dist/components/ColorSelector.d.ts +24 -0
- package/dist/components/ColorSelector.d.ts.map +1 -0
- package/dist/components/ColorSelector.js +17 -0
- package/dist/components/ColorSelector.js.map +1 -0
- package/dist/components/FieldSelector.d.ts +11 -0
- package/dist/components/FieldSelector.d.ts.map +1 -0
- package/dist/components/FieldSelector.js +11 -0
- package/dist/components/FieldSelector.js.map +1 -0
- package/dist/components/FieldTypeIcon.d.ts +8 -0
- package/dist/components/FieldTypeIcon.d.ts.map +1 -0
- package/dist/components/FieldTypeIcon.js +27 -0
- package/dist/components/FieldTypeIcon.js.map +1 -0
- package/dist/components/InputCellContent.d.ts.map +1 -1
- package/dist/components/InputCellContent.js +3 -3
- package/dist/components/InputCellContent.js.map +1 -1
- package/dist/components/SelectionListener.d.ts +15 -0
- package/dist/components/SelectionListener.d.ts.map +1 -0
- package/dist/components/SelectionListener.js +74 -0
- package/dist/components/SelectionListener.js.map +1 -0
- package/dist/components/SheetsTabBar.d.ts.map +1 -1
- package/dist/components/SheetsTabBar.js +2 -1
- package/dist/components/SheetsTabBar.js.map +1 -1
- package/dist/components/SqlCellBody.d.ts +6 -0
- package/dist/components/SqlCellBody.d.ts.map +1 -0
- package/dist/components/SqlCellBody.js +12 -0
- package/dist/components/SqlCellBody.js.map +1 -0
- package/dist/components/SqlCellConnectionSelector.d.ts +9 -0
- package/dist/components/SqlCellConnectionSelector.d.ts.map +1 -0
- package/dist/components/SqlCellConnectionSelector.js +21 -0
- package/dist/components/SqlCellConnectionSelector.js.map +1 -0
- package/dist/components/SqlCellContent.d.ts.map +1 -1
- package/dist/components/SqlCellContent.js +29 -154
- package/dist/components/SqlCellContent.js.map +1 -1
- package/dist/components/SqlCellDependentsMenu.d.ts +11 -0
- package/dist/components/SqlCellDependentsMenu.d.ts.map +1 -0
- package/dist/components/SqlCellDependentsMenu.js +62 -0
- package/dist/components/SqlCellDependentsMenu.js.map +1 -0
- package/dist/components/SqlCellEditor.d.ts +14 -0
- package/dist/components/SqlCellEditor.d.ts.map +1 -0
- package/dist/components/SqlCellEditor.js +17 -0
- package/dist/components/SqlCellEditor.js.map +1 -0
- package/dist/components/SqlCellResultNameEditor.d.ts +8 -0
- package/dist/components/SqlCellResultNameEditor.d.ts.map +1 -0
- package/dist/components/SqlCellResultNameEditor.js +38 -0
- package/dist/components/SqlCellResultNameEditor.js.map +1 -0
- package/dist/components/SqlCellResults.d.ts +17 -0
- package/dist/components/SqlCellResults.d.ts.map +1 -0
- package/dist/components/SqlCellResults.js +45 -0
- package/dist/components/SqlCellResults.js.map +1 -0
- package/dist/components/SqlCellRunButton.d.ts +5 -6
- package/dist/components/SqlCellRunButton.d.ts.map +1 -1
- package/dist/components/SqlCellRunButton.js +11 -7
- package/dist/components/SqlCellRunButton.js.map +1 -1
- package/dist/components/SqlQueryPreview.d.ts +9 -0
- package/dist/components/SqlQueryPreview.d.ts.map +1 -0
- package/dist/components/SqlQueryPreview.js +14 -0
- package/dist/components/SqlQueryPreview.js.map +1 -0
- package/dist/components/TextCellContent.d.ts.map +1 -1
- package/dist/components/TextCellContent.js +24 -7
- package/dist/components/TextCellContent.js.map +1 -1
- package/dist/components/VegaCellContent.d.ts +0 -1
- package/dist/components/VegaCellContent.d.ts.map +1 -1
- package/dist/components/VegaCellContent.js +61 -47
- package/dist/components/VegaCellContent.js.map +1 -1
- package/dist/components/VegaCellHeader.d.ts +11 -0
- package/dist/components/VegaCellHeader.d.ts.map +1 -0
- package/dist/components/VegaCellHeader.js +31 -0
- package/dist/components/VegaCellHeader.js.map +1 -0
- package/dist/components/VegaConfigPanel.d.ts +5 -0
- package/dist/components/VegaConfigPanel.d.ts.map +1 -1
- package/dist/components/VegaConfigPanel.js +53 -63
- package/dist/components/VegaConfigPanel.js.map +1 -1
- package/dist/crdt.d.ts +61 -0
- package/dist/crdt.d.ts.map +1 -0
- package/dist/crdt.js +82 -0
- package/dist/crdt.js.map +1 -0
- package/dist/dagSlice.d.ts +3 -0
- package/dist/dagSlice.d.ts.map +1 -0
- package/dist/dagSlice.js +51 -0
- package/dist/dagSlice.js.map +1 -0
- package/dist/dagUtils.d.ts +2 -1
- package/dist/dagUtils.d.ts.map +1 -1
- package/dist/dagUtils.js +35 -11
- package/dist/dagUtils.js.map +1 -1
- package/dist/defaultCellRegistry.d.ts.map +1 -1
- package/dist/defaultCellRegistry.js +63 -24
- package/dist/defaultCellRegistry.js.map +1 -1
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +2 -1
- package/dist/execution.js.map +1 -1
- package/dist/helpers.d.ts +14 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +56 -2
- package/dist/helpers.js.map +1 -1
- package/dist/hooks/useVegaCellDataSource.d.ts +18 -0
- package/dist/hooks/useVegaCellDataSource.d.ts.map +1 -0
- package/dist/hooks/useVegaCellDataSource.js +40 -0
- package/dist/hooks/useVegaCellDataSource.js.map +1 -0
- package/dist/hooks/useVegaCellQuery.d.ts +16 -0
- package/dist/hooks/useVegaCellQuery.d.ts.map +1 -0
- package/dist/hooks/useVegaCellQuery.js +25 -0
- package/dist/hooks/useVegaCellQuery.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/sqlHelpers.d.ts +3 -3
- package/dist/sqlHelpers.d.ts.map +1 -1
- package/dist/sqlHelpers.js +9 -5
- package/dist/sqlHelpers.js.map +1 -1
- package/dist/typeGuards.d.ts +2 -0
- package/dist/typeGuards.d.ts.map +1 -0
- package/dist/typeGuards.js +4 -0
- package/dist/typeGuards.js.map +1 -0
- package/dist/types.d.ts +97 -26
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -2
- package/dist/types.js.map +1 -1
- package/dist/useValidateResultName.d.ts +34 -0
- package/dist/useValidateResultName.d.ts.map +1 -0
- package/dist/useValidateResultName.js +111 -0
- package/dist/useValidateResultName.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +16 -0
- package/dist/utils.js.map +1 -1
- package/dist/validation.d.ts +16 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +40 -0
- package/dist/validation.js.map +1 -0
- package/dist/vegaSelectionUtils.d.ts +14 -0
- package/dist/vegaSelectionUtils.d.ts.map +1 -0
- package/dist/vegaSelectionUtils.js +97 -0
- package/dist/vegaSelectionUtils.js.map +1 -0
- package/dist/vegaSpecBuilder.d.ts +34 -0
- package/dist/vegaSpecBuilder.d.ts.map +1 -0
- package/dist/vegaSpecBuilder.js +90 -0
- package/dist/vegaSpecBuilder.js.map +1 -0
- package/package.json +12 -13
package/dist/cellsSlice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cellsSlice.js","sourceRoot":"","sources":["../src/cell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,EAAE,CAAC;wBACpC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;oBAC3D,CAAC,CAAC,CAAC;oBACH,MAAM,KAAK,GAAG,gBAAgB,CAC5B,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,SAAS,CACV,CAAC;oBACF,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE,CAAC;wBAC3B,IAAI,CAAC;4BACH,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;wBACtD,CAAC;wBAAC,OAAO,KAAK,EAAE,CAAC;4BACf,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;4BACzD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACZ,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gCACvB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gCAC1C,IAAI,MAAM,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;oCAC3B,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC;oCACxB,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC;gCAC7B,CAAC;4BACH,CAAC,CAAC,CACH,CAAC;wBACJ,CAAC;oBACH,CAAC;gBACH,CAAC;aACF;SACiB,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {createId} from '@paralleldrive/cuid2';\nimport {makePagedQuery} from '@sqlrooms/data-table';\nimport {sanitizeQuery} from '@sqlrooms/duckdb';\nimport {createSlice} from '@sqlrooms/room-store';\nimport {generateUniqueName} from '@sqlrooms/utils';\nimport {produce} from 'immer';\nimport {\n buildGraphCacheFromEdges,\n buildDependencyGraph,\n buildDependencyGraphAsync,\n collectReachable,\n ensureGraphCache,\n removeCellFromCache,\n replaceCellDependenciesInCache,\n topologicalOrder,\n} from './dagUtils';\nimport {\n findSheetIdForCell,\n getRequiredSqlSelectToJson,\n normalizeCellsConfigStructure,\n resolveDependencies,\n} from './helpers';\nimport {dropResultRelation} from './resultRelationPolicy';\nimport type {\n Cell,\n CellResultData,\n CellsRootState,\n CellsSliceConfig,\n CellsSliceOptions,\n CellsSliceState,\n Edge,\n SheetType,\n} from './types';\nimport {isInputCell, isSqlCell} from './types';\nimport {getSheetSchemaName, isDefined} from './utils';\n\nfunction createDefaultCellsConfig(\n config: Partial<CellsSliceConfig> | undefined,\n): CellsSliceConfig {\n const sheetId = createId();\n const defaultConfig: CellsSliceConfig = {\n data: {},\n sheets: {\n [sheetId]: {\n id: sheetId,\n type: 'notebook',\n title: 'Sheet',\n schemaName: getSheetSchemaName(sheetId),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n },\n },\n },\n sheetOrder: [sheetId],\n currentSheetId: sheetId,\n };\n\n if (!config) {\n return defaultConfig;\n }\n const {sheets, sheetOrder, currentSheetId} = normalizeCellsConfigStructure(\n config,\n defaultConfig,\n );\n\n return {\n ...defaultConfig,\n ...config,\n sheets,\n sheetOrder,\n currentSheetId,\n };\n}\n\n// --- Slice Implementation ---\n\nexport function createCellsSlice(props: CellsSliceOptions) {\n const {cellRegistry, supportedSheetTypes = ['notebook', 'canvas']} = props;\n const initialConfig = createDefaultCellsConfig(props?.config);\n // Keep result data outside Immer drafts, but scoped per slice instance.\n const cellResultCache = new Map<string, CellResultData>();\n return createSlice<CellsSliceState, CellsRootState>((set, get, store) => {\n const dropSqlResultRelation = async (resultName?: string) => {\n try {\n const connector = await get().db.getConnector();\n await dropResultRelation({connector, relationName: resultName});\n } catch {\n // Best-effort cleanup: relation might already be gone or connector\n // might be unavailable during teardown.\n }\n };\n\n return {\n cells: {\n cellRegistry,\n supportedSheetTypes,\n config: initialConfig,\n status: {},\n activeAbortControllers: {},\n resultVersion: {},\n pageVersion: {},\n\n addCell: async (sheetId: string, cell: Cell, index?: number) => {\n // Pre-compute dependencies outside produce() to support async\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const targetSheet = get().cells.config.sheets[sheetId];\n const scopedCells = Object.fromEntries(\n (targetSheet?.cellIds ?? [])\n .map((id) => get().cells.config.data[id])\n .filter(isDefined)\n .map((candidate) => [candidate.id, candidate]),\n ) as Record<string, Cell>;\n scopedCells[cell.id] = cell;\n const deps = await resolveDependencies(\n cell,\n scopedCells,\n sheetId,\n cellRegistry,\n sqlSelectToJson,\n );\n\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.data[cell.id] = cell;\n if (cell.type === 'sql') {\n draft.cells.status[cell.id] = {\n type: 'sql',\n status: 'idle',\n referencedTables: [],\n };\n } else {\n draft.cells.status[cell.id] = {type: 'other'};\n }\n\n // Single-owner invariant: a cell can belong to one sheet only.\n for (const [existingSheetId, existingSheet] of Object.entries(\n draft.cells.config.sheets,\n )) {\n if (existingSheetId === sheetId) continue;\n existingSheet.cellIds = existingSheet.cellIds.filter(\n (cid) => cid !== cell.id,\n );\n existingSheet.edges = existingSheet.edges.filter(\n (e) => e.source !== cell.id && e.target !== cell.id,\n );\n removeCellFromCache(existingSheet, cell.id);\n }\n\n let sheet = draft.cells.config.sheets[sheetId];\n if (!sheet) {\n sheet = {\n id: sheetId,\n type: 'notebook',\n title: 'Sheet',\n schemaName: getSheetSchemaName(sheetId),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n },\n };\n draft.cells.config.sheets[sheetId] = sheet;\n if (!draft.cells.config.sheetOrder.includes(sheetId)) {\n draft.cells.config.sheetOrder.push(sheetId);\n }\n if (!draft.cells.config.currentSheetId) {\n draft.cells.config.currentSheetId = sheetId;\n }\n }\n\n const newIndex =\n index !== undefined ? index : sheet.cellIds.length;\n sheet.cellIds = sheet.cellIds.filter((cid) => cid !== cell.id);\n sheet.cellIds.splice(newIndex, 0, cell.id);\n\n // Add edges from pre-computed dependencies\n sheet.edges = sheet.edges.filter(\n (edge) =>\n edge.target !== cell.id &&\n edge.id !== `${edge.source}-${cell.id}`,\n );\n const localCellIds = new Set(sheet.cellIds);\n for (const depId of deps) {\n if (!localCellIds.has(depId) || depId === cell.id) continue;\n sheet.edges.push({\n id: `${depId}-${cell.id}`,\n source: depId,\n target: cell.id,\n });\n }\n replaceCellDependenciesInCache(\n sheet,\n cell.id,\n deps.filter((depId) => localCellIds.has(depId)),\n );\n }),\n );\n },\n\n removeCell: (id: string) => {\n const previousStatus = get().cells.status[id];\n cellResultCache.delete(id);\n set((state) =>\n produce(state, (draft) => {\n delete draft.cells.config.data[id];\n delete draft.cells.status[id];\n delete draft.cells.resultVersion[id];\n delete draft.cells.pageVersion[id];\n const controller = draft.cells.activeAbortControllers[id];\n if (controller) {\n controller.abort();\n delete draft.cells.activeAbortControllers[id];\n }\n\n // Remove from all sheets\n for (const sheet of Object.values(draft.cells.config.sheets)) {\n sheet.cellIds = sheet.cellIds.filter((cid) => cid !== id);\n sheet.edges = sheet.edges.filter(\n (e) => e.source !== id && e.target !== id,\n );\n removeCellFromCache(sheet, id);\n }\n }),\n );\n if (previousStatus?.type === 'sql') {\n void dropSqlResultRelation(previousStatus.resultView);\n }\n },\n\n updateCell: async (\n id: string,\n updater: (cell: Cell) => Cell,\n opts?: {cascade?: boolean},\n ) => {\n const cell = get().cells.config.data[id];\n if (!cell) return;\n const ownerSheetId = findSheetIdForCell(get(), id);\n const scopedCells = Object.fromEntries(\n (\n (ownerSheetId &&\n get().cells.config.sheets[ownerSheetId]?.cellIds) ||\n []\n )\n .map((cellId) => get().cells.config.data[cellId])\n .filter(isDefined)\n .map((candidate) => [candidate.id, candidate]),\n ) as Record<string, Cell>;\n\n const updatedCell = updater(cell);\n scopedCells[id] = updatedCell;\n\n // Check if resultName changed for SQL cells with successful execution\n const resultNameChanged =\n isSqlCell(cell) &&\n isSqlCell(updatedCell) &&\n cell.data.resultName !== updatedCell.data.resultName;\n\n const existingStatus = get().cells.status[id];\n const hasExistingView =\n resultNameChanged &&\n existingStatus?.type === 'sql' &&\n existingStatus.status === 'success' &&\n existingStatus.resultView;\n\n const semanticInputChanged =\n isInputCell(cell) &&\n isInputCell(updatedCell) &&\n (cell.data.input.varName !== updatedCell.data.input.varName ||\n cell.data.input.value !== updatedCell.data.input.value);\n const semanticSqlChanged =\n isSqlCell(cell) &&\n isSqlCell(updatedCell) &&\n cell.data.sql !== updatedCell.data.sql;\n\n // Apply cell data to the store immediately so that other\n // actions (e.g. runCell triggered via Cmd+Enter) always see\n // the latest value. Edge/dependency updates follow\n // asynchronously below.\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.data[id] = updatedCell;\n }),\n );\n\n // Avoid expensive dependency graph recomputation on each SQL keystroke.\n // We recompute immediately for non-SQL edits, or when callers explicitly\n // request cascading behavior.\n const shouldRecomputeDependencies =\n !semanticSqlChanged || opts?.cascade === true;\n if (shouldRecomputeDependencies) {\n // Pre-compute dependencies outside produce() to support async\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const newDeps = await resolveDependencies(\n updatedCell,\n scopedCells,\n ownerSheetId || '',\n cellRegistry,\n sqlSelectToJson,\n );\n\n set((state) =>\n produce(state, (draft) => {\n const ownerSheet = Object.values(\n draft.cells.config.sheets,\n ).find((sheet) => sheet.cellIds.includes(id));\n if (ownerSheet) {\n const localCellIds = new Set(ownerSheet.cellIds);\n ownerSheet.edges = ownerSheet.edges.filter(\n (e) => e.target !== id,\n );\n for (const depId of newDeps) {\n if (!localCellIds.has(depId) || depId === id) continue;\n ownerSheet.edges.push({\n id: `${depId}-${id}`,\n source: depId,\n target: id,\n });\n }\n replaceCellDependenciesInCache(\n ownerSheet,\n id,\n newDeps.filter((depId) => localCellIds.has(depId)),\n );\n }\n }),\n );\n }\n\n // If we have an existing view, rename it instead of invalidating\n if (hasExistingView && existingStatus?.resultView) {\n const registryItem = cellRegistry[cell.type];\n if (registryItem?.renameResult) {\n void registryItem.renameResult({\n id,\n oldResultView: existingStatus.resultView,\n get,\n set,\n });\n }\n }\n\n // After update, trigger cascade only if explicitly requested\n // or if semantic execution inputs changed.\n const shouldCascade =\n opts?.cascade || resultNameChanged || semanticInputChanged;\n if (shouldCascade) {\n if (ownerSheetId) {\n void get().cells.runDownstreamCascade(ownerSheetId, id);\n }\n }\n },\n\n addSheet: (title?: string, type: SheetType = 'notebook') => {\n const id = createId();\n set((state) =>\n produce(state, (draft) => {\n const typeLabel = type.charAt(0).toUpperCase() + type.slice(1);\n const existingTitles = Object.values(\n draft.cells.config.sheets,\n ).map((s) => s.title);\n const defaultTitle = generateUniqueName(\n `${typeLabel} 1`,\n existingTitles,\n ' ',\n );\n\n draft.cells.config.sheets[id] = {\n id,\n type,\n title: title || defaultTitle,\n schemaName: getSheetSchemaName(id),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n },\n };\n draft.cells.config.sheetOrder.push(id);\n draft.cells.config.currentSheetId = id;\n }),\n );\n return id;\n },\n\n removeSheet: (sheetId: string) => {\n const sheet = get().cells.config.sheets[sheetId];\n if (!sheet) return;\n const ownedCellIds = [...sheet.cellIds];\n const relationNamesToDrop = ownedCellIds.flatMap((cellId) => {\n const status = get().cells.status[cellId];\n return status?.type === 'sql' && status.resultView\n ? [status.resultView]\n : [];\n });\n set((state) =>\n produce(state, (draft) => {\n for (const cellId of ownedCellIds) {\n cellResultCache.delete(cellId);\n delete draft.cells.config.data[cellId];\n delete draft.cells.status[cellId];\n delete draft.cells.resultVersion[cellId];\n delete draft.cells.pageVersion[cellId];\n const controller = draft.cells.activeAbortControllers[cellId];\n if (controller) {\n controller.abort();\n }\n delete draft.cells.activeAbortControllers[cellId];\n }\n\n for (const existingSheet of Object.values(\n draft.cells.config.sheets,\n )) {\n existingSheet.cellIds = existingSheet.cellIds.filter(\n (cid) => !ownedCellIds.includes(cid),\n );\n existingSheet.edges = existingSheet.edges.filter(\n (e) =>\n !ownedCellIds.includes(e.source) &&\n !ownedCellIds.includes(e.target),\n );\n for (const cellId of ownedCellIds) {\n removeCellFromCache(existingSheet, cellId);\n }\n }\n\n delete draft.cells.config.sheets[sheetId];\n draft.cells.config.sheetOrder =\n draft.cells.config.sheetOrder.filter((id) => id !== sheetId);\n if (draft.cells.config.currentSheetId === sheetId) {\n draft.cells.config.currentSheetId =\n draft.cells.config.sheetOrder[0];\n }\n }),\n );\n for (const relationName of relationNamesToDrop) {\n void dropSqlResultRelation(relationName);\n }\n },\n\n closeSheet: (sheetId: string) => {\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.sheetOrder =\n draft.cells.config.sheetOrder.filter((id) => id !== sheetId);\n if (draft.cells.config.currentSheetId === sheetId) {\n draft.cells.config.currentSheetId =\n draft.cells.config.sheetOrder[0];\n }\n }),\n );\n },\n\n openSheet: (sheetId: string) => {\n set((state) =>\n produce(state, (draft) => {\n if (!draft.cells.config.sheetOrder.includes(sheetId)) {\n draft.cells.config.sheetOrder.push(sheetId);\n }\n draft.cells.config.currentSheetId = sheetId;\n }),\n );\n },\n\n setSheetOrder: (sheetOrder: string[]) => {\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.sheetOrder = sheetOrder;\n }),\n );\n },\n\n renameSheet: (sheetId: string, title: string) => {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n // We could add validation here, but usually UI handles it.\n // For now, we'll just allow it as the primary logic is in view slices.\n sheet.title = title;\n }\n }),\n );\n },\n\n setCurrentSheet: (sheetId: string) => {\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.currentSheetId = sheetId;\n }),\n );\n },\n\n addEdge: (sheetId: string, edge: Omit<Edge, 'id'>) => {\n set((state) =>\n produce(state, (draft) => {\n let sheet = draft.cells.config.sheets[sheetId];\n if (!sheet) {\n sheet = {\n id: sheetId,\n type: 'notebook',\n title: 'Sheet',\n schemaName: getSheetSchemaName(sheetId),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n },\n };\n draft.cells.config.sheets[sheetId] = sheet;\n if (!draft.cells.config.sheetOrder.includes(sheetId)) {\n draft.cells.config.sheetOrder.push(sheetId);\n }\n if (!draft.cells.config.currentSheetId) {\n draft.cells.config.currentSheetId = sheetId;\n }\n }\n if (\n !sheet.cellIds.includes(edge.source) ||\n !sheet.cellIds.includes(edge.target)\n ) {\n return;\n }\n const id = `${edge.source}-${edge.target}`;\n if (!sheet.edges.find((e) => e.id === id)) {\n sheet.edges.push({...edge, id});\n ensureGraphCache(sheet);\n const deps = sheet.graphCache?.dependencies[edge.target] || [];\n replaceCellDependenciesInCache(sheet, edge.target, [\n ...deps,\n edge.source,\n ]);\n }\n }),\n );\n },\n\n removeEdge: (sheetId: string, edgeId: string) => {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n sheet.edges = sheet.edges.filter((e) => e.id !== edgeId);\n delete sheet.graphCache;\n }\n }),\n );\n },\n\n updateEdgesFromSql: async (sheetId: string, cellId: string) => {\n const cell = get().cells.config.data[cellId];\n const sheet = get().cells.config.sheets[sheetId];\n if (!cell || !sheet) return;\n\n // Pre-compute dependencies outside produce() to support async\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const scopedCells = Object.fromEntries(\n sheet.cellIds\n .map((id) => get().cells.config.data[id])\n .filter(isDefined)\n .map((candidate) => [candidate.id, candidate]),\n ) as Record<string, Cell>;\n const deps = await resolveDependencies(\n cell,\n scopedCells,\n sheetId,\n cellRegistry,\n sqlSelectToJson,\n );\n\n set((state) =>\n produce(state, (draft) => {\n const draftSheet = draft.cells.config.sheets[sheetId];\n if (draftSheet) {\n draftSheet.edges = draftSheet.edges.filter(\n (e) => e.target !== cellId,\n );\n const localCellIds = new Set(draftSheet.cellIds);\n for (const depId of deps) {\n if (!localCellIds.has(depId) || depId === cellId) continue;\n draftSheet.edges.push({\n id: `${depId}-${cellId}`,\n source: depId,\n target: cellId,\n });\n }\n replaceCellDependenciesInCache(\n draftSheet,\n cellId,\n deps.filter((depId) => localCellIds.has(depId)),\n );\n }\n }),\n );\n },\n\n runCell: async (\n id: string,\n opts?: {cascade?: boolean; schemaName?: string},\n ) => {\n const state = get();\n const cell = state.cells.config.data[id];\n if (!cell) return;\n\n const registryItem = cellRegistry[cell.type];\n if (!registryItem) return;\n\n if (registryItem.runCell) {\n // Pass get/set to registry's runCell\n await registryItem.runCell({id, opts, get, set});\n return;\n }\n\n // No default behavior - each cell type must define runCell if needed\n },\n cancelCell: (id: string) => {\n const state = get();\n const controller = state.cells.activeAbortControllers[id];\n if (controller) {\n controller.abort();\n }\n },\n invalidateCellStatus: (id: string) => {\n set((state) =>\n produce(state, (draft) => {\n const status = draft.cells.status[id];\n if (status?.type === 'sql') {\n // Reset to idle, clearing the result so user knows to re-run\n draft.cells.status[id] = {\n type: 'sql',\n status: 'idle',\n referencedTables: status.referencedTables || [],\n };\n }\n }),\n );\n },\n\n // Cell result cache actions\n setCellResult: (id: string, data: CellResultData) => {\n cellResultCache.set(id, data);\n set((state) =>\n produce(state, (draft) => {\n draft.cells.resultVersion[id] =\n (draft.cells.resultVersion[id] ?? 0) + 1;\n }),\n );\n },\n\n setCellResultPage: (id: string, data: CellResultData) => {\n cellResultCache.set(id, data);\n set((state) =>\n produce(state, (draft) => {\n draft.cells.pageVersion[id] =\n (draft.cells.pageVersion[id] ?? 0) + 1;\n }),\n );\n },\n\n getCellResult: (id: string) => {\n return cellResultCache.get(id);\n },\n\n clearCellResult: (id: string) => {\n cellResultCache.delete(id);\n set((state) =>\n produce(state, (draft) => {\n delete draft.cells.resultVersion[id];\n delete draft.cells.pageVersion[id];\n }),\n );\n },\n\n fetchCellResultPage: async (\n id: string,\n pagination: {pageIndex: number; pageSize: number},\n sorting?: {id: string; desc: boolean}[],\n ) => {\n const state = get();\n const status = state.cells.status[id];\n if (status?.type !== 'sql' || !status.resultView) return;\n\n const connector = await state.db.getConnector();\n const baseQuery = sanitizeQuery(`SELECT * FROM ${status.resultView}`);\n const pagedQuery = makePagedQuery(\n baseQuery,\n sorting ?? [],\n pagination,\n );\n\n const arrowTable = await connector.query(pagedQuery);\n const countResult = await connector.query(\n `SELECT COUNT(*)::int AS count FROM ${status.resultView}`,\n );\n const totalRows = countResult.toArray()[0]?.count ?? 0;\n\n get().cells.setCellResultPage(id, {arrowTable, totalRows});\n },\n\n // DAG methods (sync versions for UI usage)\n getRootCells: (sheetId: string) => {\n const {dependencies} = buildDependencyGraph(sheetId, get());\n const ids = Object.keys(dependencies);\n return ids.filter((id) => (dependencies[id]?.length ?? 0) === 0);\n },\n getDownstream: (sheetId: string, sourceCellId: string) => {\n const {dependencies, dependents} = buildDependencyGraph(\n sheetId,\n get(),\n );\n const reachable = collectReachable(sourceCellId, dependents);\n if (!reachable.size) return [];\n reachable.delete(sourceCellId);\n const rootsWithinScope = Array.from(reachable).filter((id) => {\n const deps = dependencies[id] || [];\n return deps.filter((d) => reachable.has(d)).length === 0;\n });\n return topologicalOrder(\n rootsWithinScope,\n dependencies,\n dependents,\n reachable,\n );\n },\n // Async cascade execution using AST-based dependency resolution\n runAllCellsCascade: async (sheetId: string) => {\n const cached = buildDependencyGraph(sheetId, get());\n const hasCachedNodes = Object.keys(cached.dependencies).length > 0;\n if (!hasCachedNodes) {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n sheet.graphCache = buildGraphCacheFromEdges(sheet);\n }\n }),\n );\n }\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const {dependencies, dependents} = await buildDependencyGraphAsync(\n sheetId,\n get(),\n sqlSelectToJson,\n );\n const roots = Object.keys(dependencies).filter(\n (id) => (dependencies[id]?.length ?? 0) === 0,\n );\n const order = topologicalOrder(roots, dependencies, dependents);\n for (const cellId of order) {\n try {\n await get().cells.runCell(cellId, {cascade: false});\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error);\n set((state) =>\n produce(state, (draft) => {\n const status = draft.cells.status[cellId];\n if (status?.type === 'sql') {\n status.status = 'error';\n status.lastError = message;\n }\n }),\n );\n }\n }\n },\n runDownstreamCascade: async (sheetId: string, sourceCellId: string) => {\n const cached = buildDependencyGraph(sheetId, get());\n const hasCachedNodes = Object.keys(cached.dependencies).length > 0;\n if (!hasCachedNodes) {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n sheet.graphCache = buildGraphCacheFromEdges(sheet);\n }\n }),\n );\n }\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const {dependencies, dependents} = await buildDependencyGraphAsync(\n sheetId,\n get(),\n sqlSelectToJson,\n );\n const reachable = collectReachable(sourceCellId, dependents);\n if (!reachable.size) return;\n reachable.delete(sourceCellId);\n const rootsWithinScope = Array.from(reachable).filter((id) => {\n const deps = dependencies[id] || [];\n return deps.filter((d) => reachable.has(d)).length === 0;\n });\n const order = topologicalOrder(\n rootsWithinScope,\n dependencies,\n dependents,\n reachable,\n );\n for (const cellId of order) {\n try {\n await get().cells.runCell(cellId, {cascade: false});\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error);\n set((state) =>\n produce(state, (draft) => {\n const status = draft.cells.status[cellId];\n if (status?.type === 'sql') {\n status.status = 'error';\n status.lastError = message;\n }\n }),\n );\n }\n }\n },\n },\n } as CellsSliceState;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cellsSlice.js","sourceRoot":"","sources":["../src/cellsSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAA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,CAAC;AACL,CAAC","sourcesContent":["import {createId} from '@paralleldrive/cuid2';\nimport {makePagedQuery} from '@sqlrooms/data-table';\nimport {sanitizeQuery} from '@sqlrooms/duckdb';\nimport {createSlice} from '@sqlrooms/room-store';\nimport {\n convertToValidColumnOrTableName,\n generateUniqueName,\n} from '@sqlrooms/utils';\nimport {produce} from 'immer';\nimport {\n buildDependencyGraph,\n buildDependencyGraphAsync,\n buildGraphCacheFromEdges,\n collectReachable,\n ensureGraphCache,\n removeCellFromCache,\n replaceCellDependenciesInCache,\n topologicalOrder,\n} from './dagUtils';\nimport {\n findSheetIdForCell,\n getRequiredSqlSelectToJson,\n normalizeCellsConfigStructure,\n resolveDependencies,\n} from './helpers';\nimport {dropResultRelation} from './resultRelationPolicy';\nimport type {\n Cell,\n CellResultData,\n CellsRootState,\n CellsSliceConfig,\n CellsSliceOptions,\n CellsSliceState,\n CrossFilterSelection,\n Edge,\n SheetType,\n SqlCell,\n SqlCellData,\n} from './types';\nimport {isInputCell, isSqlCell} from './types';\nimport {getEffectiveResultName, getSheetSchemaName, isDefined} from './utils';\nimport {buildCrossFilterPredicate} from './vegaSelectionUtils';\n\nfunction createDefaultCellsConfig(\n config: Partial<CellsSliceConfig> | undefined,\n): CellsSliceConfig {\n const sheetId = createId();\n const defaultConfig: CellsSliceConfig = {\n data: {},\n sheets: {\n [sheetId]: {\n id: sheetId,\n type: 'notebook',\n title: 'Sheet',\n schemaName: getSheetSchemaName(sheetId),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n tableDependencies: {},\n },\n },\n },\n sheetOrder: [sheetId],\n currentSheetId: sheetId,\n tableDepSchemas: ['main'],\n };\n\n if (!config) {\n return defaultConfig;\n }\n\n const {sheets, sheetOrder, currentSheetId} = normalizeCellsConfigStructure(\n config,\n defaultConfig,\n );\n\n return {\n ...defaultConfig,\n ...config,\n sheets,\n sheetOrder,\n currentSheetId,\n };\n}\n\n// --- Slice Implementation ---\n\nexport function createCellsSlice(props: CellsSliceOptions) {\n const {cellRegistry, supportedSheetTypes = ['notebook', 'canvas']} = props;\n const initialConfig = createDefaultCellsConfig(props?.config);\n // Keep result data outside Immer drafts, but scoped per slice instance.\n const cellResultCache = new Map<string, CellResultData>();\n return createSlice<CellsSliceState, CellsRootState>((set, get, store) => {\n const dropRelationBestEffort = async (relationName: string) => {\n try {\n const connector = await get().db.getConnector();\n await dropResultRelation({connector, relationName});\n } catch {\n // Best-effort cleanup\n }\n };\n\n const dropRelationsForStatus = async (\n cellType: string,\n status: {type: string; [key: string]: unknown} | undefined,\n ) => {\n if (!status) return;\n const registryItem = cellRegistry[cellType];\n const names = registryItem?.getRelationsToDrop?.(status) ?? [];\n for (const name of names) {\n await dropRelationBestEffort(name);\n }\n };\n\n // Mark cells stale when their dependent database tables change (schema-level).\n store.subscribe((state, prevState) => {\n if (state.db.tables === prevState.db.tables) return;\n const toName = (t: {table: {schema?: string; table: string}}) =>\n `${t.table.schema ?? 'main'}.${t.table.table}`;\n const oldNames = new Set(prevState.db.tables.map(toName));\n const newNames = new Set(state.db.tables.map(toName));\n const changed = new Set<string>();\n for (const n of oldNames) {\n if (!newNames.has(n)) changed.add(n);\n }\n for (const n of newNames) {\n if (!oldNames.has(n)) changed.add(n);\n }\n if (!changed.size) return;\n\n for (const sheet of Object.values(state.cells.config.sheets)) {\n const cache = sheet.graphCache;\n if (!cache?.tableDependencies) continue;\n for (const [cellId, tables] of Object.entries(\n cache.tableDependencies,\n )) {\n if (tables.some((t) => changed.has(t))) {\n state.cells.invalidateCellStatus(cellId);\n }\n }\n }\n });\n\n return {\n cells: {\n cellRegistry,\n supportedSheetTypes,\n config: initialConfig,\n status: {},\n activeAbortControllers: {},\n resultVersion: {},\n pageVersion: {},\n async initialize() {\n for (const [cellId, cell] of Object.entries(\n get().cells.config.data,\n )) {\n const registryItem = cellRegistry[cell.type];\n if (registryItem?.onInitialize) {\n registryItem.onInitialize({\n id: cellId,\n status: get().cells.status[cellId],\n get,\n set,\n });\n }\n }\n },\n crossFilterSelections: {},\n\n setCrossFilterSelection: (\n chartCellId: string,\n sqlId: string,\n selection: CrossFilterSelection | null,\n ) => {\n set((state) =>\n produce(state, (draft) => {\n if (!draft.cells.crossFilterSelections[sqlId]) {\n draft.cells.crossFilterSelections[sqlId] = {};\n }\n draft.cells.crossFilterSelections[sqlId][chartCellId] = selection;\n }),\n );\n },\n\n getCrossFilterPredicate: (\n chartCellId: string,\n sqlId: string,\n ): string | null => {\n const group = get().cells.crossFilterSelections[sqlId];\n if (!group) return null;\n const siblingSelections = Object.entries(group)\n .filter(([id]) => id !== chartCellId)\n .map(([, sel]) => sel);\n return buildCrossFilterPredicate(siblingSelections);\n },\n\n clearCrossFilterGroup: (sqlId: string) => {\n set((state) =>\n produce(state, (draft) => {\n delete draft.cells.crossFilterSelections[sqlId];\n }),\n );\n },\n\n addCell: async (sheetId: string, cell: Cell, index?: number) => {\n // Pre-compute dependencies outside produce() to support async\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const targetSheet = get().cells.config.sheets[sheetId];\n const scopedCells = Object.fromEntries(\n (targetSheet?.cellIds ?? [])\n .map((id) => get().cells.config.data[id])\n .filter(isDefined)\n .map((candidate) => [candidate.id, candidate]),\n ) as Record<string, Cell>;\n scopedCells[cell.id] = cell;\n\n // Generate a unique result name for SQL cells if not set\n if (cell.type === 'sql' && !cell.data.resultName) {\n const existingNames = Object.values(scopedCells)\n .filter((c): c is SqlCell => c.type === 'sql' && c.id !== cell.id)\n .map((c) =>\n getEffectiveResultName(c.data, convertToValidColumnOrTableName),\n );\n const baseName = getEffectiveResultName(\n cell.data as SqlCellData,\n convertToValidColumnOrTableName,\n );\n const uniqueName = generateUniqueName(baseName, existingNames);\n (cell as SqlCell).data.resultName = uniqueName;\n }\n\n const deps = await resolveDependencies(\n cell,\n scopedCells,\n sheetId,\n cellRegistry,\n sqlSelectToJson,\n );\n\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.data[cell.id] = cell;\n const registryItem = cellRegistry[cell.type];\n draft.cells.status[cell.id] = registryItem?.createStatus?.(\n cell.id,\n ) ?? {type: 'other'};\n\n // Single-owner invariant: a cell can belong to one sheet only.\n for (const [existingSheetId, existingSheet] of Object.entries(\n draft.cells.config.sheets,\n )) {\n if (existingSheetId === sheetId) continue;\n existingSheet.cellIds = existingSheet.cellIds.filter(\n (cid) => cid !== cell.id,\n );\n existingSheet.edges = existingSheet.edges.filter(\n (e) => e.source !== cell.id && e.target !== cell.id,\n );\n removeCellFromCache(existingSheet, cell.id);\n }\n\n let sheet = draft.cells.config.sheets[sheetId];\n if (!sheet) {\n sheet = {\n id: sheetId,\n type: 'notebook',\n title: 'Sheet',\n schemaName: getSheetSchemaName(sheetId),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n tableDependencies: {},\n },\n };\n draft.cells.config.sheets[sheetId] = sheet;\n if (!draft.cells.config.sheetOrder.includes(sheetId)) {\n draft.cells.config.sheetOrder.push(sheetId);\n }\n if (!draft.cells.config.currentSheetId) {\n draft.cells.config.currentSheetId = sheetId;\n }\n }\n\n const newIndex =\n index !== undefined ? index : sheet.cellIds.length;\n sheet.cellIds = sheet.cellIds.filter((cid) => cid !== cell.id);\n sheet.cellIds.splice(newIndex, 0, cell.id);\n\n // Add edges from pre-computed dependencies\n sheet.edges = sheet.edges.filter(\n (edge) =>\n edge.target !== cell.id &&\n edge.id !== `${edge.source}-${cell.id}`,\n );\n const localCellIds = new Set(sheet.cellIds);\n for (const depId of deps.cellIds) {\n if (!localCellIds.has(depId) || depId === cell.id) continue;\n sheet.edges.push({\n id: `${depId}-${cell.id}`,\n source: depId,\n target: cell.id,\n });\n }\n replaceCellDependenciesInCache(\n sheet,\n cell.id,\n deps.cellIds.filter((depId) => localCellIds.has(depId)),\n deps.tableNames,\n );\n }),\n );\n },\n\n removeCell: (id: string) => {\n const cell = get().cells.config.data[id];\n const previousStatus = get().cells.status[id];\n cellResultCache.delete(id);\n set((state) =>\n produce(state, (draft) => {\n delete draft.cells.config.data[id];\n delete draft.cells.status[id];\n delete draft.cells.resultVersion[id];\n delete draft.cells.pageVersion[id];\n const controller = draft.cells.activeAbortControllers[id];\n if (controller) {\n controller.abort();\n delete draft.cells.activeAbortControllers[id];\n }\n\n // Remove from all sheets\n for (const sheet of Object.values(draft.cells.config.sheets)) {\n sheet.cellIds = sheet.cellIds.filter((cid) => cid !== id);\n sheet.edges = sheet.edges.filter(\n (e) => e.source !== id && e.target !== id,\n );\n removeCellFromCache(sheet, id);\n }\n }),\n );\n if (cell) {\n const registryItem = cellRegistry[cell.type];\n if (registryItem?.onRemove) {\n void registryItem.onRemove({\n id,\n status: previousStatus,\n get,\n set,\n });\n } else {\n void dropRelationsForStatus(cell.type, previousStatus);\n }\n }\n },\n\n updateCell: async (\n id: string,\n updater: (cell: Cell) => Cell,\n opts?: {cascade?: boolean},\n ) => {\n const cell = get().cells.config.data[id];\n if (!cell) return;\n const ownerSheetId = findSheetIdForCell(get(), id);\n const scopedCells = Object.fromEntries(\n (\n (ownerSheetId &&\n get().cells.config.sheets[ownerSheetId]?.cellIds) ||\n []\n )\n .map((cellId) => get().cells.config.data[cellId])\n .filter(isDefined)\n .map((candidate) => [candidate.id, candidate]),\n ) as Record<string, Cell>;\n\n const updatedCell = updater(cell);\n scopedCells[id] = updatedCell;\n\n const registryItem = cellRegistry[cell.type];\n\n const existingStatus = get().cells.status[id];\n const oldResultRelation =\n existingStatus && registryItem?.getResultRelation\n ? registryItem.getResultRelation(existingStatus)\n : undefined;\n\n const semanticInputChanged =\n isInputCell(cell) &&\n isInputCell(updatedCell) &&\n (cell.data.input.varName !== updatedCell.data.input.varName ||\n cell.data.input.value !== updatedCell.data.input.value);\n const semanticSqlChanged =\n isSqlCell(cell) &&\n isSqlCell(updatedCell) &&\n cell.data.sql !== updatedCell.data.sql;\n\n const semanticChanged =\n registryItem?.hasSemanticChange?.(cell, updatedCell) ?? false;\n\n // Apply cell data to the store immediately so that other\n // actions (e.g. runCell triggered via Cmd+Enter) always see\n // the latest value. Edge/dependency updates follow\n // asynchronously below.\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.data[id] = updatedCell;\n if (semanticChanged) {\n const status = draft.cells.status[id];\n if (status && registryItem?.invalidateStatus) {\n draft.cells.status[id] =\n registryItem.invalidateStatus(status);\n }\n }\n }),\n );\n\n // Avoid expensive dependency graph recomputation on each SQL keystroke.\n // We recompute immediately for non-SQL edits, or when callers explicitly\n // request cascading behavior.\n const shouldRecomputeDependencies =\n !semanticSqlChanged || opts?.cascade === true;\n if (shouldRecomputeDependencies) {\n // Pre-compute dependencies outside produce() to support async\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const newDeps = await resolveDependencies(\n updatedCell,\n scopedCells,\n ownerSheetId || '',\n cellRegistry,\n sqlSelectToJson,\n );\n\n set((state) =>\n produce(state, (draft) => {\n const ownerSheet = Object.values(\n draft.cells.config.sheets,\n ).find((sheet) => sheet.cellIds.includes(id));\n if (ownerSheet) {\n const localCellIds = new Set(ownerSheet.cellIds);\n ownerSheet.edges = ownerSheet.edges.filter(\n (e) => e.target !== id,\n );\n for (const depId of newDeps.cellIds) {\n if (!localCellIds.has(depId) || depId === id) continue;\n ownerSheet.edges.push({\n id: `${depId}-${id}`,\n source: depId,\n target: id,\n });\n }\n replaceCellDependenciesInCache(\n ownerSheet,\n id,\n newDeps.cellIds.filter((depId) => localCellIds.has(depId)),\n newDeps.tableNames,\n );\n }\n }),\n );\n }\n\n // If the result relation changed name (e.g. SQL resultName changed), rename it\n const newStatus = get().cells.status[id];\n const newResultRelation =\n newStatus && registryItem?.getResultRelation\n ? registryItem.getResultRelation(newStatus)\n : undefined;\n const resultRelationChanged =\n oldResultRelation && newResultRelation !== oldResultRelation;\n if (resultRelationChanged && registryItem?.renameResult) {\n void registryItem.renameResult({\n id,\n oldResultView: oldResultRelation,\n get,\n set,\n });\n }\n\n // After update, trigger cascade only if explicitly requested\n // or if semantic execution inputs changed.\n const shouldCascade =\n opts?.cascade || resultRelationChanged || semanticInputChanged;\n if (shouldCascade) {\n if (ownerSheetId) {\n void get().cells.runDownstreamCascade(ownerSheetId, id);\n }\n }\n },\n\n addSheet: (title?: string, type: SheetType = 'notebook') => {\n const id = createId();\n set((state) =>\n produce(state, (draft) => {\n const typeLabel = type.charAt(0).toUpperCase() + type.slice(1);\n const existingTitles = Object.values(\n draft.cells.config.sheets,\n ).map((s) => s.title);\n const defaultTitle = generateUniqueName(\n `${typeLabel} 1`,\n existingTitles,\n ' ',\n );\n\n draft.cells.config.sheets[id] = {\n id,\n type,\n title: title || defaultTitle,\n schemaName: getSheetSchemaName(id),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n tableDependencies: {},\n },\n };\n draft.cells.config.sheetOrder.push(id);\n draft.cells.config.currentSheetId = id;\n }),\n );\n return id;\n },\n\n removeSheet: (sheetId: string) => {\n const sheet = get().cells.config.sheets[sheetId];\n if (!sheet) return;\n const ownedCellIds = [...sheet.cellIds];\n const relationNamesToDrop = ownedCellIds.flatMap((cellId) => {\n const cell = get().cells.config.data[cellId];\n const status = get().cells.status[cellId];\n if (!cell || !status) return [];\n const registryItem = cellRegistry[cell.type];\n return registryItem?.getRelationsToDrop?.(status) ?? [];\n });\n set((state) =>\n produce(state, (draft) => {\n for (const cellId of ownedCellIds) {\n cellResultCache.delete(cellId);\n delete draft.cells.config.data[cellId];\n delete draft.cells.status[cellId];\n delete draft.cells.resultVersion[cellId];\n delete draft.cells.pageVersion[cellId];\n const controller = draft.cells.activeAbortControllers[cellId];\n if (controller) {\n controller.abort();\n }\n delete draft.cells.activeAbortControllers[cellId];\n }\n\n for (const existingSheet of Object.values(\n draft.cells.config.sheets,\n )) {\n existingSheet.cellIds = existingSheet.cellIds.filter(\n (cid) => !ownedCellIds.includes(cid),\n );\n existingSheet.edges = existingSheet.edges.filter(\n (e) =>\n !ownedCellIds.includes(e.source) &&\n !ownedCellIds.includes(e.target),\n );\n for (const cellId of ownedCellIds) {\n removeCellFromCache(existingSheet, cellId);\n }\n }\n\n delete draft.cells.config.sheets[sheetId];\n draft.cells.config.sheetOrder =\n draft.cells.config.sheetOrder.filter((id) => id !== sheetId);\n if (draft.cells.config.currentSheetId === sheetId) {\n draft.cells.config.currentSheetId =\n draft.cells.config.sheetOrder[0];\n }\n }),\n );\n for (const relationName of relationNamesToDrop) {\n void dropRelationBestEffort(relationName);\n }\n },\n\n closeSheet: (sheetId: string) => {\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.sheetOrder =\n draft.cells.config.sheetOrder.filter((id) => id !== sheetId);\n if (draft.cells.config.currentSheetId === sheetId) {\n draft.cells.config.currentSheetId =\n draft.cells.config.sheetOrder[0];\n }\n }),\n );\n },\n\n openSheet: (sheetId: string) => {\n set((state) =>\n produce(state, (draft) => {\n if (!draft.cells.config.sheetOrder.includes(sheetId)) {\n draft.cells.config.sheetOrder.push(sheetId);\n }\n draft.cells.config.currentSheetId = sheetId;\n }),\n );\n },\n\n setSheetOrder: (sheetOrder: string[]) => {\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.sheetOrder = sheetOrder;\n }),\n );\n },\n\n renameSheet: (sheetId: string, title: string) => {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n // We could add validation here, but usually UI handles it.\n // For now, we'll just allow it as the primary logic is in view slices.\n sheet.title = title;\n }\n }),\n );\n },\n\n setCurrentSheet: (sheetId: string) => {\n set((state) =>\n produce(state, (draft) => {\n draft.cells.config.currentSheetId = sheetId;\n }),\n );\n },\n\n addEdge: (sheetId: string, edge: Omit<Edge, 'id'>) => {\n set((state) =>\n produce(state, (draft) => {\n let sheet = draft.cells.config.sheets[sheetId];\n if (!sheet) {\n sheet = {\n id: sheetId,\n type: 'notebook',\n title: 'Sheet',\n schemaName: getSheetSchemaName(sheetId),\n cellIds: [],\n edges: [],\n graphCache: {\n dependencies: {},\n dependents: {},\n contentHashByCell: {},\n tableDependencies: {},\n },\n };\n draft.cells.config.sheets[sheetId] = sheet;\n if (!draft.cells.config.sheetOrder.includes(sheetId)) {\n draft.cells.config.sheetOrder.push(sheetId);\n }\n if (!draft.cells.config.currentSheetId) {\n draft.cells.config.currentSheetId = sheetId;\n }\n }\n if (\n !sheet.cellIds.includes(edge.source) ||\n !sheet.cellIds.includes(edge.target)\n ) {\n return;\n }\n const id = `${edge.source}-${edge.target}`;\n if (!sheet.edges.find((e) => e.id === id)) {\n sheet.edges.push({...edge, id});\n ensureGraphCache(sheet);\n const deps = sheet.graphCache?.dependencies[edge.target] || [];\n replaceCellDependenciesInCache(sheet, edge.target, [\n ...deps,\n edge.source,\n ]);\n }\n }),\n );\n },\n\n removeEdge: (sheetId: string, edgeId: string) => {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n sheet.edges = sheet.edges.filter((e) => e.id !== edgeId);\n delete sheet.graphCache;\n }\n }),\n );\n },\n\n updateEdgesFromSql: async (sheetId: string, cellId: string) => {\n const cell = get().cells.config.data[cellId];\n const sheet = get().cells.config.sheets[sheetId];\n if (!cell || !sheet) return;\n\n // Pre-compute dependencies outside produce() to support async\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const scopedCells = Object.fromEntries(\n sheet.cellIds\n .map((id) => get().cells.config.data[id])\n .filter(isDefined)\n .map((candidate) => [candidate.id, candidate]),\n ) as Record<string, Cell>;\n const deps = await resolveDependencies(\n cell,\n scopedCells,\n sheetId,\n cellRegistry,\n sqlSelectToJson,\n );\n\n set((state) =>\n produce(state, (draft) => {\n const draftSheet = draft.cells.config.sheets[sheetId];\n if (draftSheet) {\n draftSheet.edges = draftSheet.edges.filter(\n (e) => e.target !== cellId,\n );\n const localCellIds = new Set(draftSheet.cellIds);\n for (const depId of deps.cellIds) {\n if (!localCellIds.has(depId) || depId === cellId) continue;\n draftSheet.edges.push({\n id: `${depId}-${cellId}`,\n source: depId,\n target: cellId,\n });\n }\n replaceCellDependenciesInCache(\n draftSheet,\n cellId,\n deps.cellIds.filter((depId) => localCellIds.has(depId)),\n deps.tableNames,\n );\n }\n }),\n );\n },\n\n runCell: async (\n id: string,\n opts?: {cascade?: boolean; schemaName?: string},\n ) => {\n const state = get();\n const cell = state.cells.config.data[id];\n if (!cell) return;\n\n const registryItem = cellRegistry[cell.type];\n if (!registryItem) return;\n\n if (registryItem.runCell) {\n // Pass get/set to registry's runCell\n await registryItem.runCell({id, opts, get, set});\n return;\n }\n\n // No default behavior - each cell type must define runCell if needed\n },\n cancelCell: (id: string) => {\n const state = get();\n const controller = state.cells.activeAbortControllers[id];\n if (controller) {\n controller.abort();\n }\n },\n invalidateCellStatus: (id: string) => {\n const cell = get().cells.config.data[id];\n if (!cell) return;\n const registryItem = cellRegistry[cell.type];\n set((state) =>\n produce(state, (draft) => {\n const status = draft.cells.status[id];\n if (status && registryItem?.invalidateStatus) {\n draft.cells.status[id] = registryItem.invalidateStatus(status);\n }\n }),\n );\n },\n\n // Cell result cache actions\n setCellResult: (id: string, data: CellResultData) => {\n cellResultCache.set(id, data);\n set((state) =>\n produce(state, (draft) => {\n draft.cells.resultVersion[id] =\n (draft.cells.resultVersion[id] ?? 0) + 1;\n }),\n );\n },\n\n setCellResultPage: (id: string, data: CellResultData) => {\n cellResultCache.set(id, data);\n set((state) =>\n produce(state, (draft) => {\n draft.cells.pageVersion[id] =\n (draft.cells.pageVersion[id] ?? 0) + 1;\n }),\n );\n },\n\n getCellResult: (id: string) => {\n return cellResultCache.get(id);\n },\n\n clearCellResult: (id: string) => {\n cellResultCache.delete(id);\n set((state) =>\n produce(state, (draft) => {\n delete draft.cells.resultVersion[id];\n delete draft.cells.pageVersion[id];\n }),\n );\n },\n\n fetchCellResultPage: async (\n id: string,\n pagination: {pageIndex: number; pageSize: number},\n sorting?: {id: string; desc: boolean}[],\n ) => {\n const state = get();\n const cell = state.cells.config.data[id];\n if (!cell) return;\n const registryItem = cellRegistry[cell.type];\n const status = state.cells.status[id];\n const resultRelation =\n status && registryItem?.getResultRelation\n ? registryItem.getResultRelation(status)\n : undefined;\n if (!resultRelation) return;\n\n const connector = await state.db.getConnector();\n const baseQuery = sanitizeQuery(`SELECT * FROM ${resultRelation}`);\n const pagedQuery = makePagedQuery(\n baseQuery,\n sorting ?? [],\n pagination,\n );\n\n const arrowTable = await connector.query(pagedQuery);\n const countResult = await connector.query(\n `SELECT COUNT(*)::int AS count FROM ${resultRelation}`,\n );\n const totalRows = countResult.toArray()[0]?.count ?? 0;\n\n get().cells.setCellResultPage(id, {arrowTable, totalRows});\n },\n\n // DAG methods (sync versions for UI usage)\n getRootCells: (sheetId: string) => {\n const {dependencies} = buildDependencyGraph(sheetId, get());\n const ids = Object.keys(dependencies);\n return ids.filter((id) => (dependencies[id]?.length ?? 0) === 0);\n },\n getDownstream: (sheetId: string, sourceCellId: string) => {\n const {dependencies, dependents} = buildDependencyGraph(\n sheetId,\n get(),\n );\n const reachable = collectReachable(sourceCellId, dependents);\n if (!reachable.size) return [];\n reachable.delete(sourceCellId);\n const rootsWithinScope = Array.from(reachable).filter((id) => {\n const deps = dependencies[id] || [];\n return deps.filter((d) => reachable.has(d)).length === 0;\n });\n return topologicalOrder(\n rootsWithinScope,\n dependencies,\n dependents,\n reachable,\n );\n },\n // Async cascade execution using AST-based dependency resolution\n runAllCellsCascade: async (sheetId: string) => {\n const cached = buildDependencyGraph(sheetId, get());\n const hasCachedNodes = Object.keys(cached.dependencies).length > 0;\n if (!hasCachedNodes) {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n sheet.graphCache = buildGraphCacheFromEdges(sheet);\n }\n }),\n );\n }\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const {dependencies, dependents} = await buildDependencyGraphAsync(\n sheetId,\n get(),\n sqlSelectToJson,\n );\n const roots = Object.keys(dependencies).filter(\n (id) => (dependencies[id]?.length ?? 0) === 0,\n );\n const order = topologicalOrder(roots, dependencies, dependents);\n for (const cellId of order) {\n try {\n await get().cells.runCell(cellId, {cascade: false});\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error);\n const failedCell = get().cells.config.data[cellId];\n const failedRegistryItem = failedCell\n ? cellRegistry[failedCell.type]\n : undefined;\n if (failedRegistryItem?.recordError) {\n set((state) =>\n produce(state, (draft) => {\n const status = draft.cells.status[cellId];\n if (status) {\n draft.cells.status[cellId] =\n failedRegistryItem.recordError!(status, message);\n }\n }),\n );\n }\n }\n }\n },\n runDownstreamCascade: async (sheetId: string, sourceCellId: string) => {\n const cached = buildDependencyGraph(sheetId, get());\n const hasCachedNodes = Object.keys(cached.dependencies).length > 0;\n if (!hasCachedNodes) {\n set((state) =>\n produce(state, (draft) => {\n const sheet = draft.cells.config.sheets[sheetId];\n if (sheet) {\n sheet.graphCache = buildGraphCacheFromEdges(sheet);\n }\n }),\n );\n }\n const sqlSelectToJson = getRequiredSqlSelectToJson(get());\n const {dependencies, dependents} = await buildDependencyGraphAsync(\n sheetId,\n get(),\n sqlSelectToJson,\n );\n const reachable = collectReachable(sourceCellId, dependents);\n if (!reachable.size) return;\n reachable.delete(sourceCellId);\n const rootsWithinScope = Array.from(reachable).filter((id) => {\n const deps = dependencies[id] || [];\n return deps.filter((d) => reachable.has(d)).length === 0;\n });\n const order = topologicalOrder(\n rootsWithinScope,\n dependencies,\n dependents,\n reachable,\n );\n for (const cellId of order) {\n try {\n await get().cells.runCell(cellId, {cascade: false});\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error);\n const failedCell = get().cells.config.data[cellId];\n const failedRegistryItem = failedCell\n ? cellRegistry[failedCell.type]\n : undefined;\n if (failedRegistryItem?.recordError) {\n set((state) =>\n produce(state, (draft) => {\n const status = draft.cells.status[cellId];\n if (status) {\n draft.cells.status[cellId] =\n failedRegistryItem.recordError!(status, message);\n }\n }),\n );\n }\n }\n }\n },\n },\n } as CellsSliceState;\n });\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AggregationSelectorProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
onValueChange: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const AggregationSelector: React.FC<AggregationSelectorProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=AggregationSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AggregationSelector.d.ts","sourceRoot":"","sources":["../../src/components/AggregationSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B,UAAU,wBAAwB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsBlE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@sqlrooms/ui';
|
|
3
|
+
const aggregationOptions = [
|
|
4
|
+
{ value: 'sum', label: 'Sum' },
|
|
5
|
+
{ value: 'mean', label: 'Mean' },
|
|
6
|
+
{ value: 'count', label: 'Count' },
|
|
7
|
+
];
|
|
8
|
+
export const AggregationSelector = ({ value, onValueChange, }) => {
|
|
9
|
+
const selectedAggregation = aggregationOptions.find((opt) => opt.value === value) ??
|
|
10
|
+
aggregationOptions[0];
|
|
11
|
+
return (_jsxs(Select, { value: selectedAggregation.value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: "h-8 text-xs", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { onCloseAutoFocus: (e) => e.preventDefault(), children: aggregationOptions.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=AggregationSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AggregationSelector.js","sourceRoot":"","sources":["../../src/components/AggregationSelector.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,MAAM,kBAAkB,GAAG;IACzB,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC;IAC5B,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAC;IAC9B,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;CACxB,CAAC;AAOX,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,EACtE,KAAK,EACL,aAAa,GACd,EAAE,EAAE;IACH,MAAM,mBAAmB,GACvB,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC;QACrD,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAExB,OAAO,CACL,MAAC,MAAM,IAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,aAAa,aACpE,KAAC,aAAa,IAAC,SAAS,EAAC,aAAa,YACpC,KAAC,WAAW,KAAG,GACD,EAChB,KAAC,aAAa,IAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YACvD,kBAAkB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAClC,KAAC,UAAU,IAAoB,KAAK,EAAE,MAAM,CAAC,KAAK,YAC/C,MAAM,CAAC,KAAK,IADE,MAAM,CAAC,KAAK,CAEhB,CACd,CAAC,GACY,IACT,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@sqlrooms/ui';\n\nconst aggregationOptions = [\n {value: 'sum', label: 'Sum'},\n {value: 'mean', label: 'Mean'},\n {value: 'count', label: 'Count'},\n] as const;\n\ninterface AggregationSelectorProps {\n value?: string;\n onValueChange: (value: string) => void;\n}\n\nexport const AggregationSelector: React.FC<AggregationSelectorProps> = ({\n value,\n onValueChange,\n}) => {\n const selectedAggregation =\n aggregationOptions.find((opt) => opt.value === value) ??\n aggregationOptions[0];\n\n return (\n <Select value={selectedAggregation.value} onValueChange={onValueChange}>\n <SelectTrigger className=\"h-8 text-xs\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent onCloseAutoFocus={(e) => e.preventDefault()}>\n {aggregationOptions.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type CellSourceSelectorProps = {
|
|
3
|
+
/** Current value in `cell:<id>` or `table:<schema.table>` format. */
|
|
4
|
+
value?: string;
|
|
5
|
+
/** Callback when the user selects a data source. Value is prefixed. */
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
7
|
+
/** Optional className override for the trigger. */
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const CellSourceSelector: React.FC<CellSourceSelectorProps>;
|
|
11
|
+
//# sourceMappingURL=CellSourceSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellSourceSelector.d.ts","sourceRoot":"","sources":["../../src/components/CellSourceSelector.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAMrC,MAAM,MAAM,uBAAuB,GAAG;IACpC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAKF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAkFhE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from '@sqlrooms/ui';
|
|
3
|
+
import { convertToValidColumnOrTableName } from '@sqlrooms/utils';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useCellsStore } from '../hooks';
|
|
6
|
+
import { isSqlCell } from '../types';
|
|
7
|
+
import { getEffectiveResultName } from '../utils';
|
|
8
|
+
import { toDataSourceCell, toDataSourceTable } from '../helpers';
|
|
9
|
+
const GREEN_ITEM = '[&_svg]:text-accent-foreground font-mono text-xs text-green-500 data-[highlighted]:text-green-500';
|
|
10
|
+
export const CellSourceSelector = ({ value, onValueChange, className, }) => {
|
|
11
|
+
const cellsData = useCellsStore((s) => s.cells.config.data);
|
|
12
|
+
const dbTables = useCellsStore((s) => s.db.tables);
|
|
13
|
+
const tableDepSchemas = useCellsStore((s) => s.cells.config.tableDepSchemas);
|
|
14
|
+
const currentSheetId = useCellsStore((s) => s.cells.config.currentSheetId);
|
|
15
|
+
const sheetCellIds = useCellsStore((s) => currentSheetId ? s.cells.config.sheets[currentSheetId]?.cellIds : undefined);
|
|
16
|
+
const availableSqlCells = useMemo(() => {
|
|
17
|
+
if (!sheetCellIds)
|
|
18
|
+
return [];
|
|
19
|
+
return sheetCellIds
|
|
20
|
+
.map((cid) => cellsData[cid])
|
|
21
|
+
.filter((c) => Boolean(c && isSqlCell(c)));
|
|
22
|
+
}, [sheetCellIds, cellsData]);
|
|
23
|
+
const availableTables = useMemo(() => {
|
|
24
|
+
const schemas = new Set(tableDepSchemas ?? ['main']);
|
|
25
|
+
return dbTables.filter((t) => !t.isView && t.table.schema != null && schemas.has(t.table.schema));
|
|
26
|
+
}, [dbTables, tableDepSchemas]);
|
|
27
|
+
const hasValue = value != null;
|
|
28
|
+
return (_jsxs(Select, { value: value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: cn('h-6 w-[180px] text-xs shadow-none', className, {
|
|
29
|
+
'[&>span]:font-mono [&>span]:text-green-500': hasValue,
|
|
30
|
+
}), children: _jsx(SelectValue, { placeholder: "Select data source" }) }), _jsxs(SelectContent, { onCloseAutoFocus: (e) => e.preventDefault(), children: [availableSqlCells.length > 0 && (_jsxs(SelectGroup, { children: [_jsx(SelectLabel, { className: "text-muted-foreground text-[10px]", children: "Cells" }), availableSqlCells.map((sql) => (_jsx(SelectItem, { className: GREEN_ITEM, value: toDataSourceCell(sql), children: getEffectiveResultName(sql.data, convertToValidColumnOrTableName) }, sql.id)))] })), availableTables.length > 0 && (_jsxs(SelectGroup, { children: [_jsx(SelectLabel, { className: "text-muted-foreground text-[10px]", children: "Tables" }), availableTables.map((t) => {
|
|
31
|
+
const qualifiedName = `${t.table.schema}.${t.table.table}`;
|
|
32
|
+
return (_jsx(SelectItem, { className: GREEN_ITEM, value: toDataSourceTable(t.table), children: qualifiedName }, qualifiedName));
|
|
33
|
+
})] }))] })] }));
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=CellSourceSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellSourceSelector.js","sourceRoot":"","sources":["../../src/components/CellSourceSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,EAAE,EACF,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,+BAA+B,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAc,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,aAAa,EA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,GAAG,CAAC,IAAmB,EACvB,+BAA+B,CAChC,IANI,GAAG,CAAC,EAAE,CAOA,CACd,CAAC,IACU,CACf,EACA,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,CAC7B,MAAC,WAAW,eACV,KAAC,WAAW,IAAC,SAAS,EAAC,mCAAmC,uBAE5C,EACb,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gCACzB,MAAM,aAAa,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gCAE3D,OAAO,CACL,KAAC,UAAU,IACT,SAAS,EAAE,UAAU,EAErB,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,YAEhC,aAAa,IAHT,aAAa,CAIP,CACd,CAAC;4BACJ,CAAC,CAAC,IACU,CACf,IACa,IACT,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n cn,\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectTrigger,\n SelectValue,\n} from '@sqlrooms/ui';\nimport {convertToValidColumnOrTableName} from '@sqlrooms/utils';\nimport React, {useMemo} from 'react';\nimport {useCellsStore} from '../hooks';\nimport {isSqlCell, SqlCell, type SqlCellData} from '../types';\nimport {getEffectiveResultName} from '../utils';\nimport {toDataSourceCell, toDataSourceTable} from '../helpers';\n\nexport type CellSourceSelectorProps = {\n /** Current value in `cell:<id>` or `table:<schema.table>` format. */\n value?: string;\n /** Callback when the user selects a data source. Value is prefixed. */\n onValueChange: (value: string) => void;\n /** Optional className override for the trigger. */\n className?: string;\n};\n\nconst GREEN_ITEM =\n '[&_svg]:text-accent-foreground font-mono text-xs text-green-500 data-[highlighted]:text-green-500';\n\nexport const CellSourceSelector: React.FC<CellSourceSelectorProps> = ({\n value,\n onValueChange,\n className,\n}) => {\n const cellsData = useCellsStore((s) => s.cells.config.data);\n const dbTables = useCellsStore((s) => s.db.tables);\n const tableDepSchemas = useCellsStore((s) => s.cells.config.tableDepSchemas);\n const currentSheetId = useCellsStore((s) => s.cells.config.currentSheetId);\n const sheetCellIds = useCellsStore((s) =>\n currentSheetId ? s.cells.config.sheets[currentSheetId]?.cellIds : undefined,\n );\n\n const availableSqlCells = useMemo(() => {\n if (!sheetCellIds) return [];\n\n return sheetCellIds\n .map((cid) => cellsData[cid])\n .filter((c): c is SqlCell => Boolean(c && isSqlCell(c)));\n }, [sheetCellIds, cellsData]);\n\n const availableTables = useMemo(() => {\n const schemas = new Set(tableDepSchemas ?? ['main']);\n return dbTables.filter(\n (t) => !t.isView && t.table.schema != null && schemas.has(t.table.schema),\n );\n }, [dbTables, tableDepSchemas]);\n\n const hasValue = value != null;\n\n return (\n <Select value={value} onValueChange={onValueChange}>\n <SelectTrigger\n className={cn('h-6 w-[180px] text-xs shadow-none', className, {\n '[&>span]:font-mono [&>span]:text-green-500': hasValue,\n })}\n >\n <SelectValue placeholder=\"Select data source\" />\n </SelectTrigger>\n <SelectContent onCloseAutoFocus={(e) => e.preventDefault()}>\n {availableSqlCells.length > 0 && (\n <SelectGroup>\n <SelectLabel className=\"text-muted-foreground text-[10px]\">\n Cells\n </SelectLabel>\n {availableSqlCells.map((sql) => (\n <SelectItem\n className={GREEN_ITEM}\n key={sql.id}\n value={toDataSourceCell(sql)}\n >\n {getEffectiveResultName(\n sql.data as SqlCellData,\n convertToValidColumnOrTableName,\n )}\n </SelectItem>\n ))}\n </SelectGroup>\n )}\n {availableTables.length > 0 && (\n <SelectGroup>\n <SelectLabel className=\"text-muted-foreground text-[10px]\">\n Tables\n </SelectLabel>\n {availableTables.map((t) => {\n const qualifiedName = `${t.table.schema}.${t.table.table}`;\n\n return (\n <SelectItem\n className={GREEN_ITEM}\n key={qualifiedName}\n value={toDataSourceTable(t.table)}\n >\n {qualifiedName}\n </SelectItem>\n );\n })}\n </SelectGroup>\n )}\n </SelectContent>\n </Select>\n );\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ChartTypeSelectorProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
onValueChange: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChartTypeSelector: React.FC<ChartTypeSelectorProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ChartTypeSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartTypeSelector.d.ts","sourceRoot":"","sources":["../../src/components/ChartTypeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B,UAAU,sBAAsB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA+B9D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@sqlrooms/ui';
|
|
3
|
+
import { ChartColumnBig, ChartLine } from 'lucide-react';
|
|
4
|
+
const chartTypeOptions = [
|
|
5
|
+
{ value: 'bar', label: 'Bar', icon: ChartColumnBig },
|
|
6
|
+
{ value: 'line', label: 'Line', icon: ChartLine },
|
|
7
|
+
];
|
|
8
|
+
export const ChartTypeSelector = ({ value, onValueChange, }) => {
|
|
9
|
+
const selectedChartType = chartTypeOptions.find((opt) => opt.value === value) ?? chartTypeOptions[0];
|
|
10
|
+
const IconComponent = selectedChartType.icon;
|
|
11
|
+
return (_jsxs(Select, { value: selectedChartType.value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: "h-8 text-xs", children: _jsx(SelectValue, { placeholder: "Select chart type", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(IconComponent, { className: "h-4 w-4" }), _jsx("span", { children: selectedChartType.label })] }) }) }), _jsx(SelectContent, { onCloseAutoFocus: (e) => e.preventDefault(), children: chartTypeOptions.map((option) => (_jsx(SelectItem, { value: option.value, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(option.icon, { className: "h-4 w-4" }), _jsx("span", { children: option.label })] }) }, option.value))) })] }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=ChartTypeSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartTypeSelector.js","sourceRoot":"","sources":["../../src/components/ChartTypeSelector.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvD,MAAM,gBAAgB,GAAG;IACvB,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAC;IAClD,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAC;CACvC,CAAC;AAOX,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,KAAK,EACL,aAAa,GACd,EAAE,EAAE;IACH,MAAM,iBAAiB,GACrB,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAE7E,MAAM,aAAa,GAAG,iBAAiB,CAAC,IAAI,CAAC;IAE7C,OAAO,CACL,MAAC,MAAM,IAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,aAAa,aAClE,KAAC,aAAa,IAAC,SAAS,EAAC,aAAa,YACpC,KAAC,WAAW,IAAC,WAAW,EAAC,mBAAmB,YAC1C,eAAK,SAAS,EAAC,yBAAyB,aACtC,KAAC,aAAa,IAAC,SAAS,EAAC,SAAS,GAAG,EACrC,yBAAO,iBAAiB,CAAC,KAAK,GAAQ,IAClC,GACM,GACA,EAChB,KAAC,aAAa,IAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YACvD,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAChC,KAAC,UAAU,IAAoB,KAAK,EAAE,MAAM,CAAC,KAAK,YAChD,eAAK,SAAS,EAAC,yBAAyB,aACtC,KAAC,MAAM,CAAC,IAAI,IAAC,SAAS,EAAC,SAAS,GAAG,EACnC,yBAAO,MAAM,CAAC,KAAK,GAAQ,IACvB,IAJS,MAAM,CAAC,KAAK,CAKhB,CACd,CAAC,GACY,IACT,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@sqlrooms/ui';\nimport {ChartColumnBig, ChartLine} from 'lucide-react';\n\nconst chartTypeOptions = [\n {value: 'bar', label: 'Bar', icon: ChartColumnBig},\n {value: 'line', label: 'Line', icon: ChartLine},\n] as const;\n\ninterface ChartTypeSelectorProps {\n value?: string;\n onValueChange: (value: string) => void;\n}\n\nexport const ChartTypeSelector: React.FC<ChartTypeSelectorProps> = ({\n value,\n onValueChange,\n}) => {\n const selectedChartType =\n chartTypeOptions.find((opt) => opt.value === value) ?? chartTypeOptions[0];\n\n const IconComponent = selectedChartType.icon;\n\n return (\n <Select value={selectedChartType.value} onValueChange={onValueChange}>\n <SelectTrigger className=\"h-8 text-xs\">\n <SelectValue placeholder=\"Select chart type\">\n <div className=\"flex items-center gap-2\">\n <IconComponent className=\"h-4 w-4\" />\n <span>{selectedChartType.label}</span>\n </div>\n </SelectValue>\n </SelectTrigger>\n <SelectContent onCloseAutoFocus={(e) => e.preventDefault()}>\n {chartTypeOptions.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n <div className=\"flex items-center gap-2\">\n <option.icon className=\"h-4 w-4\" />\n <span>{option.label}</span>\n </div>\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CollapsibleSectionButtonProps {
|
|
3
|
+
isCollapsed: boolean;
|
|
4
|
+
onToggle: () => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A simple collapse/expand button with chevron icon for collapsible sections
|
|
8
|
+
*/
|
|
9
|
+
export declare const CollapsibleSectionButton: React.FC<CollapsibleSectionButtonProps>;
|
|
10
|
+
//# sourceMappingURL=CollapsibleSectionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollapsibleSectionButton.d.ts","sourceRoot":"","sources":["../../src/components/CollapsibleSectionButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,6BAA6B;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAC7C,6BAA6B,CAkB9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@sqlrooms/ui';
|
|
3
|
+
import { ChevronDownIcon, ChevronRightIcon } from 'lucide-react';
|
|
4
|
+
/**
|
|
5
|
+
* A simple collapse/expand button with chevron icon for collapsible sections
|
|
6
|
+
*/
|
|
7
|
+
export const CollapsibleSectionButton = ({ isCollapsed, onToggle }) => {
|
|
8
|
+
return (_jsx(Button, { size: "xs", variant: "ghost", className: "absolute top-1 left-1 z-20 h-4 w-4 p-0 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-50 focus-visible:opacity-100", onClick: onToggle, "aria-expanded": !isCollapsed, "aria-label": isCollapsed ? 'Expand section' : 'Collapse section', children: isCollapsed ? (_jsx(ChevronRightIcon, { className: "h-3 w-3" })) : (_jsx(ChevronDownIcon, { className: "h-3 w-3" })) }));
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=CollapsibleSectionButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollapsibleSectionButton.js","sourceRoot":"","sources":["../../src/components/CollapsibleSectionButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAQ/D;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC,CAAC,EAAC,WAAW,EAAE,QAAQ,EAAC,EAAE,EAAE;IAC9B,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,qJAAqJ,EAC/J,OAAO,EAAE,QAAQ,mBACF,CAAC,WAAW,gBACf,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,kBAAkB,YAE9D,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,gBAAgB,IAAC,SAAS,EAAC,SAAS,GAAG,CACzC,CAAC,CAAC,CAAC,CACF,KAAC,eAAe,IAAC,SAAS,EAAC,SAAS,GAAG,CACxC,GACM,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {Button} from '@sqlrooms/ui';\nimport {ChevronDownIcon, ChevronRightIcon} from 'lucide-react';\nimport React from 'react';\n\nexport interface CollapsibleSectionButtonProps {\n isCollapsed: boolean;\n onToggle: () => void;\n}\n\n/**\n * A simple collapse/expand button with chevron icon for collapsible sections\n */\nexport const CollapsibleSectionButton: React.FC<\n CollapsibleSectionButtonProps\n> = ({isCollapsed, onToggle}) => {\n return (\n <Button\n size=\"xs\"\n variant=\"ghost\"\n className=\"absolute top-1 left-1 z-20 h-4 w-4 p-0 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-50 focus-visible:opacity-100\"\n onClick={onToggle}\n aria-expanded={!isCollapsed}\n aria-label={isCollapsed ? 'Expand section' : 'Collapse section'}\n >\n {isCollapsed ? (\n <ChevronRightIcon className=\"h-3 w-3\" />\n ) : (\n <ChevronDownIcon className=\"h-3 w-3\" />\n )}\n </Button>\n );\n};\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const colorOptions: readonly [{
|
|
3
|
+
readonly value: "#077A9D";
|
|
4
|
+
readonly label: "Blue";
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: "#FFAB00";
|
|
7
|
+
readonly label: "Orange";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "#00A972";
|
|
10
|
+
readonly label: "Green";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "#85b6b2";
|
|
13
|
+
readonly label: "Teal";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "#919191";
|
|
16
|
+
readonly label: "Gray";
|
|
17
|
+
}];
|
|
18
|
+
interface ColorSelectorProps {
|
|
19
|
+
value: string | undefined;
|
|
20
|
+
onValueChange: (value: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const ColorSelector: React.FC<ColorSelectorProps>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=ColorSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorSelector.d.ts","sourceRoot":"","sources":["../../src/components/ColorSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAMf,CAAC;AAWX,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6BtD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@sqlrooms/ui';
|
|
3
|
+
export const colorOptions = [
|
|
4
|
+
{ value: '#077A9D', label: 'Blue' },
|
|
5
|
+
{ value: '#FFAB00', label: 'Orange' },
|
|
6
|
+
{ value: '#00A972', label: 'Green' },
|
|
7
|
+
{ value: '#85b6b2', label: 'Teal' },
|
|
8
|
+
{ value: '#919191', label: 'Gray' },
|
|
9
|
+
];
|
|
10
|
+
const ColorCircle = ({ color }) => {
|
|
11
|
+
return (_jsx("div", { className: "h-3.5 w-3.5 shrink-0 rounded-full border border-gray-300", style: { backgroundColor: color } }));
|
|
12
|
+
};
|
|
13
|
+
export const ColorSelector = ({ value, onValueChange, }) => {
|
|
14
|
+
const selectedColor = colorOptions.find((opt) => opt.value === value) ?? colorOptions[0];
|
|
15
|
+
return (_jsxs(Select, { value: selectedColor.value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: "h-8 text-xs", children: _jsx(SelectValue, { placeholder: "Select color", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ColorCircle, { color: selectedColor.value }), _jsx("span", { children: selectedColor.label })] }) }) }), _jsx(SelectContent, { onCloseAutoFocus: (e) => e.preventDefault(), children: colorOptions.map((option) => (_jsx(SelectItem, { value: option.value, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ColorCircle, { color: option.value }), _jsx("span", { children: option.label })] }) }, option.value))) })] }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=ColorSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorSelector.js","source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,EAChB,KAAC,aAAa,IAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YACvD,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,KAAC,UAAU,IAAoB,KAAK,EAAE,MAAM,CAAC,KAAK,YAChD,eAAK,SAAS,EAAC,yBAAyB,aACtC,KAAC,WAAW,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,EACpC,yBAAO,MAAM,CAAC,KAAK,GAAQ,IACvB,IAJS,MAAM,CAAC,KAAK,CAKhB,CACd,CAAC,GACY,IACT,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@sqlrooms/ui';\n\nexport const colorOptions = [\n {value: '#077A9D', label: 'Blue'},\n {value: '#FFAB00', label: 'Orange'},\n {value: '#00A972', label: 'Green'},\n {value: '#85b6b2', label: 'Teal'},\n {value: '#919191', label: 'Gray'},\n] as const;\n\nconst ColorCircle: React.FC<{color: string}> = ({color}) => {\n return (\n <div\n className=\"h-3.5 w-3.5 shrink-0 rounded-full border border-gray-300\"\n style={{backgroundColor: color}}\n />\n );\n};\n\ninterface ColorSelectorProps {\n value: string | undefined;\n onValueChange: (value: string) => void;\n}\n\nexport const ColorSelector: React.FC<ColorSelectorProps> = ({\n value,\n onValueChange,\n}) => {\n const selectedColor =\n colorOptions.find((opt) => opt.value === value) ?? colorOptions[0];\n\n return (\n <Select value={selectedColor.value} onValueChange={onValueChange}>\n <SelectTrigger className=\"h-8 text-xs\">\n <SelectValue placeholder=\"Select color\">\n <div className=\"flex items-center gap-2\">\n <ColorCircle color={selectedColor.value} />\n <span>{selectedColor.label}</span>\n </div>\n </SelectValue>\n </SelectTrigger>\n <SelectContent onCloseAutoFocus={(e) => e.preventDefault()}>\n {colorOptions.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n <div className=\"flex items-center gap-2\">\n <ColorCircle color={option.value} />\n <span>{option.label}</span>\n </div>\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Field } from 'apache-arrow';
|
|
3
|
+
interface FieldSelectorProps {
|
|
4
|
+
value: string | undefined;
|
|
5
|
+
fields: Field<any>[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
onValueChange: (value: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const FieldSelector: React.FC<FieldSelectorProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=FieldSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldSelector.d.ts","sourceRoot":"","sources":["../../src/components/FieldSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAEnC,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0BtD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@sqlrooms/ui';
|
|
3
|
+
import { getArrowColumnTypeCategory } from '@sqlrooms/duckdb';
|
|
4
|
+
import { FieldTypeIcon } from './FieldTypeIcon';
|
|
5
|
+
export const FieldSelector = ({ value, fields, placeholder = 'Select field', onValueChange, }) => {
|
|
6
|
+
return (_jsxs(Select, { value: value || '', onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: "h-8 text-xs", children: _jsx(SelectValue, { placeholder: placeholder }) }), _jsx(SelectContent, { onCloseAutoFocus: (e) => e.preventDefault(), children: fields.map((field) => {
|
|
7
|
+
const typeCategory = getArrowColumnTypeCategory(field.type);
|
|
8
|
+
return (_jsx(SelectItem, { value: field.name, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FieldTypeIcon, { typeCategory: typeCategory }), _jsx("span", { children: field.name })] }) }, field.name));
|
|
9
|
+
}) })] }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=FieldSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldSelector.js","sourceRoot":"","sources":["../../src/components/FieldSelector.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,0BAA0B,EAAC,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAU9C,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,KAAK,EACL,MAAM,EACN,WAAW,GAAG,cAAc,EAC5B,aAAa,GACd,EAAE,EAAE;IACH,OAAO,CACL,MAAC,MAAM,IAAC,KAAK,EAAE,KAAK,IAAI,EAAE,EAAE,aAAa,EAAE,aAAa,aACtD,KAAC,aAAa,IAAC,SAAS,EAAC,aAAa,YACpC,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,GAAI,GAC3B,EAChB,KAAC,aAAa,IAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YACvD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;oBACpB,MAAM,YAAY,GAAG,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC5D,OAAO,CACL,KAAC,UAAU,IAAkB,KAAK,EAAE,KAAK,CAAC,IAAI,YAC5C,eAAK,SAAS,EAAC,yBAAyB,aACtC,KAAC,aAAa,IAAC,YAAY,EAAE,YAAY,GAAI,EAC7C,yBAAO,KAAK,CAAC,IAAI,GAAQ,IACrB,IAJS,KAAK,CAAC,IAAI,CAKd,CACd,CAAC;gBACJ,CAAC,CAAC,GACY,IACT,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@sqlrooms/ui';\nimport {getArrowColumnTypeCategory} from '@sqlrooms/duckdb';\nimport {FieldTypeIcon} from './FieldTypeIcon';\nimport {Field} from 'apache-arrow';\n\ninterface FieldSelectorProps {\n value: string | undefined;\n fields: Field<any>[];\n placeholder?: string;\n onValueChange: (value: string) => void;\n}\n\nexport const FieldSelector: React.FC<FieldSelectorProps> = ({\n value,\n fields,\n placeholder = 'Select field',\n onValueChange,\n}) => {\n return (\n <Select value={value || ''} onValueChange={onValueChange}>\n <SelectTrigger className=\"h-8 text-xs\">\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent onCloseAutoFocus={(e) => e.preventDefault()}>\n {fields.map((field) => {\n const typeCategory = getArrowColumnTypeCategory(field.type);\n return (\n <SelectItem key={field.name} value={field.name}>\n <div className=\"flex items-center gap-2\">\n <FieldTypeIcon typeCategory={typeCategory} />\n <span>{field.name}</span>\n </div>\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n );\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ColumnTypeCategory } from '@sqlrooms/duckdb';
|
|
3
|
+
export interface FieldTypeIconProps {
|
|
4
|
+
typeCategory: ColumnTypeCategory | undefined;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const FieldTypeIcon: React.FC<FieldTypeIconProps>;
|
|
8
|
+
//# sourceMappingURL=FieldTypeIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldTypeIcon.d.ts","sourceRoot":"","sources":["../../src/components/FieldTypeIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAczD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0BtD,CAAC"}
|