vue-socials
Version:
Social media share buttons and counts for Vue.js
78 lines (77 loc) • 2.55 kB
TypeScript
/**
* Hey!
*
* Base count mixin used for every social count component.
*/
import { Component, VNode } from 'vue';
export declare type TBaseCountDataOptions<R> = {
count: number | undefined;
response: R | null;
error: Error | string | null;
isLoading: boolean;
};
export declare type TBaseCountPropsOptions<T> = {
tag: Component | string;
shareOptions: T;
};
/**
* Wrapper around Vue mixin to pass parameters inside.
* We use multiple parameters instead of a single object because
* it causes problems with tree-shaking. I don't know why.
* A little bit inconvenient, but overall OK :)
*/
export default function BaseCount<T, R>(name: string, customShareOptions?: T, isShareOptionsRequired?: boolean, customAriaLabel?: string): import("vue").DefineComponent<{
/**
* Component tag
*/
tag: {
type: (ObjectConstructor | StringConstructor)[];
default: string;
};
/**
* Share parameters for social network
*/
shareOptions: {
type: ObjectConstructor;
default: () => T | (new (...args: any[]) => T & object) | (() => T) | ((new (...args: any[]) => T & object) | (() => T) | (T extends (...args: any) => any ? {
(): T;
new (): any;
readonly prototype: any;
} : never))[];
required: true;
};
}, unknown, TBaseCountDataOptions<R>, {
/**
* Calculate the aria-label for a counter.
* It replaces @s in a string with a social network name
* and @c with a count.
*/
ariaLabel(): string;
}, {
/**
* Save response from JSONP or HTTP and emit event
*/
handleResult(value: R): void;
/**
* Save response from JSONP or HTTP and emit event
*/
handleError(value: Error | string | null): void;
/**
* Save loading state and emit event
*/
handleLoading(value: boolean): void;
/**
* Save counter value and render inside element
*/
handleCount(count: number | undefined): void;
/**
* Create new count component
*/
generateComponent(): VNode;
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("error" | "loading" | "load")[], "error" | "loading" | "load", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
tag: string;
shareOptions: Record<string, any>;
} & {}>, {
tag: string;
shareOptions: Record<string, any>;
}>;