Skip to content

Commit

Permalink
Refactory
Browse files Browse the repository at this point in the history
  • Loading branch information
ismail-codar committed Sep 26, 2017
1 parent d091e0c commit ead7c94
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 31 deletions.
14 changes: 7 additions & 7 deletions all.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import onmouse, { SMouseEventType } from './mouse';
import onkey, { SKeyboardEventType } from './keyboard';
import ondrag, { SDragEventType } from './drag';
import classes, { SClassType } from './class';
import styles, { SStyleType } from './style';
import attrs, { SAttributeType } from './attribute';
import { attrs, SAttributeType } from './attribute';
import { styles, SStyleType } from './style';
import { classes, SClassType } from './class';
import { SDragEventType } from './drag';
import { onkey, SKeyboardEventType } from './keyboard';
import { onmouse, SMouseEventType } from './mouse';
import S from 's-js';

export const addEvents = (node: Node, arg: any) => {
Expand Down Expand Up @@ -33,7 +33,7 @@ const mixinMap: any = {
styles: styles,
attrs: attrs
};
export default function mixins(...args: ISurplusMixins[]) {
export function mixins(...args: ISurplusMixins[]) {
return function mixins(node: any) {
if (args) {
args.forEach((arg: any) => {
Expand Down
2 changes: 1 addition & 1 deletion attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type SAttributeType = {
[k: string]: any
}

export default function attrs(...args: SAttributeType[]) {
export function attrs(...args: SAttributeType[]) {
return function attrs(node: HTMLElement) {
if (args) {
args.forEach((arg: SAttributeType) => {
Expand Down
2 changes: 1 addition & 1 deletion class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type SClassType = {
[k: string]: DataSignal<boolean> | boolean
}

export default function classes(...args: SClassType[]) {
export function classes(...args: SClassType[]) {
return function classes(node: any) {
if (args) {
const classNames: any[] = []
Expand Down
12 changes: 6 additions & 6 deletions dist/all.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SMouseEventType } from './mouse';
import { SKeyboardEventType } from './keyboard';
import { SDragEventType } from './drag';
import { SClassType } from './class';
import { SStyleType } from './style';
import { SAttributeType } from './attribute';
import { SStyleType } from './style';
import { SClassType } from './class';
import { SDragEventType } from './drag';
import { SKeyboardEventType } from './keyboard';
import { SMouseEventType } from './mouse';
export declare const addEvents: (node: Node, arg: any) => void;
export declare type ISurplusMixins = {
onmouse?: SMouseEventType;
Expand All @@ -13,4 +13,4 @@ export declare type ISurplusMixins = {
styles?: SStyleType | SStyleType[];
attrs?: SAttributeType | SAttributeType;
};
export default function mixins(...args: ISurplusMixins[]): (node: any) => void;
export declare function mixins(...args: ISurplusMixins[]): (node: any) => void;
2 changes: 1 addition & 1 deletion dist/attribute.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare type SAttributeType = {
[k: string]: any;
};
export default function attrs(...args: SAttributeType[]): (node: HTMLElement) => void;
export declare function attrs(...args: SAttributeType[]): (node: HTMLElement) => void;
2 changes: 1 addition & 1 deletion dist/class.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { DataSignal } from 's-js';
export declare type SClassType = {
[k: string]: DataSignal<boolean> | boolean;
};
export default function classes(...args: SClassType[]): (node: any) => void;
export declare function classes(...args: SClassType[]): (node: any) => void;
2 changes: 1 addition & 1 deletion dist/drag.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare type SDragEventType = {
[k in "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop"]?: (evt: DragEvent) => void;
};
export default function ondrag(arg: SDragEventType): (node: Node) => void;
export declare function ondrag(arg: SDragEventType): (node: Node) => void;
7 changes: 7 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from './all';
export * from './attribute';
export * from './class';
export * from './drag';
export * from './keyboard';
export * from './mouse';
export * from './style';
1 change: 0 additions & 1 deletion dist/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/keyboard.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare type SKeyboardEventType = {
[k in "keydown" | "keyup" | "keypress"]?: (evt: KeyboardEvent) => void;
};
export default function onkey(arg: SKeyboardEventType): (node: Node) => void;
export declare function onkey(arg: SKeyboardEventType): (node: Node) => void;
77 changes: 77 additions & 0 deletions dist/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Generated by dts-bundle v0.7.3
// Dependencies for this module:
// ../s-js

declare module 'surplus-mixins' {
export * from 'surplus-mixins/all';
export * from 'surplus-mixins/attribute';
export * from 'surplus-mixins/class';
export * from 'surplus-mixins/drag';
export * from 'surplus-mixins/keyboard';
export * from 'surplus-mixins/mouse';
export * from 'surplus-mixins/style';
}

declare module 'surplus-mixins/all' {
import { SAttributeType } from 'surplus-mixins/attribute';
import { SStyleType } from 'surplus-mixins/style';
import { SClassType } from 'surplus-mixins/class';
import { SDragEventType } from 'surplus-mixins/drag';
import { SKeyboardEventType } from 'surplus-mixins/keyboard';
import { SMouseEventType } from 'surplus-mixins/mouse';
export const addEvents: (node: Node, arg: any) => void;
export type ISurplusMixins = {
onmouse?: SMouseEventType;
onkey?: SKeyboardEventType;
ondrag?: SDragEventType;
classes?: SClassType | SClassType[];
styles?: SStyleType | SStyleType[];
attrs?: SAttributeType | SAttributeType;
};
export function mixins(...args: ISurplusMixins[]): (node: any) => void;
}

declare module 'surplus-mixins/attribute' {
export type SAttributeType = {
[k: string]: any;
};
export function attrs(...args: SAttributeType[]): (node: HTMLElement) => void;
}

declare module 'surplus-mixins/class' {
import { DataSignal } from 's-js';
export type SClassType = {
[k: string]: DataSignal<boolean> | boolean;
};
export function classes(...args: SClassType[]): (node: any) => void;
}

declare module 'surplus-mixins/drag' {
export type SDragEventType = {
[k in "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop"]?: (evt: DragEvent) => void;
};
export function ondrag(arg: SDragEventType): (node: Node) => void;
}

declare module 'surplus-mixins/keyboard' {
export type SKeyboardEventType = {
[k in "keydown" | "keyup" | "keypress"]?: (evt: KeyboardEvent) => void;
};
export function onkey(arg: SKeyboardEventType): (node: Node) => void;
}

declare module 'surplus-mixins/mouse' {
export type SMouseEventType = {
[k in 'mousedown' | 'mouseenter' | 'mouseleave' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'show' | 'click' | 'contextmenu' | 'dblclick']?: (evt: MouseEvent) => void;
};
export function onmouse(arg: SMouseEventType): (node: Node) => void;
}

declare module 'surplus-mixins/style' {
import { DataSignal } from 's-js';
export type SStyleType = {
[k in "alignContent" | "alignItems" | "alignmentBaseline" | "alignSelf" | "animation" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "baselineShift" | "border" | "borderBottom" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderColor" | "borderImage" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderLeft" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRadius" | "borderRight" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStyle" | "borderTop" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "borderWidth" | "bottom" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "clear" | "clip" | "clipPath" | "clipRule" | "color" | "colorInterpolationFilters" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columns" | "columnSpan" | "columnWidth" | "content" | "counterIncrement" | "counterReset" | "cssFloat" | "cssText" | "cursor" | "direction" | "display" | "dominantBaseline" | "emptyCells" | "enableBackground" | "fill" | "fillOpacity" | "fillRule" | "filter" | "flex" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "floodColor" | "floodOpacity" | "font" | "fontFamily" | "fontFeatureSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "height" | "imeMode" | "justifyContent" | "kerning" | "layoutGrid" | "layoutGridChar" | "layoutGridLine" | "layoutGridMode" | "layoutGridType" | "left" | "length" | "letterSpacing" | "lightingColor" | "lineBreak" | "lineHeight" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "margin" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "msContentZoomChaining" | "msContentZooming" | "msContentZoomLimit" | "msContentZoomLimitMax" | "msContentZoomLimitMin" | "msContentZoomSnap" | "msContentZoomSnapPoints" | "msContentZoomSnapType" | "msFlowFrom" | "msFlowInto" | "msFontFeatureSettings" | "msGridColumn" | "msGridColumnAlign" | "msGridColumns" | "msGridColumnSpan" | "msGridRow" | "msGridRowAlign" | "msGridRows" | "msGridRowSpan" | "msHighContrastAdjust" | "msHyphenateLimitChars" | "msHyphenateLimitLines" | "msHyphenateLimitZone" | "msHyphens" | "msImeAlign" | "msOverflowStyle" | "msScrollChaining" | "msScrollLimit" | "msScrollLimitXMax" | "msScrollLimitXMin" | "msScrollLimitYMax" | "msScrollLimitYMin" | "msScrollRails" | "msScrollSnapPointsX" | "msScrollSnapPointsY" | "msScrollSnapType" | "msScrollSnapX" | "msScrollSnapY" | "msScrollTranslation" | "msTextCombineHorizontal" | "msTextSizeAdjust" | "msTouchAction" | "msTouchSelect" | "msUserSelect" | "msWrapFlow" | "msWrapMargin" | "msWrapThrough" | "opacity" | "order" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowX" | "overflowY" | "padding" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "parentRule" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "quotes" | "right" | "rotate" | "rubyAlign" | "rubyOverhang" | "rubyPosition" | "scale" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "tableLayout" | "textAlign" | "textAlignLast" | "textAnchor" | "textDecoration" | "textIndent" | "textJustify" | "textKashida" | "textKashidaSpace" | "textOverflow" | "textShadow" | "textTransform" | "textUnderlinePosition" | "top" | "touchAction" | "transform" | "transformOrigin" | "transformStyle" | "transition" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "verticalAlign" | "visibility" | "webkitAlignContent" | "webkitAlignItems" | "webkitAlignSelf" | "webkitAnimation" | "webkitAnimationDelay" | "webkitAnimationDirection" | "webkitAnimationDuration" | "webkitAnimationFillMode" | "webkitAnimationIterationCount" | "webkitAnimationName" | "webkitAnimationPlayState" | "webkitAnimationTimingFunction" | "webkitAppearance" | "webkitBackfaceVisibility" | "webkitBackgroundClip" | "webkitBackgroundOrigin" | "webkitBackgroundSize" | "webkitBorderBottomLeftRadius" | "webkitBorderBottomRightRadius" | "webkitBorderImage" | "webkitBorderRadius" | "webkitBorderTopLeftRadius" | "webkitBorderTopRightRadius" | "webkitBoxAlign" | "webkitBoxDirection" | "webkitBoxFlex" | "webkitBoxOrdinalGroup" | "webkitBoxOrient" | "webkitBoxPack" | "webkitBoxSizing" | "webkitColumnBreakAfter" | "webkitColumnBreakBefore" | "webkitColumnBreakInside" | "webkitColumnCount" | "webkitColumnGap" | "webkitColumnRule" | "webkitColumnRuleColor" | "webkitColumnRuleStyle" | "webkitColumnRuleWidth" | "webkitColumns" | "webkitColumnSpan" | "webkitColumnWidth" | "webkitFilter" | "webkitFlex" | "webkitFlexBasis" | "webkitFlexDirection" | "webkitFlexFlow" | "webkitFlexGrow" | "webkitFlexShrink" | "webkitFlexWrap" | "webkitJustifyContent" | "webkitOrder" | "webkitPerspective" | "webkitPerspectiveOrigin" | "webkitTapHighlightColor" | "webkitTextFillColor" | "webkitTextSizeAdjust" | "webkitTextStroke" | "webkitTextStrokeColor" | "webkitTextStrokeWidth" | "webkitTransform" | "webkitTransformOrigin" | "webkitTransformStyle" | "webkitTransition" | "webkitTransitionDelay" | "webkitTransitionDuration" | "webkitTransitionProperty" | "webkitTransitionTimingFunction" | "webkitUserModify" | "webkitUserSelect" | "webkitWritingMode" | "whiteSpace" | "widows" | "width" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex" | "zoom" | "resize" | "userSelect"]?: DataSignal<string> | string;
};
export function styles(...args: SStyleType[]): (node: any) => void;
}

1 change: 1 addition & 0 deletions dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mouse.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare type SMouseEventType = {
[k in 'mousedown' | 'mouseenter' | 'mouseleave' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'show' | 'click' | 'contextmenu' | 'dblclick']?: (evt: MouseEvent) => void;
};
export default function onmouse(arg: SMouseEventType): (node: Node) => void;
export declare function onmouse(arg: SMouseEventType): (node: Node) => void;
Loading

0 comments on commit ead7c94

Please sign in to comment.