@data360/mcp-viz-core 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-spec.d.ts","sourceRoot":"","sources":["../src/prepare-spec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIhD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAG9C;AAwBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,SAAM,GAAG,MAAM,CAkDnE;AAID,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAuBrE"}
1
+ {"version":3,"file":"prepare-spec.d.ts","sourceRoot":"","sources":["../src/prepare-spec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIhD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAG9C;AAwBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,SAAM,GAAG,MAAM,CAkDnE;AAID,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAwBrE"}
@@ -45,8 +45,8 @@ export function prepareSpec(spec, chartHeight = 260) {
45
45
  // 2. Responsive sizing
46
46
  out.width = "container";
47
47
  out.height = chartHeight;
48
- // 3. Suppress built-in legend — card renders its own
49
- if (out.encoding?.color) {
48
+ // 3. Suppress built-in legend — card renders its own (unless quantitative)
49
+ if (out.encoding?.color && out.encoding.color.type !== "quantitative") {
50
50
  out.encoding.color.legend = null;
51
51
  }
52
52
  // 3b. Title is displayed by VegaChartCard (prop / parseSpec); strip from the embedded spec
@@ -90,7 +90,8 @@ export function parseSpec(spec, palette) {
90
90
  const rows = name && spec.datasets?.[name]
91
91
  ? spec.datasets[name]
92
92
  : (spec.data?.values ?? []);
93
- const colorField = spec.encoding?.color?.field ?? null;
93
+ const isQuantitative = spec.encoding?.color?.type === "quantitative";
94
+ const colorField = isQuantitative ? null : (spec.encoding?.color?.field ?? null);
94
95
  const specTitle = typeof spec.title === "string"
95
96
  ? spec.title
96
97
  : spec.title?.text ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data360/mcp-viz-core",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Framework-agnostic Vega-Lite prep and World Bank theme for Data360 MCP viz tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",