interim commit

This commit is contained in:
Jason Miller
2018-03-09 13:24:30 -05:00
commit 60eafdc3fd
23 changed files with 16430 additions and 0 deletions

26
src/lib/fix-pmc.js Normal file
View File

@@ -0,0 +1,26 @@
import { options } from 'preact';
const classNameDescriptor = {
enumerable: false,
configurable: true,
get() {
return this.class;
},
set(value) {
this.class = value;
}
};
let old = options.vnode;
options.vnode = vnode => {
let a = vnode.attributes;
if (a!=null) {
if ('className' in a) {
a.class = a.className;
}
if ('class' in a) {
Object.defineProperty(a, 'className', classNameDescriptor);
}
}
if (old != null) old(vnode);
};

10
src/lib/util.js Normal file
View File

@@ -0,0 +1,10 @@
export function updater(obj, property, value) {
return e => {
let update = {};
update[property] = typeof value === 'function' ? value(obj.state[property], e) : value;
obj.setState(update);
};
}
export const toggle = value => !value;