39 lines
873 B
JavaScript
39 lines
873 B
JavaScript
|
// Thin Preact-React shim for Calendar
|
||
|
// (c) Vitaliy Filippov 2021+
|
||
|
// Repository: http://yourcmc.ru/git/vitalif-js/calendar
|
||
|
// Version: 2021-09-19
|
||
|
// License: Dual-license MPL 2.0+ or GNU LGPL 3.0+
|
||
|
|
||
|
import preact from 'preact';
|
||
|
|
||
|
function createElement(type, props, ...children)
|
||
|
{
|
||
|
if (props)
|
||
|
{
|
||
|
if (props.onClick)
|
||
|
{
|
||
|
props.onclick = props.onClick;
|
||
|
delete props.onClick;
|
||
|
}
|
||
|
if (props.onChange)
|
||
|
{
|
||
|
props.onchange = props.onChange;
|
||
|
delete props.onChange;
|
||
|
}
|
||
|
if (props.className)
|
||
|
{
|
||
|
props['class'] = props.className;
|
||
|
delete props.className;
|
||
|
}
|
||
|
}
|
||
|
return preact.h(type, props, ...children);
|
||
|
}
|
||
|
|
||
|
const React = {
|
||
|
createElement,
|
||
|
Component: preact.Component,
|
||
|
PureComponent: preact.Component,
|
||
|
};
|
||
|
|
||
|
export default React;
|