diff --git a/ivi-v0.7.0/gulpfile.js b/ivi-v0.7.0/gulpfile.js deleted file mode 100644 index 72e5f078e..000000000 --- a/ivi-v0.7.0/gulpfile.js +++ /dev/null @@ -1,47 +0,0 @@ -const gulp = require('gulp'); -const del = require('del'); -const rollup = require('rollup'); -const rollupReplace = require('rollup-plugin-replace'); -const rollupNodeResolve = require('rollup-plugin-node-resolve'); -const closureCompiler = require('google-closure-compiler-js').gulp(); - -gulp.task('clean', function () { - return del(['build', 'dist']); -}); - -gulp.task('bundle', ['clean'], function (done) { - return rollup.rollup({ - format: 'es6', - entry: 'src/main.js', - plugins: [ - rollupNodeResolve(), - rollupReplace({ - values: { - __IVI_DEV__: false, - __IVI_BROWSER__: true - } - }) - ] - }).then(function (bundle) { - return bundle.write({ - format: 'es', - dest: 'build/bundle.js' - }); - }); -}); - -gulp.task('build', ['bundle'], function () { - return gulp.src(['build/bundle.js']) - .pipe(closureCompiler({ - js_output_file: 'main.js', - compilation_level: 'ADVANCED', - language_in: 'ECMASCRIPT6_STRICT', - language_out: 'ECMASCRIPT5_STRICT', - use_types_for_optimization: true, - assume_function_wrapper: true, - output_wrapper: '(function(){%output%}).call(this);', - warning_level: 'QUIET', - rewrite_polyfills: false - })) - .pipe(gulp.dest('dist')); -}); diff --git a/ivi-v0.7.0/package.json b/ivi-v0.7.0/package.json deleted file mode 100644 index 5944b593b..000000000 --- a/ivi-v0.7.0/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "private": true, - "name": "js-framework-benchmark-ivi", - "version": "0.5.0", - "description": "Benchmark for ivi", - "author": "Stefan Krause", - "license": "Apache-2", - "homepage": "https://github.com/krausest/js-framework-benchmark", - "repository": "https://github.com/krausest/js-framework-benchmark", - "keywords": [], - "scripts": { - "build-dev": "gulp build", - "build-prod": "gulp build" - }, - "dependencies": { - "ivi": "0.7.0" - }, - "devDependencies": { - "del": "2.2.2", - "google-closure-compiler-js": "20170218.0.0", - "gulp": "3.9.1", - "rollup": "0.41.5", - "rollup-plugin-node-resolve": "2.0.0", - "rollup-plugin-replace": "1.1.1" - } -} diff --git a/ivi-v0.7.0/src/main.js b/ivi-v0.7.0/src/main.js deleted file mode 100644 index 0c53b3dca..000000000 --- a/ivi-v0.7.0/src/main.js +++ /dev/null @@ -1,189 +0,0 @@ -import { Component, connect, Events, $h, $c, selectorData, createStore, render, update, mut } from "ivi"; - -let startTime = 0; -let lastMeasure = null; - -function startMeasure(name) { - startTime = performance.now(); - lastMeasure = name; -} - -function stopMeasure() { - const last = lastMeasure; - if (lastMeasure) { - window.setTimeout(function () { - const now = performance.now(); - lastMeasure = null; - console.log(`${last} took ${now - startTime}`); - }, 0); - } -} - -function random(max) { - return Math.round(Math.random() * 1000) % max; -} - -const A = ["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 C = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; -const N = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", - "mouse", "keyboard"]; - -let nextId = 1; - -function buildData(count = 1000) { - const data = new Array(count); - for (let i = 0; i < count; i++) { - data[i] = { - id: nextId++, - label: `${A[random(A.length)]} ${C[random(C.length)]} ${N[random(N.length)]}`, - }; - } - return data; -} - -const store = createStore( - { data: mut([]), selected: null }, - function (state, action) { - const data = state.data.ref; - switch (action.type) { - case "delete": - data.splice(data.indexOf(action.item), 1); - return Object.assign({}, state, { data: mut(data) }); - case "run": - return { data: mut(buildData(1000)), selected: null }; - case "add": - return Object.assign({}, state, { data: mut(state.data.ref.concat(buildData(1000))) }); - case "update": - for (let i = 0; i < data.length; i += 10) { - const r = data[i]; - data[i] = { id: r.id, label: r.label + " !!!" }; - } - return Object.assign({}, state); - case "select": - return Object.assign({}, state, { selected: action.item }); - case "runlots": - return { data: mut(buildData(10000)), selected: null }; - case "clear": - return { data: mut([]), selected: null }; - case "swaprows": - if (data.length > 10) { - const a = data[4]; - data[4] = data[9]; - data[9] = a; - } - return Object.assign({}, state, { data: mut(data) }); - } - return state; - }, - function () { - update(); - stopMeasure(); - } -); - -class Row extends Component { - constructor(props) { - super(props); - this.click = Events.onClick(this.click.bind(this)); - this.del = Events.onClick(this.del.bind(this)); - } - - click() { - startMeasure("select"); - store.dispatch({ type: "select", item: this.props.item }); - } - - del() { - startMeasure("delete"); - store.dispatch({ type: "delete", item: this.props.item }); - } - - render() { - const { selected, item } = this.props; - return $h("tr", selected ? "danger" : null) - .children([ - $h("td", "col-md-1").children(item.id), - $h("td", "col-md-4").children( - $h("a").events(this.click).children(item.label) - ), - $h("td", "col-md-1").children( - $h("a").events(this.del).children( - $h("span", "glyphicon glyphicon-remove").props({ "aria-hidden": "true" }) - ) - ), - $h("td", "col-md-6") - ]); - } -} - -const $Row = connect( - function (prev, id) { - const item = store.getState().data.ref[id]; - const selected = store.getState().selected === item; - if (prev && prev.in.item === item && prev.in.selected === selected) { - return prev; - } - return selectorData({ item, selected }); - }, - Row -); - -function RowList(rows) { - const children = new Array(rows.length); - for (let i = 0; i < children.length; i++) { - children[i] = $Row(i).key(rows[i].id); - } - return $h("tbody").children(children); -} - -const $RowList = connect( - function (prev) { - const rows = store.getState().data; - if (prev && prev.in === rows) { - return prev; - } - return selectorData(rows, rows.ref); - }, - RowList -); - -function $Button(text, id) { - return $h("div", "col-sm-6 smallpad").children( - $h("button", "btn btn-primary btn-block") - .events(Events.onClick(() => { - startMeasure(id); - store.dispatch({ type: id }); - })) - .props({ "type": "button", "id": id }) - .children(text) - ); -} - -function Controller() { - return $h("div", "container") - .children([ - $h("div", "jumbotron").children( - $h("div", "row").children([ - $h("div", "col-md-6").children( - $h("h1").children("ivi v0.7.0") - ), - $h("div", "col-md-6").children( - $h("div", "row").children([ - $Button("Create 1,000 rows", "run"), - $Button("Create 10,000 rows", "runlots"), - $Button("Append 1,000 rows", "add"), - $Button("Update every 10th row", "update"), - $Button("Clear", "clear"), - $Button("Swap Rows", "swaprows") - ]) - ) - ]) - ), - $h("table", "table table-hover table-striped test-data").children($RowList()), - $h("span", "preloadicon glyphicon glyphicon-remove").props({ "aria-hidden": "true" }) - ]); -} - -render($c(Controller), document.getElementById("main")); diff --git a/ivi-v0.7.0/.gitignore b/ivi-v0.8.0-keyed/.gitignore similarity index 100% rename from ivi-v0.7.0/.gitignore rename to ivi-v0.8.0-keyed/.gitignore diff --git a/ivi-v0.8.0-keyed/gulpfile.js b/ivi-v0.8.0-keyed/gulpfile.js new file mode 100644 index 000000000..ed206ebea --- /dev/null +++ b/ivi-v0.8.0-keyed/gulpfile.js @@ -0,0 +1,49 @@ +const gulp = require('gulp'); +const del = require('del'); +const rollup = require('rollup'); +const rollupReplace = require('rollup-plugin-replace'); +const rollupNodeResolve = require('rollup-plugin-node-resolve'); +const closureCompiler = require('google-closure-compiler-js').gulp(); + +gulp.task('clean', function () { + return del(['build', 'dist']); +}); + +gulp.task('bundle', ['clean'], function (done) { + return rollup.rollup({ + format: 'es6', + entry: 'src/main.js', + plugins: [ + rollupNodeResolve({ + module: true, + }), + rollupReplace({ + values: { + __IVI_DEV__: false, + __IVI_BROWSER__: true + } + }) + ] + }).then(function (bundle) { + return bundle.write({ + format: 'es', + dest: 'build/bundle.js' + }); + }); +}); + +gulp.task('build', ['bundle'], function () { + return gulp.src(['build/bundle.js']) + .pipe(closureCompiler({ + js_output_file: 'main.js', + compilation_level: 'ADVANCED', + language_in: 'ECMASCRIPT6_STRICT', + language_out: 'ECMASCRIPT5_STRICT', + use_types_for_optimization: true, + assume_function_wrapper: true, + output_wrapper: '(function(){%output%}).call(this);', + warning_level: 'QUIET', + rewrite_polyfills: false + })) + .pipe(gulp.dest('dist')); +}); diff --git a/ivi-v0.7.0/index.html b/ivi-v0.8.0-keyed/index.html similarity index 61% rename from ivi-v0.7.0/index.html rename to ivi-v0.8.0-keyed/index.html index 91c0cecbc..1e408b21f 100644 --- a/ivi-v0.7.0/index.html +++ b/ivi-v0.8.0-keyed/index.html @@ -1,12 +1,15 @@ + - ivi v0.7.0 - + ivi v0.8.0 + +
- + + \ No newline at end of file diff --git a/ivi-v0.8.0-keyed/package.json b/ivi-v0.8.0-keyed/package.json new file mode 100644 index 000000000..aba39cf94 --- /dev/null +++ b/ivi-v0.8.0-keyed/package.json @@ -0,0 +1,32 @@ +{ + "private": true, + "name": "js-framework-benchmark-ivi", + "version": "0.8.0", + "description": "Benchmark for ivi", + "author": "Stefan Krause", + "license": "Apache-2", + "homepage": "https://github.com/krausest/js-framework-benchmark", + "repository": "https://github.com/krausest/js-framework-benchmark", + "keywords": [], + "scripts": { + "build-dev": "gulp build", + "build-prod": "gulp build" + }, + "dependencies": { + "ivi-core": "0.1.0", + "ivi-dom": "0.1.0", + "ivi-scheduler": "0.1.0", + "ivi-html": "0.1.0", + "ivi-events": "0.1.0", + "ivi-state": "0.1.0", + "ivi": "0.8.0" + }, + "devDependencies": { + "del": "3.0.0", + "google-closure-compiler-js": "20170626.0.0", + "gulp": "3.9.1", + "rollup": "0.45.2", + "rollup-plugin-node-resolve": "3.0.0", + "rollup-plugin-replace": "1.1.1" + } +} \ No newline at end of file diff --git a/ivi-v0.8.0-keyed/src/main.js b/ivi-v0.8.0-keyed/src/main.js new file mode 100644 index 000000000..a52ffc8af --- /dev/null +++ b/ivi-v0.8.0-keyed/src/main.js @@ -0,0 +1,81 @@ +import { Component, componentFactory, connect, selectorData, render, map } from "ivi"; +import * as h from "ivi-html"; +import * as Events from "ivi-events"; +import { store } from "./store"; + +const HiddenAttributes = { "aria-hidden": "true" }; + +class Row extends Component { + constructor(props) { + super(props); + this.click = Events.onClick(() => { store.dispatch({ type: "select", item: this.props.item }); }); + this.del = Events.onClick(() => { store.dispatch({ type: "delete", item: this.props.item }); }); + } + + render() { + const { selected, item } = this.props; + return h.tr(selected ? "danger" : null).children( + h.td("col-md-1").children(item.id), + h.td("col-md-4").children(h.a().events(this.click).children(item.label)), + h.td("col-md-1").children( + h.a().events(this.del).children(h.span("glyphicon glyphicon-remove").props(HiddenAttributes)) + ), + h.td("col-md-6") + ); + } +} + +const row = connect( + function (prev, id) { + const item = store.getState().data.ref[id]; + const selected = store.getState().selected === item; + if (prev !== null && prev.in.item === item && prev.in.selected === selected) { + return prev; + } + return selectorData({ item, selected }); + }, + Row +); + +const rowList = connect( + function (prev) { + const rows = store.getState().data; + if (prev !== null && prev.in === rows) { + return prev; + } + return selectorData(rows, rows.ref); + }, + function (rows) { return h.tbody().children(map(rows, (r, i) => row(i).key(r.id))); } +); + +function button(text, id) { + return h.div("col-sm-6 smallpad").children( + h.button("btn btn-primary btn-block") + .events(Events.onClick(() => { store.dispatch({ type: id }); })) + .props({ "type": "button", "id": id }) + .children(text) + ); +} + +render( + h.div("container").children( + h.div("jumbotron").children( + h.div("row").children( + h.div("col-md-6").children(h.h1().children("ivi v0.8.0")), + h.div("col-md-6").children( + h.div("row").children( + button("Create 1,000 rows", "run"), + button("Create 10,000 rows", "runlots"), + button("Append 1,000 rows", "add"), + button("Update every 10th row", "update"), + button("Clear", "clear"), + button("Swap Rows", "swaprows") + ) + ) + ) + ), + h.table("table table-hover table-striped test-data").children(rowList()), + h.span("preloadicon glyphicon glyphicon-remove").props(HiddenAttributes) + ), + document.getElementById("main") +); diff --git a/ivi-v0.8.0-keyed/src/store.js b/ivi-v0.8.0-keyed/src/store.js new file mode 100644 index 000000000..1502a4f7c --- /dev/null +++ b/ivi-v0.8.0-keyed/src/store.js @@ -0,0 +1,63 @@ +import { updateNextFrame } from "ivi"; +import { createStore, mut } from "ivi-state"; + +function random(max) { + return Math.round(Math.random() * 1000) % max; +} + +const A = ["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 C = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; +const N = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", + "keyboard"]; + +let nextId = 1; + +function buildData(count = 1000) { + const data = new Array(count); + for (let i = 0; i < count; i++) { + data[i] = { + id: nextId++, + label: `${A[random(A.length)]} ${C[random(C.length)]} ${N[random(N.length)]}`, + }; + } + return data; +} + +export const store = createStore( + { data: mut([]), selected: null }, + function (state, action) { + const data = state.data.ref; + switch (action.type) { + case "delete": + data.splice(data.indexOf(action.item), 1); + return { data: mut(data), selected: state.selected }; + case "run": + return { data: mut(buildData(1000)), selected: null }; + case "add": + return { data: mut(state.data.ref.concat(buildData(1000))), selected: state.selected }; + case "update": + for (let i = 0; i < data.length; i += 10) { + const r = data[i]; + data[i] = { id: r.id, label: r.label + " !!!" }; + } + return { data: state.data, selected: state.selected }; + case "select": + return { data: state.data, selected: action.item }; + case "runlots": + return { data: mut(buildData(10000)), selected: null }; + case "clear": + return { data: mut([]), selected: null }; + case "swaprows": + if (data.length > 10) { + const a = data[4]; + data[4] = data[9]; + data[9] = a; + } + return { data: mut(data), selected: state.selected }; + } + return state; + }, + updateNextFrame +); diff --git a/kivi-v1.0.0-rc2/.gitignore b/kivi-v1.0.0-rc2/.gitignore deleted file mode 100644 index 997d7c4bf..000000000 --- a/kivi-v1.0.0-rc2/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -build -dist - -node_modules - -.DS_Store -.idea -.vscode -.npm-debug -npm-debug.log diff --git a/kivi-v1.0.0-rc2/gulpfile.js b/kivi-v1.0.0-rc2/gulpfile.js deleted file mode 100644 index 586afaba5..000000000 --- a/kivi-v1.0.0-rc2/gulpfile.js +++ /dev/null @@ -1,76 +0,0 @@ -const gulp = require('gulp'); -const typescript = require('typescript'); -const ts = require('gulp-typescript'); -//const tslint = require("gulp-tslint"); -const rollup = require('rollup'); -const rollupReplace = require('rollup-plugin-replace'); -const rollupNodeResolve = require('rollup-plugin-node-resolve'); -const closureCompiler = require('google-closure-compiler-js').gulp(); - -const ClosureConfig = { - compilation_level: 'ADVANCED', -// entry_point: 'goog:main', -// dependency_mode: 'STRICT', - languageIn: 'ECMASCRIPT6_STRICT', - languageOut: 'ECMASCRIPT5_STRICT', - useTypesForOptimization: true, - assumeFunctionWrapper: true, -// output_wrapper: '(function(){%output%}).call();', -// summary_detail_level: 3, - warningLevel: 'QUIET', -}; - -function clean() { - const del = require('del'); - return del(['build', 'dist']); -} - -function compileTS() { - return gulp.src('main.ts') -/* .pipe(tslint({ - formatter: "verbose", - }))*/ - .pipe(ts(Object.assign(require('./tsconfig.json').compilerOptions, { - typescript: require('typescript'), - }))) - .pipe(gulp.dest('build/es6')); -} - -function bundle(done) { - return rollup.rollup({ - format: 'es6', - entry: 'build/es6/main.js', - plugins: [ - rollupReplace({ - delimiters: ['<@', '@>'], - values: { - KIVI_DEBUG: 'DEBUG_DISABLED', - }, - }), - rollupNodeResolve(), - ] - }).then(function(bundle) { - return bundle.write({ - format: 'es', - dest: 'build/main.es6.js', - intro: 'goog.module("main");', - sourceMap: 'inline', - }); - }); -} - -function compile() { - return gulp.src(['build/main.es6.js']) - .pipe(closureCompiler(Object.assign({}, ClosureConfig, { - js_output_file: 'main.js', - }))) - .pipe(gulp.dest('dist')); -} - -const build = gulp.series( - clean, - compileTS, - bundle, - compile); - -exports.build = build; diff --git a/kivi-v1.0.0-rc2/index.html b/kivi-v1.0.0-rc2/index.html deleted file mode 100644 index c362b029d..000000000 --- a/kivi-v1.0.0-rc2/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - kivi v1.0.0-rc0 - - - -
- - - diff --git a/kivi-v1.0.0-rc2/main.ts b/kivi-v1.0.0-rc2/main.ts deleted file mode 100644 index 33a5ad578..000000000 --- a/kivi-v1.0.0-rc2/main.ts +++ /dev/null @@ -1,295 +0,0 @@ -import { ComponentDescriptor, ElementDescriptor, createVElement, injectComponent, clock, scheduleMicrotask, - matchesWithAncestors } from "kivi"; - -let startTime = 0; -let lastMeasure: string | null; - -function startMeasure(name: string) { - startTime = performance.now(); - lastMeasure = name; -} - -function stopMeasure() { - const last = lastMeasure; - if (lastMeasure) { - window.setTimeout(function () { - const now = performance.now(); - lastMeasure = null; - console.log(`${last} took ${now - startTime}`); - }, 0); - } -} - -function _random(max: number): number { - return Math.round(Math.random() * 1000) % max; -} - -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 Colors = ["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"]; - -interface RowData { - id: number; - label: string; - mtime: number; -} - -let nextId = 1; - -function buildRowData(count = 1000): RowData[] { - const data = new Array(count); - for (let i = 0; i < count; i++) { - data[i] = ({ - id: nextId++, - label: `${Adjectives[_random(Adjectives.length)]} ` + - `${Colors[_random(Colors.length)]} ` + - `${Nouns[_random(Nouns.length)]}`, - mtime: -1, - }); - } - - return data; -} - -class Store { - data: RowData[]; - selected: RowData | null; - onChange: (() => void) | null; - - constructor() { - this.data = []; - this.selected = null; - this.onChange = null; - } - - invalidate() { - this.onChange!(); - } - - delete(row: RowData) { - this.data.splice(this.data.indexOf(row), 1); - this.invalidate(); - } - - run() { - this.data = buildRowData(); - this.selected = null; - this.invalidate(); - } - - add() { - this.data = this.data.concat(buildRowData(1000)); - this.invalidate(); - } - - update() { - const data = this.data; - for (let i = 0; i < data.length; i += 10) { - const r = data[i]; - r.label += " !!!"; - r.mtime = clock(); - } - - this.invalidate(); - } - - select(row: RowData) { - this.selected = row; - this.invalidate(); - } - - runLots() { - this.data = buildRowData(10000); - this.selected = null; - this.invalidate(); - } - - clear() { - this.data = []; - this.selected = null; - this.invalidate(); - } - - swapRows() { - if (this.data.length > 10) { - const a = this.data[4]; - this.data[4] = this.data[9]; - this.data[9] = a; - } - this.invalidate(); - } -} - -const store = new Store(); - -interface RowProps { - data: RowData; - selected: boolean; -} - -const RowTitle = new ElementDescriptor("td") - .enableCloning() - .className("col-md-1") - .update((e, oldProps, newProps) => { - if (oldProps === undefined || oldProps !== newProps) { - e.textContent = newProps; - } - }); - -const HiddenAttrs = {"aria-hidden": "true"}; - -const RemoveIcon = new ElementDescriptor("span") - .enableCloning() - .className("glyphicon glyphicon-remove") - .attrs(HiddenAttrs); - -const Row = new ComponentDescriptor() - .enableBackRef() - .tagName("tr") - .newPropsReceived((c, oldProps, newProps) => { - if (oldProps.selected !== newProps.selected || c.mtime < newProps.data.mtime) { - c.markDirty(); - } - }) - .update((c, props) => { - const data = props.data; - - c.sync(c.createVRoot().className(props.selected ? "danger" : null).children([ - RowTitle.createVNode().data(data.id), - createVElement("td").className("col-md-4").children([ - createVElement("a").child(data.label), - ]), - createVElement("td").className("col-md-1").children([ - createVElement("a").children([ - RemoveIcon.createVNode(), - ]), - ]), - createVElement("td").className("col-md-6"), - ])); - }); - -const onRowClick = Row.createDelegatedEventHandler(".col-md-4 > a", "tr", (e, c, props) => { - startMeasure("select"); - store.select(props.data); -}); - -const onRowDelete = Row.createDelegatedEventHandler(".col-md-1 > a", "tr", (e, c, props) => { - startMeasure("delete"); - store.delete(props.data); -}); - -function rowClick(e: MouseEvent) { - onRowClick(e); - onRowDelete(e); -} - -const Menu = new ComponentDescriptor() - .enableBackRef() - .attached((c) => { - (c.element as HTMLElement).onclick = (e) => { - e.stopPropagation(); - if (matchesWithAncestors(e.target as Element, "#run", c.element)) { - startMeasure("run"); - store.run(); - } else if (matchesWithAncestors(e.target as Element, "#runlots", c.element)) { - startMeasure("runLots"); - store.runLots(); - } else if (matchesWithAncestors(e.target as Element, "#add", c.element)) { - startMeasure("add"); - store.add(); - } else if (matchesWithAncestors(e.target as Element, "#update", c.element)) { - startMeasure("update"); - store.update(); - } else if (matchesWithAncestors(e.target as Element, "#clear", c.element)) { - startMeasure("clear"); - store.clear(); - } else if (matchesWithAncestors(e.target as Element, "#swaprows", c.element)) { - startMeasure("swapRows"); - store.swapRows(); - } - }; - }) - .update((c) => { - const buttonClassName = "btn btn-primary btn-block"; - - c.sync(c.createVRoot().className("jumbotron").children([ - createVElement("div").className("row").children([ - createVElement("div").className("col-md-6").children([ - createVElement("h1").child("kivi v0.11.0"), - ]), - createVElement("div").className("col-md-6").children([ - createVElement("div").className("row").children([ - createVElement("div").className("col-sm-6 smallpad").children([ - createVElement("button").props({"id": "run", "type": "button"}).className(buttonClassName) - .child("Create 1,000 rows"), - ]), - createVElement("div").className("col-sm-6 smallpad").children([ - createVElement("button").props({"id": "runlots", "type": "button"}).className(buttonClassName) - .child("Create 10,000 rows"), - ]), - createVElement("div").className("col-sm-6 smallpad").children([ - createVElement("button").props({"id": "add", "type": "button"}).className(buttonClassName) - .child("Append 1,000 rows"), - ]), - createVElement("div").className("col-sm-6 smallpad").children([ - createVElement("button").props({"id": "update", "type": "button"}).className(buttonClassName) - .child("Update every 10th row"), - ]), - createVElement("div").className("col-sm-6 smallpad").children([ - createVElement("button").props({"id": "clear", "type": "button"}).className(buttonClassName) - .child("Clear"), - ]), - createVElement("div").className("col-sm-6 smallpad").children([ - createVElement("button").props({"id": "swaprows", "type": "button"}).className(buttonClassName) - .child("Swap Rows"), - ]), - ]), - ]), - ]), - ])); - }); - -const Table = new ComponentDescriptor() - .tagName("table") - .attached((c) => { - (c.element as HTMLElement).onclick = rowClick; - }) - .update((c, props) => { - const data = props.data; - const children = new Array(data.length); - for (let i = 0; i < data.length; i++) { - const r = data[i]; - children[i] = Row.createVNode({ - selected: props.selected === r, - data: r, - }).key(r.id); - } - - c.sync(c.createVRoot().className("table table-hover table-striped test-data").children([ - createVElement("tbody").trackByKeyChildren(children), - ])); - }); - -const Main = new ComponentDescriptor() - .update((c, props, state) => { - c.sync(c.createVRoot().className("container").children([ - Menu.createImmutableVNode(), - Table.createVNode(store), - createVElement("span").className("preloadicon glyphicon glyphicon-remove").attrs(HiddenAttrs), - ])); - - stopMeasure(); - scheduleMicrotask(() => { - // Increment scheduler clock. - // Because of the benchmark we need to force sync updates, and because of this internal clock isn't increasing. - }); - }); - -const c = injectComponent(Main, document.getElementById("main")!, undefined, true); -store.onChange = function() { - c.markDirty(); - c.update(); -}; diff --git a/kivi-v1.0.0-rc2/package.json b/kivi-v1.0.0-rc2/package.json deleted file mode 100644 index 5ef60fbe0..000000000 --- a/kivi-v1.0.0-rc2/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "private": true, - "name": "js-framework-benchmark-kivi", - "version": "0.11.0", - "description": "Benchmark for kivi", - "author": "Stefan Krause", - "license": "Apache-2", - "homepage": "https://github.com/krausest/js-framework-benchmark", - "repository": "https://github.com/krausest/js-framework-benchmark", - "keywords": [], - "scripts": { - "build-dev": "gulp build", - "build-prod": "gulp build" - }, - "dependencies": { - "kivi": "1.0.0-rc2" - }, - "devDependencies": { - "del": "2.2.2", - "google-closure-compiler-js": "20161024.0.0", - "gulp": "github:gulpjs/gulp#4.0", - "gulp-tslint": "6.1.3", - "gulp-typescript": "3.1.3", - "rollup": "0.36.3", - "rollup-plugin-node-resolve": "2.0.0", - "rollup-plugin-replace": "1.1.1", - "tslint": "4.0.0", - "typescript": "2.0.10" - } -} diff --git a/kivi-v1.0.0-rc2/tsconfig.json b/kivi-v1.0.0-rc2/tsconfig.json deleted file mode 100644 index 685c7ef06..000000000 --- a/kivi-v1.0.0-rc2/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "lib": ["es6", "dom"], - "outDir": "build/es6", - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "strictNullChecks": true, - "removeComments": false, - "moduleResolution": "node" - }, - "files": [ - "main.ts" - ], - "compileOnSave": false -} \ No newline at end of file diff --git a/kivi-v1.0.0-rc2/tslint.json b/kivi-v1.0.0-rc2/tslint.json deleted file mode 100644 index 4028fa4e4..000000000 --- a/kivi-v1.0.0-rc2/tslint.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "rules": { - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": true, - "indent": [true, "spaces"], - "label-position": true, - "label-undefined": true, - "max-line-length": [true, 140], - "member-access": false, - "member-ordering": [false], - "no-arg": true, - "no-bitwise": false, - "no-console": [false], - "no-construct": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "quotemark": [true, "double", "avoid-escape"], - "radix": true, - "semicolon": [true], - "trailing-comma": [true, { - "singleline": "never", - "multiline": "always" - }], - "triple-equals": [true, "allow-null-check"], - "typedef-whitespace": [true, { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }], - "variable-name": false, - "whitespace": [true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/webdriver-ts/src/common.ts b/webdriver-ts/src/common.ts index 415de57de..df2e3f3ad 100644 --- a/webdriver-ts/src/common.ts +++ b/webdriver-ts/src/common.ts @@ -52,8 +52,7 @@ export let frameworks = [ f("hyperapp-v0.9.1", true), f("inferno-v3.1.2-non-keyed", true), f("inferno-v3.1.2-keyed", false), - f("ivi-v0.7.0", false), - f("kivi-v1.0.0-rc2", false), + f("ivi-v0.8.0-keyed", false), f("knockout-v3.4.1", false), f("marionette-v3.3.1", false), f("marko-v4.3.0", false),