Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snabbdom

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snabbdom - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

10

es/h.d.ts
import { VNode, VNodeData } from './vnode';
export declare type VNodes = Array<VNode>;
export declare type VNodesSparse = VNode | Array<VNode | undefined | null>;
export declare type VNodeChildElement = VNode | string | number | undefined | null;
export declare type ArrayOrElement<T> = T | T[];
export declare type VNodeChildren = ArrayOrElement<VNodeChildElement>;
export declare function h(sel: string): VNode;
export declare function h(sel: string, data: VNodeData): VNode;
export declare function h(sel: string, text: string): VNode;
export declare function h(sel: string, children: VNodesSparse): VNode;
export declare function h(sel: string, data: VNodeData, text: string): VNode;
export declare function h(sel: string, data: VNodeData, children: VNodesSparse): VNode;
export declare function h(sel: string, children: VNodeChildren): VNode;
export declare function h(sel: string, data: VNodeData, children: VNodeChildren): VNode;
export default h;

@@ -42,3 +42,3 @@ import { vnode } from './vnode';

}
if (is.array(children)) {
if (children !== undefined) {
for (i = 0; i < children.length; ++i) {

@@ -45,0 +45,0 @@ if (is.primitive(children[i]))

import { Module } from './module';
declare global {
interface Element {
setAttribute(name: string, value: string | number | boolean): void;
setAttributeNS(namespaceURI: string, qualifiedName: string, value: string | number | boolean): void;
}
}
export declare type Attrs = Record<string, string | number | boolean>;
export declare const attributesModule: Module;
export default attributesModule;
var raf = (typeof window !== 'undefined' && window.requestAnimationFrame) || setTimeout;
var nextFrame = function (fn) { raf(function () { raf(fn); }); };
var reflowForced = false;
function setNextFrame(obj, prop, val) {

@@ -59,2 +60,6 @@ nextFrame(function () { obj[prop] = val; });

}
if (!reflowForced) {
getComputedStyle(document.body).transform;
reflowForced = true;
}
var name, elm = vnode.elm, i = 0, compStyle, style = s.remove, amount = 0, applied = [];

@@ -78,3 +83,7 @@ for (name in style) {

}
function forceReflow() {
reflowForced = false;
}
export var styleModule = {
pre: forceReflow,
create: updateStyle,

@@ -81,0 +90,0 @@ update: updateStyle,

@@ -24,3 +24,3 @@ import vnode from './vnode';

for (i = 0, n = elmChildren.length; i < n; i++) {
children.push(toVNode(elmChildren[i]));
children.push(toVNode(elmChildren[i], domApi));
}

@@ -27,0 +27,0 @@ return vnode(sel, { attrs: attrs }, children, undefined, node);

import { VNode, VNodeData } from './vnode';
export declare type VNodes = Array<VNode>;
export declare type VNodesSparse = VNode | Array<VNode | undefined | null>;
export declare type VNodeChildElement = VNode | string | number | undefined | null;
export declare type ArrayOrElement<T> = T | T[];
export declare type VNodeChildren = ArrayOrElement<VNodeChildElement>;
export declare function h(sel: string): VNode;
export declare function h(sel: string, data: VNodeData): VNode;
export declare function h(sel: string, text: string): VNode;
export declare function h(sel: string, children: VNodesSparse): VNode;
export declare function h(sel: string, data: VNodeData, text: string): VNode;
export declare function h(sel: string, data: VNodeData, children: VNodesSparse): VNode;
export declare function h(sel: string, children: VNodeChildren): VNode;
export declare function h(sel: string, data: VNodeData, children: VNodeChildren): VNode;
export default h;

@@ -44,3 +44,3 @@ "use strict";

}
if (is.array(children)) {
if (children !== undefined) {
for (i = 0; i < children.length; ++i) {

@@ -47,0 +47,0 @@ if (is.primitive(children[i]))

import { Module } from './module';
declare global {
interface Element {
setAttribute(name: string, value: string | number | boolean): void;
setAttributeNS(namespaceURI: string, qualifiedName: string, value: string | number | boolean): void;
}
}
export declare type Attrs = Record<string, string | number | boolean>;
export declare const attributesModule: Module;
export default attributesModule;

@@ -5,2 +5,3 @@ "use strict";

var nextFrame = function (fn) { raf(function () { raf(fn); }); };
var reflowForced = false;
function setNextFrame(obj, prop, val) {

@@ -62,2 +63,6 @@ nextFrame(function () { obj[prop] = val; });

}
if (!reflowForced) {
getComputedStyle(document.body).transform;
reflowForced = true;
}
var name, elm = vnode.elm, i = 0, compStyle, style = s.remove, amount = 0, applied = [];

@@ -81,3 +86,7 @@ for (name in style) {

}
function forceReflow() {
reflowForced = false;
}
exports.styleModule = {
pre: forceReflow,
create: updateStyle,

@@ -84,0 +93,0 @@ update: updateStyle,

{
"name": "snabbdom",
"version": "0.7.1",
"version": "0.7.2",
"description": "A virtual DOM library with focus on simplicity, modularity, powerful features and performance.",

@@ -5,0 +5,0 @@ "main": "snabbdom.js",

@@ -64,2 +64,3 @@ # Snabbdom

* Template string support using [snabby](https://github.com/jamen/snabby).
* Virtual DOM assertion with [snabbdom-looks-like](https://github.com/jvanbruegge/snabbdom-looks-like)

@@ -173,3 +174,3 @@ ## Inline example

var newNode = h('div', {style: {color: '#000'}}, [
var newVNode = h('div', {style: {color: '#000'}}, [
h('h1', 'Headline'),

@@ -705,4 +706,8 @@ h('p', 'A paragraph'),

* [sprotty](https://github.com/theia-ide/sprotty) - "A web-based diagramming framework" uses Snabbdom.
* [Mark Text](https://github.com/marktext/marktext) - "Realtime preview Markdown Editor" build on Snabbdom.
* [puddles](https://github.com/flintinatux/puddles) -
"Tiny vdom app framework. Pure Redux. No boilerplate." - Built with :heart: on Snabbdom.
* [Backbone.VDOMView](https://github.com/jcbrand/backbone.vdomview) - A [Backbone](http://backbonejs.org/) View with VirtualDOM capability via Snabbdom.
Be sure to share it if you're building an application in another way
using Snabbdom.
import {vnode, VNode, VNodeData} from './vnode';
export type VNodes = Array<VNode>;
export type VNodesSparse = VNode | Array<VNode | undefined | null>;
export type VNodeChildElement = VNode | string | number | undefined | null;
export type ArrayOrElement<T> = T | T[];
export type VNodeChildren = ArrayOrElement<VNodeChildElement>
import * as is from './is';

@@ -20,6 +22,4 @@

export function h(sel: string, data: VNodeData): VNode;
export function h(sel: string, text: string): VNode;
export function h(sel: string, children: VNodesSparse): VNode;
export function h(sel: string, data: VNodeData, text: string): VNode;
export function h(sel: string, data: VNodeData, children: VNodesSparse): VNode;
export function h(sel: string, children: VNodeChildren): VNode;
export function h(sel: string, data: VNodeData, children: VNodeChildren): VNode;
export function h(sel: any, b?: any, c?: any): VNode {

@@ -38,3 +38,3 @@ var data: VNodeData = {}, children: any, text: any, i: number;

}
if (is.array(children)) {
if (children !== undefined) {
for (i = 0; i < children.length; ++i) {

@@ -41,0 +41,0 @@ if (is.primitive(children[i])) children[i] = vnode(undefined, undefined, undefined, children[i], undefined);

import {VNode, VNodeData} from '../vnode';
import {Module} from './module';
// because those in TypeScript are too restrictive: https://github.com/Microsoft/TSJS-lib-generator/pull/237
declare global {
interface Element {
setAttribute(name: string, value: string | number | boolean): void;
setAttributeNS(namespaceURI: string, qualifiedName: string, value: string | number | boolean): void;
}
}
export type Attrs = Record<string, string | number | boolean>

@@ -31,15 +39,12 @@

} else {
// because those in TypeScript are too restrictive: https://github.com/Microsoft/TSJS-lib-generator/pull/237
type SetAttribute = (name: string, value: string | number | boolean) => void;
type SetAttributeNS = (namespaceURI: string, qualifiedName: string, value: string | number | boolean) => void;
if (key.charCodeAt(0) !== xChar) {
(elm.setAttribute as SetAttribute)(key, cur);
elm.setAttribute(key, cur);
} else if (key.charCodeAt(3) === colonChar) {
// Assume xml namespace
(elm.setAttributeNS as SetAttributeNS)(xmlNS, key, cur);
elm.setAttributeNS(xmlNS, key, cur);
} else if (key.charCodeAt(5) === colonChar) {
// Assume xlink namespace
(elm.setAttributeNS as SetAttributeNS)(xlinkNS, key, cur);
elm.setAttributeNS(xlinkNS, key, cur);
} else {
(elm.setAttribute as SetAttribute)(key, cur);
elm.setAttribute(key, cur);
}

@@ -46,0 +51,0 @@ }

@@ -11,2 +11,3 @@ import {VNode, VNodeData} from '../vnode';

var nextFrame = function(fn: any) { raf(function() { raf(fn); }); };
var reflowForced = false;

@@ -70,2 +71,6 @@ function setNextFrame(obj: any, prop: string, val: any): void {

}
if(!reflowForced) {
getComputedStyle(document.body).transform;
reflowForced = true;
}
var name: string, elm = vnode.elm, i = 0, compStyle: CSSStyleDeclaration,

@@ -88,3 +93,8 @@ style = s.remove, amount = 0, applied: Array<string> = [];

function forceReflow() {
reflowForced = false;
}
export const styleModule = {
pre: forceReflow,
create: updateStyle,

@@ -91,0 +101,0 @@ update: updateStyle,

@@ -25,3 +25,3 @@ import vnode, {VNode} from './vnode';

for (i = 0, n = elmChildren.length; i < n; i++) {
children.push(toVNode(elmChildren[i]));
children.push(toVNode(elmChildren[i], domApi));
}

@@ -28,0 +28,0 @@ return vnode(sel, {attrs}, children, undefined, node);

@@ -26,3 +26,3 @@ "use strict";

for (i = 0, n = elmChildren.length; i < n; i++) {
children.push(toVNode(elmChildren[i]));
children.push(toVNode(elmChildren[i], domApi));
}

@@ -29,0 +29,0 @@ return vnode_1.default(sel, { attrs: attrs }, children, undefined, node);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc