@sqlrooms/vega 0.27.0-rc.1 → 0.27.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.
|
@@ -41,6 +41,6 @@ export function VegaChartToolResult({ className, sqlQuery, vegaLiteSpec, options
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}, [toolCallId, currentSessionId, appliedSpec, setToolAdditionalData]);
|
|
44
|
-
return (_jsx("div", { className: cn('flex flex-col gap-2', className), children: _jsx(VegaChartContainer, { spec: vegaLiteSpec, sqlQuery: sqlQuery, options: options, editable: editable, onSpecChange: handleSpecChange, onSqlChange: handleSqlChange, children: _jsx("div", { className: "relative
|
|
44
|
+
return (_jsx("div", { className: cn('flex flex-col gap-2', className), children: _jsx(VegaChartContainer, { spec: vegaLiteSpec, sqlQuery: sqlQuery, options: options, editable: editable, onSpecChange: handleSpecChange, onSqlChange: handleSqlChange, children: _jsx("div", { className: "relative", children: _jsx(VegaChartDisplay, { aspectRatio: 16 / 9, className: "pt-2", children: _jsxs(VegaLiteArrowChart.Actions, { className: "right-3", children: [_jsx(VegaExportAction, {}), editable && _jsx(VegaEditAction, { editorMode: editorMode })] }) }) }) }) }));
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=VegaChartToolResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VegaChartToolResult.js","sourceRoot":"","sources":["../src/VegaChartToolResult.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAC,cAAc,EAAC,MAAM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qB,EAAE,SAAS,CAAC,YAClD,KAAC,kBAAkB,IACjB,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,eAAe,YAG5B,cAAK,SAAS,EAAC,UAAU,YACvB,KAAC,gBAAgB,IAAC,WAAW,EAAE,EAAE,GAAG,CAAC,EAAE,SAAS,EAAC,MAAM,YACrD,MAAC,kBAAkB,CAAC,OAAO,IAAC,SAAS,EAAC,SAAS,aAC7C,KAAC,gBAAgB,KAAG,EACnB,QAAQ,IAAI,KAAC,cAAc,IAAC,UAAU,EAAE,UAAU,GAAI,IAC5B,GACZ,GACf,GACa,GACjB,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {useStoreWithAi} from '@sqlrooms/ai';\nimport {cn} from '@sqlrooms/ui';\nimport {useCallback, useState} from 'react';\nimport {EmbedOptions, VisualizationSpec} from 'vega-embed';\nimport {VegaChartContainer} from './editor/VegaChartContainer';\nimport {VegaChartDisplay} from './editor/VegaChartDisplay';\nimport {EditorMode} from './editor/types';\nimport {VegaEditAction} from './VegaEditAction';\nimport {VegaExportAction} from './VegaExportAction';\nimport {VegaLiteArrowChart} from './VegaLiteArrowChart';\n\nexport type VegaChartToolResultProps = {\n className?: string;\n reasoning: string;\n sqlQuery: string;\n vegaLiteSpec: VisualizationSpec;\n options?: EmbedOptions;\n /**\n * Tool call ID for AI slice integration (enables persistence)\n */\n toolCallId?: string;\n /**\n * Whether editing is enabled\n * @default true\n */\n editable?: boolean;\n /**\n * Which editors to show when editing\n * @default 'both'\n */\n editorMode?: EditorMode;\n};\n\n/**\n * Renders a chart tool call with visualization using Vega-Lite.\n * Supports inline editing with AI slice persistence.\n *\n * @param {VegaChartToolResultProps} props - The component props\n * @returns {JSX.Element} The rendered chart tool call\n */\nexport function VegaChartToolResult({\n className,\n sqlQuery,\n vegaLiteSpec,\n options,\n toolCallId,\n editable = true,\n editorMode = 'both',\n}: VegaChartToolResultProps) {\n // AI slice integration for persisting changes\n const setToolAdditionalData = useStoreWithAi(\n (s) => s.ai.setSessionToolAdditionalData,\n );\n const currentSession = useStoreWithAi((s) => s.ai.getCurrentSession());\n const currentSessionId = currentSession?.id;\n\n // Track applied values for callbacks (to persist both spec and sql together)\n const [appliedSpec, setAppliedSpec] = useState(vegaLiteSpec);\n const [appliedSql, setAppliedSql] = useState(sqlQuery);\n\n // Callbacks to persist changes to AI slice\n const handleSpecChange = useCallback(\n (newSpec: VisualizationSpec) => {\n setAppliedSpec(newSpec);\n if (toolCallId && currentSessionId) {\n setToolAdditionalData(currentSessionId, toolCallId, {\n sqlQuery: appliedSql,\n vegaLiteSpec: newSpec,\n });\n }\n },\n [toolCallId, currentSessionId, appliedSql, setToolAdditionalData],\n );\n\n const handleSqlChange = useCallback(\n (newSql: string) => {\n setAppliedSql(newSql);\n if (toolCallId && currentSessionId) {\n setToolAdditionalData(currentSessionId, toolCallId, {\n sqlQuery: newSql,\n vegaLiteSpec: appliedSpec,\n });\n }\n },\n [toolCallId, currentSessionId, appliedSpec, setToolAdditionalData],\n );\n\n return (\n <div className={cn('flex flex-col gap-2', className)}>\n <VegaChartContainer\n spec={vegaLiteSpec}\n sqlQuery={sqlQuery}\n options={options}\n editable={editable}\n onSpecChange={handleSpecChange}\n onSqlChange={handleSqlChange}\n >\n {/* Chart with actions toolbar */}\n <div className=\"relative\">\n <VegaChartDisplay aspectRatio={16 / 9} className=\"pt-2\">\n <VegaLiteArrowChart.Actions className=\"right-3\">\n <VegaExportAction />\n {editable && <VegaEditAction editorMode={editorMode} />}\n </VegaLiteArrowChart.Actions>\n </VegaChartDisplay>\n </div>\n </VegaChartContainer>\n </div>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/vega",
|
|
3
|
-
"version": "0.27.0-rc.
|
|
3
|
+
"version": "0.27.0-rc.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@openassistant/utils": "1.0.0-alpha.0",
|
|
23
|
-
"@sqlrooms/ai": "0.27.0-rc.
|
|
24
|
-
"@sqlrooms/duckdb": "0.27.0-rc.
|
|
25
|
-
"@sqlrooms/monaco-editor": "0.27.0-rc.
|
|
26
|
-
"@sqlrooms/sql-editor": "0.27.0-rc.
|
|
27
|
-
"@sqlrooms/ui": "0.27.0-rc.
|
|
28
|
-
"@sqlrooms/utils": "0.27.0-rc.
|
|
23
|
+
"@sqlrooms/ai": "0.27.0-rc.2",
|
|
24
|
+
"@sqlrooms/duckdb": "0.27.0-rc.2",
|
|
25
|
+
"@sqlrooms/monaco-editor": "0.27.0-rc.2",
|
|
26
|
+
"@sqlrooms/sql-editor": "0.27.0-rc.2",
|
|
27
|
+
"@sqlrooms/ui": "0.27.0-rc.2",
|
|
28
|
+
"@sqlrooms/utils": "0.27.0-rc.2",
|
|
29
29
|
"lucide-react": "^0.556.0",
|
|
30
30
|
"react-vega": "^8.0.0",
|
|
31
31
|
"vega": "^6.2.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
49
|
"typedoc": "typedoc"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "eec06537352a9e760de21d7bcc77d9aa2db2a5ec"
|
|
52
52
|
}
|