diff --git a/jquery/collapsibleTabs.d.ts b/jquery/collapsibleTabs.d.ts new file mode 100644 index 0000000..7fe542b --- /dev/null +++ b/jquery/collapsibleTabs.d.ts @@ -0,0 +1,42 @@ +/** + * CollapsibleTabsPlugin used in MediaWiki vector skin + * Copied from https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/skins/Vector/+/master/resources/CollapsibleTabsPlugin.d.ts + */ + +declare global { + interface JQueryStatic { + collapsibleTabs: CollapsibleTabsStatic; + } + interface JQuery { + collapsibleTabs(options: Partial): 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 {} + +export {} diff --git a/jquery/index.d.ts b/jquery/index.d.ts index f66a58f..382e5e4 100644 --- a/jquery/index.d.ts +++ b/jquery/index.d.ts @@ -1,3 +1,4 @@ import 'jquery'; import './textSelection'; +import './collapsibleTabs'; diff --git a/package.json b/package.json index 64257a0..36d3182 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "types-mediawiki", - "version": "0.5.1", + "version": "0.6.0", "description": "TypeScript definitions for MediaWiki JS interface", "types": "index.d.ts", "scripts": {