Skip to content

Commit 229ac91

Browse files
committed
Merge branch 'ts-thomas-master'
2 parents 18d60f5 + 960b245 commit 229ac91

File tree

10 files changed

+49
-138
lines changed

10 files changed

+49
-138
lines changed

frameworks/keyed/mikado/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<title>Mikado-"keyed"</title>
66
<link rel="preload" href="dist/main.js" as="script">
77
<link href="/css/currentStyle.css" rel="stylesheet"/>
8-
<!--<script src="node_modules/mikado/src/config.js"></script><script type="module" src="src/main.js"></script>-->
98
</head>
109
<body>
1110
<div id="main"></div>
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
{
2+
"private": true,
23
"name": "js-framework-benchmark-mikado",
3-
"description": "Web's smartest virtual DOM templating engine.",
44
"homepage": "https://github.com/nextapps-de/mikado/",
55
"author": "Nextapps GmbH",
6-
"version": "1.0.0",
76
"license": "Apache-2.0",
8-
"main": "src/mikado.js",
97
"js-framework-benchmark": {
108
"frameworkVersionFromPackage": "mikado"
119
},
12-
"browser": "src/browser.js",
1310
"preferGlobal": false,
14-
"bin": {
15-
"mikado": "./task/compile.js"
16-
},
1711
"repository": {
1812
"type": "git",
1913
"url": "https://github.com/krausest/js-framework-benchmark.git"
2014
},
2115
"scripts": {
22-
"compile": "node node_modules/mikado/task/compile ./../../src/template/app.html && node node_modules/mikado/task/compile ./../../src/template/item.html && echo Compile Complete. && exit 0",
23-
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false USE_POLYFILL=false SUPPORT_CACHE=false SUPPORT_EVENTS=true SUPPORT_STORAGE=true SUPPORT_HELPERS=true SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_LOOP_INCLUDE=false SUPPORT_CONDITIONAL=false && exit 0",
16+
"compile": "mikado-compile src/template/app.html && mikado-compile src/template/item.html && echo Compile Complete. && exit 0",
17+
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false USE_POLYFILL=false SUPPORT_CACHE=false SUPPORT_EVENTS=true SUPPORT_STORAGE=true SUPPORT_HELPERS='swap' SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=false SUPPORT_CACHE_HELPERS=false SUPPORT_POOLS=false SUPPORT_COMPILE=false && exit 0",
2418
"build-prod": "npm run build"
2519
},
2620
"dependencies": {
27-
"mikado": "0.1.2"
21+
"mikado": "^0.6.53"
2822
},
2923
"devDependencies": {
30-
"google-closure-compiler": "20190910.0.0-nightly",
31-
"html2json": "1.0.2"
24+
"google-closure-compiler": "20191012.0.0-nightly",
25+
"mikado-compile": "0.6.5"
3226
}
3327
}
Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,29 @@
1-
"use strict";
2-
31
import Mikado from "../node_modules/mikado/src/mikado.js";
42
import app from "./template/app.es6.js";
53
import item from "./template/item.es6.js";
64
import { buildData } from "./data.js";
7-
import { startMeasure, stopMeasure } from "./bench.js";
85

9-
const main = document.getElementById("main");
10-
new Mikado(main, app).render().destroy(true);
6+
Mikado.once(document.getElementById("main"), app);
117

