mediawiki-skins-Vector/resources/CollapsibleTabsPlugin.d.ts
Stephen Niedzielski bd7bd75569 [JavaScript] Validate types
Lift the mists of confusion by checking that all JavaScript types align.
No ignores! This is the JavaScript equivalent to Phan.

This patch adds the necessary infrastructure for verifying typing and
fixes the few flaws found.

Bug: T239262
Change-Id: I2557471421196ea46cd13dfb786a52968fbfcc97
2020-03-16 09:10:08 -06:00

35 lines
1.1 KiB
TypeScript

interface JQueryStatic {
collapsibleTabs: CollapsibleTabsStatic;
}
interface JQuery {
collapsibleTabs(options: Partial<CollapsibleTabsOptions>): void;
}
/** A jQuery plugin that makes collapsible tabs for the Vector skin. */
interface CollapsibleTabsOptions {
/** Optional tab selector. Defaults to `#p-views ul`. */
expandedContainer: string;
/** Optional menu item selector. Defaults to `#p-cactions ul`. */
collapsedContainer: string;
/** Optional selector for tabs that are collapsible. Defaults to `li.collapsible`. */
collapsible: string;
shifting: boolean;
expandedWidth: number;
expandCondition(eleWidth: number): boolean;
collapseCondition(): boolean;
}
interface CollapsibleTabsStatic {
defaults: CollapsibleTabsOptions;
instances: JQuery[];
addData($collapsible: JQuery): void;
getSettings($collapsible: JQuery): CollapsibleTabsOptions;
handleResize(): void;
moveToCollapsed($moving: JQuery): void;
moveToExpanded($moving: JQuery): void;
calculateTabDistance(): number;
}
interface CollapsibleTabs extends CollapsibleTabsStatic, CollapsibleTabsOptions {}