@lionad/cx-comps-tanstack-charts 0.1.0-alpha.7 → 0.1.0-alpha.9

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/index.mjs CHANGED
@@ -24,6 +24,8 @@ import { treemap } from "@tanstack/charts/hierarchy/treemap";
24
24
  import { forceLayout } from "@tanstack/charts/network/force";
25
25
  import { sankeyDiagram } from "@tanstack/charts/network/sankey";
26
26
  import { geoAlbersUsa, geoEqualEarth, geoIdentity, geoMercator, geoNaturalEarth1, geoOrthographic } from "d3-geo";
27
+ import { decorative } from "@tanstack/charts/mark/decorative";
28
+ import { tooltip } from "@tanstack/charts/tooltip";
27
29
  import { compileTrigger, createTriggerRegistry } from "@lionad/cx-stream";
28
30
  //#region src/shared/chart-skeleton.vue
29
31
  const _sfc_main$6 = /*@__PURE__*/ defineComponent({
@@ -1145,10 +1147,15 @@ function translateLegend(legend) {
1145
1147
  if (width !== void 0) items.width = width;
1146
1148
  return colorLegend(items);
1147
1149
  }
1148
- /** tooltip 声明:true→缺省开启(undefined),false→关闭,对象→标量子集原样透传 */
1149
- function translateTooltip(tooltip) {
1150
- if (tooltip === true) return void 0;
1151
- if (tooltip === false) return false;
1150
+ /**
1151
+ * tooltip 声明:false→关闭;true→默认 DOM extension;对象→extension + 标量子集。
1152
+ * 库层没有「缺省开启」——resolveTooltipInput undefined 返回 null 即关闭,
1153
+ * 开启必须显式挂 extension(裸 extension { use, ...options } 两形态);
1154
+ * 裸 options 对象会在 mount 时抛 TypeError(input.use 为 undefined)。
1155
+ */
1156
+ function translateTooltip(tooltip$1) {
1157
+ if (tooltip$1 === false) return false;
1158
+ if (tooltip$1 === true) return tooltip;
1152
1159
  const options = {};
1153
1160
  for (const key of [
1154
1161
  "placement",
@@ -1158,8 +1165,11 @@ function translateTooltip(tooltip) {
1158
1165
  "anchor",
1159
1166
  "sort",
1160
1167
  "items"
1161
- ]) if (tooltip[key] !== void 0) options[key] = tooltip[key];
1162
- return options;
1168
+ ]) if (tooltip$1[key] !== void 0) options[key] = tooltip$1[key];
1169
+ return {
1170
+ use: tooltip,
1171
+ ...options
1172
+ };
1163
1173
  }
1164
1174
  /**
1165
1175
  * 时间轴 channel 纠偏:utc/time scale 要求 channel 值为 Date 实例,而 JSON spec 只能
@@ -1223,20 +1233,23 @@ function buildDefinition(spec, datasets, rowsOverride) {
1223
1233
  let derivedXDomain;
1224
1234
  let derivedYDomain;
1225
1235
  let polarOnly = spec.marks.length > 0;
1236
+ const pushMark = (specMark, runtimeMark) => {
1237
+ marks.push(specMark.decorative === true ? decorative(runtimeMark) : runtimeMark);
1238
+ };
1226
1239
  for (const mark of spec.marks) {
1227
1240
  const bound = rowsOverride !== void 0 && mark.data === void 0 ? {
1228
1241
  ...mark,
1229
1242
  data: "rows"
1230
1243
  } : mark;
1231
1244
  if (!POLAR_FAMILY_TYPES.has(bound.type)) polarOnly = false;
1232
- if (bound.type === "polar") marks.push(translatePolar(bound, table));
1233
- else if (bound.type === "pie") marks.push(translatePie(bound, table));
1245
+ if (bound.type === "polar") pushMark(bound, translatePolar(bound, table));
1246
+ else if (bound.type === "pie") pushMark(bound, translatePie(bound, table));
1234
1247
  else if (COMPOSITE_TYPES.has(bound.type)) {
1235
1248
  const result = translateCompositeMark(bound, table, (child, rows) => buildDefinition(child, void 0, rows));
1236
- marks.push(...result.marks);
1249
+ for (const expanded of result.marks) pushMark(bound, expanded);
1237
1250
  if (result.xDomain) derivedXDomain = result.xDomain;
1238
1251
  if (result.yDomain) derivedYDomain = result.yDomain;
1239
- } else marks.push(translateMark(bound, table));
1252
+ } else pushMark(bound, translateMark(bound, table));
1240
1253
  }
1241
1254
  const definition = {
1242
1255
  marks,
@@ -1276,10 +1289,8 @@ function buildDefinition(spec, datasets, rowsOverride) {
1276
1289
  if (spec.keyboard !== void 0) definition.keyboard = spec.keyboard;
1277
1290
  if (spec.focusRing !== void 0) definition.focusRing = spec.focusRing;
1278
1291
  if (spec.focus !== void 0) definition.focus = spec.focus;
1279
- if (spec.tooltip !== void 0) {
1280
- const tooltip = translateTooltip(spec.tooltip);
1281
- if (tooltip !== void 0) definition.tooltip = tooltip;
1282
- }
1292
+ const tooltip$2 = spec.tooltip === void 0 ? tooltip : translateTooltip(spec.tooltip);
1293
+ if (tooltip$2 !== void 0) definition.tooltip = tooltip$2;
1283
1294
  return definition;
1284
1295
  }
1285
1296
  /**
@@ -101,6 +101,13 @@ export interface CxChartMarkSpec {
101
101
  */
102
102
  data?: readonly unknown[] | string;
103
103
  id?: string;
104
+ /**
105
+ * 装饰层开关:true 时经库 decorative() 包装——保留比例尺与绘制几何、剥离交互
106
+ * 所有权(tooltip 命中/焦点/条件高亮均跳过该 mark)。典型:辅助折线/参考线/标注
107
+ * 不抢数据点的 tooltip 命中。库层约束是带 focus/states 行为的 mark 不可包装
108
+ * (initialize 抛 TypeError),本 grammar 不暴露条件态声明,故恒安全。
109
+ */
110
+ decorative?: boolean;
104
111
  x?: string;
105
112
  y?: string;
106
113
  x1?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lionad/cx-comps-tanstack-charts",
3
- "version": "0.1.0-alpha.7",
3
+ "version": "0.1.0-alpha.9",
4
4
  "description": "cx material components wrapping TanStack Charts (@tanstack/charts/vue)",
5
5
  "keywords": [
6
6
  "charts",