vccs 1.0.0-beta.1 → 1.0.0-beta.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.
@@ -148,7 +148,7 @@ var BarRectangles = /* @__PURE__ */ defineComponent({
148
148
  emit("mouseenter", bar, index, event);
149
149
  },
150
150
  mouseleave: ({ bar, index }, _position, event) => {
151
- tooltip.clear("hover");
151
+ tooltip.clear("hover", "item");
152
152
  emit("mouseleave", bar, index, event);
153
153
  }
154
154
  });
@@ -156,7 +156,7 @@ var FunnelView = /* @__PURE__ */ defineComponent({
156
156
  });
157
157
  }
158
158
  function handleTrapezoidLeave() {
159
- tooltip.clear("hover");
159
+ tooltip.clear("hover", "item");
160
160
  }
161
161
  return () => {
162
162
  if (props.hide) return null;
@@ -125,7 +125,7 @@ var ScatterView = /* @__PURE__ */ defineComponent({
125
125
  });
126
126
  };
127
127
  const onMouseLeaveSymbol = () => {
128
- tooltip.clear("hover");
128
+ tooltip.clear("hover", "item");
129
129
  };
130
130
  let symbolData = [];
131
131
  const listeners = delegateItemEvents((index) => symbolData[index], {
@@ -203,7 +203,7 @@ var CellGridLayer = /* @__PURE__ */ defineComponent({
203
203
  coordinate: void 0,
204
204
  active: false
205
205
  });
206
- else tooltip.clear("hover");
206
+ else tooltip.clear("hover", "item");
207
207
  }
208
208
  function onEnter(cell, index, event) {
209
209
  keyboard.value = false;
@@ -369,7 +369,7 @@ function useJourneySankey(props, slots, emit) {
369
369
  }
370
370
  function leave() {
371
371
  hover.value = void 0;
372
- tooltip.clear("hover");
372
+ tooltip.clear("hover", "item");
373
373
  }
374
374
  function leaveNode(node, event) {
375
375
  leave();
@@ -292,11 +292,11 @@ function useSankey(props, slots, emit) {
292
292
  emit("link-mouseenter", link, index, e);
293
293
  }
294
294
  function handleNodeMouseLeave(node, index, e) {
295
- tooltip.clear("hover");
295
+ tooltip.clear("hover", "item");
296
296
  emit("node-mouseleave", node, index, e);
297
297
  }
298
298
  function handleLinkMouseLeave(link, index, e) {
299
- tooltip.clear("hover");
299
+ tooltip.clear("hover", "item");
300
300
  emit("link-mouseleave", link, index, e);
301
301
  }
302
302
  function handleNodeClick(node, index, e) {
@@ -247,7 +247,7 @@ function useSparkline(props, emit) {
247
247
  function setActive(index, keyboard = false) {
248
248
  const point = index === null ? void 0 : points.value[index];
249
249
  if (!point && !keyboard) {
250
- tooltip.clear("hover");
250
+ tooltip.clear("hover", "item");
251
251
  return;
252
252
  }
253
253
  const action = {
@@ -201,7 +201,7 @@ function useSunburst(props, slots, emit) {
201
201
  });
202
202
  }
203
203
  function handleMouseLeave(node, e) {
204
- tooltip.clear("hover");
204
+ tooltip.clear("hover", "item");
205
205
  emit("node-mouseleave", node, indexOf(node), e);
206
206
  }
207
207
  function handleClick(node, e) {
@@ -278,7 +278,7 @@ function useTreemap(props, slots, emit) {
278
278
  emit("node-mouseenter", node, index, e);
279
279
  }
280
280
  function handleNodeMouseLeave(node, index, e) {
281
- tooltip.clear("hover");
281
+ tooltip.clear("hover", "item");
282
282
  emit("node-mouseleave", node, index, e);
283
283
  }
284
284
  function handleNodeClick(node, index, e) {
@@ -10,8 +10,7 @@ function useTooltipChartSynchronisation(source, enabled) {
10
10
  const activeDataKey = computed(() => tooltip.target.value?.entry?.value?.settings.dataKey);
11
11
  const eventEmitterSymbol = presentation.emitter;
12
12
  const syncId = presentation.syncId;
13
- const tooltipState = computed(() => tooltip.syncInteraction.value);
14
- const isReceivingSynchronisation = computed(() => tooltipState.value?.active);
13
+ const isReceivingSynchronisation = computed(() => tooltip.receivingSynchronisation.value);
15
14
  watchEffect(() => {
16
15
  if (!enabled()) return;
17
16
  if (isReceivingSynchronisation.value) return;
@@ -30,7 +30,7 @@ function usePointEvents(emit) {
30
30
  emit("mouseenter", entry, index, event);
31
31
  },
32
32
  onMouseleave: (event) => {
33
- tooltip.clear("hover");
33
+ tooltip.clear("hover", "item");
34
34
  emit("mouseleave", entry, index, event);
35
35
  }
36
36
  };
@@ -286,8 +286,9 @@ function createTooltip(inputs) {
286
286
  coordinate: input.coordinate
287
287
  };
288
288
  }
289
- function clear(channel) {
289
+ function clear(channel, scope) {
290
290
  if (channel === "hover" && settings.value.trigger !== "hover") return;
291
+ if (scope === "item" && selection.value?.target.entry === void 0) return;
291
292
  request(null);
292
293
  if (channel === "keyboard") {
293
294
  selection.value = null;
@@ -371,10 +372,7 @@ function createTooltip(inputs) {
371
372
  index: selection.value.requestedIndex,
372
373
  active: selection.value.active
373
374
  } : noInteraction),
374
- syncInteraction: computed(() => ({
375
- ...selection.value?.channel === "sync" ? interaction.value : noInteraction,
376
- label: label.value
377
- })),
375
+ receivingSynchronisation: computed(() => selection.value?.channel === "sync"),
378
376
  activeIndexFor,
379
377
  coordinateFor,
380
378
  activate,
@@ -139,7 +139,7 @@ var PieView = /* @__PURE__ */ defineComponent({
139
139
  });
140
140
  }
141
141
  function handleSectorLeave() {
142
- tooltip.clear("hover");
142
+ tooltip.clear("hover", "item");
143
143
  }
144
144
  let sectorList = items.value;
145
145
  const listeners = delegateItemEvents((position) => sectorList[position]?.value, {
@@ -217,7 +217,7 @@ var RadialBarView = /* @__PURE__ */ defineComponent({
217
217
  emit("mouseenter", sector, sector.index, event);
218
218
  };
219
219
  const onMouseleave = (event) => {
220
- tooltip.clear("hover");
220
+ tooltip.clear("hover", "item");
221
221
  emit("mouseleave", sector, sector.index, event);
222
222
  };
223
223
  if (slots.shape) return createVNode("g", mergeProps({ "key": items.value[i].key }, { [DATA_ITEM_INDEX_ATTRIBUTE_NAME]: sector.index }, {
@@ -228,18 +228,11 @@ export declare function useTooltipController(): {
228
228
  entries: import('./registry.js').Registry<TooltipPayloadConfiguration>;
229
229
  announcement: import('vue').ShallowRef<string, string>;
230
230
  keyboardInteraction: ComputedRef<TooltipInteraction>;
231
- syncInteraction: ComputedRef<{
232
- label: string | undefined;
233
- configuration?: TooltipPayloadConfiguration;
234
- active: boolean;
235
- index: TooltipActiveIndex;
236
- dataKey: import('../types/base.js').ChartDataKey | undefined;
237
- coordinate: Coordinate | undefined;
238
- }>;
231
+ receivingSynchronisation: ComputedRef<boolean>;
239
232
  activeIndexFor: (entry: Entry) => ComputedRef<number | null>;
240
233
  coordinateFor: (candidate: Target | undefined, fallback?: Coordinate) => Coordinate | undefined;
241
234
  activate: (channel: Channel, input: TooltipTargetRequest) => void;
242
- clear: (channel: Channel) => void;
235
+ clear: (channel: Channel, scope?: "item") => void;
243
236
  };
244
237
  export declare function useTooltipSource(): TooltipSource;
245
238
  export declare function provideTooltipEntry(entry: Entry): void;
@@ -435,17 +428,10 @@ export declare function createTooltip(inputs: TooltipInputs): {
435
428
  entries: import('./registry.js').Registry<TooltipPayloadConfiguration>;
436
429
  announcement: import('vue').ShallowRef<string, string>;
437
430
  keyboardInteraction: ComputedRef<TooltipInteraction>;
438
- syncInteraction: ComputedRef<{
439
- label: string | undefined;
440
- configuration?: TooltipPayloadConfiguration;
441
- active: boolean;
442
- index: TooltipActiveIndex;
443
- dataKey: import('../types/base.js').ChartDataKey | undefined;
444
- coordinate: Coordinate | undefined;
445
- }>;
431
+ receivingSynchronisation: ComputedRef<boolean>;
446
432
  activeIndexFor: (entry: Entry) => ComputedRef<number | null>;
447
433
  coordinateFor: (candidate: Target | undefined, fallback?: Coordinate) => Coordinate | undefined;
448
434
  activate: (channel: Channel, input: TooltipTargetRequest) => void;
449
- clear: (channel: Channel) => void;
435
+ clear: (channel: Channel, scope?: "item") => void;
450
436
  };
451
437
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vccs",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.1",
4
+ "version": "1.0.0-beta.2",
5
5
  "description": "Composable charting components for Vue 3 — an unofficial port of Recharts",
6
6
  "author": "rick-hup",
7
7
  "license": "MIT",