Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// import virtualize from 'snabbdom-virtualize/strings'
const snabbdom = require('snabbdom')
export const patch = snabbdom.init([ // Init patch function with chosen modules
require('snabbdom/modules/class').default, // makes it easy to toggle classes
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/style').default, // handles styling on elements with support for animations
require('snabbdom/modules/props').default, // for setting properties on DOM elements
require('snabbdom/modules/dataset').default,
require('snabbdom/modules/eventlisteners').default // attaches event listeners
])
export const h = require('snabbdom/h').default // helper function for creating vnodes
export const toHTML = require('snabbdom-to-html') // helper function for convert vnode to HTML string
export const toVNode = require('snabbdom/tovnode').default // helper function for convert DOM to vnode
export const htmlToVNode = html => { // helper function for convert html to vnode
const wrapper = document.createElement('div')
wrapper.innerHTML = html
return toVNode(wrapper).children
}
// import virtualize from 'snabbdom-virtualize/strings'
const snabbdom = require('snabbdom')
export const patch = snabbdom.init([ // Init patch function with chosen modules
require('snabbdom/modules/class').default, // makes it easy to toggle classes
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/style').default, // handles styling on elements with support for animations
require('snabbdom/modules/props').default, // for setting properties on DOM elements
require('snabbdom/modules/dataset').default,
require('snabbdom/modules/eventlisteners').default // attaches event listeners
])
export const h = require('snabbdom/h').default // helper function for creating vnodes
export const toHTML = require('snabbdom-to-html') // helper function for convert vnode to HTML string
export const toVNode = require('snabbdom/tovnode').default // helper function for convert DOM to vnode
export const htmlToVNode = html => { // helper function for convert html to vnode
const wrapper = document.createElement('div')
wrapper.innerHTML = html
return toVNode(wrapper).children
}
import * as snabbdom from 'snabbdom'
import * as snabbdom_class from 'snabbdom/modules/class'
import * as snabbdom_props from 'snabbdom/modules/props'
import * as snabbdom_style from 'snabbdom/modules/style'
import * as snabbdom_directive from './directives/directive'
import * as snabbdom_create_component from './directives/create-component'
import * as snabbdom_eventlisteners from 'snabbdom/modules/eventlisteners'
import * as snabbdom_h from 'snabbdom/h'
const patch = snabbdom.init([ // Init patch function with chosen modules
snabbdom_class.default, // makes it easy to toggle classes
snabbdom_props.default, // for setting properties on DOM elements
snabbdom_style.default, // handles styling on elements with support for animations
snabbdom_eventlisteners.default, // attaches event listeners
snabbdom_directive.default, // xiaowenjie add 处理指令
snabbdom_create_component.default, // xiaowenjie 创建插件
])
const h = snabbdom_h.default // helper function for creating vnodes
export { h, patch }
import { wait } from '@skatejs/bore';
import define from '@skatejs/define';
import Element, { h } from '..';
const Test = define(
class extends Element {
static modules = [
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/eventlisteners').default,
require('snabbdom/modules/class').default,
require('snabbdom/modules/props').default,
require('snabbdom/modules/style').default,
require('snabbdom/modules/dataset').default
];
static props = { name: String };
name: string = 'World';
render() {
return h('span', `Hello, ${this.name}!`);
}
}
);
function testContent(text) {
return `<span>Hello, ${text}!</span>`;
}
const init = actions =>
snabbdom.init([
actions.route ? link(actions) : {},
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/class').default,
require('snabbdom/modules/dataset').default,
require('snabbdom/modules/eventlisteners').default,
require('snabbdom/modules/props').default,
require('snabbdom/modules/style').default
])
},{}],13:[function(require,module,exports){
var snabbdom = require('snabbdom');
var patch = snabbdom.init([
require('snabbdom/modules/class').default,
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/props').default,
require('snabbdom/modules/style').default,
require('snabbdom/modules/eventlisteners').default,
require('snabbdom/modules/dataset').default
]);
snabbdom_h = require('snabbdom/h').default;
function stringifyEvent(e) {
const obj = {};
for (let k in e) {
obj[k] = e[k];
}
return JSON.stringify(obj, (k, v) => {
if (v instanceof Node) return 'Node';
if (v instanceof Window) return 'Window';
return v;
}, ' ');
}
import flyd from 'flyd';
import flip from 'ramda/src/flip';
import over from 'ramda/src/over';
import curry from 'ramda/src/curry';
import forwardTo from 'flyd/module/forwardto';
const snabbdom = require('snabbdom');
const patch = snabbdom.init([
require('snabbdom/modules/class').default,
require('snabbdom/modules/props').default,
require('snabbdom/modules/style').default,
require('snabbdom/modules/eventlisteners').default
]);
export const mount = (module, root) => {
const { init, update, render, subscribe } = module;
const model = init();
const actions$ = flyd.stream();
if(subscribe) {
const subscription$ = subscribe(model);
flyd.on(actions$, subscription$);
}
const model$ = flyd.scan(flip(update), model, actions$);
const vnode$ = flyd.map((model) => render(model, actions$), model$);
},{}],13:[function(require,module,exports){
var snabbdom = require('snabbdom');
var patch = snabbdom.init([
require('snabbdom/modules/class').default,
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/props').default,
require('snabbdom/modules/style').default,
require('snabbdom/modules/eventlisteners').default,
require('snabbdom/modules/dataset').default
]);
snabbdom_h = require('snabbdom/h').default;
function stringifyEvent(e) {
const obj = {};
for (let k in e) {
obj[k] = e[k];
}
return JSON.stringify(obj, (k, v) => {
if (v instanceof Node) return 'Node';
if (v instanceof Window) return 'Window';
return v;
}, ' ');
}
attrs[index] = value;
}
});
return snabbdomh.default(
name,
{
on, style, attrs, hook, class: sclass, key,
},
children,
);
}
const patch = snabbdom.init([
attributes.default,
style.default,
eventlisteners.default,
sclass.default,
]);
let renderPipeline = [];
function scheduleRender(node) {
renderPipeline.push(node);
const rendering = [...renderPipeline];
renderPipeline = [];
window.requestAnimationFrame(() => {
rendering.forEach(node => node.partialRender());
});
}
function destroyUnreferencedComponents() {
const keysCache = Object.keys(cache);