An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
chore(release): prepare graphic-walker 0.5.3
observedobserver2aadf3057eee
diff --git a/packages/computation-conformance/package.json b/packages/computation-conformance/package.jsonindex 7d049ac4..fa085162 100644--- a/packages/computation-conformance/package.json+++ b/packages/computation-conformance/package.json@@ -13,7 +13,7 @@"singleQuote": true},"dependencies": {- "@kanaries/graphic-walker": "0.5.2"+ "@kanaries/graphic-walker": "0.5.3"},"devDependencies": {"@duckdb/duckdb-wasm": "^1.28.0",diff --git a/packages/duckdb-wasm-computation/package.json b/packages/duckdb-wasm-computation/package.jsonindex 26c47902..8d7daf8d 100644--- a/packages/duckdb-wasm-computation/package.json+++ b/packages/duckdb-wasm-computation/package.json@@ -16,7 +16,7 @@},"devDependencies": {"@duckdb/duckdb-wasm": "^1.28.0",- "@kanaries/graphic-walker": "0.5.2",+ "@kanaries/graphic-walker": "0.5.3","@kanaries/gw-dsl-parser": "^0.1.48-rc3","apache-arrow": "^17.0.0","nanoid": "^5.0.1",diff --git a/packages/graphic-walker/package.json b/packages/graphic-walker/package.jsonindex 3943f1c5..392c3158 100644--- a/packages/graphic-walker/package.json+++ b/packages/graphic-walker/package.json@@ -1,6 +1,6 @@{"name": "@kanaries/graphic-walker",- "version": "0.5.2",+ "version": "0.5.3","scripts": {"dev:front_end": "vite --host","dev": "npm run dev:front_end",@@ -15,7 +15,10 @@},"files": ["dist",- "src"+ "src",+ "README.md",+ "LICENSE",+ "LICENSE2"],"license": "Apache-2.0","author": {@@ -90,15 +93,12 @@"i18next-browser-languagedetector": "^6.1.5","immer": "^9.0.15","immutable": "^5.1.1",- "jest": "^29.6.2","leaflet": "^1.9.4","lodash-es": "^4.17.15","mobx": "^6.3.3","mobx-react-lite": "^4.1.1","nanoid": "^4.0.2","pgsql-ast-parser": "^11.1.0",- "postcss": "^8.3.7",- "postinstall-postinstall": "^2.1.0","rbush": "^3.0.1","re-resizable": "^6.11.2","react-color": "^2.19.3",@@ -119,7 +119,11 @@"vega": "^5.22.1","vega-embed": "^6.21.0","vega-lite": "^5.6.0",- "vega-webgl-renderer": "^1.0.0-beta.2"+ "vega-webgl-renderer": "^1.0.0-beta.2",+ "ts-xor": "^1.3.0",+ "@types/geojson": "^7946.0.10",+ "@types/react-beautiful-dnd": "^13.1.2",+ "@types/topojson-client": "^3.1.1"},"devDependencies": {"@playwright/test": "^1.62.0",@@ -128,23 +132,22 @@"@types/d3-format": "^3.0.1","@types/d3-scale": "^4.0.3","@types/d3-time-format": "^4.0.0",- "@types/geojson": "^7946.0.10","@types/leaflet": "^1.9.3","@types/lodash-es": "^4.17.12","@types/rbush": "^3.0.3","@types/react": "*",- "@types/react-beautiful-dnd": "^13.1.2","@types/react-color": "^3.0.6","@types/react-dom": "*",- "@types/topojson-client": "^3.1.1","@vercel/analytics": "^1.6.1","@vitejs/plugin-react": "^3.1.0","ts-json-schema-generator": "^1.5.0","ts-patch": "^3.1.2",- "ts-xor": "^1.3.0","typescript": "^5.2.2","typescript-transform-paths": "^3.4.7",- "vite": "^4.1.1"+ "vite": "^4.1.1",+ "jest": "^29.6.2",+ "postcss": "^8.3.7",+ "postinstall-postinstall": "^2.1.0"},"peerDependencies": {"react": ">=19.0.0",diff --git a/packages/graphic-walker/src/components/toolbar/toolbar-select-button.tsx b/packages/graphic-walker/src/components/toolbar/toolbar-select-button.tsxindex a21e6605..8934bc08 100644--- a/packages/graphic-walker/src/components/toolbar/toolbar-select-button.tsx+++ b/packages/graphic-walker/src/components/toolbar/toolbar-select-button.tsx@@ -29,7 +29,8 @@ const ToolbarSelectButton = memo<IToolbarProps<ToolbarSelectButtonItem>>(functioconst opened = openedKey === id;const currentOption = options.find((opt) => opt.key === value);- const CurrentIcon = currentOption?.icon;+ // the button shows the selected option itself; the item icon is the fallback when nothing matches+ const ButtonIcon = currentOption?.icon ?? Icon;return (<DropdownMenu modal={false} open={opened} onOpenChange={(open) => (open ? setOpenedKey(id) : setOpenedKey(''))}>@@ -43,8 +44,11 @@ const ToolbarSelectButton = memo<IToolbarProps<ToolbarSelectButtonItem>>(functio><DropdownMenuTrigger disabled={disabled} asChild><Button className="relative" disabled={disabled} variant="none" size="toolbar">- <Icon className="w-[18px] h-[18px]" style={styles?.icon} />- {CurrentIcon && <CurrentIcon style={styles?.icon} className="absolute w-[11px] h-[11px] right-[7px] bottom-[5px]" />}+ <ButtonIcon className="w-[18px] h-[18px]" style={styles?.icon} />+ <span+ aria-hidden+ className="absolute right-[3px] bottom-[3px] border-l-4 border-b-4 border-l-transparent border-b-current opacity-50"+ /></Button></DropdownMenuTrigger></ToolbarItemContainer>diff --git a/packages/graphic-walker/src/interfaces.ts b/packages/graphic-walker/src/interfaces.tsindex a5a3f8c2..fe0e65b7 100644--- a/packages/graphic-walker/src/interfaces.ts+++ b/packages/graphic-walker/src/interfaces.ts@@ -483,6 +483,11 @@ export interface IVegaChartRef {export interface IChartExportResult<T extends 'svg' | 'data-url' = 'svg' | 'data-url'> {mode: T;title: string;+ /**+ * The complete chart, with repeated Vega views composed into one image.+ * Individual view exports remain available in `charts`.+ */+ combinedData?: string;nCols: number;nRows: number;charts: {diff --git a/packages/graphic-walker/src/models/visSpecHistory.ts b/packages/graphic-walker/src/models/visSpecHistory.tsindex e86af841..75a3321b 100644--- a/packages/graphic-walker/src/models/visSpecHistory.ts+++ b/packages/graphic-walker/src/models/visSpecHistory.ts@@ -554,12 +554,14 @@ export const redo: (data: VisSpecWithHistory) => VisSpecWithHistory = redoWith(rexport const at: (data: VisSpecWithHistory, cursor: number) => IChart = atWith(reducerT);export { freeze };-export const performers = Object.fromEntries(- (Object.keys(Methods) as (keyof typeof Methods)[]).map((k) => [k, (data: any, ...args: any[]) => perform(data, [Methods[k], ...args] as any)])-) as unknown as {+type VisPerformers = {[K in keyof typeof Methods]: (data: VisSpecWithHistory, ...args: PropsMap[(typeof Methods)[K]]) => VisSpecWithHistory;};+export const performers: VisPerformers = Object.fromEntries(+ (Object.keys(Methods) as (keyof typeof Methods)[]).map((k) => [k, (data: any, ...args: any[]) => perform(data, [Methods[k], ...args] as any)])+) as unknown as VisPerformers;+function emptyChart(visId: string, name: string, defaultConfig?: IDefaultConfig): IChart {return {config: defaultConfig?.config ? { ...emptyVisualConfig, ...defaultConfig.config } : emptyVisualConfig,diff --git a/packages/graphic-walker/src/utils/vegaApiExport.test.ts b/packages/graphic-walker/src/utils/vegaApiExport.test.tsnew file mode 100644index 00000000..d2ffe813--- /dev/null+++ b/packages/graphic-walker/src/utils/vegaApiExport.test.ts@@ -0,0 +1,94 @@+import type { IVegaChartRef } from '../interfaces';+import { combineCanvases, combineSVGs, getCompositeGridLayout } from './vegaApiExport';++const chartRef = (x: number, y: number, w: number, h: number): IVegaChartRef => ({+ x,+ y,+ w,+ h,+ innerWidth: w,+ innerHeight: h,+ view: null,+ canvas: null,+});++describe('Vega export composition', () => {+ test('lays out unequal grid cells using the largest item in each row and column', () => {+ const layout = getCompositeGridLayout([+ { x: 0, y: 0, width: 100, height: 40 },+ { x: 1, y: 0, width: 120, height: 50 },+ { x: 0, y: 1, width: 90, height: 60 },+ { x: 1, y: 1, width: 110, height: 55 },+ ]);++ expect(layout).toEqual({+ width: 220,+ height: 110,+ items: [+ { x: 0, y: 0, width: 100, height: 40, offsetX: 0, offsetY: 0 },+ { x: 1, y: 0, width: 120, height: 50, offsetX: 100, offsetY: 0 },+ { x: 0, y: 1, width: 90, height: 60, offsetX: 0, offsetY: 50 },+ { x: 1, y: 1, width: 110, height: 55, offsetX: 100, offsetY: 50 },+ ],+ });+ });++ test('draws canvases into one image using their grid offsets', () => {+ const drawImage = jest.fn();+ const combinedCanvas = {+ width: 0,+ height: 0,+ getContext: () => ({ drawImage }),+ };+ const previousDocument = globalThis.document;+ Object.defineProperty(globalThis, 'document', {+ configurable: true,+ value: {+ createElement: (name: string) => {+ expect(name).toBe('canvas');+ return combinedCanvas;+ },+ },+ });++ try {+ const first = { width: 100, height: 40 } as HTMLCanvasElement;+ const second = { width: 120, height: 50 } as HTMLCanvasElement;+ const result = combineCanvases([first, second], [chartRef(0, 0, 100, 40), chartRef(1, 0, 120, 50)]);++ expect(result).toBe(combinedCanvas);+ expect(combinedCanvas.width).toBe(220);+ expect(combinedCanvas.height).toBe(50);+ expect(drawImage).toHaveBeenNthCalledWith(1, first, 0, 0);+ expect(drawImage).toHaveBeenNthCalledWith(2, second, 100, 0);+ } finally {+ Object.defineProperty(globalThis, 'document', {+ configurable: true,+ value: previousDocument,+ });+ }+ });++ test('combines repeated SVG views and namespaces their definitions', () => {+ const first = '<svg width="100" height="40"><defs><clipPath id="clip"><path /></clipPath></defs><g clip-path="url(#clip)" /></svg>';+ const second =+ '<svg width="120" height="50"><defs><clipPath id="clip"><path /></clipPath></defs><g aria-labelledby="title"><title id="title">B</title><g clip-path="url(#clip)" /></g></svg>';++ const combined = combineSVGs([first, second], [chartRef(0, 0, 100, 40), chartRef(1, 0, 120, 50)]);++ expect(combined).toContain('width="220" height="50" viewBox="0 0 220 50"');+ expect(combined).toContain('<svg x="0" y="0" width="100" height="40">');+ expect(combined).toContain('<svg x="100" y="0" width="120" height="50">');+ expect(combined).toContain('id="gw-export-0-clip"');+ expect(combined).toContain('url(#gw-export-0-clip)');+ expect(combined).toContain('id="gw-export-1-clip"');+ expect(combined).toContain('url(#gw-export-1-clip)');+ expect(combined).toContain('aria-labelledby="gw-export-1-title"');+ expect(combined).toContain('id="gw-export-1-title"');+ });++ test('keeps a single SVG unchanged', () => {+ const svg = '<svg width="100" height="40"><g /></svg>';+ expect(combineSVGs([svg], [chartRef(0, 0, 100, 40)])).toBe(svg);+ });+});diff --git a/packages/graphic-walker/src/utils/vegaApiExport.ts b/packages/graphic-walker/src/utils/vegaApiExport.tsindex 3b080412..6abc74c3 100644--- a/packages/graphic-walker/src/utils/vegaApiExport.ts+++ b/packages/graphic-walker/src/utils/vegaApiExport.ts@@ -1,8 +1,171 @@-import { useImperativeHandle, type ForwardedRef, useEffect, RefObject } from "react";-import { useAppRootContext } from "../components/appRoot";-import type { IReactVegaHandler } from "../vis/react-vega";-import type { IChartExportResult, IVegaChartRef } from "../interfaces";+import { useImperativeHandle, type ForwardedRef, useEffect, RefObject } from 'react';+import { useAppRootContext } from '../components/appRoot';+import type { IReactVegaHandler } from '../vis/react-vega';+import type { IChartExportResult, IVegaChartRef } from '../interfaces';+type GridItem = Pick<IVegaChartRef, 'x' | 'y'> & {+ width: number;+ height: number;+};++export interface ICompositeGridItem extends GridItem {+ offsetX: number;+ offsetY: number;+}++export interface ICompositeGridLayout {+ width: number;+ height: number;+ items: ICompositeGridItem[];+}++export function getCompositeGridLayout(items: GridItem[]): ICompositeGridLayout | null {+ if (items.length === 0) {+ return null;+ }++ const columnCount = items.reduce((max, item) => Math.max(max, item.x), 0) + 1;+ const rowCount = items.reduce((max, item) => Math.max(max, item.y), 0) + 1;+ const columnWidths = new Array<number>(columnCount).fill(0);+ const rowHeights = new Array<number>(rowCount).fill(0);++ for (const item of items) {+ columnWidths[item.x] = Math.max(columnWidths[item.x], item.width);+ rowHeights[item.y] = Math.max(rowHeights[item.y], item.height);+ }++ const columnOffsets = new Array<number>(columnCount).fill(0);+ const rowOffsets = new Array<number>(rowCount).fill(0);+ for (let i = 1; i < columnCount; i += 1) {+ columnOffsets[i] = columnOffsets[i - 1] + columnWidths[i - 1];+ }+ for (let i = 1; i < rowCount; i += 1) {+ rowOffsets[i] = rowOffsets[i - 1] + rowHeights[i - 1];+ }++ return {+ width: columnWidths.reduce((sum, width) => sum + width, 0),+ height: rowHeights.reduce((sum, height) => sum + height, 0),+ items: items.map((item) => ({+ ...item,+ offsetX: columnOffsets[item.x],+ offsetY: rowOffsets[item.y],+ })),+ };+}++export function combineCanvases(canvases: HTMLCanvasElement[], refs: IVegaChartRef[]): HTMLCanvasElement | null {+ if (canvases.length === 0 || canvases.length !== refs.length) {+ return null;+ }+ if (canvases.length === 1) {+ return canvases[0];+ }++ const layout = getCompositeGridLayout(+ canvases.map((canvas, index) => ({+ x: refs[index].x,+ y: refs[index].y,+ width: canvas.width,+ height: canvas.height,+ }))+ );+ if (!layout) {+ return null;+ }++ const combinedCanvas = document.createElement('canvas');+ combinedCanvas.width = layout.width;+ combinedCanvas.height = layout.height;+ const context = combinedCanvas.getContext('2d');+ if (!context) {+ return null;+ }++ layout.items.forEach((item, index) => {+ context.drawImage(canvases[index], item.offsetX, item.offsetY);+ });+ return combinedCanvas;+}++function readSvgDimension(svg: string, name: 'width' | 'height', fallback: number): number {+ const openingTag = svg.match(/<svg\b[^>]*>/i)?.[0];+ const value = openingTag?.match(new RegExp(`\\b${name}\\s*=\\s*["']([^"']+)["']`, 'i'))?.[1];+ const parsed = value ? Number.parseFloat(value) : Number.NaN;+ if (Number.isFinite(parsed) && parsed >= 0) {+ return parsed;+ }+ const viewBox = openingTag?.match(/\bviewBox\s*=\s*["'][^"']*\s(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)["']/i);+ const viewBoxDimension = viewBox?.[name === 'width' ? 1 : 2];+ const parsedViewBoxDimension = viewBoxDimension ? Number.parseFloat(viewBoxDimension) : Number.NaN;+ return Number.isFinite(parsedViewBoxDimension) && parsedViewBoxDimension >= 0 ? parsedViewBoxDimension : fallback;+}++function namespaceSvgIds(svg: string, prefix: string): string {+ const ids = new Set<string>();+ const withNamespacedIds = svg.replace(/\bid=(["'])([^"']+)\1/g, (_match, quote: string, id: string) => {+ ids.add(id);+ return `id=${quote}${prefix}${id}${quote}`;+ });+ if (ids.size === 0) {+ return withNamespacedIds;+ }+ return withNamespacedIds+ .replace(/url\(\s*#([^)]+?)\s*\)/g, (match, id: string) => (ids.has(id) ? `url(#${prefix}${id})` : match))+ .replace(/\b((?:xlink:)?href)=(["'])#([^"']+)\2/g, (match, attribute: string, quote: string, id: string) =>+ ids.has(id) ? `${attribute}=${quote}#${prefix}${id}${quote}` : match+ )+ .replace(/\b(aria-labelledby|aria-describedby)=(["'])([^"']+)\2/g, (_match, attribute: string, quote: string, value: string) => {+ const namespacedValue = value+ .split(/\s+/)+ .map((id) => (ids.has(id) ? `${prefix}${id}` : id))+ .join(' ');+ return `${attribute}=${quote}${namespacedValue}${quote}`;+ });+}++function positionNestedSvg(svg: string, x: number, y: number, prefix: string): string | null {+ const cleaned = namespaceSvgIds(+ svg+ .replace(/^\s*<\?xml[^>]*>\s*/i, '')+ .replace(/^\s*<!DOCTYPE[^>]*>\s*/i, ''),+ prefix+ );+ if (!/<svg\b/i.test(cleaned)) {+ return null;+ }+ return cleaned.replace(/<svg\b/i, `<svg x="${x}" y="${y}"`);+}++export function combineSVGs(svgs: string[], refs: IVegaChartRef[]): string | null {+ if (svgs.length === 0 || svgs.length !== refs.length) {+ return null;+ }+ if (svgs.length === 1) {+ return svgs[0];+ }++ const layout = getCompositeGridLayout(+ svgs.map((svg, index) => ({+ x: refs[index].x,+ y: refs[index].y,+ width: readSvgDimension(svg, 'width', refs[index].w),+ height: readSvgDimension(svg, 'height', refs[index].h),+ }))+ );+ if (!layout) {+ return null;+ }++ const children = layout.items.map((item, index) => positionNestedSvg(svgs[index], item.offsetX, item.offsetY, `gw-export-${index}-`));+ if (children.some((child) => child === null)) {+ return null;+ }++ return `<svg xmlns="http://www.w3.org/2000/svg" width="${layout.width}" height="${layout.height}" viewBox="0 0 ${layout.width} ${layout.height}">${children.join(+ ''+ )}</svg>`;+}export const useVegaExportApi = (name: string | undefined,@@ -11,63 +174,60 @@ export const useVegaExportApi = (renderTaskRefs: RefObject<Promise<unknown>[]>,containerRef: RefObject<HTMLDivElement | null>,) => {- const renderHandle = {- getSVGData() {- return Promise.all(viewsRef.current.map(item => {+ const getSVGs = () =>+ Promise.all(+ viewsRef.current.map((item) => {if (!item.view) {throw new Error('View is not available');}return item.view.toSVG();- }));- },- async getCanvasData() {- const canvases = await Promise.all(viewsRef.current.map(item => {+ })+ );+ const getCanvases = () =>+ Promise.all(+ viewsRef.current.map((item) => {if (!item.view) {throw new Error('View is not available');}return item.view.toCanvas(2);- }));- return canvases.map(canvas => canvas.toDataURL('image/png', 1));+ })+ );+ const renderHandle = {+ async getSVGData() {+ const data = combineSVGs(await getSVGs(), viewsRef.current);+ return data ? [data] : [];+ },+ async getCanvasData() {+ const canvas = combineCanvases(await getCanvases(), viewsRef.current);+ return canvas ? [canvas.toDataURL('image/png', 1)] : [];},async downloadSVG(filename = `gw chart ${Date.now() % 1_000_000}`.padStart(6, '0')) {- const data = await Promise.all(viewsRef.current.map(item => {- if (!item.view) {- throw new Error('View is not available');- }- return item.view.toSVG();- }));- const files: string[] = [];- for (let i = 0; i < data.length; i += 1) {- const d = data[i];- const file = new File([d], `${filename}${data.length > 1 ? `_${i + 1}` : ''}.svg`);- const url = URL.createObjectURL(file);- const a = document.createElement('a');- a.download = file.name;- a.href = url;- a.click();- requestAnimationFrame(() => {- URL.revokeObjectURL(url);- });+ const data = combineSVGs(await getSVGs(), viewsRef.current);+ if (!data) {+ return [];}- return files;+ const file = new File([data], `${filename}.svg`, { type: 'image/svg+xml' });+ const url = URL.createObjectURL(file);+ const anchor = document.createElement('a');+ anchor.download = file.name;+ anchor.href = url;+ anchor.click();+ requestAnimationFrame(() => {+ URL.revokeObjectURL(url);+ });+ return [data];},async downloadPNG(filename = `gw chart ${Date.now() % 1_000_000}`.padStart(6, '0')) {- const canvases = await Promise.all(viewsRef.current.map(item => {- if (!item.view) {- throw new Error('View is not available');- }- return item.view.toCanvas(2);- }));- const data = canvases.map(canvas => canvas.toDataURL('image/png', 1));- const files: string[] = [];- for (let i = 0; i < data.length; i += 1) {- const d = data[i];- const a = document.createElement('a');- a.download = `${filename}${data.length > 1 ? `_${i + 1}` : ''}.png`;- a.href = d.replace(/^data:image\/[^;]/, 'data:application/octet-stream');- a.click();+ const canvas = combineCanvases(await getCanvases(), viewsRef.current);+ if (!canvas) {+ return [];}- return files;+ const data = canvas.toDataURL('image/png', 1);+ const anchor = document.createElement('a');+ anchor.download = `${filename}.png`;+ anchor.href = data.replace(/^data:image\/[^;]/, 'data:application/octet-stream');+ anchor.click();+ return [data];},};@@ -175,19 +335,17 @@ export const useVegaExportApi = (chartType: 'vega',};if (mode === 'data-url') {- const imgData = await renderHandle.getCanvasData();- if (imgData) {- for (let i = 0; i < imgData.length; i += 1) {- res.charts[i].data = imgData[i];- }+ const canvases = await getCanvases();+ for (let i = 0; i < canvases.length; i += 1) {+ res.charts[i].data = canvases[i].toDataURL('image/png', 1);}+ res.combinedData = combineCanvases(canvases, viewsRef.current)?.toDataURL('image/png', 1);} else if (mode === 'svg') {- const svgData = await renderHandle.getSVGData();- if (svgData) {- for (let i = 0; i < svgData.length; i += 1) {- res.charts[i].data = svgData[i];- }+ const svgs = await getSVGs();+ for (let i = 0; i < svgs.length; i += 1) {+ res.charts[i].data = svgs[i];}+ res.combinedData = combineSVGs(svgs, viewsRef.current) ?? undefined;}return res;}) as typeof ctx.exportChart;diff --git a/packages/graphic-walker/src/visualSettings/index.tsx b/packages/graphic-walker/src/visualSettings/index.tsxindex 324ef2c0..9f8b7b5a 100644--- a/packages/graphic-walker/src/visualSettings/index.tsx+++ b/packages/graphic-walker/src/visualSettings/index.tsx@@ -1,30 +1,54 @@import {ArrowUturnLeftIcon,- BarsArrowDownIcon,- BarsArrowUpIcon,- PhotoIcon,- CubeIcon,- Square3Stack3DIcon,- StopIcon,ArrowUturnRightIcon,- WrenchIcon,- ChevronUpDownIcon,- XMarkIcon,- ChevronDoubleUpIcon,- ArrowsUpDownIcon,- LightBulbIcon,Cog6ToothIcon,- TableCellsIcon,MapPinIcon,GlobeAltIcon,- RectangleGroupIcon,GlobeAmericasIcon,- DocumentPlusIcon,PaintBrushIcon,SparklesIcon,+ CodeBracketIcon,} from '@heroicons/react/24/outline';+import {+ AggregationIcon,+ AxesZoomIcon,+ ComputedFieldIcon,+ CoordGenericIcon,+ CoordSystemIcon,+ DebugIcon,+ ExportChartIcon,+ ExportCsvIcon,+ LayoutAutoIcon,+ LayoutFixedIcon,+ LayoutFullIcon,+ LayoutSizeIcon,+ MarkArcIcon,+ MarkAreaIcon,+ MarkAutoIcon,+ MarkBarIcon,+ MarkBoxplotIcon,+ MarkChoroplethIcon,+ MarkCircleIcon,+ MarkLineIcon,+ MarkPointIcon,+ MarkRectIcon,+ MarkTableIcon,+ MarkTextIcon,+ MarkTickIcon,+ MarkTrailIcon,+ MarkTypeIcon,+ RowLimitIcon,+ SortAscendingIcon,+ SortDescendingIcon,+ StackCenterIcon,+ StackIcon,+ StackNoneIcon,+ StackNormalizeIcon,+ TableSummaryIcon,+ TransposeIcon,+} from '../components/icons/toolbar';import { observer } from 'mobx-react-lite';-import React, { SVGProps, useCallback, useMemo } from 'react';+import React, { useCallback, useMemo } from 'react';import { useTranslation } from 'react-i18next';import { ResizeDialog } from '../components/sizeSetting';import { GLOBAL_CONFIG } from '../config';@@ -136,7 +160,7 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'aggregation',label: t('toggle.aggregation'),- icon: CubeIcon,+ icon: AggregationIcon,checked: defaultAggregated,onChange: (checked) => {vizStore.setVisualConfig('defaultAggregated', checked);@@ -145,183 +169,26 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'mark_type',label: tGlobal('constant.mark_type.__enum__'),- icon: StopIcon,- styles: {- icon: {- color: 'rgb(294,115,22)',- },- },+ icon: MarkTypeIcon,options: GLOBAL_CONFIG.GEOM_TYPES[coordSystem].map((g) => ({key: g,label: tGlobal(`constant.mark_type.${g}`),icon: {- auto: LightBulbIcon,- bar: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M9,4v16h6v-16Z" />- </svg>- ),- line: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M5,6L19,18" />- </svg>- ),- area: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="none"- fill="currentColor"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M5,20v-17l14,4V20Z" />- </svg>- ),- trail: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="none"- fill="currentColor"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M5,6l7,4l7-2v2l-7,4l-7,-4z" />- </svg>- ),- point: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M9,12 A3,3,0,0,1,16,12 A3,3,0,0,1,9,12" />- </svg>- ),- circle: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="none"- fill="currentColor"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M6,12 A6,6,0,0,1,18,12 A6,6,0,0,1,6,12" />- </svg>- ),- tick: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M5,12h14" />- </svg>- ),- rect: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="none"- fill="currentColor"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M5,5v14h14v-14z" />- </svg>- ),- text: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="currentColor"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M10.5 21l5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 016-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 01-3.827-5.802"- />- </svg>- ),- arc: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="none"- fill="currentColor"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M12,21l-9,-15a12,12,0,0,1,18,0Z" />- </svg>- ),- boxplot: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M7,7v9h10v-9Zm0,4h8M12,7v-6m-3,0h6M12,16v7m-3,0h6" />- </svg>- ),- table: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 01-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0112 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"- />- </svg>- ),+ auto: MarkAutoIcon,+ bar: MarkBarIcon,+ line: MarkLineIcon,+ area: MarkAreaIcon,+ trail: MarkTrailIcon,+ point: MarkPointIcon,+ circle: MarkCircleIcon,+ tick: MarkTickIcon,+ rect: MarkRectIcon,+ text: MarkTextIcon,+ arc: MarkArcIcon,+ boxplot: MarkBoxplotIcon,+ table: MarkTableIcon,poi: MapPinIcon,- choropleth: RectangleGroupIcon,+ choropleth: MarkChoroplethIcon,}[g],})),value: markType,@@ -339,15 +206,15 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'stack_mode',label: tGlobal('constant.stack_mode.__enum__'),- icon: Square3Stack3DIcon,+ icon: StackIcon,options: GLOBAL_CONFIG.STACK_MODE.map((g) => ({key: g,label: tGlobal(`constant.stack_mode.${g}`),icon: {- none: XMarkIcon,- stack: ChevronDoubleUpIcon,- normalize: ArrowsUpDownIcon,- center: ChevronUpDownIcon, // TODO: fix unsafe extends+ none: StackNoneIcon,+ stack: StackIcon,+ normalize: StackNormalizeIcon,+ center: StackCenterIcon, // TODO: fix unsafe extends}[g],})),value: stack,@@ -359,56 +226,38 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'transpose',label: t('button.transpose'),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M7.59664 2.93628C7.76085 3.06401 8.00012 2.94698 8.00012 2.73895V1.99998C9.98143 2 11.1848 2.3637 11.9105 3.08945C12.6363 3.81522 13 5.0186 13 6.99998C13 7.27613 13.2239 7.49998 13.5 7.49998C13.7761 7.49998 14 7.27613 14 6.99998C14 4.9438 13.6325 3.39719 12.6176 2.38234C11.6028 1.36752 10.0562 0.999999 8.00012 0.999984V0.261266C8.00012 0.0532293 7.76085 -0.0637944 7.59664 0.063928L6.00384 1.30277C5.87516 1.40286 5.87516 1.59735 6.00384 1.69744L7.59664 2.93628ZM9.5 5H2.5C2.22386 5 2 5.22386 2 5.5V12.5C2 12.7761 2.22386 13 2.5 13H9.5C9.77614 13 10 12.7761 10 12.5V5.5C10 5.22386 9.77614 5 9.5 5ZM2.5 4C1.67157 4 1 4.67157 1 5.5V12.5C1 13.3284 1.67157 14 2.5 14H9.5C10.3284 14 11 13.3284 11 12.5V5.5C11 4.67157 10.3284 4 9.5 4H2.5Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: TransposeIcon,onClick: () => vizStore.transpose(),},{key: 'sort:asc',label: t('button.ascending'),- icon: BarsArrowUpIcon,+ icon: SortAscendingIcon,onClick: () => vizStore.applyDefaultSort('ascending'),},{key: 'sort:dec',label: t('button.descending'),- icon: BarsArrowDownIcon,+ icon: SortDescendingIcon,onClick: () => vizStore.applyDefaultSort('descending'),},{key: 'table:summary',label: t('table.summary'),- icon: TableCellsIcon,+ icon: TableSummaryIcon,checked: showTableSummary,onChange: (checked) => {vizStore.setVisualLayout('showTableSummary', checked);},},...(experimentalFeatures?.computedField- ? [{ key: 'field:add', label: 'Add Computed Field', icon: DocumentPlusIcon, onClick: () => vizStore.setComputedFieldFid('') }]+ ? [{ key: 'field:add', label: 'Add Computed Field', icon: ComputedFieldIcon, onClick: () => vizStore.setComputedFieldFid('') }]: []),'-',{key: 'axes_resize',label: t('toggle.axes_resize'),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159ZM4.25 6.5C4.25 6.22386 4.47386 6 4.75 6H6V4.75C6 4.47386 6.22386 4.25 6.5 4.25C6.77614 4.25 7 4.47386 7 4.75V6H8.25C8.52614 6 8.75 6.22386 8.75 6.5C8.75 6.77614 8.52614 7 8.25 7H7V8.25C7 8.52614 6.77614 8.75 6.5 8.75C6.22386 8.75 6 8.52614 6 8.25V7H4.75C4.47386 7 4.25 6.77614 4.25 6.5Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: AxesZoomIcon,checked: interactiveScale,onChange: (checked) => {vizStore.setVisualLayout('interactiveScale', checked);@@ -416,59 +265,23 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler},{key: 'scale',- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M3.00014 2.73895C3.00014 2.94698 2.76087 3.06401 2.59666 2.93628L1.00386 1.69744C0.875177 1.59735 0.875177 1.40286 1.00386 1.30277L2.59666 0.063928C2.76087 -0.0637944 3.00014 0.0532293 3.00014 0.261266V1.00012H9.00009V0.261296C9.00009 0.0532591 9.23936 -0.0637646 9.40358 0.0639578L10.9964 1.3028C11.1251 1.40289 11.1251 1.59738 10.9964 1.69747L9.40358 2.93631C9.23936 3.06404 9.00009 2.94701 9.00009 2.73898V2.00012H3.00014V2.73895ZM9.50002 4.99998H2.50002C2.22388 4.99998 2.00002 5.22384 2.00002 5.49998V12.5C2.00002 12.7761 2.22388 13 2.50002 13H9.50002C9.77616 13 10 12.7761 10 12.5V5.49998C10 5.22384 9.77616 4.99998 9.50002 4.99998ZM2.50002 3.99998C1.67159 3.99998 1.00002 4.67156 1.00002 5.49998V12.5C1.00002 13.3284 1.67159 14 2.50002 14H9.50002C10.3284 14 11 13.3284 11 12.5V5.49998C11 4.67156 10.3284 3.99998 9.50002 3.99998H2.50002ZM14.7389 6.00001H14V12H14.7389C14.9469 12 15.064 12.2393 14.9362 12.4035L13.6974 13.9963C13.5973 14.125 13.4028 14.125 13.3027 13.9963L12.0639 12.4035C11.9362 12.2393 12.0532 12 12.2612 12H13V6.00001H12.2612C12.0532 6.00001 11.9361 5.76074 12.0639 5.59653L13.3027 4.00373C13.4028 3.87505 13.5973 3.87505 13.6974 4.00374L14.9362 5.59653C15.0639 5.76074 14.9469 6.00001 14.7389 6.00001Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: LayoutSizeIcon,label: tGlobal(`constant.layout_type.__enum__`),options: [{key: 'fixed',label: tGlobal(`constant.layout_type.fixed`),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M1.44995 0.949951C1.31734 0.949951 1.19016 1.00263 1.0964 1.0964C1.00263 1.19017 0.949951 1.31735 0.949951 1.44995L0.949966 3.44995C0.949969 3.7261 1.17383 3.94995 1.44997 3.94995C1.72611 3.94995 1.94997 3.72609 1.94997 3.44995L1.94995 1.94995H3.44997C3.72611 1.94995 3.94997 1.72609 3.94997 1.44995C3.94997 1.17381 3.72611 0.949951 3.44997 0.949951H1.44995ZM5.94995 0.949951C5.67381 0.949951 5.44995 1.17381 5.44995 1.44995C5.44995 1.72609 5.67381 1.94995 5.94995 1.94995H8.94995C9.22609 1.94995 9.44995 1.72609 9.44995 1.44995C9.44995 1.17381 9.22609 0.949951 8.94995 0.949951H5.94995ZM5.44995 13.45C5.44995 13.1738 5.67381 12.95 5.94995 12.95H8.94995C9.22609 12.95 9.44995 13.1738 9.44995 13.45C9.44995 13.7261 9.22609 13.95 8.94995 13.95H5.94995C5.67381 13.95 5.44995 13.7261 5.44995 13.45ZM1.94995 5.94995C1.94995 5.67381 1.72609 5.44995 1.44995 5.44995C1.17381 5.44995 0.949951 5.67381 0.949951 5.94995V8.94995C0.949951 9.22609 1.17381 9.44995 1.44995 9.44995C1.72609 9.44995 1.94995 9.22609 1.94995 8.94995V5.94995ZM13.45 5.44995C13.7261 5.44995 13.95 5.67381 13.95 5.94995V8.94995C13.95 9.22609 13.7261 9.44995 13.45 9.44995C13.1738 9.44995 12.95 9.22609 12.95 8.94995V5.94995C12.95 5.67381 13.1738 5.44995 13.45 5.44995ZM11.45 0.949951C11.1738 0.949951 10.95 1.17381 10.95 1.44995C10.95 1.72609 11.1738 1.94995 11.45 1.94995H12.9499V3.44995C12.9499 3.72609 13.1738 3.94995 13.4499 3.94995C13.7261 3.94995 13.9499 3.72609 13.9499 3.44995V1.44995C13.9499 1.17381 13.7252 0.949951 13.449 0.949951H11.45ZM1.44995 10.95C1.72609 10.95 1.94995 11.1738 1.94995 11.45V12.95H3.44997C3.72611 12.95 3.94997 13.1738 3.94997 13.45C3.94997 13.7261 3.72611 13.95 3.44997 13.95H1.44995C1.17381 13.95 0.949951 13.7261 0.949951 13.45V11.45C0.949951 11.1738 1.17381 10.95 1.44995 10.95ZM13.95 11.45C13.95 11.1738 13.7261 10.95 13.45 10.95C13.1738 10.9499 12.95 11.1738 12.95 11.4499L12.9491 12.95H11.45C11.1738 12.95 10.95 13.1738 10.95 13.45C10.95 13.7261 11.1738 13.95 11.45 13.95H13.4499C13.7261 13.95 13.9499 13.7261 13.9499 13.45L13.95 11.45Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: LayoutFixedIcon,},{key: 'auto',label: tGlobal(`constant.layout_type.auto`),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M1.49988 2.00012C1.77602 2.00012 1.99988 1.77626 1.99988 1.50012C1.99988 1.22398 1.77602 1.00012 1.49988 1.00012C1.22374 1.00012 0.999878 1.22398 0.999878 1.50012C0.999878 1.77626 1.22374 2.00012 1.49988 2.00012ZM4.49988 2.00012C4.77602 2.00012 4.99988 1.77626 4.99988 1.50012C4.99988 1.22398 4.77602 1.00012 4.49988 1.00012C4.22374 1.00012 3.99988 1.22398 3.99988 1.50012C3.99988 1.77626 4.22374 2.00012 4.49988 2.00012ZM7.99988 1.50012C7.99988 1.77626 7.77602 2.00012 7.49988 2.00012C7.22374 2.00012 6.99988 1.77626 6.99988 1.50012C6.99988 1.22398 7.22374 1.00012 7.49988 1.00012C7.77602 1.00012 7.99988 1.22398 7.99988 1.50012ZM10.4999 2.00012C10.776 2.00012 10.9999 1.77626 10.9999 1.50012C10.9999 1.22398 10.776 1.00012 10.4999 1.00012C10.2237 1.00012 9.99988 1.22398 9.99988 1.50012C9.99988 1.77626 10.2237 2.00012 10.4999 2.00012ZM13.9999 1.50012C13.9999 1.77626 13.776 2.00012 13.4999 2.00012C13.2237 2.00012 12.9999 1.77626 12.9999 1.50012C12.9999 1.22398 13.2237 1.00012 13.4999 1.00012C13.776 1.00012 13.9999 1.22398 13.9999 1.50012ZM1.49988 14.0001C1.77602 14.0001 1.99988 13.7763 1.99988 13.5001C1.99988 13.224 1.77602 13.0001 1.49988 13.0001C1.22374 13.0001 0.999878 13.224 0.999878 13.5001C0.999878 13.7763 1.22374 14.0001 1.49988 14.0001ZM1.99988 10.5001C1.99988 10.7763 1.77602 11.0001 1.49988 11.0001C1.22374 11.0001 0.999878 10.7763 0.999878 10.5001C0.999878 10.224 1.22374 10.0001 1.49988 10.0001C1.77602 10.0001 1.99988 10.224 1.99988 10.5001ZM1.49988 8.00012C1.77602 8.00012 1.99988 7.77626 1.99988 7.50012C1.99988 7.22398 1.77602 7.00012 1.49988 7.00012C1.22374 7.00012 0.999878 7.22398 0.999878 7.50012C0.999878 7.77626 1.22374 8.00012 1.49988 8.00012ZM1.99988 4.50012C1.99988 4.77626 1.77602 5.00012 1.49988 5.00012C1.22374 5.00012 0.999878 4.77626 0.999878 4.50012C0.999878 4.22398 1.22374 4.00012 1.49988 4.00012C1.77602 4.00012 1.99988 4.22398 1.99988 4.50012ZM13.4999 11.0001C13.776 11.0001 13.9999 10.7763 13.9999 10.5001C13.9999 10.224 13.776 10.0001 13.4999 10.0001C13.2237 10.0001 12.9999 10.224 12.9999 10.5001C12.9999 10.7763 13.2237 11.0001 13.4999 11.0001ZM13.9999 7.50012C13.9999 7.77626 13.776 8.00012 13.4999 8.00012C13.2237 8.00012 12.9999 7.77626 12.9999 7.50012C12.9999 7.22398 13.2237 7.00012 13.4999 7.00012C13.776 7.00012 13.9999 7.22398 13.9999 7.50012ZM13.4999 5.00012C13.776 5.00012 13.9999 4.77626 13.9999 4.50012C13.9999 4.22398 13.776 4.00012 13.4999 4.00012C13.2237 4.00012 12.9999 4.22398 12.9999 4.50012C12.9999 4.77626 13.2237 5.00012 13.4999 5.00012ZM4.99988 13.5001C4.99988 13.7763 4.77602 14.0001 4.49988 14.0001C4.22374 14.0001 3.99988 13.7763 3.99988 13.5001C3.99988 13.224 4.22374 13.0001 4.49988 13.0001C4.77602 13.0001 4.99988 13.224 4.99988 13.5001ZM7.49988 14.0001C7.77602 14.0001 7.99988 13.7763 7.99988 13.5001C7.99988 13.224 7.77602 13.0001 7.49988 13.0001C7.22374 13.0001 6.99988 13.224 6.99988 13.5001C6.99988 13.7763 7.22374 14.0001 7.49988 14.0001ZM10.9999 13.5001C10.9999 13.7763 10.776 14.0001 10.4999 14.0001C10.2237 14.0001 9.99988 13.7763 9.99988 13.5001C9.99988 13.224 10.2237 13.0001 10.4999 13.0001C10.776 13.0001 10.9999 13.224 10.9999 13.5001ZM13.4999 14.0001C13.776 14.0001 13.9999 13.7763 13.9999 13.5001C13.9999 13.224 13.776 13.0001 13.4999 13.0001C13.2237 13.0001 12.9999 13.224 12.9999 13.5001C12.9999 13.7763 13.2237 14.0001 13.4999 14.0001ZM3.99988 5.00012C3.99988 4.44784 4.44759 4.00012 4.99988 4.00012H9.99988C10.5522 4.00012 10.9999 4.44784 10.9999 5.00012V10.0001C10.9999 10.5524 10.5522 11.0001 9.99988 11.0001H4.99988C4.44759 11.0001 3.99988 10.5524 3.99988 10.0001V5.00012ZM4.99988 5.00012H9.99988V10.0001H4.99988V5.00012Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: LayoutAutoIcon,},{key: 'full',label: tGlobal(`constant.layout_type.full`),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M1.99998 0.999976C1.44769 0.999976 0.999976 1.44769 0.999976 1.99998V13C0.999976 13.5523 1.44769 14 1.99998 14H13C13.5523 14 14 13.5523 14 13V1.99998C14 1.44769 13.5523 0.999976 13 0.999976H1.99998ZM1.99998 1.99998L13 1.99998V13H1.99998V1.99998ZM4.49996 3.99996C4.22382 3.99996 3.99996 4.22382 3.99996 4.49996V10.5C3.99996 10.7761 4.22382 11 4.49996 11H10.5C10.7761 11 11 10.7761 11 10.5V4.49996C11 4.22382 10.7761 3.99996 10.5 3.99996H4.49996ZM4.99996 9.99996V4.99996H9.99996V9.99996H4.99996Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: LayoutFullIcon,},],// GLOBAL_CONFIG.CHART_LAYOUT_TYPE.map((g) => ({@@ -505,34 +318,12 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'coord_system',label: tGlobal('constant.coord_system.__enum__'),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M8.8914 2.1937C9.1158 2.35464 9.16725 2.66701 9.00631 2.89141L2.47388 12H13.5C13.7761 12 14 12.2239 14 12.5C14 12.7762 13.7761 13 13.5 13H1.5C1.31254 13 1.14082 12.8952 1.0552 12.7284C0.969578 12.5616 0.984438 12.361 1.09369 12.2086L8.19369 2.30862C8.35462 2.08422 8.667 2.03277 8.8914 2.1937ZM11.1 6.50001C11.1 6.22387 11.3238 6.00001 11.6 6.00001C11.8761 6.00001 12.1 6.22387 12.1 6.50001C12.1 6.77615 11.8761 7.00001 11.6 7.00001C11.3238 7.00001 11.1 6.77615 11.1 6.50001ZM10.4 4.00001C10.1239 4.00001 9.90003 4.22387 9.90003 4.50001C9.90003 4.77615 10.1239 5.00001 10.4 5.00001C10.6762 5.00001 10.9 4.77615 10.9 4.50001C10.9 4.22387 10.6762 4.00001 10.4 4.00001ZM12.1 8.50001C12.1 8.22387 12.3238 8.00001 12.6 8.00001C12.8761 8.00001 13.1 8.22387 13.1 8.50001C13.1 8.77615 12.8761 9.00001 12.6 9.00001C12.3238 9.00001 12.1 8.77615 12.1 8.50001ZM13.4 10C13.1239 10 12.9 10.2239 12.9 10.5C12.9 10.7761 13.1239 11 13.4 11C13.6762 11 13.9 10.7761 13.9 10.5C13.9 10.2239 13.6762 10 13.4 10Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: CoordSystemIcon,options: GLOBAL_CONFIG.COORD_TYPES.map((c) => ({key: c,label: tGlobal(`constant.coord_system.${c}`),icon: {- generic: (props: SVGProps<SVGSVGElement>) => (- <svg- stroke="currentColor"- fill="none"- strokeWidth="1.5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"- aria-hidden- {...props}- >- <path strokeLinecap="round" strokeLinejoin="round" d="M2 12h20M12 2v20" />- <path strokeLinecap="round" strokeLinejoin="round" d="M12 7h2M12 16h2M7 12v-2M16 12v-2" />- </svg>- ),+ generic: CoordGenericIcon,geographic: GlobeAltIcon,}[c],})),@@ -555,7 +346,7 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'debug',label: t('toggle.debug'),- icon: WrenchIcon,+ icon: DebugIcon,checked: showActions,onChange: (checked) => {vizStore.setVisualLayout('showActions', checked);@@ -566,7 +357,7 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'export_chart',label: t('button.export_chart'),- icon: PhotoIcon,+ icon: ExportChartIcon,form: (<div className="flex flex-col"><Button variant="ghost" aria-label={t('button.export_chart_as', { type: 'png' })} onClick={() => downloadPNG()}>@@ -586,7 +377,7 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'csv',label: t('button.export_chart_as', { type: 'csv' }),- icon: TableCellsIcon,+ icon: ExportCsvIcon,onClick: downloadCSV,},{@@ -600,16 +391,7 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'export_code',label: t('button.export_code'),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M9.96424 2.68571C10.0668 2.42931 9.94209 2.13833 9.6857 2.03577C9.4293 1.93322 9.13832 2.05792 9.03576 2.31432L5.03576 12.3143C4.9332 12.5707 5.05791 12.8617 5.3143 12.9642C5.5707 13.0668 5.86168 12.9421 5.96424 12.6857L9.96424 2.68571ZM3.85355 5.14646C4.04882 5.34172 4.04882 5.6583 3.85355 5.85356L2.20711 7.50001L3.85355 9.14646C4.04882 9.34172 4.04882 9.6583 3.85355 9.85356C3.65829 10.0488 3.34171 10.0488 3.14645 9.85356L1.14645 7.85356C0.951184 7.6583 0.951184 7.34172 1.14645 7.14646L3.14645 5.14646C3.34171 4.9512 3.65829 4.9512 3.85355 5.14646ZM11.1464 5.14646C11.3417 4.9512 11.6583 4.9512 11.8536 5.14646L13.8536 7.14646C14.0488 7.34172 14.0488 7.6583 13.8536 7.85356L11.8536 9.85356C11.6583 10.0488 11.3417 10.0488 11.1464 9.85356C10.9512 9.6583 10.9512 9.34172 11.1464 9.14646L12.7929 7.50001L11.1464 5.85356C10.9512 5.6583 10.9512 5.34172 11.1464 5.14646Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: CodeBracketIcon,onClick: () => {vizStore.setShowCodeExportPanel(true);},@@ -619,16 +401,7 @@ const VisualSettings: React.FC<IVisualSettings> = ({ rendererHandler, csvHandler{key: 'limit_axis',label: t('limit'),- icon: (props: SVGProps<SVGSVGElement>) => (- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>- <path- d="M9.94969 7.49989C9.94969 8.85288 8.85288 9.94969 7.49989 9.94969C6.14691 9.94969 5.0501 8.85288 5.0501 7.49989C5.0501 6.14691 6.14691 5.0501 7.49989 5.0501C8.85288 5.0501 9.94969 6.14691 9.94969 7.49989ZM10.8632 8C10.6213 9.64055 9.20764 10.8997 7.49989 10.8997C5.79214 10.8997 4.37847 9.64055 4.13662 8H0.5C0.223858 8 0 7.77614 0 7.5C0 7.22386 0.223858 7 0.5 7H4.13659C4.37835 5.35935 5.79206 4.1001 7.49989 4.1001C9.20772 4.1001 10.6214 5.35935 10.8632 7H14.5C14.7761 7 15 7.22386 15 7.5C15 7.77614 14.7761 8 14.5 8H10.8632Z"- fill="currentColor"- fillRule="evenodd"- clipRule="evenodd"- ></path>- </svg>- ),+ icon: RowLimitIcon,form: (<LimitSettingvalue={limit}diff --git a/packages/graphic-walker/vite.config.ts b/packages/graphic-walker/vite.config.tsindex ddbae8bd..7de92deb 100644--- a/packages/graphic-walker/vite.config.ts+++ b/packages/graphic-walker/vite.config.ts@@ -87,6 +87,7 @@ export default defineConfig({rollupOptions: {external: modulesNotToBundle,output: {+ interop: 'auto',globals: {'react': 'React','react-dom': 'ReactDOM',diff --git a/packages/playground/package.json b/packages/playground/package.jsonindex d314f0c9..4e020018 100644--- a/packages/playground/package.json+++ b/packages/playground/package.json@@ -21,7 +21,7 @@"@headlessui/react": "2.2.10","@heroicons/react": "^2.0.8","@kanaries/duckdb-computation": "0.0.1",- "@kanaries/graphic-walker": "0.5.2",+ "@kanaries/graphic-walker": "0.5.3","@vercel/analytics": "^1.1.1","color-space": "2.0.1","react": "^19.2.0",diff --git a/packages/playground/src/examples/pages/exportChart.stories.tsx b/packages/playground/src/examples/pages/exportChart.stories.tsxindex 395ed323..1ca7bdc2 100644--- a/packages/playground/src/examples/pages/exportChart.stories.tsx+++ b/packages/playground/src/examples/pages/exportChart.stories.tsx@@ -13,7 +13,7 @@ export default function ExportChartExample() {if (!gwRef.current) return;if (type === 'svg') {const res = await gwRef.current.exportChart('svg');- const d = res.charts[0]?.data;+ const d = res.combinedData ?? res.charts[0]?.data;if (d) {const blob = new Blob([d], { type: 'image/svg+xml' });const url = URL.createObjectURL(blob);@@ -25,7 +25,7 @@ export default function ExportChartExample() {}} else {const res = await gwRef.current.exportChart('data-url');- const d = res.charts[0]?.data;+ const d = res.combinedData ?? res.charts[0]?.data;if (d) {const a = document.createElement('a');a.href = d.replace(/^data:image\/[^;]/, 'data:application/octet-stream');