diff --git a/frameworks/keyed/mikado-proxy/index.html b/frameworks/keyed/mikado-proxy/index.html new file mode 100644 index 000000000..0d7a5059d --- /dev/null +++ b/frameworks/keyed/mikado-proxy/index.html @@ -0,0 +1,13 @@ + + + + + Mikado-"keyed" + + + + +
+ + + diff --git a/frameworks/keyed/mikado-proxy/package.json b/frameworks/keyed/mikado-proxy/package.json new file mode 100644 index 000000000..bd4157076 --- /dev/null +++ b/frameworks/keyed/mikado-proxy/package.json @@ -0,0 +1,27 @@ +{ + "private": true, + "name": "js-framework-benchmark-mikado-proxy", + "homepage": "https://github.com/nextapps-de/mikado/", + "author": "Nextapps GmbH", + "license": "Apache-2.0", + "js-framework-benchmark": { + "frameworkVersionFromPackage": "mikado" + }, + "preferGlobal": false, + "repository": { + "type": "git", + "url": "https://github.com/krausest/js-framework-benchmark.git" + }, + "scripts": { + "compile": "mikado-compile src/template/app.html && mikado-compile src/template/item.html && echo Compile Complete. && exit 0", + "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=false SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=true SUPPORT_CACHE_HELPERS=false SUPPORT_POOLS=false SUPPORT_CALLBACKS=false SUPPORT_COMPILE=false && exit 0", + "build-prod": "npm run build" + }, + "dependencies": { + "mikado": "^0.7.46" + }, + "devDependencies": { + "google-closure-compiler": "^20191030.0.0-nightly", + "mikado-compile": "0.6.5" + } +} diff --git a/frameworks/keyed/mikado-proxy/src/data.js b/frameworks/keyed/mikado-proxy/src/data.js new file mode 100644 index 000000000..31cba7bf1 --- /dev/null +++ b/frameworks/keyed/mikado-proxy/src/data.js @@ -0,0 +1,40 @@ +const ADJECTIVES = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"]; +const COLOURS = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; +const NOUNS = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]; + +const len_ADJECTIVES = ADJECTIVES.length; +const len_COLOURS = COLOURS.length; +const len_NOUNS = NOUNS.length; + +let _nextId = 1; + +export function buildData(count){ + + // if(count === 1){ + // + // return { + // + // id: _nextId++, + // label: ADJECTIVES[_random(len_ADJECTIVES)] + " " + COLOURS[_random(len_COLOURS)] + " " + NOUNS[_random(len_NOUNS)] + // } + // } + + const data = new Array(count); + + for(let i = 0; i < count; i++){ + + data[i] = { + + "id": _nextId++, + "label": ADJECTIVES[_random(len_ADJECTIVES)] + " " + COLOURS[_random(len_COLOURS)] + " " + NOUNS[_random(len_NOUNS)], + "selected": "" + }; + } + + return data; +} + +function _random(max){ + + return (Math.random() * max) | 0; +} \ No newline at end of file diff --git a/frameworks/keyed/mikado-proxy/src/main.js b/frameworks/keyed/mikado-proxy/src/main.js new file mode 100644 index 000000000..5db56b555 --- /dev/null +++ b/frameworks/keyed/mikado-proxy/src/main.js @@ -0,0 +1,32 @@ +import Mikado from "../node_modules/mikado/src/mikado.js"; +import Array from "../node_modules/mikado/src/array.js"; +import app from "./template/app.es6.js"; +import item from "./template/item.es6.js"; +import { buildData } from "./data.js"; + +Mikado.once(document.getElementById("main"), app); + +let selected = 0; +const store = new Array(); +const view = new Mikado(document.getElementById("tbody"), item, { + "reuse": false, "store": store +}) +.route("run", () => store.set(buildData(1000))) +.route("runlots", () => store.set(buildData(10000))) +.route("add", () => store.concat(buildData(1000))) +.route("update", () => { + for(let i = 0, len = store.length; i < len; i += 10) + store[i].label += " !!!" +}) +.route("clear", () => store.splice()) +.route("swaprows", () => { + const tmp = store[998]; + store[998] = store[1]; + store[1] = tmp; +}) +.route("remove", target => store.splice(view.index(target), 1)) +.route("select", target => { + store[selected]["selected"] = ""; + store[selected = view.index(target)]["selected"] = "danger"; +}) +.listen("click"); diff --git a/frameworks/keyed/mikado-proxy/src/template/app.html b/frameworks/keyed/mikado-proxy/src/template/app.html new file mode 100644 index 000000000..946096b22 --- /dev/null +++ b/frameworks/keyed/mikado-proxy/src/template/app.html @@ -0,0 +1,35 @@ +
+
+
+
+

