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

snabbdom

Package Overview
Dependencies
Maintainers
1
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.6.1 to 0.6.2

helpers/attachto.js.diff

2

.vscode/settings.json
{
"typescript.tsdk": "./node_modules/typescript/lib"
"typescript.check.workspaceVersion": false
}

@@ -1,8 +0,8 @@

import { VNode } from './vnode';
import { VNode, VNodeData } from './vnode';
export declare function h(sel: string): VNode;
export declare function h(sel: string, data: any): 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: Array<VNode>): VNode;
export declare function h(sel: string, data: any, text: string): VNode;
export declare function h(sel: string, data: any, children: Array<VNode>): VNode;
export declare function h(sel: string, data: VNodeData, text: string): VNode;
export declare function h(sel: string, data: VNodeData, children: Array<VNode>): VNode;
export default h;

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

// Remove placeholder
vnode.elm && vnode.elm.parentNode && vnode.elm.parentNode.removeChild(vnode.elm);
if (vnode.elm !== undefined) {
vnode.elm.parentNode.removeChild(vnode.elm);
}
// Remove real element from where it was inserted

@@ -19,0 +21,0 @@ vnode.elm = vnode.data.attachData.real;

@@ -19,2 +19,4 @@ "use strict";

return;
if (oldAttrs === attrs)
return;
oldAttrs = oldAttrs || {};

@@ -21,0 +23,0 @@ attrs = attrs || {};

@@ -6,2 +6,4 @@ "use strict";

return;
if (oldClass === klass)
return;
oldClass = oldClass || {};

@@ -8,0 +10,0 @@ klass = klass || {};

@@ -6,2 +6,4 @@ "use strict";

return;
if (oldDataset === dataset)
return;
oldDataset = oldDataset || {};

@@ -8,0 +10,0 @@ dataset = dataset || {};

@@ -6,2 +6,4 @@ "use strict";

return;
if (oldProps === props)
return;
oldProps = oldProps || {};

@@ -8,0 +10,0 @@ props = props || {};

@@ -11,2 +11,4 @@ "use strict";

return;
if (oldStyle === style)
return;
oldStyle = oldStyle || {};

@@ -13,0 +15,0 @@ style = style || {};

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

@@ -23,3 +23,3 @@ "main": "snabbdom.js",

"testem": "^1.0.2",
"typescript": "^2.0.6",
"typescript": "^2.1.0",
"xyz": "0.5.x"

@@ -26,0 +26,0 @@ },

@@ -1,2 +0,2 @@

import { Hooks } from './hooks';
import { Module } from './modules/module';
import { VNode } from './vnode';

@@ -6,2 +6,2 @@ import { DOMAPI } from './htmldomapi';

export { thunk } from './thunk';
export declare function init(modules: Array<Hooks>, domApi?: DOMAPI): (oldVnode: Element | VNode, vnode: VNode) => VNode;
export declare function init(modules: Array<Partial<Module>>, domApi?: DOMAPI): (oldVnode: Element | VNode, vnode: VNode) => VNode;

@@ -34,4 +34,6 @@ "use strict";

for (j = 0; j < modules.length; ++j) {
if (modules[j][hooks[i]] !== undefined)
cbs[hooks[i]].push(modules[j][hooks[i]]);
var hook = modules[j][hooks[i]];
if (hook !== undefined) {
cbs[hooks[i]].push(hook);
}
}

