mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-25 08:06:22 +08:00
222
types/bootstrap/bootstrap-tests.ts
Normal file → Executable file
222
types/bootstrap/bootstrap-tests.ts
Normal file → Executable file
@@ -1,48 +1,204 @@
|
||||
$('body').off('.data-api');
|
||||
$('body').off('.alert.data-api');
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Alert
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
$(".btn.danger").button("toggle").addClass("fat");
|
||||
$("#myModal").modal();
|
||||
$("#myModal").modal({ keyboard: false });
|
||||
$("#myModal").modal('show');
|
||||
$("#alert").alert();
|
||||
|
||||
$('#myModal').on('show', (e) => e.preventDefault());
|
||||
$("#alert").alert("close");
|
||||
|
||||
$('#myModal').modal({ keyboard: false });
|
||||
$('#myModal').modal('toggle');
|
||||
$("#alert").on("close.bs.alert", () => {});
|
||||
|
||||
$('.dropdown-toggle').dropdown();
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Button
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
$('#navbar').scrollspy();
|
||||
$('body').scrollspy({ target: '#navbar-example' });
|
||||
// $("#button").button(); // must fail
|
||||
|
||||
$('#element').tooltip('show');
|
||||
$("#button").button("toggle");
|
||||
|
||||
$('#element').popover('show');
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Carousel
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
$(".alert").alert();
|
||||
$(".alert").alert('close');
|
||||
$("#carousel").carousel();
|
||||
|
||||
$('.nav-tabs').button();
|
||||
$().button('toggle');
|
||||
$("#carousel").carousel("pause");
|
||||
|
||||
$(".collapse").collapse();
|
||||
$("#carousel").carousel(100);
|
||||
|
||||
$('#myCollapsible').collapse({ toggle: false });
|
||||
|
||||
$('.carousel').carousel();
|
||||
$('.carousel').carousel({ interval: 2000 });
|
||||
|
||||
$('.typeahead').typeahead({
|
||||
matcher: item => true,
|
||||
sorter: (items: any[]) => items,
|
||||
updater: item => item,
|
||||
highlighter: item => ""
|
||||
$("#carousel").carousel({
|
||||
interval: 5000,
|
||||
keyboard: true,
|
||||
pause: "hover",
|
||||
wrap: true,
|
||||
});
|
||||
|
||||
$('#navbar').affix();
|
||||
$("#carousel").carousel({
|
||||
pause: false,
|
||||
});
|
||||
|
||||
$('.item').emulateTransitionEnd(2000);
|
||||
$("#carousel").on("slide.bs.carousel", function(ev) {
|
||||
const that: HTMLElement = this;
|
||||
const from: number = ev.from;
|
||||
const to: number = ev.to;
|
||||
const direction: string = ev.direction;
|
||||
const data: undefined = ev.data;
|
||||
});
|
||||
|
||||
$.support.transition = false;
|
||||
console.log(($.support.transition as any as TransitionEventNames).end === "transitionend");
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Dropdown
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
$("#dropdown").dropdown();
|
||||
|
||||
$("#dropdown").dropdown("update");
|
||||
|
||||
$("#dropdown").on("hide.bs.dropdown", () => {});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
offset: 10,
|
||||
flip: false,
|
||||
boundary: "window",
|
||||
});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
offset: "10px",
|
||||
});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
offset(offsets: BootstrapOffsetsExtend) {
|
||||
if (!this.flip)
|
||||
return { popper: { left: 100 } };
|
||||
return {};
|
||||
},
|
||||
});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
boundary: document.body,
|
||||
});
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Modal
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
$("#modal").modal();
|
||||
|
||||
$("#modal").modal("show");
|
||||
|
||||
$("#modal").on("hide.bs.modal", () => {});
|
||||
|
||||
$("#modal").modal({
|
||||
backdrop: false,
|
||||
focus: false,
|
||||
keyboard: false,
|
||||
show: false,
|
||||
});
|
||||
|
||||
$("#modal").modal({
|
||||
backdrop: "static",
|
||||
});
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Tooltip
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
$("#tooltip").tooltip();
|
||||
|
||||
$("#tooltip").tooltip("show");
|
||||
|
||||
$("#tooltip").on("hide.bs.tooltip", () => {});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
animation: false,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
container: "#container",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
container: document.getElementById("#container") as HTMLElement,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
container: false,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
delay: 250,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
delay: {show: 500, hide: 100},
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
html: true,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
placement: "auto",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
placement(this, tooltip, trigger) {
|
||||
console.log(this.tip === tooltip);
|
||||
console.log(this.element === trigger);
|
||||
console.log(this.config.html);
|
||||
return "left";
|
||||
},
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
selector: "[rel=\"tooltip\"]",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
selector: false,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
template: '<div class="tooltip empty" role="tooltip"></div>',
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
title: "Hello world",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
title: document.getElementById("title-element") as HTMLElement,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
title(this: Element) {
|
||||
return this.textContent as string;
|
||||
},
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
trigger: "focus hover",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
offset: 10,
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
offset: "10px",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
fallbackPlacement: "clockwise",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
fallbackPlacement: ["flip", "clockwise"],
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
boundary: "scrollParent",
|
||||
});
|
||||
|
||||
$("#tooltip").tooltip({
|
||||
boundary: document.body,
|
||||
});
|
||||
|
||||
370
types/bootstrap/index.d.ts
vendored
Normal file → Executable file
370
types/bootstrap/index.d.ts
vendored
Normal file → Executable file
@@ -1,133 +1,299 @@
|
||||
// Type definitions for Bootstrap 3.3.5
|
||||
// Project: http://twitter.github.com/bootstrap/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Type definitions for Bootstrap 4.0
|
||||
// Project: https://github.com/twbs/bootstrap/
|
||||
// Definitions by: denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// TODO: collapse, tab (list-group, navs), popovers, scrollspy
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
/// <reference types="jquery" />
|
||||
|
||||
interface ModalOptions {
|
||||
backdrop?: boolean|string;
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
remote?: string;
|
||||
// --------------------------------------------------------------------------
|
||||
// Some Types and Interfaces
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
type BootstrapPlacement = "auto" | "top" | "bottom" | "left" | "right";
|
||||
type PopperBehavior = "flip" | "clockwise" | "counterclockwise";
|
||||
|
||||
interface BootstrapDelay {
|
||||
show: number;
|
||||
hide: number;
|
||||
}
|
||||
|
||||
interface ModalOptionsBackdropString {
|
||||
backdrop?: string; // for "static"
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
remote?: string;
|
||||
interface BootstrapTooltipInstance {
|
||||
config: BootstrapTooltipOption;
|
||||
element: Element;
|
||||
tip: HTMLElement;
|
||||
}
|
||||
|
||||
interface ScrollSpyOptions {
|
||||
offset?: number;
|
||||
target?: string;
|
||||
interface BootstrapOffsetExtend {
|
||||
top?: number;
|
||||
left?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
interface TooltipOptions {
|
||||
animation?: boolean;
|
||||
html?: boolean;
|
||||
placement?: string | Function;
|
||||
selector?: string;
|
||||
title?: string | Function;
|
||||
trigger?: string;
|
||||
template?: string;
|
||||
delay?: number | Object;
|
||||
container?: string | boolean;
|
||||
viewport?: string | Function | Object;
|
||||
interface BootstrapOffsetsExtend {
|
||||
popper?: BootstrapOffsetExtend;
|
||||
reference?: BootstrapOffsetExtend;
|
||||
}
|
||||
|
||||
interface PopoverOptions {
|
||||
animation?: boolean;
|
||||
html?: boolean;
|
||||
placement?: string | Function;
|
||||
selector?: string;
|
||||
trigger?: string;
|
||||
title?: string | Function;
|
||||
template?: string;
|
||||
content?: any;
|
||||
delay?: number | Object;
|
||||
container?: string | boolean;
|
||||
viewport?: string | Function | Object;
|
||||
}
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Options Interfaces
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
interface CollapseOptions {
|
||||
parent?: any;
|
||||
toggle?: boolean;
|
||||
}
|
||||
|
||||
interface CarouselOptions {
|
||||
interface BootstrapCarouselOption {
|
||||
/**
|
||||
* The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.
|
||||
*
|
||||
* @default 5000
|
||||
*/
|
||||
interval?: number;
|
||||
pause?: string;
|
||||
wrap?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the carousel should react to keyboard events.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.
|
||||
* If set to false, hovering over the carousel won't pause it.
|
||||
* On touch-enabled devices, when set to "hover", cycling will pause on touchend (once the user finished interacting with the carousel)
|
||||
* for two intervals, before automatically resuming. Note that this is in addition to the above mouse behavior.
|
||||
*
|
||||
* @default "hover"
|
||||
*/
|
||||
pause?: "hover" | false;
|
||||
|
||||
/**
|
||||
* Whether the carousel should cycle continuously or have hard stops.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
wrap?: boolean;
|
||||
}
|
||||
|
||||
interface TypeaheadOptions {
|
||||
source?: any;
|
||||
items?: number;
|
||||
minLength?: number;
|
||||
matcher?: (item: any) => boolean;
|
||||
sorter?: (items: any[]) => any[];
|
||||
updater?: (item: any) => any;
|
||||
highlighter?: (item: any) => string;
|
||||
interface BootstrapDropdownOption {
|
||||
/**
|
||||
* Offset of the dropdown relative to its target.
|
||||
* For more information refer to Popper.js's offset docs.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
offset?: number | string | ((this: BootstrapDropdownOption, offset: BootstrapOffsetsExtend) => BootstrapOffsetsExtend);
|
||||
|
||||
/**
|
||||
* Allow Dropdown to flip in case of an overlapping on the reference element.
|
||||
* For more information refer to Popper.js's flip docs.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
flip?: boolean;
|
||||
|
||||
/**
|
||||
* Overflow constraint boundary of the dropdown menu.
|
||||
* Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only).
|
||||
* For more information refer to Popper.js's preventOverflow docs.
|
||||
*
|
||||
* @default "scrollParent"
|
||||
*/
|
||||
boundary?: "viewport" | "window" | "scrollParent" | HTMLElement;
|
||||
}
|
||||
|
||||
interface AffixOptions {
|
||||
offset?: number | Function | Object;
|
||||
target?: any;
|
||||
interface BootstrapModalOption {
|
||||
/**
|
||||
* Includes a modal-backdrop element.
|
||||
* Alternatively, specify static for a backdrop which doesn't close the modal on click.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
backdrop?: boolean | "static";
|
||||
|
||||
/**
|
||||
* Closes the modal when escape key is pressed.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* Puts the focus on the modal when initialized.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
focus?: boolean;
|
||||
|
||||
/**
|
||||
* Shows the modal when initialized.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
show?: boolean;
|
||||
}
|
||||
|
||||
interface TransitionEventNames {
|
||||
end: string;
|
||||
interface BootstrapTooltipOption {
|
||||
/**
|
||||
* Apply a CSS fade transition to the tooltip.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
animation?: boolean;
|
||||
|
||||
/**
|
||||
* Appends the tooltip to a specific element. Example: `container: 'body'`.
|
||||
* This option is particularly useful in that it allows you to position the tooltip
|
||||
* in the flow of the document near the triggering element - which will prevent
|
||||
* the tooltip from floating away from the triggering element during a window resize.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
container?: string | Element | false;
|
||||
|
||||
/**
|
||||
* Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type.
|
||||
* If a number is supplied, delay is applied to both hide/show.
|
||||
* Object structure is: `delay: { "show": 500, "hide": 100 }`.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
delay?: number | BootstrapDelay;
|
||||
|
||||
/**
|
||||
* Allow HTML in the tooltip.
|
||||
* If true, HTML tags in the tooltip's title will be rendered in the tooltip.
|
||||
* If false, jQuery's text method will be used to insert content into the DOM.
|
||||
* Use text if you're worried about XSS attacks.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
html?: boolean;
|
||||
|
||||
/**
|
||||
* How to position the tooltip - auto | top | bottom | left | right.
|
||||
* When auto is specified, it will dynamically reorient the tooltip.
|
||||
* When a function is used to determine the placement, it is called with
|
||||
* the tooltip DOM node as its first argument and the triggering element DOM node as its second.
|
||||
* The this context is set to the tooltip instance.
|
||||
*
|
||||
* @default "top"
|
||||
*/
|
||||
placement?: BootstrapPlacement | ((this: BootstrapTooltipInstance, tooltip: HTMLElement, trigger: Element) => BootstrapPlacement);
|
||||
|
||||
/**
|
||||
* If a selector is provided, tooltip objects will be delegated to the specified targets.
|
||||
* In practice, this is used to enable dynamic HTML content to have popovers added.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
selector?: string | false;
|
||||
|
||||
/**
|
||||
* Base HTML to use when creating the tooltip. The tooltip's title will be injected into
|
||||
* the `.tooltip-inner`. The `.arrow` will become the tooltip's arrow.
|
||||
* The outermost wrapper element should have the `.tooltip` class and `role="tooltip"`.
|
||||
*
|
||||
* @default '<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
*/
|
||||
template?: string;
|
||||
|
||||
/**
|
||||
* Default title value if title attribute isn't present.
|
||||
* If a function is given, it will be called with its this reference set to the element
|
||||
* that the tooltip is attached to.
|
||||
*
|
||||
* @default ""
|
||||
*/
|
||||
title?: string | Element | ((this: Element) => string);
|
||||
|
||||
/**
|
||||
* How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
|
||||
* 'manual' indicates that the tooltip will be triggered programmatically via the .tooltip('show'), .tooltip('hide') and
|
||||
* .tooltip('toggle') methods; this value cannot be combined with any other trigger.
|
||||
* 'hover' on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if
|
||||
* alternative methods for conveying the same information for keyboard users is present.
|
||||
*
|
||||
* @default "hover focus"
|
||||
*/
|
||||
trigger?: string;
|
||||
|
||||
/**
|
||||
* Offset of the tooltip relative to its target.
|
||||
* For more information refer to Popper.js's offset docs.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
offset?: number | string;
|
||||
|
||||
/**
|
||||
* Allow to specify which position Popper will use on fallback.
|
||||
* For more information refer to Popper.js's behavior docs.
|
||||
*
|
||||
* @default "flip"
|
||||
*/
|
||||
fallbackPlacement?: PopperBehavior | PopperBehavior[];
|
||||
|
||||
/**
|
||||
* Overflow constraint boundary of the tooltip.
|
||||
* Accepts the values of 'viewport', 'window', 'scrollParent',
|
||||
* or an HTMLElement reference (JavaScript only).
|
||||
* For more information refer to Popper.js's preventOverflow docs.
|
||||
*
|
||||
* @default "scrollParent"
|
||||
*/
|
||||
boundary?: "viewport" | "window" | "scrollParent" | HTMLElement;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
modal(options?: ModalOptions): JQuery;
|
||||
modal(options?: ModalOptionsBackdropString): JQuery;
|
||||
modal(command: string, relatedTarget?: Element): JQuery;
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Events
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
dropdown(): JQuery;
|
||||
dropdown(command: string): JQuery;
|
||||
interface BootstrapCarouselEventHandler<TElement> extends JQuery.Event<TElement, undefined> {
|
||||
/**
|
||||
* The direction in which the carousel is sliding.
|
||||
*/
|
||||
direction: "left" | "right";
|
||||
|
||||
scrollspy(command: string): JQuery;
|
||||
scrollspy(options?: ScrollSpyOptions): JQuery;
|
||||
/**
|
||||
* The index of the current item.
|
||||
*/
|
||||
from: number;
|
||||
|
||||
tab(): JQuery;
|
||||
tab(command: string): JQuery;
|
||||
|
||||
tooltip(options?: TooltipOptions): JQuery;
|
||||
tooltip(command: string): JQuery;
|
||||
|
||||
popover(options?: PopoverOptions): JQuery;
|
||||
popover(command: string): JQuery;
|
||||
|
||||
alert(): JQuery;
|
||||
alert(command: string): JQuery;
|
||||
|
||||
button(): JQuery;
|
||||
button(command: string): JQuery;
|
||||
|
||||
collapse(options?: CollapseOptions): JQuery;
|
||||
collapse(command: string): JQuery;
|
||||
|
||||
carousel(options?: CarouselOptions): JQuery;
|
||||
carousel(command: string): JQuery;
|
||||
carousel(index: number): JQuery;
|
||||
|
||||
typeahead(options?: TypeaheadOptions): JQuery;
|
||||
|
||||
affix(options?: AffixOptions): JQuery;
|
||||
affix(command: string): JQuery;
|
||||
|
||||
emulateTransitionEnd(duration: number): JQuery;
|
||||
/**
|
||||
* The index of the next item.
|
||||
*/
|
||||
to: number;
|
||||
}
|
||||
|
||||
interface JQuerySupport {
|
||||
transition: boolean | TransitionEventNames;
|
||||
}
|
||||
type BootstrapAlertEvent = "close.bs.alert" | "closed.bs.alert";
|
||||
type BootstrapCarouselEvent = "slide.bs.carousel" | "slid.bs.carousel";
|
||||
type BootstrapDropdownEvent = "show.bs.dropdown" | "shown.bs.dropdown" | "hide.bs.dropdown" | "hidden.bs.dropdown";
|
||||
type BootstrapModalEvent = "show.bs.modal" | "shown.bs.modal" | "hide.bs.modal" | "hidden.bs.modal";
|
||||
type BootstrapTooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.tooltip" | "hidden.bs.tooltip" | "inserted.bs.tooltip";
|
||||
|
||||
declare module "bootstrap" {
|
||||
// --------------------------------------------------------------------------------------
|
||||
// jQuery
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> {
|
||||
alert(action?: "close" | "dispose"): this;
|
||||
|
||||
button(action: "toggle" | "dispose"): this;
|
||||
|
||||
carousel(action: "cycle" | "pause" | number | "prev" | "next" | "dispose"): this;
|
||||
carousel(options?: BootstrapCarouselOption): this;
|
||||
|
||||
dropdown(action: "toggle" | "update" | "dispose"): this;
|
||||
dropdown(options?: BootstrapDropdownOption): this;
|
||||
|
||||
modal(action: "toggle" | "show" | "hide" | "handleUpdate" | "dispose"): this;
|
||||
modal(options?: BootstrapModalOption): this;
|
||||
|
||||
tooltip(action: "show" | "hide" | "toggle" | "dispose" | "enable" | "disable" | "toggleEnabled" | "update"): this;
|
||||
tooltip(options?: BootstrapTooltipOption): this;
|
||||
|
||||
on(events: BootstrapCarouselEvent, handler: JQuery.EventHandlerBase<TElement, BootstrapCarouselEventHandler<TElement>>): this;
|
||||
on(events: BootstrapAlertEvent | BootstrapDropdownEvent | BootstrapModalEvent | BootstrapTooltipEvent,
|
||||
handler: JQuery.EventHandler<TElement>): this;
|
||||
}
|
||||
|
||||
5
types/bootstrap/tsconfig.json
Normal file → Executable file
5
types/bootstrap/tsconfig.json
Normal file → Executable file
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -15,7 +15,8 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
80
types/bootstrap/tslint.json
Normal file → Executable file
80
types/bootstrap/tslint.json
Normal file → Executable file
@@ -1,79 +1 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
48
types/bootstrap/v3/bootstrap-tests.ts
Normal file
48
types/bootstrap/v3/bootstrap-tests.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
$('body').off('.data-api');
|
||||
$('body').off('.alert.data-api');
|
||||
|
||||
$(".btn.danger").button("toggle").addClass("fat");
|
||||
$("#myModal").modal();
|
||||
$("#myModal").modal({ keyboard: false });
|
||||
$("#myModal").modal('show');
|
||||
|
||||
$('#myModal').on('show', (e) => e.preventDefault());
|
||||
|
||||
$('#myModal').modal({ keyboard: false });
|
||||
$('#myModal').modal('toggle');
|
||||
|
||||
$('.dropdown-toggle').dropdown();
|
||||
|
||||
$('#navbar').scrollspy();
|
||||
$('body').scrollspy({ target: '#navbar-example' });
|
||||
|
||||
$('#element').tooltip('show');
|
||||
|
||||
$('#element').popover('show');
|
||||
|
||||
$(".alert").alert();
|
||||
$(".alert").alert('close');
|
||||
|
||||
$('.nav-tabs').button();
|
||||
$().button('toggle');
|
||||
|
||||
$(".collapse").collapse();
|
||||
|
||||
$('#myCollapsible').collapse({ toggle: false });
|
||||
|
||||
$('.carousel').carousel();
|
||||
$('.carousel').carousel({ interval: 2000 });
|
||||
|
||||
$('.typeahead').typeahead({
|
||||
matcher: item => true,
|
||||
sorter: (items: any[]) => items,
|
||||
updater: item => item,
|
||||
highlighter: item => ""
|
||||
});
|
||||
|
||||
$('#navbar').affix();
|
||||
|
||||
$('.item').emulateTransitionEnd(2000);
|
||||
|
||||
$.support.transition = false;
|
||||
console.log(($.support.transition as any as TransitionEventNames).end === "transitionend");
|
||||
133
types/bootstrap/v3/index.d.ts
vendored
Normal file
133
types/bootstrap/v3/index.d.ts
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
// Type definitions for Bootstrap 3.3.5
|
||||
// Project: http://twitter.github.com/bootstrap/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
interface ModalOptions {
|
||||
backdrop?: boolean|string;
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
remote?: string;
|
||||
}
|
||||
|
||||
interface ModalOptionsBackdropString {
|
||||
backdrop?: string; // for "static"
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
remote?: string;
|
||||
}
|
||||
|
||||
interface ScrollSpyOptions {
|
||||
offset?: number;
|
||||
target?: string;
|
||||
}
|
||||
|
||||
interface TooltipOptions {
|
||||
animation?: boolean;
|
||||
html?: boolean;
|
||||
placement?: string | Function;
|
||||
selector?: string;
|
||||
title?: string | Function;
|
||||
trigger?: string;
|
||||
template?: string;
|
||||
delay?: number | Object;
|
||||
container?: string | boolean;
|
||||
viewport?: string | Function | Object;
|
||||
}
|
||||
|
||||
interface PopoverOptions {
|
||||
animation?: boolean;
|
||||
html?: boolean;
|
||||
placement?: string | Function;
|
||||
selector?: string;
|
||||
trigger?: string;
|
||||
title?: string | Function;
|
||||
template?: string;
|
||||
content?: any;
|
||||
delay?: number | Object;
|
||||
container?: string | boolean;
|
||||
viewport?: string | Function | Object;
|
||||
}
|
||||
|
||||
interface CollapseOptions {
|
||||
parent?: any;
|
||||
toggle?: boolean;
|
||||
}
|
||||
|
||||
interface CarouselOptions {
|
||||
interval?: number;
|
||||
pause?: string;
|
||||
wrap?: boolean;
|
||||
keyboard?: boolean;
|
||||
}
|
||||
|
||||
interface TypeaheadOptions {
|
||||
source?: any;
|
||||
items?: number;
|
||||
minLength?: number;
|
||||
matcher?: (item: any) => boolean;
|
||||
sorter?: (items: any[]) => any[];
|
||||
updater?: (item: any) => any;
|
||||
highlighter?: (item: any) => string;
|
||||
}
|
||||
|
||||
interface AffixOptions {
|
||||
offset?: number | Function | Object;
|
||||
target?: any;
|
||||
}
|
||||
|
||||
interface TransitionEventNames {
|
||||
end: string;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
modal(options?: ModalOptions): JQuery;
|
||||
modal(options?: ModalOptionsBackdropString): JQuery;
|
||||
modal(command: string, relatedTarget?: Element): JQuery;
|
||||
|
||||
dropdown(): JQuery;
|
||||
dropdown(command: string): JQuery;
|
||||
|
||||
scrollspy(command: string): JQuery;
|
||||
scrollspy(options?: ScrollSpyOptions): JQuery;
|
||||
|
||||
tab(): JQuery;
|
||||
tab(command: string): JQuery;
|
||||
|
||||
tooltip(options?: TooltipOptions): JQuery;
|
||||
tooltip(command: string): JQuery;
|
||||
|
||||
popover(options?: PopoverOptions): JQuery;
|
||||
popover(command: string): JQuery;
|
||||
|
||||
alert(): JQuery;
|
||||
alert(command: string): JQuery;
|
||||
|
||||
button(): JQuery;
|
||||
button(command: string): JQuery;
|
||||
|
||||
collapse(options?: CollapseOptions): JQuery;
|
||||
collapse(command: string): JQuery;
|
||||
|
||||
carousel(options?: CarouselOptions): JQuery;
|
||||
carousel(command: string): JQuery;
|
||||
carousel(index: number): JQuery;
|
||||
|
||||
typeahead(options?: TypeaheadOptions): JQuery;
|
||||
|
||||
affix(options?: AffixOptions): JQuery;
|
||||
affix(command: string): JQuery;
|
||||
|
||||
emulateTransitionEnd(duration: number): JQuery;
|
||||
}
|
||||
|
||||
interface JQuerySupport {
|
||||
transition: boolean | TransitionEventNames;
|
||||
}
|
||||
|
||||
declare module "bootstrap" {
|
||||
}
|
||||
29
types/bootstrap/v3/tsconfig.json
Normal file
29
types/bootstrap/v3/tsconfig.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"bootstrap": [
|
||||
"bootstrap/v3"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap-tests.ts"
|
||||
]
|
||||
}
|
||||
79
types/bootstrap/v3/tslint.json
Normal file
79
types/bootstrap/v3/tslint.json
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
5
types/knockstrap/index.d.ts
vendored
5
types/knockstrap/index.d.ts
vendored
@@ -4,9 +4,8 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
///<reference types="jquery" />
|
||||
///<reference types="bootstrap" />
|
||||
///<reference types="knockout" />
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="knockout" />
|
||||
|
||||
interface KnockoutUtils {
|
||||
uniqueId(prefix: string): string;
|
||||
|
||||
Reference in New Issue
Block a user