Skip to content

Commit

Permalink
execute created components, format with tabs, and use const
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Jun 16, 2019
1 parent 5cc1f99 commit 99b1e6f
Show file tree
Hide file tree
Showing 14 changed files with 217 additions and 210 deletions.
113 changes: 57 additions & 56 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true
},
"rules": {
"constructor-super": 2,
"dot-notation": 2,
"no-class-assign": 2,
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-const-assign": 2,
"no-constant-condition": ["error", { "checkLoops": false }],
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-empty": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-global-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-mixed-spaces-and-tabs": 2,
"no-new-symbol": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-self-assign": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-undef": 2,
"no-unexpected-multiline": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"no-unused-labels": 2,
"no-unused-vars": 2,
"no-useless-escape": 2,
"object-shorthand": 2,
"require-yield": 2,
"semi": 2,
"use-isnan": 2,
"valid-typeof": 2
}
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true
},
"rules": {
"constructor-super": 2,
"dot-notation": 2,
"no-class-assign": 2,
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-const-assign": 2,
"no-constant-condition": ["error", { "checkLoops": false }],
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-empty": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-global-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-mixed-spaces-and-tabs": 2,
"no-new-symbol": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-self-assign": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-undef": 2,
"no-unexpected-multiline": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"no-unused-labels": 2,
"no-unused-vars": 2,
"no-useless-escape": 2,
"object-shorthand": 2,
"prefer-const": 2,
"require-yield": 2,
"semi": 2,
"use-isnan": 2,
"valid-typeof": 2
}
}
2 changes: 1 addition & 1 deletion build/release/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for (let i = 0; i < packages.length; i++) {
const packageJSONPath = path.join(package, "package.json");
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf8"));
packageJSON.version = version;
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, 3));
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, "\t"));
}
}

Expand Down
54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"name": "moon",
"version": "1.0.0-beta.2",
"description": "The minimal & fast UI library",
"scripts": {
"build": "node build/build.js",
"test": "MOON_ENV=\"development\" jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme",
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"gzip-size": "^5.0.0",
"jest": "^24.6.0",
"rollup": "^1.8.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-eslint": "^5.1.0",
"uglify-js": "^3.5.3"
}
"name": "moon",
"version": "1.0.0-beta.2",
"description": "The minimal & fast UI library",
"scripts": {
"build": "node build/build.js",
"test": "MOON_ENV=\"development\" jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme",
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"gzip-size": "^5.0.0",
"jest": "^24.6.0",
"rollup": "^1.8.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-eslint": "^5.1.0",
"uglify-js": "^3.5.3"
}
}
42 changes: 21 additions & 21 deletions packages/moon-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "moon-cli",
"version": "1.0.0-beta.2",
"description": "Moon project generator",
"main": "dist/moon-cli.min.js",
"bin": {
"moon": "dist/moon-cli.min.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"keywords": [
"moon",
"cli"
],
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme"
"name": "moon-cli",
"version": "1.0.0-beta.2",
"description": "Moon project generator",
"main": "dist/moon-cli.min.js",
"bin": {
"moon": "dist/moon-cli.min.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"keywords": [
"moon",
"cli"
],
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme"
}
42 changes: 21 additions & 21 deletions packages/moon-mvl/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "moon-mvl",
"version": "1.0.0-beta.2",
"description": "Moon MVL component compiler",
"main": "dist/moon-mvl.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"keywords": [
"moon",
"mvl"
],
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme",
"peerDependencies": {
"moon": "*"
}
"name": "moon-mvl",
"version": "1.0.0-beta.2",
"description": "Moon MVL component compiler",
"main": "dist/moon-mvl.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"keywords": [
"moon",
"mvl"
],
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme",
"peerDependencies": {
"moon": "*"
}
}
44 changes: 23 additions & 21 deletions packages/moon/dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,16 +1171,35 @@
};

Node.prototype.MoonEvent = null;
/**
* Executes a component and modifies it to be the result of the component view.
*
* @param {Object} node
*/

function executeComponent(node) {
while (node.type === types.component) {
// Execute the component to get the component view.
var nodeName = node.name;
var nodeComponent = components[nodeName](m, node.data, node.children, ms[nodeName]); // Update the node to reflect the component view.

node.type = nodeComponent.type;
node.name = nodeComponent.name;
node.data = nodeComponent.data;
node.children = nodeComponent.children;
}
}
/**
* Creates an old reference node from a view node.
*
* @param {Object} node
* @returns {Object} node to be used as an old node
*/


function executeCreate(node) {
var element;
var children = [];
var element;

if (node.type === types.text) {
// Create a text node using the text content from the default key.
Expand All @@ -1192,7 +1211,9 @@
var nodeChildren = node.children;

for (var i = 0; i < nodeChildren.length; i++) {
var childOld = executeCreate(nodeChildren[i]);
var childNew = nodeChildren[i];
executeComponent(childNew);
var childOld = executeCreate(childNew);
children.push(childOld);
element.appendChild(childOld.element);
} // Set data.
Expand Down Expand Up @@ -1227,25 +1248,6 @@

return new NodeOld(node, element, children);
}
/**
* Executes a component and modifies it to be the result of the component view.
*
* @param {Object} node
*/


function executeComponent(node) {
while (node.type === types.component) {
// Execute the component to get the component view.
var nodeName = node.name;
var nodeComponent = components[nodeName](m, node.data, node.children, ms[nodeName]); // Update the node to reflect the component view.

node.type = nodeComponent.type;
node.name = nodeComponent.name;
node.data = nodeComponent.data;
node.children = nodeComponent.children;
}
}
/**
* Executes a view and finds differences between nodes.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/moon/dist/moon.min.js

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions packages/moon/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "moon",
"version": "1.0.0-beta.2",
"description": "The minimal & fast UI library",
"main": "dist/moon.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"keywords": [
"moon",
"user interface",
"UI",
"view",
"model",
"library"
],
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme"
"name": "moon",
"version": "1.0.0-beta.2",
"description": "The minimal & fast UI library",
"main": "dist/moon.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/kbrsh/moon.git"
},
"keywords": [
"moon",
"user interface",
"UI",
"view",
"model",
"library"
],
"author": "Kabir Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/kbrsh/moon/issues"
},
"homepage": "https://github.com/kbrsh/moon#readme"
}
Loading

0 comments on commit 99b1e6f

Please sign in to comment.