Skip to content

Commit 1da6af9

Browse files
committed
chore(ts): change file extension for some components and all moved to src
1 parent 4ed58cb commit 1da6af9

29 files changed

+65
-33
lines changed
File renamed without changes.

src/bounding.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
/**
3+
* @typedef {Object} Bounding
4+
* @property {Number} left left offset coordinate
5+
* @property {Number} top top offset coordinate
6+
* @property {Number} width
7+
* @property {Number} height
8+
*/
9+
export class Bounding
10+
{
11+
public left: number;
12+
public top: number;
13+
public width: number;
14+
public height: number;
15+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/edges.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
/**
3+
* @typedef {Object} Edges
4+
* @property {Boolean} top If the top edge was exceeded
5+
* @property {Boolean} right If the right edge was exceeded
6+
* @property {Boolean} bottom If the bottom edge was exceeded
7+
* @property {Boolean} left If the left edge was exceeded
8+
*/
9+
export class Edges {
10+
top: Boolean;
11+
right: Boolean;
12+
bottom: Boolean;
13+
left: Boolean;
14+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

js/tabs.js renamed to src/tabs.ts

+36-33
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
1-
(function($, anim) {
2-
'use strict';
3-
4-
let _defaults = {
5-
duration: 300,
6-
onShow: null,
7-
swipeable: false,
8-
responsiveThreshold: Infinity // breakpoint for swipeable
9-
};
10-
1+
import { Component } from "./component";
2+
import $ from "cash-dom";
3+
import { M } from "./global";
4+
import anim from "animejs";
5+
import { Carousel } from "./carousel";
6+
7+
let _defaults = {
8+
duration: 300,
9+
onShow: null,
10+
swipeable: false,
11+
responsiveThreshold: Infinity, // breakpoint for swipeable
12+
};
13+
14+
/**
15+
* @class
16+
*
17+
*/
18+
export class Tabs extends Component {
19+
$tabLinks: any;
20+
index: number;
21+
_indicator: any;
22+
_handleWindowResizeBound: (this: Window, ev: UIEvent) => any;
23+
_handleTabClickBound: (this: Window, ev: UIEvent) => any;
24+
tabWidth: number;
25+
$activeTabLink: any;
26+
$content: any;
27+
tabsWidth: number;
28+
_tabsCarousel: any;
1129
/**
12-
* @class
13-
*
30+
* Construct Tabs instance
31+
* @constructor
32+
* @param {Element} el
33+
* @param {Object} options
1434
*/
15-
class Tabs extends Component {
16-
/**
17-
* Construct Tabs instance
18-
* @constructor
19-
* @param {Element} el
20-
* @param {Object} options
21-
*/
22-
constructor(el, options) {
23-
super(Tabs, el, options);
24-
25-
this.el.M_Tabs = this;
35+
constructor(el, options: any) {
36+
super(Tabs, el, options);
2637

2738
/**
2839
* Options for the Tabs
@@ -82,7 +93,6 @@
8293
this._teardownNormalTabs();
8394
}
8495

85-
this.$el[0].M_Tabs = undefined;
8696
}
8797

8898
/**
@@ -145,7 +155,7 @@
145155

146156
// Update the variables with the new link and content
147157
this.$activeTabLink = tabLink;
148-
this.$content = $(M.escapeHash(tabLink[0].hash));
158+
this.$content = $(M.escapeHash((<any> tabLink[0]).hash));
149159
this.$tabLinks = this.$el.children('li.tab').children('a');
150160

151161
// Make the tab active.
@@ -259,7 +269,7 @@
259269
// Keep active tab index to set initial carousel slide
260270
let activeTabIndex = this.$activeTabLink.closest('.tab').index();
261271

262-
this._tabsCarousel = M.Carousel.init($tabsWrapper[0], {
272+
this._tabsCarousel = Carousel.init($tabsWrapper[0], {
263273
fullWidth: true,
264274
noWrap: true,
265275
onCycleTo: (item) => {
@@ -393,10 +403,3 @@
393403
}
394404
}
395405
}
396-
397-
M.Tabs = Tabs;
398-
399-
if (M.jQueryLoaded) {
400-
M.initializeJqueryWrapper(Tabs, 'tabs', 'M_Tabs');
401-
}
402-
})(cash, M.anime);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)