Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ismail-codar committed Jul 28, 2017
1 parent 953d45c commit 7ab55c1
Show file tree
Hide file tree
Showing 15 changed files with 567 additions and 0 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
25 changes: 25 additions & 0 deletions class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DataSignal } from 's-js';

//CSSStyleDeclaration keys
export type SClassType = {
[k: string]: DataSignal<boolean> | boolean
}

export default function classes(...args: SClassType[]) {
return function classes(node: any) {
if (args) {
const classNames: any[] = []
args.forEach((arg:SClassType) => {
for (const key in arg) {
const val: any = (arg as any)[key]
if (typeof val == "function" ? val() : val)
classNames.push(key)
}
})
node.className = classNames.join(" ")
}
}
}



5 changes: 5 additions & 0 deletions dist/class.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DataSignal } from 's-js';
export declare type SClassType = {
[k: string]: DataSignal<boolean> | boolean;
};
export default function classes(...args: SClassType[]): (node: any) => void;
19 changes: 19 additions & 0 deletions dist/class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default function classes() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return function classes(node) {
if (args) {
var classNames_1 = [];
args.forEach(function (arg) {
for (var key in arg) {
var val = arg[key];
if (typeof val == "function" ? val() : val)
classNames_1.push(key);
}
});
node.className = classNames_1.join(" ");
}
};
}
1 change: 1 addition & 0 deletions dist/keyboard.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function onkey(arg: any): (node: Node) => void;
4 changes: 4 additions & 0 deletions dist/keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default function onkey(arg) {
return function onkey(node) {
};
}
4 changes: 4 additions & 0 deletions dist/mouse.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +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;
15 changes: 15 additions & 0 deletions dist/mouse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { S } from 'surplus';
export default function onmouse(arg) {
return function onmouse(node) {
if (arg) {
var _loop_1 = function (key) {
var val = arg[key];
node.addEventListener(key, val, false);
S.cleanup(function () { node.removeEventListener(key, val); });
};
for (var key in arg) {
_loop_1(key);
}
}
};
}
5 changes: 5 additions & 0 deletions dist/style.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DataSignal } from 's-js';
export declare 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 default function styles(...args: SStyleType[]): (node: any) => void;
16 changes: 16 additions & 0 deletions dist/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default function styles() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return function style(node) {
if (args) {
args.forEach(function (arg) {
for (var key in arg) {
var val = arg[key];
node["style"][key] = typeof val == "function" ? val() : val;
}
});
}
};
}
5 changes: 5 additions & 0 deletions keyboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

export default function onkey(arg: any) {
return function onkey(node: Node) {
}
}
29 changes: 29 additions & 0 deletions mouse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { S } from 'surplus'

// https://developer.mozilla.org/en-US/docs/Web/Events : MouseEvent

export type SMouseEventType = {
[k in
"mousedown" |
"mouseenter" |
"mouseleave" |
"mousemove" |
"mouseout" |
"mouseover" |
"mouseup" |
"show" |
"click" |
"contextmenu" |
"dblclick"
]?: (evt: MouseEvent) => void}

export default function onmouse(arg: SMouseEventType) {
return function onmouse(node: Node) {
if (arg)
for (const key in arg) {
const val: any = (arg as any)[key]
node.addEventListener(key, val, false)
S.cleanup(function () { node.removeEventListener(key, val) })
}
}
}
59 changes: 59 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"_args": [
[
{
"raw": "C:\\\\Users\\\\codar.victor\\\\Documents\\\\GitHub\\\\surplus-mixins",
"scope": null,
"escapedName": null,
"name": null,
"rawSpec": "C:\\\\Users\\\\codar.victor\\\\Documents\\\\GitHub\\\\surplus-mixins",
"spec": "C:\\Users\\codar.victor\\Documents\\GitHub\\surplus-mixins",
"type": "directory"
},
"C:\\Users\\codar.victor\\Documents\\GitHub\\surplus-material"
]
],
"_from": "..\\surplus-mixins",
"_id": "[email protected]",
"_inCache": true,
"_location": "/surplus-mixins",
"_phantomChildren": {},
"_requested": {
"raw": "C:\\\\Users\\\\codar.victor\\\\Documents\\\\GitHub\\\\surplus-mixins",
"scope": null,
"escapedName": null,
"name": null,
"rawSpec": "C:\\\\Users\\\\codar.victor\\\\Documents\\\\GitHub\\\\surplus-mixins",
"spec": "C:\\Users\\codar.victor\\Documents\\GitHub\\surplus-mixins",
"type": "directory"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "file:..\\surplus-mixins",
"_shasum": "5e4ab086d430ec4ec18b18f6d6446ab884d742e3",
"_shrinkwrap": null,
"_spec": "C:\\\\Users\\\\codar.victor\\\\Documents\\\\GitHub\\\\surplus-mixins",
"_where": "C:\\Users\\codar.victor\\Documents\\GitHub\\surplus-material",
"author": {
"name": "ismail codar"
},
"dependencies": {
"surplus": "^0.4.3"
},
"description": "Some surplus mixins",
"devDependencies": {
"typescript": "^2.3.4"
},
"gitHead": "4a52dc0222fa9bd11729189ca25953fce7b25050",
"license": "MIT",
"main": "dist",
"name": "surplus-mixins",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"scripts": {
"build": "tsc"
},
"version": "1.0.0"
}
Loading

0 comments on commit 7ab55c1

Please sign in to comment.