Skip to content

Commit 2890a87

Browse files
committed
* Getting ready for publication
1 parent 8a14232 commit 2890a87

File tree

12 files changed

+213
-82
lines changed

12 files changed

+213
-82
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
.idea
3+
.DS_Store
4+
._.DS_Store

.jscsrc

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch", "finally"],
3+
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "finally"],
4+
"requireSpaceBeforeBlockStatements": true,
5+
"requireParenthesesAroundIIFE": true,
6+
"requireSpacesInConditionalExpression": true,
7+
"requireSpacesInAnonymousFunctionExpression": {
8+
"beforeOpeningRoundBrace": true,
9+
"beforeOpeningCurlyBrace": true
10+
},
11+
"requireSpacesInNamedFunctionExpression": {
12+
"beforeOpeningCurlyBrace": true
13+
},
14+
"requireBlocksOnNewline": 1,
15+
"disallowPaddingNewlinesInBlocks": true,
16+
"disallowEmptyBlocks": true,
17+
"requireSpacesInsideObjectBrackets": "all",
18+
"disallowSpacesInsideArrayBrackets": true,
19+
"disallowSpacesInsideParentheses": true,
20+
"disallowQuotedKeysInObjects": true,
21+
"disallowSpaceAfterObjectKeys": true,
22+
"requireCommaBeforeLineBreak": true,
23+
"requireOperatorBeforeLineBreak": true,
24+
"disallowSpaceAfterPrefixUnaryOperators": true,
25+
"disallowSpaceBeforePostfixUnaryOperators": true,
26+
"disallowSpaceBeforeBinaryOperators": [","],
27+
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
28+
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
29+
"requireCamelCaseOrUpperCaseIdentifiers": true,
30+
"disallowKeywords": ["with"],
31+
"disallowMultipleLineStrings": true,
32+
"validateLineBreaks": "LF",
33+
"validateQuoteMarks": {
34+
"mark": "'",
35+
"escape": false
36+
},
37+
"validateIndentation": "\t",
38+
"disallowMixedSpacesAndTabs": "smart",
39+
"disallowTrailingWhitespace": true,
40+
"disallowTrailingComma": true,
41+
"disallowKeywordsOnNewLine": ["else", "catch", "finally"],
42+
"maximumLineLength": {
43+
"value": 120,
44+
"allowUrlComments": true
45+
},
46+
"requireCapitalizedConstructors": true,
47+
"safeContextKeyword": ["self"],
48+
"requireDotNotation": true,
49+
"disallowYodaConditions": true,
50+
"plugins": [
51+
"jscs-jsdoc"
52+
],
53+
"jsDoc": {
54+
"checkAnnotations": "jsdoc3",
55+
"checkTypes": true,
56+
"checkParamNames": true,
57+
"checkRedundantParams": true
58+
},
59+
"excludeFiles": [
60+
"node_modules/**"
61+
]
62+
}

.jshintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

