Skip to content

Commit 803bba8

Browse files
committed
Types - Add types for exposed methods
1 parent 119d9b5 commit 803bba8

File tree

1 file changed

+113
-1
lines changed

1 file changed

+113
-1
lines changed

types/vue-data-ui.d.ts

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5929,5 +5929,117 @@ declare module 'vue-data-ui' {
59295929

59305930
export type VueDataUiConfigKey = "vue_ui_3d_bar" | "vue_ui_age_pyramid" | "vue_ui_annotator" | "vue_ui_candlestick" | "vue_ui_chestnut" | "vue_ui_dashboard" | "vue_ui_digits" | "vue_ui_donut" | "vue_ui_donut_evolution" | "vue_ui_gauge" | "vue_ui_heatmap" | "vue_ui_mini_loader" | "vue_ui_molecule" | "vue_ui_mood_radar" | "vue_ui_onion" | "vue_ui_quadrant" | "vue_ui_radar" | "vue_ui_rating" | "vue_ui_relation_circle" | "vue_ui_rings" | "vue_ui_scatter" | "vue_ui_screenshot" | "vue_ui_skeleton" | "vue_ui_smiley" | "vue_ui_sparkhistogram" | "vue_ui_sparkstackbar" | "vue_ui_sparkbar" | "vue_ui_sparkline" | "vue_ui_table" | "vue_ui_table_sparkline" | "vue_ui_thermometer" | "vue_ui_tiremarks" | "vue_ui_vertical_bar" | "vue_ui_waffle" | "vue_ui_wheel" | "vue_ui_xy" | "vue_ui_nested_donuts" | "vue_ui_galaxy" | "vue_ui_kpi" | "vue_ui_treemap" | "vue_ui_table_heatmap" | "vue_ui_accordion" | "vue_ui_quick_chart" | "vue_ui_cursor" | "vue_ui_spark_trend" | "vue_ui_strip_plot" | "vue_ui_dumbbell" | "vue_ui_word_cloud" | "vue_ui_xy_canvas" | "vue_ui_flow" | "vue_ui_parallel_coordinate_plot" | "vue_ui_timer" | "vue_ui_carousel_table" | "vue_ui_gizmo" | "vue_ui_stackbar" | "vue_ui_bullet" | "vue_ui_funnel" | "vue_ui_history_plot";
59315931

5932-
export const getVueDataUiConfig: () => VueDataUiConfig;
5932+
export type VueDataUiWordCloudTransformCallback = ((word: string) => string) | null;
5933+
5934+
/**
5935+
* Vue Data UI utility
5936+
* ---
5937+
* Create a dataset for VueUiWordCloud from a string
5938+
* ___
5939+
* @example
5940+
* const dataset = createWordCloudDatasetFromPlainText('Lorem Ipsum Dolor', (w) => w.toUpperCase())
5941+
*
5942+
* @param text - The text from which the dataset will be generated
5943+
* @param callback - Optional transform callback to format each word of the dataset
5944+
*/
5945+
export const createWordCloudDatasetFromPlainText: (text: string, callback?: VueDataUiWordCloudTransformCallback ) => VueUiWordCloudDatasetItem[];
5946+
5947+
export type VueDataUiAbbreviatePayload = {
5948+
source: string;
5949+
length?: number;
5950+
}
5951+
5952+
/**
5953+
* Vue Data UI utility
5954+
* ---
5955+
* Abbreviate a string to a given length
5956+
* ___
5957+
* @example
5958+
* const label = abbreviate({
5959+
* source: 'Lorem Ipsum Dolor',
5960+
* length: 3
5961+
* })
5962+
*
5963+
* @param source - The string to abbreviate
5964+
* @param length - The number of letters to return (defaults to 3)
5965+
*/
5966+
export const abbreviate: (payload: VueDataUiAbbreviatePayload) => string;
5967+
5968+
/**
5969+
* Vue Data UI utility
5970+
* ---
5971+
* Get the color palette for a given theme
5972+
* ___
5973+
* @example
5974+
* const palette = getPalette("hack");
5975+
*
5976+
* @param theme - The theme for which the palette is requested (e.g., "hack" | "zen", | "concrete")
5977+
*/
5978+
export const getPalette: (theme: Theme) => string[];
5979+
5980+
/**
5981+
* Vue Data UI utility
5982+
* ---
5983+
* Get the default config for a given component
5984+
* ___
5985+
* @example
5986+
* const defaultConfig = getVueDataUiConfig("vue_ui_xy");
5987+
*
5988+
* @param key - The key of the component in snake case (e.g., "vue_ui_xy")
5989+
*/
5990+
export const getVueDataUiConfig: (key: VueDataUiConfigKey) => VueDataUiConfig;
5991+
5992+
/**
5993+
* Vue Data UI utility
5994+
* ---
5995+
* Lightens a color by a specified strength.
5996+
* ___
5997+
* @example
5998+
* const color = lightenColor("#FF0000", 0.25);
5999+
* const color = lightenColor("#FF000080", 0.25);
6000+
* const color = lightenColor("rgb(255,0,0)", 0.25);
6001+
* const color = lightenColor("rgb(255,0,0,0.5)", 0.25);
6002+
* const color = lightenColor("red", 0.25);
6003+
*
6004+
* @param color - The input color. Can be hexadecimal (e.g., "#FF0000", or "#FF000080" with alpha channel), RGB or RGBA, or a named color.
6005+
* @param strength - The strength to lighten the color, typically a value between 0 and 1.
6006+
* @returns The lightened color in hexadecimal format.
6007+
*/
6008+
export const lightenColor: (color: string, strength: number) => string;
6009+
6010+
/**
6011+
* Vue Data UI utility
6012+
* ---
6013+
* Darkens a color by a specified strength.
6014+
* ___
6015+
* @example
6016+
* const color = darkenColor("#FF0000", 0.25);
6017+
* const color = darkenColor("#FF000080", 0.25);
6018+
* const color = darkenColor("rgb(255,0,0)", 0.25);
6019+
* const color = darkenColor("rgb(255,0,0,0.5)", 0.25);
6020+
* const color = darkenColor("red", 0.25);
6021+
*
6022+
* @param color - The input color. Can be hexadecimal (e.g., "#FF0000", or "#FF000080" with alpha channel), or RGB or RGBA.
6023+
* @param strength - The strength to darken the color, typically a value between 0 and 1.
6024+
* @returns The darkened color in hexadecimal format.
6025+
*/
6026+
export const darkenColor: (color: string, strength: number) => string;
6027+
6028+
/**
6029+
* Vue Data UI utility
6030+
* ---
6031+
* Shifts hue for a given color, by a given strength.
6032+
* ___
6033+
* @example
6034+
* const color = shiftColorHue("#FF0000", 0.25);
6035+
* const color = shiftColorHue("#FF000080", 0.25);
6036+
* const color = shiftColorHue("rgb(255,0,0)", 0.25);
6037+
* const color = shiftColorHue("rgb(255,0,0,0.5)", 0.25);
6038+
* const color = shiftColorHue("red", 0.25);
6039+
*
6040+
* @param color - The input color. Can be hexadecimal (e.g., "#FF0000", or "#FF000080" with alpha channel), or RGB or RGBA.
6041+
* @param strength - The strength to darken the color, typically a value between 0 and 1.
6042+
* @returns The shifted color in hexadecimal format.
6043+
*/
6044+
export const shiftColorHue: (color: string, strength: number) => string;
59336045
}

0 commit comments

Comments
 (0)