Mikado-"keyed"

+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + +
+ +
\ No newline at end of file diff --git a/frameworks/keyed/mikado-proxy/src/template/item.html b/frameworks/keyed/mikado-proxy/src/template/item.html new file mode 100644 index 000000000..35ac016fe --- /dev/null +++ b/frameworks/keyed/mikado-proxy/src/template/item.html @@ -0,0 +1,12 @@ + + {{=data.id}} + + {{=data.label}} + + + + + + + + \ No newline at end of file diff --git a/frameworks/keyed/mikado-proxy/task/build.js b/frameworks/keyed/mikado-proxy/task/build.js new file mode 100644 index 000000000..929d26370 --- /dev/null +++ b/frameworks/keyed/mikado-proxy/task/build.js @@ -0,0 +1,115 @@ +const child_process = require('child_process'); +const fs = require('fs'); + +console.log("Start build ....."); +console.log(); + +fs.existsSync("log") || fs.mkdirSync("log"); + +let flag_str = ""; + +var options = (function(argv){ + + const arr = {}; + let count = 0; + + argv.forEach(function(val, index) { + + if(++count > 2){ + + index = val.split('='); + val = index[1]; + index = index[0].toUpperCase(); + + flag_str += " --define='" + index + "=" + val + "'"; + arr[index] = val; + + if(count > 3) console.log(index + ': ' + val); + } + }); + + console.log('RELEASE: ' + (arr['RELEASE'] || 'custom')); + + return arr; + +})(process.argv); + +const parameter = (function(opt){ + + let parameter = ''; + + for(let index in opt){ + + if(opt.hasOwnProperty(index)){ + + parameter += ' --' + index + '=' + opt[index]; + } + } + + return parameter; +})({ + + compilation_level: "ADVANCED_OPTIMIZATIONS", //"WHITESPACE" + use_types_for_optimization: true, + //new_type_inf: true, + jscomp_warning: "newCheckTypes", + //jscomp_error: "strictCheckTypes", + jscomp_error: "newCheckTypesExtraChecks", + generate_exports: true, + export_local_property_definitions: true, + language_in: "ECMASCRIPT6_STRICT", + language_out: "ECMASCRIPT6_STRICT", + process_closure_primitives: true, + summary_detail_level: 3, + warning_level: "VERBOSE", + emit_use_strict: true, + + output_manifest: "log/manifest.log", + output_module_dependencies: "log/module_dependencies.log", + property_renaming_report: "log/property_renaming.log", + create_source_map: "log/source_map.log", + variable_renaming_report: "log/variable_renaming.log", + strict_mode_input: true, + assume_function_wrapper: true, + + transform_amd_modules: true, + process_common_js_modules: true, + module_resolution: "BROWSER", + //dependency_mode: "SORT_ONLY", + //js_module_root: "./", + entry_point: "./src/main.js", + //manage_closure_dependencies: true, + dependency_mode: "PRUNE_LEGACY", + rewrite_polyfills: false, + + isolation_mode: "IIFE" + //output_wrapper: "(function(){%output%}());" + + //formatting: "PRETTY_PRINT" +}); + +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(){ + + console.log("Build Complete."); +}); + +function exec(prompt, callback){ + + const child = child_process.exec(prompt, function(err, stdout, stderr){ + + if(err){ + + console.error(err); + } + else{ + + if(callback){ + + callback(); + } + } + }); + + child.stdout.pipe(process.stdout); + child.stderr.pipe(process.stderr); +}