feat(openclaw): add shopping, supermarket deals, geizhals, and ebay MCP tools

This commit is contained in:
Moritz Graf
2026-09-10 21:32:22 +02:00
parent 2f2f597a67
commit 1e81cdbead
4754 changed files with 1298747 additions and 896 deletions
@@ -0,0 +1,3 @@
import type { ChartComponent } from './types.js';
export declare const Chart: ChartComponent;
//# sourceMappingURL=chart.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../src/chart.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAWhD,eAAO,MAAM,KAAK,gBA8GE,CAAA"}
+273
View File
@@ -0,0 +1,273 @@
'use strict';
var chart_js = require('chart.js');
var vue = require('vue');
const CommonProps = {
data: {
type: Object,
required: true
},
options: {
type: Object,
default: ()=>({})
},
plugins: {
type: Array,
default: ()=>[]
},
datasetIdKey: {
type: String,
default: "label"
},
updateMode: {
type: String,
default: undefined
}
};
const A11yProps = {
ariaLabel: {
type: String
},
ariaDescribedby: {
type: String
}
};
const Props = {
type: {
type: String,
required: true
},
destroyDelay: {
type: Number,
default: 0 // No delay by default
},
...CommonProps,
...A11yProps
};
const compatProps = vue.version[0] === "2" ? (internals, props)=>Object.assign(internals, {
attrs: props
}) : (internals, props)=>Object.assign(internals, props);
function toRawIfProxy(obj) {
return vue.isProxy(obj) ? vue.toRaw(obj) : obj;
}
function cloneProxy(obj) {
let src = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : obj;
return vue.isProxy(src) ? new Proxy(obj, {}) : obj;
}
function setOptions(chart, nextOptions) {
const options = chart.options;
if (options && nextOptions) {
Object.assign(options, nextOptions);
}
}
function setLabels(currentData, nextLabels) {
currentData.labels = nextLabels;
}
function setDatasets(currentData, nextDatasets, datasetIdKey) {
const addedDatasets = [];
currentData.datasets = nextDatasets.map((nextDataset)=>{
// given the new set, find it's current match
const currentDataset = currentData.datasets.find((dataset)=>dataset[datasetIdKey] === nextDataset[datasetIdKey]);
// There is no original to update, so simply add new one
if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) {
return {
...nextDataset
};
}
addedDatasets.push(currentDataset);
Object.assign(currentDataset, nextDataset);
return currentDataset;
});
}
function cloneData(data, datasetIdKey) {
const nextData = {
labels: [],
datasets: []
};
setLabels(nextData, data.labels);
setDatasets(nextData, data.datasets, datasetIdKey);
return nextData;
}
/**
* Get dataset from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/ function getDatasetAtEvent(chart, event) {
return chart.getElementsAtEventForMode(event, "dataset", {
intersect: true
}, false);
}
/**
* Get single dataset element from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/ function getElementAtEvent(chart, event) {
return chart.getElementsAtEventForMode(event, "nearest", {
intersect: true
}, false);
}
/**
* Get all dataset elements from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/ function getElementsAtEvent(chart, event) {
return chart.getElementsAtEventForMode(event, "index", {
intersect: true
}, false);
}
const Chart = vue.defineComponent({
props: Props,
setup (props, param) {
let { expose , slots } = param;
const canvasRef = vue.ref(null);
const chartRef = vue.shallowRef(null);
expose({
chart: chartRef
});
const renderChart = ()=>{
if (!canvasRef.value) return;
const { type , data , options , plugins , datasetIdKey } = props;
const clonedData = cloneData(data, datasetIdKey);
const proxiedData = cloneProxy(clonedData, data);
chartRef.value = new chart_js.Chart(canvasRef.value, {
type,
data: proxiedData,
options: {
...options
},
plugins
});
};
const destroyChart = ()=>{
const chart = vue.toRaw(chartRef.value);
if (chart) {
if (props.destroyDelay > 0) {
setTimeout(()=>{
chart.destroy();
chartRef.value = null;
}, props.destroyDelay);
} else {
chart.destroy();
chartRef.value = null;
}
}
};
const update = (chart)=>{
chart.update(props.updateMode);
};
vue.onMounted(renderChart);
vue.onUnmounted(destroyChart);
vue.watch([
()=>props.options,
()=>props.data
], (param, param1)=>{
let [nextOptionsProxy, nextDataProxy] = param, [prevOptionsProxy, prevDataProxy] = param1;
const chart = vue.toRaw(chartRef.value);
if (!chart) {
return;
}
let shouldUpdate = false;
if (nextOptionsProxy) {
const nextOptions = toRawIfProxy(nextOptionsProxy);
const prevOptions = toRawIfProxy(prevOptionsProxy);
if (nextOptions && nextOptions !== prevOptions) {
setOptions(chart, nextOptions);
shouldUpdate = true;
}
}
if (nextDataProxy) {
const nextLabels = toRawIfProxy(nextDataProxy.labels);
const prevLabels = toRawIfProxy(prevDataProxy.labels);
const nextDatasets = toRawIfProxy(nextDataProxy.datasets);
const prevDatasets = toRawIfProxy(prevDataProxy.datasets);
if (nextLabels !== prevLabels) {
setLabels(chart.config.data, nextLabels);
shouldUpdate = true;
}
if (nextDatasets && nextDatasets !== prevDatasets) {
setDatasets(chart.config.data, nextDatasets, props.datasetIdKey);
shouldUpdate = true;
}
}
if (shouldUpdate) {
vue.nextTick(()=>{
update(chart);
});
}
}, {
deep: true
});
return ()=>{
return vue.h("canvas", {
role: "img",
"aria-label": props.ariaLabel,
"aria-describedby": props.ariaDescribedby,
ref: canvasRef
}, [
vue.h("p", {}, [
slots.default ? slots.default() : ""
])
]);
};
}
});
function createTypedChart(type, registerables) {
chart_js.Chart.register(registerables);
return vue.defineComponent({
props: CommonProps,
setup (props, param) {
let { expose } = param;
const chart = vue.shallowRef(null);
const chartComponentRef = vue.shallowRef(null);
vue.watch(()=>chartComponentRef.value?.chart ?? null, (nextChart)=>{
chart.value = nextChart;
}, {
flush: "sync"
});
expose({
chart
});
const reforwardRef = (instance)=>{
chartComponentRef.value = instance;
};
return ()=>{
return vue.h(Chart, compatProps({
ref: reforwardRef
}, {
type,
...props
}));
};
}
});
}
const Bar = /* #__PURE__ */ createTypedChart("bar", chart_js.BarController);
const Doughnut = /* #__PURE__ */ createTypedChart("doughnut", chart_js.DoughnutController);
const Line = /* #__PURE__ */ createTypedChart("line", chart_js.LineController);
const Pie = /* #__PURE__ */ createTypedChart("pie", chart_js.PieController);
const PolarArea = /* #__PURE__ */ createTypedChart("polarArea", chart_js.PolarAreaController);
const Radar = /* #__PURE__ */ createTypedChart("radar", chart_js.RadarController);
const Bubble = /* #__PURE__ */ createTypedChart("bubble", chart_js.BubbleController);
const Scatter = /* #__PURE__ */ createTypedChart("scatter", chart_js.ScatterController);
exports.Bar = Bar;
exports.Bubble = Bubble;
exports.Chart = Chart;
exports.Doughnut = Doughnut;
exports.Line = Line;
exports.Pie = Pie;
exports.PolarArea = PolarArea;
exports.Radar = Radar;
exports.Scatter = Scatter;
exports.createTypedChart = createTypedChart;
exports.getDatasetAtEvent = getDatasetAtEvent;
exports.getElementAtEvent = getElementAtEvent;
exports.getElementsAtEvent = getElementsAtEvent;
//# sourceMappingURL=index.cjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
import { Chart } from './chart.js';
import { createTypedChart, Bar, Doughnut, Line, Pie, PolarArea, Radar, Bubble, Scatter } from './typedCharts.js';
export type { ChartProps, ChartComponentRef } from './types.js';
export { getDatasetAtEvent, getElementAtEvent, getElementsAtEvent } from './utils.js';
export { Chart, createTypedChart, Bar, Doughnut, Line, Pie, PolarArea, Radar, Bubble, Scatter };
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EACL,gBAAgB,EAChB,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,OAAO,EACR,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,OAAO,EACR,CAAA"}
+259
View File
@@ -0,0 +1,259 @@
import { Chart as Chart$1, BarController, DoughnutController, LineController, PieController, PolarAreaController, RadarController, BubbleController, ScatterController } from 'chart.js';
import { version, isProxy, toRaw, defineComponent, ref, shallowRef, onMounted, onUnmounted, watch, nextTick, h } from 'vue';
const CommonProps = {
data: {
type: Object,
required: true
},
options: {
type: Object,
default: ()=>({})
},
plugins: {
type: Array,
default: ()=>[]
},
datasetIdKey: {
type: String,
default: "label"
},
updateMode: {
type: String,
default: undefined
}
};
const A11yProps = {
ariaLabel: {
type: String
},
ariaDescribedby: {
type: String
}
};
const Props = {
type: {
type: String,
required: true
},
destroyDelay: {
type: Number,
default: 0 // No delay by default
},
...CommonProps,
...A11yProps
};
const compatProps = version[0] === "2" ? (internals, props)=>Object.assign(internals, {
attrs: props
}) : (internals, props)=>Object.assign(internals, props);
function toRawIfProxy(obj) {
return isProxy(obj) ? toRaw(obj) : obj;
}
function cloneProxy(obj) {
let src = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : obj;
return isProxy(src) ? new Proxy(obj, {}) : obj;
}
function setOptions(chart, nextOptions) {
const options = chart.options;
if (options && nextOptions) {
Object.assign(options, nextOptions);
}
}
function setLabels(currentData, nextLabels) {
currentData.labels = nextLabels;
}
function setDatasets(currentData, nextDatasets, datasetIdKey) {
const addedDatasets = [];
currentData.datasets = nextDatasets.map((nextDataset)=>{
// given the new set, find it's current match
const currentDataset = currentData.datasets.find((dataset)=>dataset[datasetIdKey] === nextDataset[datasetIdKey]);
// There is no original to update, so simply add new one
if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) {
return {
...nextDataset
};
}
addedDatasets.push(currentDataset);
Object.assign(currentDataset, nextDataset);
return currentDataset;
});
}
function cloneData(data, datasetIdKey) {
const nextData = {
labels: [],
datasets: []
};
setLabels(nextData, data.labels);
setDatasets(nextData, data.datasets, datasetIdKey);
return nextData;
}
/**
* Get dataset from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/ function getDatasetAtEvent(chart, event) {
return chart.getElementsAtEventForMode(event, "dataset", {
intersect: true
}, false);
}
/**
* Get single dataset element from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/ function getElementAtEvent(chart, event) {
return chart.getElementsAtEventForMode(event, "nearest", {
intersect: true
}, false);
}
/**
* Get all dataset elements from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/ function getElementsAtEvent(chart, event) {
return chart.getElementsAtEventForMode(event, "index", {
intersect: true
}, false);
}
const Chart = defineComponent({
props: Props,
setup (props, param) {
let { expose , slots } = param;
const canvasRef = ref(null);
const chartRef = shallowRef(null);
expose({
chart: chartRef
});
const renderChart = ()=>{
if (!canvasRef.value) return;
const { type , data , options , plugins , datasetIdKey } = props;
const clonedData = cloneData(data, datasetIdKey);
const proxiedData = cloneProxy(clonedData, data);
chartRef.value = new Chart$1(canvasRef.value, {
type,
data: proxiedData,
options: {
...options
},
plugins
});
};
const destroyChart = ()=>{
const chart = toRaw(chartRef.value);
if (chart) {
if (props.destroyDelay > 0) {
setTimeout(()=>{
chart.destroy();
chartRef.value = null;
}, props.destroyDelay);
} else {
chart.destroy();
chartRef.value = null;
}
}
};
const update = (chart)=>{
chart.update(props.updateMode);
};
onMounted(renderChart);
onUnmounted(destroyChart);
watch([
()=>props.options,
()=>props.data
], (param, param1)=>{
let [nextOptionsProxy, nextDataProxy] = param, [prevOptionsProxy, prevDataProxy] = param1;
const chart = toRaw(chartRef.value);
if (!chart) {
return;
}
let shouldUpdate = false;
if (nextOptionsProxy) {
const nextOptions = toRawIfProxy(nextOptionsProxy);
const prevOptions = toRawIfProxy(prevOptionsProxy);
if (nextOptions && nextOptions !== prevOptions) {
setOptions(chart, nextOptions);
shouldUpdate = true;
}
}
if (nextDataProxy) {
const nextLabels = toRawIfProxy(nextDataProxy.labels);
const prevLabels = toRawIfProxy(prevDataProxy.labels);
const nextDatasets = toRawIfProxy(nextDataProxy.datasets);
const prevDatasets = toRawIfProxy(prevDataProxy.datasets);
if (nextLabels !== prevLabels) {
setLabels(chart.config.data, nextLabels);
shouldUpdate = true;
}
if (nextDatasets && nextDatasets !== prevDatasets) {
setDatasets(chart.config.data, nextDatasets, props.datasetIdKey);
shouldUpdate = true;
}
}
if (shouldUpdate) {
nextTick(()=>{
update(chart);
});
}
}, {
deep: true
});
return ()=>{
return h("canvas", {
role: "img",
"aria-label": props.ariaLabel,
"aria-describedby": props.ariaDescribedby,
ref: canvasRef
}, [
h("p", {}, [
slots.default ? slots.default() : ""
])
]);
};
}
});
function createTypedChart(type, registerables) {
Chart$1.register(registerables);
return defineComponent({
props: CommonProps,
setup (props, param) {
let { expose } = param;
const chart = shallowRef(null);
const chartComponentRef = shallowRef(null);
watch(()=>chartComponentRef.value?.chart ?? null, (nextChart)=>{
chart.value = nextChart;
}, {
flush: "sync"
});
expose({
chart
});
const reforwardRef = (instance)=>{
chartComponentRef.value = instance;
};
return ()=>{
return h(Chart, compatProps({
ref: reforwardRef
}, {
type,
...props
}));
};
}
});
}
const Bar = /* #__PURE__ */ createTypedChart("bar", BarController);
const Doughnut = /* #__PURE__ */ createTypedChart("doughnut", DoughnutController);
const Line = /* #__PURE__ */ createTypedChart("line", LineController);
const Pie = /* #__PURE__ */ createTypedChart("pie", PieController);
const PolarArea = /* #__PURE__ */ createTypedChart("polarArea", PolarAreaController);
const Radar = /* #__PURE__ */ createTypedChart("radar", RadarController);
const Bubble = /* #__PURE__ */ createTypedChart("bubble", BubbleController);
const Scatter = /* #__PURE__ */ createTypedChart("scatter", ScatterController);
export { Bar, Bubble, Chart, Doughnut, Line, Pie, PolarArea, Radar, Scatter, createTypedChart, getDatasetAtEvent, getElementAtEvent, getElementsAtEvent };
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long
+69
View File
@@ -0,0 +1,69 @@
import type { PropType } from 'vue';
import type { ChartData, Plugin } from 'chart.js';
export declare const CommonProps: {
readonly data: {
readonly type: PropType<ChartData<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>>;
readonly required: true;
};
readonly options: {
readonly type: PropType<import("chart.js/dist/types/utils")._DeepPartialObject<import("chart.js").CoreChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").ElementChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").PluginChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").DatasetChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").ScaleChartOptions<keyof import("chart.js").ChartTypeRegistry>>>;
readonly default: () => {};
};
readonly plugins: {
readonly type: PropType<Plugin<keyof import("chart.js").ChartTypeRegistry, import("chart.js/dist/types/basic").AnyObject>[]>;
readonly default: () => never[];
};
readonly datasetIdKey: {
readonly type: StringConstructor;
readonly default: "label";
};
readonly updateMode: {
readonly type: PropType<"resize" | "reset" | "none" | "hide" | "show" | "default" | "active">;
readonly default: undefined;
};
};
export declare const A11yProps: {
readonly ariaLabel: {
readonly type: StringConstructor;
};
readonly ariaDescribedby: {
readonly type: StringConstructor;
};
};
export declare const Props: {
readonly ariaLabel: {
readonly type: StringConstructor;
};
readonly ariaDescribedby: {
readonly type: StringConstructor;
};
readonly data: {
readonly type: PropType<ChartData<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>>;
readonly required: true;
};
readonly options: {
readonly type: PropType<import("chart.js/dist/types/utils")._DeepPartialObject<import("chart.js").CoreChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").ElementChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").PluginChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").DatasetChartOptions<keyof import("chart.js").ChartTypeRegistry> & import("chart.js").ScaleChartOptions<keyof import("chart.js").ChartTypeRegistry>>>;
readonly default: () => {};
};
readonly plugins: {
readonly type: PropType<Plugin<keyof import("chart.js").ChartTypeRegistry, import("chart.js/dist/types/basic").AnyObject>[]>;
readonly default: () => never[];
};
readonly datasetIdKey: {
readonly type: StringConstructor;
readonly default: "label";
};
readonly updateMode: {
readonly type: PropType<"resize" | "reset" | "none" | "hide" | "show" | "default" | "active">;
readonly default: undefined;
};
readonly type: {
readonly type: PropType<keyof import("chart.js").ChartTypeRegistry>;
readonly required: true;
};
readonly destroyDelay: {
readonly type: NumberConstructor;
readonly default: 0;
};
};
//# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAEV,SAAS,EAET,MAAM,EAEP,MAAM,UAAU,CAAA;AAEjB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CAqBd,CAAA;AAEV,eAAO,MAAM,SAAS;;;;;;;CAOZ,CAAA;AAEV,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWR,CAAA"}
@@ -0,0 +1,15 @@
import type { ChartType, ChartComponentLike, DefaultDataPoint } from 'chart.js';
import type { TypedChartComponent } from './types.js';
export declare function createTypedChart<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown>(type: TType, registerables: ChartComponentLike): TypedChartComponent<TType, TData, TLabel>;
export interface ExtendedDataPoint {
[key: string]: string | number | null | ExtendedDataPoint;
}
export declare const Bar: TypedChartComponent<"bar", (number | [number, number] | null)[] | ExtendedDataPoint[], unknown>;
export declare const Doughnut: TypedChartComponent<"doughnut", number[], unknown>;
export declare const Line: TypedChartComponent<"line", (number | import("chart.js").Point | null)[], unknown>;
export declare const Pie: TypedChartComponent<"pie", number[], unknown>;
export declare const PolarArea: TypedChartComponent<"polarArea", number[], unknown>;
export declare const Radar: TypedChartComponent<"radar", (number | null)[], unknown>;
export declare const Bubble: TypedChartComponent<"bubble", import("chart.js").BubbleDataPoint[], unknown>;
export declare const Scatter: TypedChartComponent<"scatter", (number | import("chart.js").Point | null)[], unknown>;
//# sourceMappingURL=typedCharts.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"typedCharts.d.ts","sourceRoot":"","sources":["../src/typedCharts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAa/E,OAAO,KAAK,EAAE,mBAAmB,EAAqB,MAAM,YAAY,CAAA;AAKxE,wBAAgB,gBAAgB,CAC9B,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO,EAEhB,IAAI,EAAE,KAAK,EACX,aAAa,EAAE,kBAAkB,GAChC,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAuC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,iBAAiB,CAAA;CAC1D;AAED,eAAO,MAAM,GAAG,iGAGO,CAAA;AAEvB,eAAO,MAAM,QAAQ,oDAGpB,CAAA;AAED,eAAO,MAAM,IAAI,oFAA2D,CAAA;AAE5E,eAAO,MAAM,GAAG,+CAAyD,CAAA;AAEzE,eAAO,MAAM,SAAS,qDAGrB,CAAA;AAED,eAAO,MAAM,KAAK,0DAA6D,CAAA;AAE/E,eAAO,MAAM,MAAM,8EAGlB,CAAA;AAED,eAAO,MAAM,OAAO,uFAGnB,CAAA"}
+41
View File
@@ -0,0 +1,41 @@
import type { DefineComponent } from 'vue';
import type { Chart as ChartJS, ChartType, ChartData, ChartOptions, DefaultDataPoint, Plugin, UpdateMode } from 'chart.js';
export interface ChartProps<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown> {
/**
* Chart.js chart type
*/
type: TType;
/**
* The data object that is passed into the Chart.js chart
* @see https://www.chartjs.org/docs/latest/getting-started/
*/
data: ChartData<TType, TData, TLabel>;
/**
* The options object that is passed into the Chart.js chart
* @see https://www.chartjs.org/docs/latest/general/options.html
* @default {}
*/
options?: ChartOptions<TType>;
/**
* The plugins array that is passed into the Chart.js chart
* @see https://www.chartjs.org/docs/latest/developers/plugins.html
* @default []
*/
plugins?: Plugin<TType>[];
/**
* Key name to identificate dataset
* @default 'label'
*/
datasetIdKey?: string;
/**
* A mode string to indicate transition configuration should be used.
* @see https://www.chartjs.org/docs/latest/developers/api.html#update-mode
*/
updateMode?: UpdateMode;
}
export interface ChartComponentRef<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown> {
chart: ChartJS<TType, TData, TLabel> | null;
}
export type ChartComponent = DefineComponent<ChartProps>;
export type TypedChartComponent<TType extends ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown> = DefineComponent<Omit<ChartProps<TType, TData, TLabel>, 'type'>>;
//# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAC1C,OAAO,KAAK,EACV,KAAK,IAAI,OAAO,EAChB,SAAS,EACT,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,UAAU,EACX,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,UAAU,CACzB,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO;IAEhB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;;OAGG;IACH,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACrC;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB,CAChC,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO;IAEhB,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;CAC5C;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;AAExD,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,SAAS,EACvB,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO,IACd,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA"}
+30
View File
@@ -0,0 +1,30 @@
import type { Chart, ChartType, ChartData, ChartDataset, ChartOptions, DefaultDataPoint } from 'chart.js';
export declare const compatProps: <I extends {}, T extends {}>(internals: I, props: T) => I & T;
export declare function toRawIfProxy<T>(obj: T): T;
export declare function cloneProxy<T extends object>(obj: T, src?: T): T;
export declare function setOptions<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown>(chart: Chart<TType, TData, TLabel>, nextOptions: ChartOptions<TType>): void;
export declare function setLabels<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown>(currentData: ChartData<TType, TData, TLabel>, nextLabels: TLabel[] | undefined): void;
export declare function setDatasets<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown>(currentData: ChartData<TType, TData, TLabel>, nextDatasets: ChartDataset<TType, TData>[], datasetIdKey: string): void;
export declare function cloneData<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown>(data: ChartData<TType, TData, TLabel>, datasetIdKey: string): ChartData<TType, TData, TLabel>;
/**
* Get dataset from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/
export declare function getDatasetAtEvent(chart: Chart, event: MouseEvent): import("chart.js").InteractionItem[];
/**
* Get single dataset element from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/
export declare function getElementAtEvent(chart: Chart, event: MouseEvent): import("chart.js").InteractionItem[];
/**
* Get all dataset elements from mouse click event
* @param chart - Chart.js instance
* @param event - Mouse click event
* @returns Dataset
*/
export declare function getElementsAtEvent(chart: Chart, event: MouseEvent): import("chart.js").InteractionItem[];
//# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EACjB,MAAM,UAAU,CAAA;AAEjB,eAAO,MAAM,WAAW,+DAKe,CAAA;AAEvC,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAErC;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,IAAM,KAE7D;AAED,wBAAgB,UAAU,CACxB,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO,EAChB,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,KAAK,CAAC,QAMrE;AAED,wBAAgB,SAAS,CACvB,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO,EAEhB,WAAW,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAC5C,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,QAGjC;AAED,wBAAgB,WAAW,CACzB,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO,EAEhB,WAAW,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAC5C,YAAY,EAAE,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAC1C,YAAY,EAAE,MAAM,QA4BrB;AAED,wBAAgB,SAAS,CACvB,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAC/B,MAAM,GAAG,OAAO,EAChB,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,mCAU5D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,wCAOhE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,wCAOhE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,wCAOjE"}