@@ -219,6 +221,8 @@ }

}
var elm = vnode.elm = oldVnode.elm, oldCh = oldVnode.children, ch = vnode.children;
var elm = vnode.elm = oldVnode.elm;
var oldCh = oldVnode.children;
var ch = vnode.children;
if (oldVnode === vnode)
return;
if (isDef(vnode.data)) {
if (vnode.data !== undefined) {
for (i = 0; i < cbs.update.length; ++i)

@@ -225,0 +229,0 @@ cbs.update[i](oldVnode, vnode);

@@ -1,2 +0,2 @@

import {vnode, VNode} from './vnode';
import {vnode, VNode, VNodeData} from './vnode';
import * as is from './is';

@@ -17,9 +17,9 @@

export function h(sel: string): VNode;
export function h(sel: string, data: any): VNode;
export function h(sel: string, data: VNodeData): VNode;
export function h(sel: string, text: string): VNode;
export function h(sel: string, children: Array<VNode>): VNode;
export function h(sel: string, data: any, text: string): VNode;
export function h(sel: string, data: any, children: Array<VNode>): VNode;
export function h(sel: string, data: VNodeData, text: string): VNode;
export function h(sel: string, data: VNodeData, children: Array<VNode>): VNode;
export function h(sel: any, b?: any, c?: any): VNode {
var data = {}, children: any, text: any, i: number;
var data: VNodeData = {}, children: any, text: any, i: number;
if (c !== undefined) {

@@ -26,0 +26,0 @@ data = b;

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

// Remove placeholder
vnode.elm && vnode.elm.parentNode && vnode.elm.parentNode.removeChild(vnode.elm);
if (vnode.elm !== undefined) {
(vnode.elm.parentNode as HTMLElement).removeChild(vnode.elm);
}
// Remove real element from where it was inserted

@@ -48,2 +50,2 @@ vnode.elm = (vnode.data as VNodeData).attachData.real;

};
export default attachTo;
export default attachTo;

@@ -66,2 +66,3 @@ export interface DOMAPI {

} as DOMAPI;
export default htmlDomApi;
export default htmlDomApi;

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

if (!oldAttrs && !attrs) return;
if (oldAttrs === attrs) return;
oldAttrs = oldAttrs || {};

@@ -28,0 +29,0 @@ attrs = attrs || {};

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

if (!oldClass && !klass) return;
if (oldClass === klass) return;
oldClass = oldClass || {};

@@ -12,0 +13,0 @@ klass = klass || {};

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

if (!oldDataset && !dataset) return;
if (oldDataset === dataset) return;
oldDataset = oldDataset || {};

@@ -13,0 +14,0 @@ dataset = dataset || {};

import {PreHook, CreateHook, UpdateHook, DestroyHook, RemoveHook, PostHook} from '../hooks';
export interface Module {
pre?: PreHook;
create?: CreateHook;
update?: UpdateHook;
destroy?: DestroyHook;
remove?: RemoveHook;
post?: PostHook;
pre: PreHook;
create: CreateHook;
update: UpdateHook;
destroy: DestroyHook;
remove: RemoveHook;
post: PostHook;
}

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

if (!oldProps && !props) return;
if (oldProps === props) return;
oldProps = oldProps || {};

@@ -12,0 +13,0 @@ props = props || {};

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

if (!oldStyle && !style) return;
if (oldStyle === style) return;
oldStyle = oldStyle || {};

@@ -19,0 +20,0 @@ style = style || {};

/* global module, document, Node */
import {Module} from './modules/module';
import {Hooks} from './hooks';

@@ -24,4 +25,10 @@ import vnode, {VNode, VNodeData, Key} from './vnode';

type ArraysOf<T> = {
[K in keyof T]: (T[K])[];
}
type ModuleHooks = ArraysOf<Module>;
function createKeyToOldIdx(children: Array<VNode>, beginIdx: number, endIdx: number): KeyToIndexMap {
let i: number, map: {[s: string]: number} = {}, key: Key;
let i: number, map: KeyToIndexMap = {}, key: Key;
for (i = beginIdx; i <= endIdx; ++i) {

@@ -34,3 +41,3 @@ key = children[i].key;

const hooks = ['create', 'update', 'remove', 'destroy', 'pre', 'post'];
const hooks: (keyof Module)[] = ['create', 'update', 'remove', 'destroy', 'pre', 'post'];

@@ -40,4 +47,4 @@ export {h} from './h';

export function init(modules: Array<Hooks>, domApi?: DOMAPI) {
let i: number, j: number, cbs: any = {};
export function init(modules: Array<Partial<Module>>, domApi?: DOMAPI) {
let i: number, j: number, cbs = ({} as ModuleHooks);

@@ -49,3 +56,6 @@ const api: DOMAPI = domApi !== undefined ? domApi : htmlDomApi;

for (j = 0; j < modules.length; ++j) {
if ((modules[j] as any)[hooks[i]] !== undefined) cbs[hooks[i]].push((modules[j] as any)[hooks[i]]);
const hook = modules[j][hooks[i]];
if (hook !== undefined) {
(cbs[hooks[i]] as Array<any>).push(hook);
}
}

@@ -232,7 +242,9 @@ }

}
let elm = vnode.elm = oldVnode.elm, oldCh = oldVnode.children, ch = vnode.children;
const elm = vnode.elm = (oldVnode.elm as Node);
let oldCh = oldVnode.children;
let ch = vnode.children;
if (oldVnode === vnode) return;
if (isDef(vnode.data)) {
if (vnode.data !== undefined) {
for (i = 0; i < cbs.update.length; ++i) cbs.update[i](oldVnode, vnode);
i = (vnode.data as VNodeData).hook;
i = vnode.data.hook;
if (isDef(i) && isDef(i = i.update)) i(oldVnode, vnode);

@@ -242,13 +254,13 @@ }

if (isDef(oldCh) && isDef(ch)) {
if (oldCh !== ch) updateChildren(elm as Node, oldCh as Array<VNode>, ch as Array<VNode>, insertedVnodeQueue);
if (oldCh !== ch) updateChildren(elm, oldCh as Array<VNode>, ch as Array<VNode>, insertedVnodeQueue);
} else if (isDef(ch)) {
if (isDef(oldVnode.text)) api.setTextContent(elm as Node, '');
addVnodes(elm as Node, null, ch as Array<VNode>, 0, (ch as Array<VNode>).length - 1, insertedVnodeQueue);
if (isDef(oldVnode.text)) api.setTextContent(elm, '');
addVnodes(elm, null, ch as Array<VNode>, 0, (ch as Array<VNode>).length - 1, insertedVnodeQueue);
} else if (isDef(oldCh)) {
removeVnodes(elm as Node, oldCh as Array<VNode>, 0, (oldCh as Array<VNode>).length - 1);
removeVnodes(elm, oldCh as Array<VNode>, 0, (oldCh as Array<VNode>).length - 1);
} else if (isDef(oldVnode.text)) {
api.setTextContent(elm as Node, '');
api.setTextContent(elm, '');
}
} else if (oldVnode.text !== vnode.text) {
api.setTextContent(elm as Node, vnode.text as string);
api.setTextContent(elm, vnode.text as string);
}

@@ -255,0 +267,0 @@ if (isDef(hook) && isDef(i = hook.postpatch)) {

import {Hooks} from './hooks';
export type Key = string | number | undefined;
export type Key = string | number;

@@ -24,9 +24,9 @@ export interface VNode {

attachData?: any;
[key: string]: any; // for any other 3rd party module
// end of modules
hook?: Hooks;
key?: string | number;
key?: Key;
ns?: string; // for SVGs
fn?: () => VNode; // for thunks
args?: Array<any>; // for thunks
[key: string]: any; // for any other 3rd party module
// end of modules
}

@@ -33,0 +33,0 @@

@@ -30,3 +30,3 @@ {

"src/htmldomapi.ts",
"src/hooks.d.ts",
"src/hooks.ts",
"src/is.ts",

@@ -33,0 +33,0 @@ "src/snabbdom.bundle.ts",

import { Hooks } from './hooks';
export declare type Key = string | number | undefined;
export declare type Key = string | number;
export interface VNode {

@@ -20,10 +20,10 @@ sel: string | undefined;

attachData?: any;
[key: string]: any;
hook?: Hooks;
key?: string | number;
key?: Key;
ns?: string;
fn?: () => VNode;
args?: Array<any>;
[key: string]: any;
}
export declare function vnode(sel: string, data: any | undefined, children: Array<VNode | string> | undefined, text: string | undefined, elm: Element | Text | undefined): VNode;
export default vnode;

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

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