Skip to content

Commit

Permalink
feat: prepare for TS defs generation (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed May 15, 2020
1 parent 9696afc commit 2921654
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions @types/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type SplitLayoutOrientation = 'horizontal' | 'vertical';
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"dependencies": {
"polymer": "^2.0.0",
"iron-resizable-behavior": "^2.0.0",
"vaadin-themable-mixin": "vaadin/vaadin-themable-mixin#^1.2.1",
"vaadin-themable-mixin": "vaadin/vaadin-themable-mixin#^1.6.1",
"vaadin-lumo-styles": "vaadin/vaadin-lumo-styles#^1.1.0",
"vaadin-material-styles": "vaadin/vaadin-material-styles#^1.1.0",
"vaadin-element-mixin": "vaadin/vaadin-element-mixin#^2.3.0"
"vaadin-element-mixin": "vaadin/vaadin-element-mixin#^2.4.1"
},
"devDependencies": {
"iron-component-page": "^3.0.0",
Expand Down
14 changes: 14 additions & 0 deletions gen-tsd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"excludeFiles": [
"wct.conf.js",
"index.html",
"demo/**/*",
"test/**/*",
"theme/**/*"
],
"autoImport": {
"./@types/interfaces": [
"SplitLayoutOrientation"
]
}
}
11 changes: 11 additions & 0 deletions magi-p3-post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
files: [
'vaadin-split-layout.js'
],
from: [
/import '\.\/theme\/lumo\/vaadin-(.+)\.js';/
],
to: [
`import './theme/lumo/vaadin-$1.js';\nexport * from './src/vaadin-$1.js';`
]
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
},
"homepage": "https://vaadin.com/components",
"files": [
"vaadin-*.d.ts",
"vaadin-*.js",
"@types",
"src",
"theme"
],
Expand Down
21 changes: 21 additions & 0 deletions src/vaadin-split-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
*
* @memberof Vaadin
* @mixes Vaadin.ElementMixin
* @mixes Vaadin.ThemableMixin
* @mixes Polymer.GestureEventListeners
* @demo demo/index.html
Expand All @@ -240,23 +241,29 @@
return {
/**
* The split layout's orientation. Possible values are: `horizontal|vertical`.
* @type {!SplitLayoutOrientation}
*/
orientation: {
type: String,
reflectToAttribute: true,
value: 'horizontal'
},

/** @private */
_previousPrimaryPointerEvents: String,

/** @private */
_previousSecondaryPointerEvents: String
};
}

/** @protected */
ready() {
super.ready();
new Polymer.FlattenedNodesObserver(this, this._processChildren);
}

/** @private */
_processChildren() {
this.getEffectiveChildren().forEach((child, i) => {
if (i === 0) {
Expand All @@ -271,6 +278,7 @@
});
}

/** @private */
_setFlexBasis(element, flexBasis, containerSize) {
flexBasis = Math.max(0, Math.min(flexBasis, containerSize));
if (flexBasis === 0) {
Expand All @@ -280,6 +288,7 @@
element.style.flex = '1 1 ' + flexBasis + 'px';
}

/** @private */
_setPointerEventsNone(event) {
if (!this._primaryChild || !this._secondaryChild) {
return;
Expand All @@ -292,6 +301,7 @@
event.preventDefault();
}

/** @private */
_restorePointerEvents() {
if (!this._primaryChild || !this._secondaryChild) {
return;
Expand All @@ -300,6 +310,7 @@
this._secondaryChild.style.pointerEvents = this._previousSecondaryPointerEvents;
}

/** @private */
_onHandleTrack(event) {
if (!this._primaryChild || !this._secondaryChild) {
return;
Expand Down Expand Up @@ -332,6 +343,16 @@
}
}

/**
* Can be called to manually notify a resizable and its descendant
* resizables of a resize change.
*/
notifyResize() {
// NOTE: we have this method here to include it to TypeScript definitions.
// gen-typescript-declarations does not generate types for `mixinBehaviors`
super.notifyResize();
}

/**
* Fired when the splitter is dragged. Non-bubbling. Fired for the splitter
* element and any nested elements with `IronResizableBehavior`.
Expand Down

0 comments on commit 2921654

Please sign in to comment.