.jshintrc

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
// Custom globals.
3+
"globals" : {
4+
"module": true,
5+
"exports": true,
6+
"require": true
7+
},
8+
9+
// Settings
10+
"passfail" : false, // Stop on first error.
11+
"maxerr" : 100, // Maximum error before stopping.
12+
13+
// Predefined globals whom JSHint will ignore.
14+
"browser" : true, // Standard browser globals e.g. `window`, `document`.
15+
16+
"node" : false,
17+
"rhino" : false,
18+
"couch" : false,
19+
"wsh" : false, // Windows Scripting Host.
20+
21+
"jquery" : false,
22+
"prototypejs" : false,
23+
"mootools" : false,
24+
"dojo" : false,
25+
26+
// Development.
27+
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
28+
"devel" : false, // Allow developments statements e.g. `console.log();`.
29+
30+
31+
// ECMAScript 5.
32+
"strict" : false, // Require `use strict` pragma in every file.
33+
"globalstrict" : true, // Allow global "use strict" (also enables 'strict').
34+
35+
36+
// The Good Parts.
37+
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
38+
"laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
39+
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
40+
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
41+
"curly" : true, // Require {} for every new block or scope.
42+
"eqeqeq" : true, // Require triple equals i.e. `===`.
43+
"eqnull" : false, // Tolerate use of `== null`.
44+
"evil" : false, // Tolerate use of `eval`.
45+
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
46+
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
47+
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
48+
"latedef" : true, // Prohipit variable use before definition.
49+
"loopfunc" : false, // Allow functions to be defined within loops.
50+
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
51+
"regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
52+
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
53+
"scripturl" : false, // Tolerate script-targeted URLs.
54+
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
55+
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
56+
"undef" : true, // Require all non-global variables be declared before they are used.
57+
"camelcase" : true, // require camelCase or ALL_CAPS
58+
"unused" : true, // prohibit unused variables
59+
// Personal styling prefeirences.
60+
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
61+
"noempty" : true, // Prohibit use of empty blocks.
62+
"nonew" : true, // Prohibit use of constructors for side-effects.
63+
"nomen" : false, // Prohibit use of initial or trailing underbars in names.
64+
"onevar" : false, // Allow only one `var` statement per function.
65+
"plusplus" : true, // Prohibit use of `++` & `--`.
66+
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
67+
"trailing" : true, // Prohibit trailing whitespaces.
68+
"white" : true, // Check against strict whitespace and indentation rules.
69+
"indent" : 4 // Specify indentation spacing
70+
}

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
I'm not gonna say what has already been said, just follow the basic guideline from [GitHub][github_guide].
2+
And follow the style guide set by JSHint ans JSCS rules.
3+
4+
Our style guide is available on the [Wizcorp GitHub's group][styleguide]
5+
6+
[github_guide]: https://guides.github.com/activities/contributing-to-open-source/#contributing
7+
[styleguide]: https://github.com/Wizcorp/StyleGuides/tree/master/Javascript

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release history
22

3+
## v0.7.0
4+
5+
### Let's meet the world
6+
WuiDom finally get released under WizUI and have its package.json file to reach even more build systems.
7+
8+
39
## v0.6.2
410

511
### Dependencies update

README.md

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,14 @@
11
# WuiDom
2-
3-
## Motivation for WUI
4-
5-
Wizcorp UI (hereafter referred to as 'WUI') is a series of UI elements that were created to minimize
6-
programmer interaction with the DOM and eliminate the need for programmers to create HTML.
7-
Here at Wizcorp, we make single-page applications that often have many thousands of lines of
8-
generated HTML. Therefore, even a single DOM query can be very slow, resulting in an unacceptably
9-
slow user experience. WUI allows the programmer to create HTML elements while minimizing
10-
interaction with the DOM, and maintain fine-level control over exactly when, where and in what
11-
manner data is displayed and how events are handled.
12-
13-
WUI also allows for simple interaction with Tomes, another Wizcorp API, to allow DOM elements to be
14-
updated whenever the underlying data associated with them changes. This is useful for such things as
15-
validation, real-time data display and for asynchronous processing. By fully leveraging the
16-
non-blocking nature of Node.js, WUI will perform nearly real-time updating of data and allow the
17-
programmer to avoid DOM calls, have more compact code and allow for more reusable user interface
18-
components.
2+
[![Circle CI](https://circleci.com/gh/WizUI/WuiDom/tree/master.svg?style=svg)](https://circleci.com/gh/WizUI/WuiDom/tree/master)
193

204
## What WuiDom is
215

22-
WuiDom is the base object of the WUI system. It represents the smallest unit of programmatic logic,
6+
WuiDom is the base object of the [WizUI] system. It represents the smallest unit of programmatic logic,
237
an object corresponding to an underlying HTML element and that associated data (including, but not
248
limited to, a Tome), events and other properties. WuiDom allows the programmer to keep a reference
259
to generated elements (if desired) or to create throw-away elements. A simple function can create a
2610
generic UI template or create a custom view. Because WuiDom inherits from EventEmitter,
27-
programmer-defined events can be conditionally emitted and handled by WUI or other modules.
28-
29-
## WUI Components
30-
31-
One of the major goals of WUI, aside from reducing interaction with the DOM, is to enable developers
32-
to create re-usable user interface components, common behaviours and reusable views. When creating
33-
WUI components, please try to keep that goal in mind. The ideal WUI component can be used on many
34-
views and ideally that means to not making too many assumptions about the underlying data or the the
35-
business logic of the game.
36-
37-
Below is a partial list of the existing WUI components, and what their primary functions are:
38-
39-
### WuiButton
40-
41-
You can read the WuiButton documentation [here](https://github.com/Wizcorp/wui-button).
42-
43-
### WuiView
44-
45-
You can read about the WuiView documentation [here](https://github.com/Wizcorp/wui-view).
46-
47-
### WuiImage
48-
49-
You can read more about the WuiImage documentation [here](https://github.com/Wizcorp/wui-image).
11+
programmer-defined events can be conditionally emitted and handled by [WizUI] or other modules.
5012

5113
### Creating a new WuiDom element
5214

@@ -98,7 +60,7 @@ The result is a new child element is immediately inserted as the last child of p
9860
Please note that this method is the preferred way to create new WuiDom elements.
9961

10062
The createChild method takes an HTML tag name (such as 'input', 'label', 'div' or so forth)
101-
and a list of associated options. WUI created an underlying rootElement (discussed at length below)
63+
and a list of associated options. [WizUI] created an underlying rootElement (discussed at length below)
10264
and appends the element as the last child element of the parent (caller) element.
10365

10466
An options element can contain numerous keys that are used by WuiDom to create the HTML element.
@@ -116,9 +78,9 @@ In the above example, the code assumes parentElement already exists and is also
11678
(see above for creating the first WuiDom object in your code!). Here we create an input tag
11779
(could just as easily be a 'div' or 'button'.)
11880

119-
WUI reads the options object next, and creating a child text-node based on the user-supplied 'text'
81+
[WizUI] reads the options object next, and creating a child text-node based on the user-supplied 'text'
12082
option, in this case using 'Example' for the text. It then applies the style and class name.
121-
Finally, WUI will add each attribute specified by the keys in the 'attr' object. The resulting
83+
Finally, [WizUI] will add each attribute specified by the keys in the 'attr' object. The resulting
12284
HTML markup can be seen below:
12385

12486
```html
@@ -414,11 +376,11 @@ onchange, onclick and others.
414376
415377
##### allowDomEvents
416378
417-
The allowDomEvents function can be called from any WuiDom element, in order to tell WUI that
379+
The allowDomEvents function can be called from any WuiDom element, in order to tell [WizUI] that
418380
the element will listen for DOM events. The correct syntax for DOM events is 'dom.event'.
419381
Therefore the change event would be emitted as 'dom.change'.
420382
421-
Note that by default, DOM events are **not** propagated through WUI. **This method must be
383+
Note that by default, DOM events are **not** propagated through [WizUI]. **This method must be
422384
called in order to enable DOM events on a WuiDom object.**
423385
424386
##### Example
@@ -440,20 +402,20 @@ playerXPElement.on('dom.change', function() {
440402
```
441403
442404
In this example, we create a WuiDom element called playerXPElement.
443-
The function call to allowDomEvents tells WUI that the element that wants to consume DOM events.
405+
The function call to allowDomEvents tells [WizUI] that the element that wants to consume DOM events.
444406
In the final line, we tell the element to run the function every time the dom.change event is fired.
445407
446408
When the method runs, it will check to see if the player has gained a level, and then
447409
possibly display an animation. If the player levels up, an event called levelUp is emitted.
448-
This is just one example of how events might be used with WUI. Please see [here][0] for a list of
410+
This is just one example of how events might be used with [WizUI]. Please see [here][0] for a list of
449411
DOM events.
450412
451413
[0]: https://developer.mozilla.org/en-US/docs/DOM_Client_Object_Cross-Reference/DOM_Events
452414
453415
### Operations on a WuiDom element
454416
455417
WuiDom supports a number of functions that can be used to interact with the underlying element,
456-
even after the element has already been added to the DOM. One primary purpose of WUI, is to allow
418+
even after the element has already been added to the DOM. One primary purpose of [WizUI], is to allow
457419
these operations to be performed without having to pay the cost of an inefficient DOM lookup every
458420
time we wish to run a command.
459421
@@ -671,3 +633,5 @@ Calling the method:
671633
```javascript
672634
childElement.replaceClassNames(['unread'], ['read', 'stroke']);
673635
```
636+
637+
[WizUI]: http://wizui.github.com "WizUI"

circle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test:
2+
override:
3+
- node ./node_modules/.bin/jshint src
4+
- node ./node_modules/.bin/jscs src

component.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"name": "WuiDom",
33
"repo": "wizui/wuidom",
4-
"version": "0.6.2",
4+
"version": "0.7.0",
55
"description": "Core Class for WizUI",
66
"dependencies": {
77
"Wizcorp/util": "0.1.0",
88
"Wizcorp/events": "0.1.3",
99
"micky2be/dom-shims": "0.1.5"
1010
},
1111
"scripts": [
12-
"index.js",
13-
"domEvents.js"
14-
]
12+
"src/index.js",
13+
"src/domEvents.js"
14+
],
15+
"main": "src/index.js"
1516
}

package.json

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
{
22
"name": "WuiDom",
3-
"repo": "wizui/wuidom",
4-
"version": "0.6.2",
53
"description": "Core Class for WizUI",
4+
"keywords": [
5+
"frontend",
6+
"magical",
7+
"virtualdom"
8+
],
9+
"author": "Wizcorp <info@wizcorp>",
10+
"maintainers": [
11+
"Micky Brunetti (http://www.github.com/micky2be)"
12+
],
13+
"repository": "wizui/wuidom",
14+
"homepage": "http://wizui.github.io/",
15+
"version": "0.7.0",
616
"format": "cjs",
717
"registry": "npm",
818
"dependencies": {
919
"util": "0.10.3",
1020
"events": "1.0.2",
1121
"dom-shims": "0.1.4"
1222
},
23+
"devDependencies": {
24+
"jshint": "2.8.0",
25+
"jscs": "1.13.1",
26+
"jscs-jsdoc": "1.1.0"
27+
},
1328
"files": [
14-
"index.js",
15-
"domEvents.js"
29+
"src/index.js",
30+
"src/domEvents.js"
1631
],
17-
"main" : "index.js"
32+
"main" : "src/index.js",
33+
"license": "MIT"
1834
}

0 commit comments

Comments
 (0)