12-
const state = { "selected": -1 };
8+
const state = { "selected": {} };
139
const root = document.getElementById("tbody");
1410
const mikado = Mikado.new(root, item, {
15-
16-
"store": true,
17-
"loose": true,
18-
"reuse": false,
19-
"state": state // external reference
20-
})
21-
.route("run", function(){
22-
if(DEBUG) startMeasure("run");
23-
mikado.render(buildData(1000));
24-
if(DEBUG) stopMeasure();
25-
})
26-
.route("runlots", function(){
27-
if(DEBUG) startMeasure("runlots");
28-
mikado.render(buildData(10000));
29-
if(DEBUG) stopMeasure();
11+
"reuse": false, "state": state
3012
})
31-
.route("add", function(){
32-
if(DEBUG) startMeasure("add");
33-
mikado.append(buildData(1000));
34-
if(DEBUG) stopMeasure();
35-
})
36-
.route("update", function(){
37-
if(DEBUG) startMeasure("update");
13+
.route("run", () => { mikado.render(buildData(1000)) })
14+
.route("runlots", () => { mikado.render(buildData(10000)) })
15+
.route("add", () => { mikado.append(buildData(1000)) })
16+
.route("update", () => {
3817
for(let i = 0, len = mikado.length; i < len; i += 10){
39-
mikado.item(i).label += " !!!";
18+
mikado.data(i).label += " !!!";
4019
mikado.refresh(i);
4120
}
42-
if(DEBUG) stopMeasure();
43-
})
44-
.route("clear", function(){
45-
if(DEBUG) startMeasure("clear");
46-
mikado.clear();
47-
if(DEBUG) stopMeasure();
48-
})
49-
.route("swaprows", function(){
50-
if(DEBUG) startMeasure("swaprows");
51-
mikado.swap(1, 998);
52-
if(DEBUG) stopMeasure();
53-
})
54-
.route("remove", function(target){
55-
if(DEBUG) startMeasure("remove");
56-
mikado.remove(target);
57-
if(DEBUG) stopMeasure();
5821
})
59-
.route("select", function(target){
60-
if(DEBUG) startMeasure("select");
61-
const selected = state["selected"];
62-
if(selected >= 0) mikado.node(selected).className = "";
63-
target.className = "danger";
64-
state["selected"] = mikado.index(target);
65-
if(DEBUG) stopMeasure();
22+
.route("clear", () => { mikado.clear() })
23+
.route("swaprows", () => { mikado.swap(1, 998) })
24+
.route("remove", target => { mikado.remove(target) })
25+
.route("select", target => {
26+
state["selected"].className = "";
27+
(state["selected"] = target).className = "danger";
6628
})
6729
.listen("click");

frameworks/keyed/mikado/src/template/item.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<tr class="{{this.state.selected === index ? 'danger' : ''}}" root>
2-
<td class="col-md-1">{{item.id}}</td>
1+
<tr class="{{this.state.selected === self ? 'danger' : ''}}" root>
2+
<td class="col-md-1">{{data.id}}</td>
33
<td class="col-md-4">
4-
<a class="lbl" click="select:root">{{item.label}}</a>
4+
<a class="lbl" click="select:root">{{data.label}}</a>
55
</td>
66
<td class="col-md-1">
77
<a class="remove" click="remove:root">

frameworks/keyed/mikado/task/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const parameter = (function(opt){
8888
//formatting: "PRETTY_PRINT"
8989
});
9090

91-
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --js='src/*.js' --js='src/template/*.es6.js' --js='node_modules/mikado/src/*.js'" + flag_str + " --js_output_file='dist/main.js' && exit 0", function(){
91+
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --js='src/*.js' --js='src/template/*.es6.js' --js='node_modules/mikado/src/*.js' --js='!src/*config.js'" + flag_str + " --js_output_file='dist/main.js' && exit 0", function(){
9292

9393
console.log("Build Complete.");
9494
});

frameworks/non-keyed/mikado/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<head>
44
<meta charset="utf-8"/>
55
<title>Mikado-"non-keyed"</title>
6+
<link rel="preload" href="dist/main.js" as="script">
67
<link href="/css/currentStyle.css" rel="stylesheet"/>
7-
<!--<script src="src/config.js"></script><script type="module" src="src/main.js"></script>-->
88
</head>
99
<body>
1010
<div id="main"></div>
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
{
2+
"private": true,
23
"name": "js-framework-benchmark-mikado",
3-
"description": "Web's smartest virtual DOM templating engine.",
44
"homepage": "https://github.com/nextapps-de/mikado/",
55
"author": "Nextapps GmbH",
6-
"version": "1.0.0",
76
"license": "Apache-2.0",
8-
"main": "src/mikado.js",
97
"js-framework-benchmark": {
108
"frameworkVersionFromPackage": "mikado"
119
},
12-
"browser": "src/browser.js",
1310
"preferGlobal": false,
14-
"bin": {
15-
"mikado": "./task/compile.js"
16-
},
1711
"repository": {
1812
"type": "git",
1913
"url": "https://github.com/krausest/js-framework-benchmark.git"
2014
},
2115
"scripts": {
22-
"compile": "node node_modules/mikado/task/compile ./../../src/template/app.html && node node_modules/mikado/task/compile ./../../src/template/item.html && echo Compile Complete. && exit 0",
23-
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false USE_POLYFILL=false SUPPORT_CACHE=false SUPPORT_EVENTS=true SUPPORT_STORAGE=true SUPPORT_HELPERS=true SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_LOOP_INCLUDE=false SUPPORT_CONDITIONAL=false && exit 0",
16+
"compile": "mikado-compile src/template/app.html && mikado-compile src/template/item.html && echo Compile Complete. && exit 0",
17+
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false USE_POLYFILL=false SUPPORT_CACHE=false SUPPORT_EVENTS=true SUPPORT_STORAGE=true SUPPORT_HELPERS='swap' SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=false SUPPORT_CACHE_HELPERS=false SUPPORT_POOLS=false SUPPORT_COMPILE=false && exit 0",
2418
"build-prod": "npm run build"
2519
},
2620
"dependencies": {
27-
"mikado": "0.1.2"
21+
"mikado": "^0.6.53"
2822
},
2923
"devDependencies": {
30-
"google-closure-compiler": "20190904.0.0-nightly",
31-
"html2json": "1.0.2"
24+
"google-closure-compiler": "20191012.0.0-nightly",
25+
"mikado-compile": "0.6.5"
3226
}
3327
}
Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,29 @@
1-
"use strict";
2-
31
import Mikado from "../node_modules/mikado/src/mikado.js";
42
import app from "./template/app.es6.js";
53
import item from "./template/item.es6.js";
64
import { buildData } from "./data.js";
7-
import { startMeasure, stopMeasure } from "./bench.js";
85

9-
const main = document.getElementById("main");
10-
new Mikado(main, app).render().destroy(true);
6+
Mikado.once(document.getElementById("main"), app);
117

12-
const state = { "selected": -1 };
8+
const state = { "selected": {} };
139
const root = document.getElementById("tbody");
1410
const mikado = Mikado.new(root, item, {
15-
16-
"store": true,
17-
"loose": true,
18-
"reuse": true,
19-
"state": state // external reference
20-
})
21-
.route("run", function(){
22-
if(DEBUG) startMeasure("run");
23-
mikado.render(buildData(1000));
24-
if(DEBUG) stopMeasure();
25-
})
26-
.route("runlots", function(){
27-
if(DEBUG) startMeasure("runlots");
28-
mikado.render(buildData(10000));
29-
if(DEBUG) stopMeasure();
11+
"reuse": true, "state": state
3012
})
31-
.route("add", function(){
32-
if(DEBUG) startMeasure("add");
33-
mikado.append(buildData(1000));
34-
if(DEBUG) stopMeasure();
35-
})
36-
.route("update", function(){
37-
if(DEBUG) startMeasure("update");
13+
.route("run", () => { mikado.render(buildData(1000)) })
14+
.route("runlots", () => { mikado.render(buildData(10000)) })
15+
.route("add", () => { mikado.append(buildData(1000)) })
16+
.route("update", () => {
3817
for(let i = 0, len = mikado.length; i < len; i += 10){
39-
mikado.item(i).label += " !!!";
18+
mikado.data(i).label += " !!!";
4019
mikado.refresh(i);
4120
}
42-
if(DEBUG) stopMeasure();
43-
})
44-
.route("clear", function(){
45-
if(DEBUG) startMeasure("clear");
46-
mikado.clear();
47-
if(DEBUG) stopMeasure();
48-
})
49-
.route("swaprows", function(){
50-
if(DEBUG) startMeasure("swaprows");
51-
mikado.swap(1, 998);
52-
if(DEBUG) stopMeasure();
53-
})
54-
.route("remove", function(target){
55-
if(DEBUG) startMeasure("remove");
56-
mikado.remove(target);
57-
if(DEBUG) stopMeasure();
5821
})
59-
.route("select", function(target){
60-
if(DEBUG) startMeasure("select");
61-
const selected = state["selected"];
62-
if(selected >= 0) mikado.node(selected).className = "";
63-
target.className = "danger";
64-
state["selected"] = mikado.index(target);
65-
if(DEBUG) stopMeasure();
22+
.route("clear", () => { mikado.clear() })
23+
.route("swaprows", () => { mikado.swap(1, 998) })
24+
.route("remove", target => { mikado.remove(target) })
25+
.route("select", target => {
26+
state["selected"].className = "";
27+
(state["selected"] = target).className = "danger";
6628
})
6729
.listen("click");

frameworks/non-keyed/mikado/src/template/item.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<tr class="{{this.state.selected === index ? 'danger' : ''}}" root>
2-
<td class="col-md-1">{{item.id}}</td>
1+
<tr class="{{this.state.selected === self ? 'danger' : ''}}" root>
2+
<td class="col-md-1">{{data.id}}</td>
33
<td class="col-md-4">
4-
<a class="lbl" click="select:root">{{item.label}}</a>
4+
<a class="lbl" click="select:root">{{data.label}}</a>
55
</td>
66
<td class="col-md-1">
77
<a class="remove" click="remove:root">

frameworks/non-keyed/mikado/task/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const parameter = (function(opt){
8888
//formatting: "PRETTY_PRINT"
8989
});
9090

91-
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --js='src/*.js' --js='src/template/*.es6.js' --js='node_modules/mikado/src/*.js'" + flag_str + " --js_output_file='dist/main.js' && exit 0", function(){
91+
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --js='src/*.js' --js='src/template/*.es6.js' --js='node_modules/mikado/src/*.js' --js='!src/*config.js'" + flag_str + " --js_output_file='dist/main.js' && exit 0", function(){
9292

9393
console.log("Build Complete.");
9494
});

0 commit comments

Comments
 (0)